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

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