@opencrvs/toolkit 1.8.0-rc.f9fb039 → 1.8.0-rc.fa564ca

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 (39) hide show
  1. package/dist/commons/api/router.d.ts +7047 -3158
  2. package/dist/commons/conditionals/conditionals.d.ts +7 -6
  3. package/dist/commons/events/ActionConfig.d.ts +15774 -7797
  4. package/dist/commons/events/ActionDocument.d.ts +292 -105
  5. package/dist/commons/events/ActionInput.d.ts +75 -3
  6. package/dist/commons/events/ActionType.d.ts +4 -0
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +437 -12
  8. package/dist/commons/events/Constants.d.ts +2 -0
  9. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  10. package/dist/commons/events/CreatedAtLocation.d.ts +3 -0
  11. package/dist/commons/events/Draft.d.ts +10 -5
  12. package/dist/commons/events/EventConfig.d.ts +11281 -7033
  13. package/dist/commons/events/EventDocument.d.ts +212 -99
  14. package/dist/commons/events/EventIndex.d.ts +281 -531
  15. package/dist/commons/events/EventInput.d.ts +0 -13
  16. package/dist/commons/events/EventMetadata.d.ts +68 -44
  17. package/dist/commons/events/FieldConfig.d.ts +486 -440
  18. package/dist/commons/events/FieldTypeMapping.d.ts +5 -2
  19. package/dist/commons/events/FieldValue.d.ts +2 -0
  20. package/dist/commons/events/FormConfig.d.ts +3346 -3052
  21. package/dist/commons/events/PageConfig.d.ts +750 -680
  22. package/dist/commons/events/SummaryConfig.d.ts +17 -0
  23. package/dist/commons/events/User.d.ts +31 -7
  24. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  25. package/dist/commons/events/WorkqueueConfig.d.ts +3936 -807
  26. package/dist/commons/events/defineConfig.d.ts +1385 -576
  27. package/dist/commons/events/event.d.ts +5 -5
  28. package/dist/commons/events/field.d.ts +9 -13
  29. package/dist/commons/events/index.d.ts +4 -0
  30. package/dist/commons/events/scopes.d.ts +20 -1
  31. package/dist/commons/events/serializer.d.ts +2 -0
  32. package/dist/commons/events/test.utils.d.ts +26 -6
  33. package/dist/commons/events/utils.d.ts +327 -291
  34. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  35. package/dist/conditionals/index.js +28 -8
  36. package/dist/events/index.js +1947 -561
  37. package/dist/scopes/index.d.ts +158 -1
  38. package/dist/scopes/index.js +152 -1
  39. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { EventFieldId } from './AdvancedSearchConfig';
2
- import { EventMetadataKeys, EventMetadataParameter } from './EventMetadata';
3
2
  import { SelectOption } from './FieldConfig';
3
+ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
4
4
  /**
5
5
  * Creates a function that acts like a callable + static method container.
6
6
  *
@@ -10,7 +10,7 @@ import { SelectOption } from './FieldConfig';
10
10
  */
11
11
  declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
12
12
  range: () => {
13
- fieldId: "status" | "updatedAt" | "registeredAt" | "registeredAtLocation" | "trackingId";
13
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
14
14
  options: {
15
15
  value: string;
16
16
  label: import("./TranslationConfig").TranslationConfig;
@@ -22,7 +22,7 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
22
22
  };
23
23
  };
24
24
  exact: () => {
25
- fieldId: "status" | "updatedAt" | "registeredAt" | "registeredAtLocation" | "trackingId";
25
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
26
26
  options: {
27
27
  value: string;
28
28
  label: import("./TranslationConfig").TranslationConfig;
@@ -34,7 +34,7 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
34
34
  };
35
35
  };
36
36
  fuzzy: () => {
37
- fieldId: "status" | "updatedAt" | "registeredAt" | "registeredAtLocation" | "trackingId";
37
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
38
38
  options: {
39
39
  value: string;
40
40
  label: import("./TranslationConfig").TranslationConfig;
@@ -47,7 +47,7 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
47
47
  };
48
48
  };
49
49
  declare const event: typeof eventFn & {
50
- field(field: EventMetadataKeys): EventMetadataParameter;
50
+ field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
51
51
  hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
52
52
  };
53
53
  export { event };
@@ -1,4 +1,5 @@
1
1
  import { FieldConditional } from './Conditional';
2
+ import { TranslationConfig } from './TranslationConfig';
2
3
  /**
3
4
  * Entry point for defining conditional logic or configuration for a form field.
4
5
  * @param fieldId - The ID of the field to define rules or config for.
@@ -6,9 +7,11 @@ import { FieldConditional } from './Conditional';
6
7
  */
7
8
  export declare function field(fieldId: string, options?: {
8
9
  conditionals?: FieldConditional[];
10
+ searchCriteriaLabelPrefix?: TranslationConfig;
9
11
  }): {
10
12
  range: () => {
11
13
  conditionals?: FieldConditional[];
14
+ searchCriteriaLabelPrefix?: TranslationConfig;
12
15
  fieldId: string;
13
16
  fieldType: "field";
14
17
  } & {
@@ -18,6 +21,7 @@ export declare function field(fieldId: string, options?: {
18
21
  };
19
22
  exact: () => {
20
23
  conditionals?: FieldConditional[];
24
+ searchCriteriaLabelPrefix?: TranslationConfig;
21
25
  fieldId: string;
22
26
  fieldType: "field";
23
27
  } & {
@@ -27,6 +31,7 @@ export declare function field(fieldId: string, options?: {
27
31
  };
28
32
  fuzzy: () => {
29
33
  conditionals?: FieldConditional[];
34
+ searchCriteriaLabelPrefix?: TranslationConfig;
30
35
  fieldId: string;
31
36
  fieldType: "field";
32
37
  } & {
@@ -34,14 +39,14 @@ export declare function field(fieldId: string, options?: {
34
39
  type: "fuzzy";
35
40
  };
36
41
  };
42
+ $$field: string;
37
43
  isAfter: () => {
38
44
  days: (days: number) => {
39
45
  inPast: () => import("../conditionals/conditionals").JSONSchema;
40
46
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
41
47
  };
42
48
  date: (date: string | {
43
- [key: string]: unknown;
44
- _fieldId: string;
49
+ $$field: string;
45
50
  }) => import("../conditionals/conditionals").JSONSchema;
46
51
  now: () => import("../conditionals/conditionals").JSONSchema;
47
52
  };
@@ -51,14 +56,12 @@ export declare function field(fieldId: string, options?: {
51
56
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
52
57
  };
53
58
  date: (date: string | {
54
- [key: string]: unknown;
55
- _fieldId: string;
59
+ $$field: string;
56
60
  }) => import("../conditionals/conditionals").JSONSchema;
57
61
  now: () => import("../conditionals/conditionals").JSONSchema;
58
62
  };
59
63
  isEqualTo: (value: string | boolean | {
60
- [key: string]: unknown;
61
- _fieldId: string;
64
+ $$field: string;
62
65
  }) => import("../conditionals/conditionals").JSONSchema;
63
66
  isFalsy: () => import("../conditionals/conditionals").JSONSchema;
64
67
  isUndefined: () => import("../conditionals/conditionals").JSONSchema;
@@ -66,12 +69,5 @@ export declare function field(fieldId: string, options?: {
66
69
  isValidEnglishName: () => import("../conditionals/conditionals").JSONSchema;
67
70
  matches: (pattern: string) => import("../conditionals/conditionals").JSONSchema;
68
71
  isBetween: (min: number, max: number) => import("../conditionals/conditionals").JSONSchema;
69
- getId: () => {
70
- fieldId: string;
71
- };
72
- /**
73
- * @private Internal property used for field reference tracking.
74
- */
75
- _fieldId: string;
76
72
  };
77
73
  //# sourceMappingURL=field.d.ts.map
@@ -1,3 +1,4 @@
1
+ export * from './Constants';
1
2
  export * from './ActionConfig';
2
3
  export * from './offline';
3
4
  export * from './EventConfig';
@@ -6,6 +7,8 @@ export * from './FieldConfig';
6
7
  export * from './PageConfig';
7
8
  export * from './SummaryConfig';
8
9
  export * from './WorkqueueConfig';
10
+ export * from './WorkqueueColumnConfig';
11
+ export * from './workqueueDefaultColumns';
9
12
  export * from './Draft';
10
13
  export * from './EventMetadata';
11
14
  export * from './EventInput';
@@ -31,6 +34,7 @@ export * from './AdvancedSearchConfig';
31
34
  export * from './test.utils';
32
35
  export * from './TemplateConfig';
33
36
  export * from './scopes';
37
+ export * from './serializer';
34
38
  export * from '../conditionals/conditionals';
35
39
  export * from '../conditionals/validate';
36
40
  export * from './field';
@@ -1,6 +1,5 @@
1
1
  import { Scope } from '../scopes';
2
2
  import { ActionType } from './ActionType';
3
- export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
4
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"];
5
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")[];
6
5
  export declare const ACTION_ALLOWED_SCOPES: {
@@ -22,5 +21,25 @@ export declare const ACTION_ALLOWED_SCOPES: {
22
21
  UNASSIGN: null;
23
22
  DETECT_DUPLICATE: [];
24
23
  };
24
+ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
25
+ READ: never[];
26
+ CREATE: "record.notify"[];
27
+ NOTIFY: "record.notify"[];
28
+ DECLARE: never[];
29
+ DELETE: never[];
30
+ VALIDATE: never[];
31
+ REGISTER: never[];
32
+ PRINT_CERTIFICATE: never[];
33
+ REQUEST_CORRECTION: never[];
34
+ REJECT_CORRECTION: never[];
35
+ APPROVE_CORRECTION: never[];
36
+ MARKED_AS_DUPLICATE: never[];
37
+ ARCHIVE: never[];
38
+ REJECT: never[];
39
+ ASSIGN: never[];
40
+ UNASSIGN: never[];
41
+ DETECT_DUPLICATE: never[];
42
+ };
43
+ export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
25
44
  export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
26
45
  //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { deserializeQuery } from './serializers/user/deserializer';
2
+ //# sourceMappingURL=serializer.d.ts.map
@@ -6,8 +6,8 @@ import { EventConfig } from './EventConfig';
6
6
  import { EventDocument } from './EventDocument';
7
7
  import { EventIndex } from './EventIndex';
8
8
  import { EventInput } from './EventInput';
9
- import { FieldValue } from './FieldValue';
10
9
  import { TranslationConfig } from './TranslationConfig';
10
+ import { WorkqueueConfig } from './WorkqueueConfig';
11
11
  export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
12
12
  export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
13
13
  export declare const eventPayloadGenerator: {
@@ -181,11 +181,13 @@ export declare const eventPayloadGenerator: {
181
181
  type: "ARCHIVE";
182
182
  transactionId: string;
183
183
  declaration: {};
184
- annotation: {
185
- isDuplicate: boolean;
186
- };
184
+ annotation: {};
187
185
  duplicates: never[];
188
186
  eventId: string;
187
+ reason: {
188
+ message: string;
189
+ isDuplicate: boolean;
190
+ };
189
191
  };
190
192
  reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
191
193
  type: "REJECT";
@@ -194,6 +196,9 @@ export declare const eventPayloadGenerator: {
194
196
  annotation: {};
195
197
  duplicates: never[];
196
198
  eventId: string;
199
+ reason: {
200
+ message: string;
201
+ };
197
202
  };
198
203
  register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
199
204
  type: "REGISTER";
@@ -319,7 +324,22 @@ export declare function generateEventDocument({ configuration, actions }: {
319
324
  configuration: EventConfig;
320
325
  actions: ActionType[];
321
326
  }): EventDocument;
322
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
323
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
327
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: EventState): Draft;
328
+ export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
329
+ /**
330
+ * Useful for testing when we need deterministic outcome.
331
+ * @param seed - Seed value for the pseudo-random number generator
332
+ *
333
+ * @returns A function that generates pseudo-random numbers between 0 and 1
334
+ */
335
+ export declare function createPseudoRandomNumberGenerator(seed: number): () => number;
336
+ export declare function generateRandomSignature(rng: () => number): string;
337
+ export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
324
338
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
339
+ export declare const BearerTokenByUserType: {
340
+ fieldAgent: string;
341
+ registrationAgent: string;
342
+ localRegistrar: string;
343
+ };
344
+ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
325
345
  //# sourceMappingURL=test.utils.d.ts.map