@opencrvs/toolkit 1.8.0-rc.f8aa0c5 → 1.8.0-rc.f8be155

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 (30) hide show
  1. package/dist/commons/api/router.d.ts +9861 -5350
  2. package/dist/commons/events/ActionConfig.d.ts +0 -2856
  3. package/dist/commons/events/ActionDocument.d.ts +706 -805
  4. package/dist/commons/events/ActionInput.d.ts +602 -602
  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/Draft.d.ts +54 -59
  9. package/dist/commons/events/EventConfig.d.ts +0 -1564
  10. package/dist/commons/events/EventDocument.d.ts +441 -516
  11. package/dist/commons/events/EventIndex.d.ts +210 -630
  12. package/dist/commons/events/EventMetadata.d.ts +7 -49
  13. package/dist/commons/events/FieldConfig.d.ts +0 -198
  14. package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
  15. package/dist/commons/events/FieldValue.d.ts +12 -12
  16. package/dist/commons/events/FormConfig.d.ts +0 -1200
  17. package/dist/commons/events/PageConfig.d.ts +0 -288
  18. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  19. package/dist/commons/events/WorkqueueConfig.d.ts +750 -3247
  20. package/dist/commons/events/defineConfig.d.ts +0 -316
  21. package/dist/commons/events/field.d.ts +0 -5
  22. package/dist/commons/events/index.d.ts +0 -1
  23. package/dist/commons/events/scopes.d.ts +2 -1
  24. package/dist/commons/events/test.utils.d.ts +15 -37
  25. package/dist/commons/events/utils.d.ts +9 -466
  26. package/dist/conditionals/index.js +17 -20
  27. package/dist/events/index.js +654 -1053
  28. package/dist/scopes/index.d.ts +7 -96
  29. package/dist/scopes/index.js +26 -105
  30. 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: {
@@ -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
@@ -11,13 +11,6 @@ import { TranslationConfig } from './TranslationConfig';
11
11
  import { FieldConfig } from './FieldConfig';
12
12
  import { WorkqueueConfig } from './WorkqueueConfig';
13
13
  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
14
  export declare function generateRandomName(rng: () => number): {
22
15
  firstname: string;
23
16
  surname: string;
@@ -61,8 +54,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
61
54
  street?: string | null | undefined;
62
55
  zipCode?: string | null | undefined;
63
56
  } | {
64
- firstname?: string | null | undefined;
65
- surname?: string | null | undefined;
57
+ firstname: string;
58
+ surname: string;
66
59
  middlename?: string | null | undefined;
67
60
  } | {
68
61
  country: string;
@@ -114,8 +107,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
114
107
  street?: string | null | undefined;
115
108
  zipCode?: string | null | undefined;
116
109
  } | {
117
- firstname?: string | null | undefined;
118
- surname?: string | null | undefined;
110
+ firstname: string;
111
+ surname: string;
119
112
  middlename?: string | null | undefined;
120
113
  } | {
121
114
  country: string;
@@ -161,8 +154,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
161
154
  street?: string | null | undefined;
162
155
  zipCode?: string | null | undefined;
163
156
  } | {
164
- firstname?: string | null | undefined;
165
- surname?: string | null | undefined;
157
+ firstname: string;
158
+ surname: string;
166
159
  middlename?: string | null | undefined;
167
160
  } | {
168
161
  country: string;
@@ -225,8 +218,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
225
218
  street?: string | null | undefined;
226
219
  zipCode?: string | null | undefined;
227
220
  } | {
228
- firstname?: string | null | undefined;
229
- surname?: string | null | undefined;
221
+ firstname: string;
222
+ surname: string;
230
223
  middlename?: string | null | undefined;
231
224
  } | {
232
225
  country: string;
@@ -273,7 +266,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
273
266
  message: string;
274
267
  };
275
268
  };
276
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
269
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
277
270
  transactionId: string;
278
271
  declaration: Record<string, string | number | boolean | {
279
272
  type: string;
@@ -291,8 +284,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
291
284
  street?: string | null | undefined;
292
285
  zipCode?: string | null | undefined;
293
286
  } | {
294
- firstname?: string | null | undefined;
295
- surname?: string | null | undefined;
287
+ firstname: string;
288
+ surname: string;
296
289
  middlename?: string | null | undefined;
297
290
  } | {
298
291
  country: string;
@@ -318,7 +311,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
318
311
  originalFilename: string;
319
312
  }[] | [string, string] | null | undefined>;
320
313
  annotation: {};
321
- registrationNumber?: string | undefined;
322
314
  keepAssignment?: boolean | undefined;
323
315
  type: "REGISTER";
324
316
  eventId: string;
@@ -351,8 +343,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
351
343
  street?: string | null | undefined;
352
344
  zipCode?: string | null | undefined;
353
345
  } | {
354
- firstname?: string | null | undefined;
355
- surname?: string | null | undefined;
346
+ firstname: string;
347
+ surname: string;
356
348
  middlename?: string | null | undefined;
357
349
  } | {
358
350
  country: string;
@@ -402,28 +394,16 @@ export declare function eventPayloadGenerator(rng: () => number): {
402
394
  };
403
395
  };
404
396
  };
405
- export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
397
+ export declare function generateActionDocument({ configuration, action, rng, defaults }: {
406
398
  configuration: EventConfig;
407
399
  action: ActionType;
408
400
  rng?: () => number;
409
401
  defaults?: Partial<ActionDocument>;
410
- user?: Partial<{
411
- signature: string;
412
- primaryOfficeId: UUID;
413
- role: TestUserRole;
414
- id: string;
415
- }>;
416
402
  }): ActionDocument;
417
- export declare function generateEventDocument({ configuration, actions, rng, user }: {
403
+ export declare function generateEventDocument({ configuration, actions, rng }: {
418
404
  configuration: EventConfig;
419
405
  actions: ActionType[];
420
406
  rng?: () => number;
421
- user?: Partial<{
422
- signature: string;
423
- primaryOfficeId: UUID;
424
- role: TestUserRole;
425
- id: string;
426
- }>;
427
407
  }): EventDocument;
428
408
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
429
409
  eventId: UUID;
@@ -440,8 +420,6 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
440
420
  * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
441
421
  */
442
422
  export declare function createPrng(seed: number): () => number;
443
- export declare function generateUuid(rng?: () => number): UUID;
444
- export declare function generateRegistrationNumber(rng: () => number): string;
445
423
  export declare function generateRandomSignature(rng: () => number): string;
446
424
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
447
425
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;