@opencrvs/toolkit 1.8.0-rc.f82791e → 1.8.0-rc.f8296f8

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 (40) hide show
  1. package/dist/commons/api/router.d.ts +7485 -3044
  2. package/dist/commons/conditionals/conditionals.d.ts +2 -1
  3. package/dist/commons/events/ActionConfig.d.ts +20595 -2656
  4. package/dist/commons/events/ActionDocument.d.ts +760 -553
  5. package/dist/commons/events/ActionInput.d.ts +377 -305
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +637 -48
  7. package/dist/commons/events/Constants.d.ts +2 -0
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  9. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  10. package/dist/commons/events/Draft.d.ts +43 -40
  11. package/dist/commons/events/EventConfig.d.ts +16491 -7434
  12. package/dist/commons/events/EventDocument.d.ts +471 -423
  13. package/dist/commons/events/EventIndex.d.ts +694 -293
  14. package/dist/commons/events/EventInput.d.ts +0 -13
  15. package/dist/commons/events/EventMetadata.d.ts +262 -16
  16. package/dist/commons/events/FieldConfig.d.ts +850 -69
  17. package/dist/commons/events/FieldType.d.ts +3 -2
  18. package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
  19. package/dist/commons/events/FieldValue.d.ts +6 -3
  20. package/dist/commons/events/FormConfig.d.ts +5749 -925
  21. package/dist/commons/events/PageConfig.d.ts +1191 -3
  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 +4491 -10
  26. package/dist/commons/events/defineConfig.d.ts +1269 -7
  27. package/dist/commons/events/event.d.ts +37 -8
  28. package/dist/commons/events/field.d.ts +24 -10
  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 +35 -14
  33. package/dist/commons/events/transactions.d.ts +1 -1
  34. package/dist/commons/events/utils.d.ts +313 -24
  35. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  36. package/dist/conditionals/index.js +19 -2
  37. package/dist/events/index.js +2859 -1192
  38. package/dist/scopes/index.d.ts +158 -1
  39. package/dist/scopes/index.js +152 -1
  40. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { EventFieldId } from './AdvancedSearchConfig';
2
2
  import { SelectOption } from './FieldConfig';
3
+ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
3
4
  /**
4
5
  * Creates a function that acts like a callable + static method container.
5
6
  *
@@ -8,17 +9,45 @@ import { SelectOption } from './FieldConfig';
8
9
  * event.hasAction('CLICKED') // → returns conditional
9
10
  */
10
11
  declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
11
- fieldId: "status" | "trackingId";
12
- options: {
13
- value: string;
14
- label: import("./TranslationConfig").TranslationConfig;
15
- }[] | undefined;
16
- config: {
17
- type: "EXACT";
12
+ range: () => {
13
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
14
+ options: {
15
+ value: string;
16
+ label: import("./TranslationConfig").TranslationConfig;
17
+ }[] | undefined;
18
+ fieldType: "event";
19
+ } & {
20
+ config: {
21
+ type: "range";
22
+ };
23
+ };
24
+ exact: () => {
25
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
26
+ options: {
27
+ value: string;
28
+ label: import("./TranslationConfig").TranslationConfig;
29
+ }[] | undefined;
30
+ fieldType: "event";
31
+ } & {
32
+ config: {
33
+ type: "exact";
34
+ };
35
+ };
36
+ fuzzy: () => {
37
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
38
+ options: {
39
+ value: string;
40
+ label: import("./TranslationConfig").TranslationConfig;
41
+ }[] | undefined;
42
+ fieldType: "event";
43
+ } & {
44
+ config: {
45
+ type: "fuzzy";
46
+ };
18
47
  };
19
- fieldType: "event";
20
48
  };
21
49
  declare const event: typeof eventFn & {
50
+ field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
22
51
  hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
23
52
  };
24
53
  export { event };
@@ -1,29 +1,43 @@
1
+ import { FieldConditional } from './Conditional';
2
+ import { TranslationConfig } from './TranslationConfig';
1
3
  /**
2
4
  * Entry point for defining conditional logic or configuration for a form field.
3
5
  * @param fieldId - The ID of the field to define rules or config for.
4
6
  * @returns An object combining conditional methods and configuration builders.
5
7
  */
6
- export declare function field(fieldId: string): {
8
+ export declare function field(fieldId: string, options?: {
9
+ conditionals?: FieldConditional[];
10
+ searchCriteriaLabelPrefix?: TranslationConfig;
11
+ }): {
7
12
  range: () => {
8
- config: {
9
- type: "RANGE";
10
- };
13
+ conditionals?: FieldConditional[];
14
+ searchCriteriaLabelPrefix?: TranslationConfig;
11
15
  fieldId: string;
12
16
  fieldType: "field";
13
- };
14
- exact: () => {
17
+ } & {
15
18
  config: {
16
- type: "EXACT";
19
+ type: "range";
17
20
  };
21
+ };
22
+ exact: () => {
23
+ conditionals?: FieldConditional[];
24
+ searchCriteriaLabelPrefix?: TranslationConfig;
18
25
  fieldId: string;
19
26
  fieldType: "field";
20
- };
21
- fuzzy: () => {
27
+ } & {
22
28
  config: {
23
- type: "FUZZY";
29
+ type: "exact";
24
30
  };
31
+ };
32
+ fuzzy: () => {
33
+ conditionals?: FieldConditional[];
34
+ searchCriteriaLabelPrefix?: TranslationConfig;
25
35
  fieldId: string;
26
36
  fieldType: "field";
37
+ } & {
38
+ config: {
39
+ type: "fuzzy";
40
+ };
27
41
  };
28
42
  isAfter: () => {
29
43
  days: (days: number) => {
@@ -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
@@ -1,4 +1,5 @@
1
- import { ActionDocument, ActionUpdate } from './ActionDocument';
1
+ import { UUID } from '../uuid';
2
+ import { ActionDocument, ActionUpdate, EventState } from './ActionDocument';
2
3
  import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
3
4
  import { ActionType } from './ActionType';
4
5
  import { Draft } from './Draft';
@@ -6,9 +7,9 @@ import { EventConfig } from './EventConfig';
6
7
  import { EventDocument } from './EventDocument';
7
8
  import { EventIndex } from './EventIndex';
8
9
  import { EventInput } from './EventInput';
9
- import { FieldValue } from './FieldValue';
10
10
  import { TranslationConfig } from './TranslationConfig';
11
- export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): Partial<import("./ActionDocument").EventState>;
11
+ import { WorkqueueConfig } from './WorkqueueConfig';
12
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
12
13
  export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
13
14
  export declare const eventPayloadGenerator: {
14
15
  create: (input?: Partial<EventInput>) => {
@@ -21,7 +22,7 @@ export declare const eventPayloadGenerator: {
21
22
  id: string;
22
23
  };
23
24
  draft: ({ eventId, actionType }: {
24
- eventId: string;
25
+ eventId: UUID;
25
26
  actionType: ActionType;
26
27
  }, input?: Partial<Draft>) => Draft;
27
28
  actions: {
@@ -65,7 +66,7 @@ export declare const eventPayloadGenerator: {
65
66
  option: string;
66
67
  filename: string;
67
68
  originalFilename: string;
68
- }[] | undefined>;
69
+ }[] | [string, string] | undefined>;
69
70
  annotation: {};
70
71
  eventId: string;
71
72
  };
@@ -115,7 +116,7 @@ export declare const eventPayloadGenerator: {
115
116
  option: string;
116
117
  filename: string;
117
118
  originalFilename: string;
118
- }[] | undefined>>;
119
+ }[] | [string, string] | undefined>>;
119
120
  eventId: string;
120
121
  };
121
122
  validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
@@ -158,7 +159,7 @@ export declare const eventPayloadGenerator: {
158
159
  option: string;
159
160
  filename: string;
160
161
  originalFilename: string;
161
- }[] | undefined>;
162
+ }[] | [string, string] | undefined>;
162
163
  annotation: {};
163
164
  duplicates: never[];
164
165
  eventId: string;
@@ -181,11 +182,13 @@ export declare const eventPayloadGenerator: {
181
182
  type: "ARCHIVE";
182
183
  transactionId: string;
183
184
  declaration: {};
184
- annotation: {
185
- isDuplicate: boolean;
186
- };
185
+ annotation: {};
187
186
  duplicates: never[];
188
187
  eventId: string;
188
+ reason: {
189
+ message: string;
190
+ isDuplicate: boolean;
191
+ };
189
192
  };
190
193
  reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
191
194
  type: "REJECT";
@@ -194,6 +197,9 @@ export declare const eventPayloadGenerator: {
194
197
  annotation: {};
195
198
  duplicates: never[];
196
199
  eventId: string;
200
+ reason: {
201
+ message: string;
202
+ };
197
203
  };
198
204
  register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
199
205
  type: "REGISTER";
@@ -235,7 +241,7 @@ export declare const eventPayloadGenerator: {
235
241
  option: string;
236
242
  filename: string;
237
243
  originalFilename: string;
238
- }[] | undefined>;
244
+ }[] | [string, string] | undefined>;
239
245
  annotation: {};
240
246
  eventId: string;
241
247
  };
@@ -287,7 +293,7 @@ export declare const eventPayloadGenerator: {
287
293
  option: string;
288
294
  filename: string;
289
295
  originalFilename: string;
290
- }[] | undefined>;
296
+ }[] | [string, string] | undefined>;
291
297
  annotation: {};
292
298
  eventId: string;
293
299
  };
@@ -319,7 +325,22 @@ export declare function generateEventDocument({ configuration, actions }: {
319
325
  configuration: EventConfig;
320
326
  actions: ActionType[];
321
327
  }): EventDocument;
322
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
323
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
328
+ export declare function generateEventDraftDocument(eventId: UUID, actionType?: ActionType, declaration?: EventState): Draft;
329
+ export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
330
+ /**
331
+ * Useful for testing when we need deterministic outcome.
332
+ * @param seed - Seed value for the pseudo-random number generator
333
+ *
334
+ * @returns A function that generates pseudo-random numbers between 0 and 1
335
+ */
336
+ export declare function createPseudoRandomNumberGenerator(seed: number): () => number;
337
+ export declare function generateRandomSignature(rng: () => number): string;
338
+ export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
324
339
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
340
+ export declare const BearerTokenByUserType: {
341
+ fieldAgent: string;
342
+ registrationAgent: string;
343
+ localRegistrar: string;
344
+ };
345
+ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
325
346
  //# sourceMappingURL=test.utils.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare function generateTransactionId(): import("../uuid").UUID;
1
+ export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
2
2
  //# sourceMappingURL=transactions.d.ts.map