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

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 +2944 -1117
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -2
  3. package/dist/commons/conditionals/validate.d.ts +6 -0
  4. package/dist/commons/events/ActionConfig.d.ts +24179 -11127
  5. package/dist/commons/events/ActionDocument.d.ts +1818 -414
  6. package/dist/commons/events/ActionInput.d.ts +1504 -304
  7. package/dist/commons/events/ActionType.d.ts +4 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +75 -3
  9. package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
  10. package/dist/commons/events/Constants.d.ts +1 -0
  11. package/dist/commons/events/CreatedAtLocation.d.ts +2 -1
  12. package/dist/commons/events/Draft.d.ts +129 -33
  13. package/dist/commons/events/EventConfig.d.ts +12161 -5927
  14. package/dist/commons/events/EventDocument.d.ts +1162 -298
  15. package/dist/commons/events/EventIndex.d.ts +284 -31
  16. package/dist/commons/events/EventMetadata.d.ts +57 -57
  17. package/dist/commons/events/FieldConfig.d.ts +2074 -1202
  18. package/dist/commons/events/FieldType.d.ts +4 -1
  19. package/dist/commons/events/FieldTypeMapping.d.ts +94 -52
  20. package/dist/commons/events/FieldValue.d.ts +43 -5
  21. package/dist/commons/events/FormConfig.d.ts +10259 -4769
  22. package/dist/commons/events/PageConfig.d.ts +3480 -2134
  23. package/dist/commons/events/SummaryConfig.d.ts +0 -5
  24. package/dist/commons/events/WorkqueueConfig.d.ts +297 -19
  25. package/dist/commons/events/defineConfig.d.ts +1724 -701
  26. package/dist/commons/events/field.d.ts +5 -10
  27. package/dist/commons/events/test.utils.d.ts +125 -40
  28. package/dist/commons/events/transactions.d.ts +1 -1
  29. package/dist/commons/events/utils.d.ts +10015 -331
  30. package/dist/conditionals/index.js +26 -6
  31. package/dist/events/index.js +760 -491
  32. package/package.json +1 -1
@@ -39,14 +39,14 @@ export declare function field(fieldId: string, options?: {
39
39
  type: "fuzzy";
40
40
  };
41
41
  };
42
+ $$field: string;
42
43
  isAfter: () => {
43
44
  days: (days: number) => {
44
45
  inPast: () => import("../conditionals/conditionals").JSONSchema;
45
46
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
46
47
  };
47
48
  date: (date: string | {
48
- [key: string]: unknown;
49
- _fieldId: string;
49
+ $$field: string;
50
50
  }) => import("../conditionals/conditionals").JSONSchema;
51
51
  now: () => import("../conditionals/conditionals").JSONSchema;
52
52
  };
@@ -56,14 +56,12 @@ export declare function field(fieldId: string, options?: {
56
56
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
57
57
  };
58
58
  date: (date: string | {
59
- [key: string]: unknown;
60
- _fieldId: string;
59
+ $$field: string;
61
60
  }) => import("../conditionals/conditionals").JSONSchema;
62
61
  now: () => import("../conditionals/conditionals").JSONSchema;
63
62
  };
64
63
  isEqualTo: (value: string | boolean | {
65
- [key: string]: unknown;
66
- _fieldId: string;
64
+ $$field: string;
67
65
  }) => import("../conditionals/conditionals").JSONSchema;
68
66
  isFalsy: () => import("../conditionals/conditionals").JSONSchema;
69
67
  isUndefined: () => import("../conditionals/conditionals").JSONSchema;
@@ -74,9 +72,6 @@ export declare function field(fieldId: string, options?: {
74
72
  getId: () => {
75
73
  fieldId: string;
76
74
  };
77
- /**
78
- * @private Internal property used for field reference tracking.
79
- */
80
- _fieldId: string;
75
+ object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
81
76
  };
82
77
  //# sourceMappingURL=field.d.ts.map
@@ -1,6 +1,5 @@
1
- import { UUID } from '../uuid';
2
- import { ActionDocument, ActionUpdate, EventState } from './ActionDocument';
3
- import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
1
+ import { ActionDocument, EventState } from './ActionDocument';
2
+ import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
4
3
  import { ActionType } from './ActionType';
5
4
  import { Draft } from './Draft';
6
5
  import { EventConfig } from './EventConfig';
@@ -8,10 +7,20 @@ import { EventDocument } from './EventDocument';
8
7
  import { EventIndex } from './EventIndex';
9
8
  import { EventInput } from './EventInput';
10
9
  import { TranslationConfig } from './TranslationConfig';
10
+ import { FieldConfig } from './FieldConfig';
11
11
  import { WorkqueueConfig } from './WorkqueueConfig';
12
- export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
13
- export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
14
- export declare const eventPayloadGenerator: {
12
+ import { FieldValue } from './FieldValue';
13
+ export declare function generateRandomName(rng: () => number): {
14
+ firstname: string;
15
+ surname: string;
16
+ };
17
+ /**
18
+ * Quick-and-dirty mock data generator for event actions.
19
+ */
20
+ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number, rng: () => number): FieldValue;
21
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number): EventState;
22
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType, rng: () => number): {};
23
+ export declare function eventPayloadGenerator(rng: () => number): {
15
24
  create: (input?: Partial<EventInput>) => {
16
25
  transactionId: string;
17
26
  type: string;
@@ -22,12 +31,11 @@ export declare const eventPayloadGenerator: {
22
31
  id: string;
23
32
  };
24
33
  draft: ({ eventId, actionType }: {
25
- eventId: UUID;
34
+ eventId: string;
26
35
  actionType: ActionType;
27
36
  }, input?: Partial<Draft>) => Draft;
28
37
  actions: {
29
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
30
- type: "DECLARE";
38
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
31
39
  transactionId: string;
32
40
  declaration: Record<string, string | number | boolean | {
33
41
  type: string;
@@ -44,6 +52,10 @@ export declare const eventPayloadGenerator: {
44
52
  residentialArea?: string | null | undefined;
45
53
  street?: string | null | undefined;
46
54
  zipCode?: string | null | undefined;
55
+ } | {
56
+ firstname: string;
57
+ surname: string;
58
+ middlename?: string | null | undefined;
47
59
  } | {
48
60
  country: string;
49
61
  district: string;
@@ -66,20 +78,19 @@ export declare const eventPayloadGenerator: {
66
78
  option: string;
67
79
  filename: string;
68
80
  originalFilename: string;
69
- }[] | [string, string] | undefined>;
81
+ }[] | [string, string] | null | undefined>;
70
82
  annotation: {};
83
+ keepAssignment?: boolean | undefined;
84
+ type: "DECLARE";
71
85
  eventId: string;
72
86
  };
73
87
  /**
74
88
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
75
89
  */
76
- notify: (eventId: string, input?: {
77
- transactionId?: string;
78
- declaration?: Partial<ActionUpdate>;
79
- }) => {
90
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
80
91
  type: "NOTIFY";
81
92
  transactionId: string;
82
- declaration: Partial<Record<string, string | number | boolean | {
93
+ declaration: Record<string, string | number | boolean | {
83
94
  type: string;
84
95
  filename: string;
85
96
  originalFilename: string;
@@ -94,6 +105,10 @@ export declare const eventPayloadGenerator: {
94
105
  residentialArea?: string | null | undefined;
95
106
  street?: string | null | undefined;
96
107
  zipCode?: string | null | undefined;
108
+ } | {
109
+ firstname: string;
110
+ surname: string;
111
+ middlename?: string | null | undefined;
97
112
  } | {
98
113
  country: string;
99
114
  district: string;
@@ -116,11 +131,11 @@ export declare const eventPayloadGenerator: {
116
131
  option: string;
117
132
  filename: string;
118
133
  originalFilename: string;
119
- }[] | [string, string] | undefined>>;
134
+ }[] | [string, string] | null | undefined>;
120
135
  eventId: string;
136
+ keepAssignment: boolean | undefined;
121
137
  };
122
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
123
- type: "VALIDATE";
138
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
124
139
  transactionId: string;
125
140
  declaration: Record<string, string | number | boolean | {
126
141
  type: string;
@@ -137,6 +152,10 @@ export declare const eventPayloadGenerator: {
137
152
  residentialArea?: string | null | undefined;
138
153
  street?: string | null | undefined;
139
154
  zipCode?: string | null | undefined;
155
+ } | {
156
+ firstname: string;
157
+ surname: string;
158
+ middlename?: string | null | undefined;
140
159
  } | {
141
160
  country: string;
142
161
  district: string;
@@ -159,8 +178,10 @@ export declare const eventPayloadGenerator: {
159
178
  option: string;
160
179
  filename: string;
161
180
  originalFilename: string;
162
- }[] | [string, string] | undefined>;
181
+ }[] | [string, string] | null | undefined>;
163
182
  annotation: {};
183
+ keepAssignment?: boolean | undefined;
184
+ type: "VALIDATE";
164
185
  duplicates: never[];
165
186
  eventId: string;
166
187
  };
@@ -178,10 +199,52 @@ export declare const eventPayloadGenerator: {
178
199
  assignedTo: null;
179
200
  eventId: string;
180
201
  };
181
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
182
- type: "ARCHIVE";
202
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
183
203
  transactionId: string;
184
- declaration: {};
204
+ declaration: Record<string, string | number | boolean | {
205
+ type: string;
206
+ filename: string;
207
+ originalFilename: string;
208
+ } | {
209
+ country: string;
210
+ district: string;
211
+ addressType: "DOMESTIC";
212
+ province: string;
213
+ urbanOrRural: "URBAN";
214
+ number?: string | null | undefined;
215
+ town?: string | null | undefined;
216
+ residentialArea?: string | null | undefined;
217
+ street?: string | null | undefined;
218
+ zipCode?: string | null | undefined;
219
+ } | {
220
+ firstname: string;
221
+ surname: string;
222
+ middlename?: string | null | undefined;
223
+ } | {
224
+ country: string;
225
+ district: string;
226
+ addressType: "DOMESTIC";
227
+ province: string;
228
+ urbanOrRural: "RURAL";
229
+ village?: string | null | undefined;
230
+ } | {
231
+ country: string;
232
+ state: string;
233
+ addressType: "INTERNATIONAL";
234
+ district2: string;
235
+ cityOrTown?: string | null | undefined;
236
+ addressLine1?: string | null | undefined;
237
+ addressLine2?: string | null | undefined;
238
+ addressLine3?: string | null | undefined;
239
+ postcodeOrZip?: string | null | undefined;
240
+ } | {
241
+ type: string;
242
+ option: string;
243
+ filename: string;
244
+ originalFilename: string;
245
+ }[] | [string, string] | null | undefined>;
246
+ keepAssignment?: boolean | undefined;
247
+ type: "ARCHIVE";
185
248
  annotation: {};
186
249
  duplicates: never[];
187
250
  eventId: string;
@@ -190,19 +253,19 @@ export declare const eventPayloadGenerator: {
190
253
  isDuplicate: boolean;
191
254
  };
192
255
  };
193
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
194
- type: "REJECT";
256
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
195
257
  transactionId: string;
196
- declaration: {};
197
258
  annotation: {};
259
+ keepAssignment?: boolean | undefined;
260
+ type: "REJECT";
261
+ declaration: {};
198
262
  duplicates: never[];
199
263
  eventId: string;
200
264
  reason: {
201
265
  message: string;
202
266
  };
203
267
  };
204
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
205
- type: "REGISTER";
268
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
206
269
  transactionId: string;
207
270
  declaration: Record<string, string | number | boolean | {
208
271
  type: string;
@@ -219,6 +282,10 @@ export declare const eventPayloadGenerator: {
219
282
  residentialArea?: string | null | undefined;
220
283
  street?: string | null | undefined;
221
284
  zipCode?: string | null | undefined;
285
+ } | {
286
+ firstname: string;
287
+ surname: string;
288
+ middlename?: string | null | undefined;
222
289
  } | {
223
290
  country: string;
224
291
  district: string;
@@ -241,19 +308,22 @@ export declare const eventPayloadGenerator: {
241
308
  option: string;
242
309
  filename: string;
243
310
  originalFilename: string;
244
- }[] | [string, string] | undefined>;
311
+ }[] | [string, string] | null | undefined>;
245
312
  annotation: {};
313
+ keepAssignment?: boolean | undefined;
314
+ type: "REGISTER";
246
315
  eventId: string;
247
316
  };
248
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
249
- type: "PRINT_CERTIFICATE";
317
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
250
318
  transactionId: string;
251
- declaration: {};
252
319
  annotation: {};
320
+ keepAssignment?: boolean | undefined;
321
+ type: "PRINT_CERTIFICATE";
322
+ declaration: {};
253
323
  eventId: string;
254
324
  };
255
325
  correction: {
256
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
326
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
257
327
  type: "REQUEST_CORRECTION";
258
328
  transactionId: string;
259
329
  declaration: Record<string, string | number | boolean | {
@@ -271,6 +341,10 @@ export declare const eventPayloadGenerator: {
271
341
  residentialArea?: string | null | undefined;
272
342
  street?: string | null | undefined;
273
343
  zipCode?: string | null | undefined;
344
+ } | {
345
+ firstname: string;
346
+ surname: string;
347
+ middlename?: string | null | undefined;
274
348
  } | {
275
349
  country: string;
276
350
  district: string;
@@ -293,47 +367,58 @@ export declare const eventPayloadGenerator: {
293
367
  option: string;
294
368
  filename: string;
295
369
  originalFilename: string;
296
- }[] | [string, string] | undefined>;
370
+ }[] | [string, string] | null | undefined>;
297
371
  annotation: {};
298
372
  eventId: string;
373
+ keepAssignment: boolean | undefined;
299
374
  };
300
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
375
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
301
376
  type: "APPROVE_CORRECTION";
302
377
  transactionId: string;
303
378
  declaration: {};
304
379
  annotation: {};
305
380
  eventId: string;
306
381
  requestId: string;
382
+ keepAssignment: boolean | undefined;
307
383
  };
308
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
384
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
309
385
  type: "REJECT_CORRECTION";
310
386
  transactionId: string;
311
387
  declaration: {};
312
388
  annotation: {};
313
389
  eventId: string;
314
390
  requestId: string;
391
+ keepAssignment: boolean | undefined;
315
392
  };
316
393
  };
317
394
  };
318
395
  };
319
- export declare function generateActionDocument({ configuration, action, defaults }: {
396
+ export declare function generateActionDocument({ configuration, action, rng, defaults }: {
320
397
  configuration: EventConfig;
321
398
  action: ActionType;
399
+ rng?: () => number;
322
400
  defaults?: Partial<ActionDocument>;
323
401
  }): ActionDocument;
324
- export declare function generateEventDocument({ configuration, actions }: {
402
+ export declare function generateEventDocument({ configuration, actions, rng }: {
325
403
  configuration: EventConfig;
326
404
  actions: ActionType[];
405
+ rng?: () => number;
327
406
  }): EventDocument;
328
- export declare function generateEventDraftDocument(eventId: UUID, actionType?: ActionType, declaration?: EventState): Draft;
407
+ export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
408
+ eventId: string;
409
+ actionType: ActionType;
410
+ rng?: () => number;
411
+ declaration?: EventState;
412
+ }): Draft;
329
413
  export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
414
+ export declare function getRandomDate(rng: () => number, start: string, end: string): string;
330
415
  /**
331
416
  * Useful for testing when we need deterministic outcome.
332
417
  * @param seed - Seed value for the pseudo-random number generator
333
418
  *
334
- * @returns A function that generates pseudo-random numbers between 0 and 1
419
+ * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
335
420
  */
336
- export declare function createPseudoRandomNumberGenerator(seed: number): () => number;
421
+ export declare function createPrng(seed: number): () => number;
337
422
  export declare function generateRandomSignature(rng: () => number): string;
338
423
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
339
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