@opencrvs/toolkit 1.8.0-rc.fb8e005 → 1.8.0-rc.fbababd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/commons/api/router.d.ts +8621 -5643
  2. package/dist/commons/events/ActionConfig.d.ts +18584 -33488
  3. package/dist/commons/events/ActionDocument.d.ts +1083 -1182
  4. package/dist/commons/events/ActionInput.d.ts +726 -726
  5. package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -222
  6. package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
  7. package/dist/commons/events/CountryConfigQueryInput.d.ts +412 -1160
  8. package/dist/commons/events/CreatedAtLocation.d.ts +2 -1
  9. package/dist/commons/events/Draft.d.ts +71 -76
  10. package/dist/commons/events/EventConfig.d.ts +17504 -27573
  11. package/dist/commons/events/EventDocument.d.ts +707 -782
  12. package/dist/commons/events/EventIndex.d.ts +224 -639
  13. package/dist/commons/events/EventMetadata.d.ts +31 -73
  14. package/dist/commons/events/FieldConfig.d.ts +37 -198
  15. package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
  16. package/dist/commons/events/FieldValue.d.ts +12 -12
  17. package/dist/commons/events/FormConfig.d.ts +66 -1200
  18. package/dist/commons/events/PageConfig.d.ts +18 -288
  19. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  20. package/dist/commons/events/WorkqueueConfig.d.ts +740 -3237
  21. package/dist/commons/events/defineConfig.d.ts +1589 -3532
  22. package/dist/commons/events/field.d.ts +0 -5
  23. package/dist/commons/events/index.d.ts +0 -1
  24. package/dist/commons/events/scopes.d.ts +3 -2
  25. package/dist/commons/events/test.utils.d.ts +17 -40
  26. package/dist/commons/events/transactions.d.ts +1 -1
  27. package/dist/commons/events/utils.d.ts +1604 -3684
  28. package/dist/conditionals/index.js +17 -20
  29. package/dist/events/index.js +1323 -1695
  30. package/dist/scopes/index.d.ts +1 -4
  31. package/dist/scopes/index.js +17 -67
  32. package/package.json +3 -3
@@ -1,6 +1,5 @@
1
1
  import { FieldConditional } from './Conditional';
2
2
  import { TranslationConfig } from './TranslationConfig';
3
- import { ValidationConfig } from './FieldConfig';
4
3
  /**
5
4
  * Entry point for defining conditional logic or configuration for a form field.
6
5
  * @param fieldId - The ID of the field to define rules or config for.
@@ -8,12 +7,10 @@ import { ValidationConfig } from './FieldConfig';
8
7
  */
9
8
  export declare function field(fieldId: string, options?: {
10
9
  conditionals?: FieldConditional[];
11
- validations?: ValidationConfig[];
12
10
  searchCriteriaLabelPrefix?: TranslationConfig;
13
11
  }): {
14
12
  range: () => {
15
13
  conditionals?: FieldConditional[];
16
- validations?: ValidationConfig[];
17
14
  searchCriteriaLabelPrefix?: TranslationConfig;
18
15
  fieldId: string;
19
16
  fieldType: "field";
@@ -24,7 +21,6 @@ export declare function field(fieldId: string, options?: {
24
21
  };
25
22
  exact: () => {
26
23
  conditionals?: FieldConditional[];
27
- validations?: ValidationConfig[];
28
24
  searchCriteriaLabelPrefix?: TranslationConfig;
29
25
  fieldId: string;
30
26
  fieldType: "field";
@@ -35,7 +31,6 @@ export declare function field(fieldId: string, options?: {
35
31
  };
36
32
  fuzzy: () => {
37
33
  conditionals?: FieldConditional[];
38
- validations?: ValidationConfig[];
39
34
  searchCriteriaLabelPrefix?: TranslationConfig;
40
35
  fieldId: string;
41
36
  fieldType: "field";
@@ -35,7 +35,6 @@ export * from './test.utils';
35
35
  export * from './TemplateConfig';
36
36
  export * from './scopes';
37
37
  export * from './serializer';
38
- export * from './state/availableActions';
39
38
  export * from '../conditionals/conditionals';
40
39
  export * from '../conditionals/validate';
41
40
  export * from './field';
@@ -1,4 +1,5 @@
1
1
  import { Scope } from '../scopes';
2
+ import { ActionType } from './ActionType';
2
3
  export declare const CONFIG_GET_ALLOWED_SCOPES: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records", "config", "config.update:all"];
3
4
  export declare const CONFIG_SEARCH_ALLOWED_SCOPES: ("search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage")[];
4
5
  export declare const ACTION_ALLOWED_SCOPES: {
@@ -10,7 +11,7 @@ export declare const ACTION_ALLOWED_SCOPES: {
10
11
  VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
11
12
  REGISTER: ["record.register"];
12
13
  PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
13
- REQUEST_CORRECTION: ["record.registration-request-correction"];
14
+ REQUEST_CORRECTION: ["record.registration-request-correction", "record.registration-correct"];
14
15
  REJECT_CORRECTION: ["record.registration-correct"];
15
16
  APPROVE_CORRECTION: ["record.registration-correct"];
16
17
  MARKED_AS_DUPLICATE: ["record.declaration-archive"];
@@ -39,6 +40,6 @@ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
39
40
  UNASSIGN: never[];
40
41
  DETECT_DUPLICATE: never[];
41
42
  };
42
- export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
43
43
  export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
44
+ export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
44
45
  //# sourceMappingURL=scopes.d.ts.map
@@ -1,4 +1,3 @@
1
- import { UUID } from '../uuid';
2
1
  import { ActionDocument, EventState } from './ActionDocument';
3
2
  import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
4
3
  import { ActionType } from './ActionType';
@@ -11,13 +10,6 @@ import { TranslationConfig } from './TranslationConfig';
11
10
  import { FieldConfig } from './FieldConfig';
12
11
  import { WorkqueueConfig } from './WorkqueueConfig';
13
12
  import { FieldValue } from './FieldValue';
14
- import { z } from 'zod';
15
- /**
16
- * In real application, the roles are defined in the countryconfig.
17
- * These are just for testing purposes to generate realistic mock data.
18
- */
19
- export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
20
- export type TestUserRole = z.infer<typeof TestUserRole>;
21
13
  export declare function generateRandomName(rng: () => number): {
22
14
  firstname: string;
23
15
  surname: string;
@@ -39,7 +31,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
39
31
  id: string;
40
32
  };
41
33
  draft: ({ eventId, actionType }: {
42
- eventId: UUID;
34
+ eventId: string;
43
35
  actionType: ActionType;
44
36
  }, input?: Partial<Draft>) => Draft;
45
37
  actions: {
@@ -61,8 +53,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
61
53
  street?: string | null | undefined;
62
54
  zipCode?: string | null | undefined;
63
55
  } | {
64
- firstname?: string | null | undefined;
65
- surname?: string | null | undefined;
56
+ firstname: string;
57
+ surname: string;
66
58
  middlename?: string | null | undefined;
67
59
  } | {
68
60
  country: string;
@@ -114,8 +106,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
114
106
  street?: string | null | undefined;
115
107
  zipCode?: string | null | undefined;
116
108
  } | {
117
- firstname?: string | null | undefined;
118
- surname?: string | null | undefined;
109
+ firstname: string;
110
+ surname: string;
119
111
  middlename?: string | null | undefined;
120
112
  } | {
121
113
  country: string;
@@ -161,8 +153,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
161
153
  street?: string | null | undefined;
162
154
  zipCode?: string | null | undefined;
163
155
  } | {
164
- firstname?: string | null | undefined;
165
- surname?: string | null | undefined;
156
+ firstname: string;
157
+ surname: string;
166
158
  middlename?: string | null | undefined;
167
159
  } | {
168
160
  country: string;
@@ -225,8 +217,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
225
217
  street?: string | null | undefined;
226
218
  zipCode?: string | null | undefined;
227
219
  } | {
228
- firstname?: string | null | undefined;
229
- surname?: string | null | undefined;
220
+ firstname: string;
221
+ surname: string;
230
222
  middlename?: string | null | undefined;
231
223
  } | {
232
224
  country: string;
@@ -273,7 +265,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
273
265
  message: string;
274
266
  };
275
267
  };
276
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
268
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
277
269
  transactionId: string;
278
270
  declaration: Record<string, string | number | boolean | {
279
271
  type: string;
@@ -291,8 +283,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
291
283
  street?: string | null | undefined;
292
284
  zipCode?: string | null | undefined;
293
285
  } | {
294
- firstname?: string | null | undefined;
295
- surname?: string | null | undefined;
286
+ firstname: string;
287
+ surname: string;
296
288
  middlename?: string | null | undefined;
297
289
  } | {
298
290
  country: string;
@@ -318,7 +310,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
318
310
  originalFilename: string;
319
311
  }[] | [string, string] | null | undefined>;
320
312
  annotation: {};
321
- registrationNumber?: string | undefined;
322
313
  keepAssignment?: boolean | undefined;
323
314
  type: "REGISTER";
324
315
  eventId: string;
@@ -351,8 +342,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
351
342
  street?: string | null | undefined;
352
343
  zipCode?: string | null | undefined;
353
344
  } | {
354
- firstname?: string | null | undefined;
355
- surname?: string | null | undefined;
345
+ firstname: string;
346
+ surname: string;
356
347
  middlename?: string | null | undefined;
357
348
  } | {
358
349
  country: string;
@@ -402,31 +393,19 @@ export declare function eventPayloadGenerator(rng: () => number): {
402
393
  };
403
394
  };
404
395
  };
405
- export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
396
+ export declare function generateActionDocument({ configuration, action, rng, defaults }: {
406
397
  configuration: EventConfig;
407
398
  action: ActionType;
408
399
  rng?: () => number;
409
400
  defaults?: Partial<ActionDocument>;
410
- user?: Partial<{
411
- signature: string;
412
- primaryOfficeId: UUID;
413
- role: TestUserRole;
414
- id: string;
415
- }>;
416
401
  }): ActionDocument;
417
- export declare function generateEventDocument({ configuration, actions, rng, user }: {
402
+ export declare function generateEventDocument({ configuration, actions, rng }: {
418
403
  configuration: EventConfig;
419
404
  actions: ActionType[];
420
405
  rng?: () => number;
421
- user?: Partial<{
422
- signature: string;
423
- primaryOfficeId: UUID;
424
- role: TestUserRole;
425
- id: string;
426
- }>;
427
406
  }): EventDocument;
428
407
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
429
- eventId: UUID;
408
+ eventId: string;
430
409
  actionType: ActionType;
431
410
  rng?: () => number;
432
411
  declaration?: EventState;
@@ -440,8 +419,6 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
440
419
  * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
441
420
  */
442
421
  export declare function createPrng(seed: number): () => number;
443
- export declare function generateUuid(rng?: () => number): UUID;
444
- export declare function generateRegistrationNumber(rng: () => number): string;
445
422
  export declare function generateRandomSignature(rng: () => number): string;
446
423
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
447
424
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
@@ -1,2 +1,2 @@
1
- export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
1
+ export declare function generateTransactionId(): import("../uuid").UUID;
2
2
  //# sourceMappingURL=transactions.d.ts.map