@opencrvs/toolkit 1.8.0-rc.fbb7263 → 1.8.0-rc.fca3e39

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.
@@ -1,5 +1,5 @@
1
1
  import { ActionDocument } from './ActionDocument';
2
- import { ArchivedActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
2
+ import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
3
3
  import { ActionType } from './ActionType';
4
4
  import { Draft } from './Draft';
5
5
  import { EventConfig } from './EventConfig';
@@ -14,6 +14,7 @@ export declare function generateActionInput(configuration: EventConfig, action:
14
14
  } | {
15
15
  country: string;
16
16
  district: string;
17
+ addressType: "DOMESTIC";
17
18
  province: string;
18
19
  urbanOrRural: "URBAN";
19
20
  number?: string | undefined;
@@ -24,9 +25,20 @@ export declare function generateActionInput(configuration: EventConfig, action:
24
25
  } | {
25
26
  country: string;
26
27
  district: string;
28
+ addressType: "DOMESTIC";
27
29
  province: string;
28
30
  urbanOrRural: "RURAL";
29
31
  village?: string | undefined;
32
+ } | {
33
+ country: string;
34
+ state: string;
35
+ addressType: "INTERNATIONAL";
36
+ district2: string;
37
+ cityOrTown?: string | undefined;
38
+ addressLine1?: string | undefined;
39
+ addressLine2?: string | undefined;
40
+ addressLine3?: string | undefined;
41
+ postcodeOrZip?: string | undefined;
30
42
  } | {
31
43
  type: string;
32
44
  option: string;
@@ -78,6 +90,7 @@ export declare const eventPayloadGenerator: {
78
90
  } | {
79
91
  country: string;
80
92
  district: string;
93
+ addressType: "DOMESTIC";
81
94
  province: string;
82
95
  urbanOrRural: "URBAN";
83
96
  number?: string | null | undefined;
@@ -88,9 +101,20 @@ export declare const eventPayloadGenerator: {
88
101
  } | {
89
102
  country: string;
90
103
  district: string;
104
+ addressType: "DOMESTIC";
91
105
  province: string;
92
106
  urbanOrRural: "RURAL";
93
107
  village?: string | null | undefined;
108
+ } | {
109
+ country: string;
110
+ state: string;
111
+ addressType: "INTERNATIONAL";
112
+ district2: string;
113
+ cityOrTown?: string | null | undefined;
114
+ addressLine1?: string | null | undefined;
115
+ addressLine2?: string | null | undefined;
116
+ addressLine3?: string | null | undefined;
117
+ postcodeOrZip?: string | null | undefined;
94
118
  } | {
95
119
  type: string;
96
120
  option: string;
@@ -107,6 +131,7 @@ export declare const eventPayloadGenerator: {
107
131
  } | {
108
132
  country: string;
109
133
  district: string;
134
+ addressType: "DOMESTIC";
110
135
  province: string;
111
136
  urbanOrRural: "URBAN";
112
137
  number?: string | null | undefined;
@@ -117,9 +142,20 @@ export declare const eventPayloadGenerator: {
117
142
  } | {
118
143
  country: string;
119
144
  district: string;
145
+ addressType: "DOMESTIC";
120
146
  province: string;
121
147
  urbanOrRural: "RURAL";
122
148
  village?: string | null | undefined;
149
+ } | {
150
+ country: string;
151
+ state: string;
152
+ addressType: "INTERNATIONAL";
153
+ district2: string;
154
+ cityOrTown?: string | null | undefined;
155
+ addressLine1?: string | null | undefined;
156
+ addressLine2?: string | null | undefined;
157
+ addressLine3?: string | null | undefined;
158
+ postcodeOrZip?: string | null | undefined;
123
159
  } | {
124
160
  type: string;
125
161
  option: string;
@@ -139,6 +175,7 @@ export declare const eventPayloadGenerator: {
139
175
  } | {
140
176
  country: string;
141
177
  district: string;
178
+ addressType: "DOMESTIC";
142
179
  province: string;
143
180
  urbanOrRural: "URBAN";
144
181
  number?: string | null | undefined;
@@ -149,9 +186,20 @@ export declare const eventPayloadGenerator: {
149
186
  } | {
150
187
  country: string;
151
188
  district: string;
189
+ addressType: "DOMESTIC";
152
190
  province: string;
153
191
  urbanOrRural: "RURAL";
154
192
  village?: string | null | undefined;
193
+ } | {
194
+ country: string;
195
+ state: string;
196
+ addressType: "INTERNATIONAL";
197
+ district2: string;
198
+ cityOrTown?: string | null | undefined;
199
+ addressLine1?: string | null | undefined;
200
+ addressLine2?: string | null | undefined;
201
+ addressLine3?: string | null | undefined;
202
+ postcodeOrZip?: string | null | undefined;
155
203
  } | {
156
204
  type: string;
157
205
  option: string;
@@ -170,6 +218,7 @@ export declare const eventPayloadGenerator: {
170
218
  } | {
171
219
  country: string;
172
220
  district: string;
221
+ addressType: "DOMESTIC";
173
222
  province: string;
174
223
  urbanOrRural: "URBAN";
175
224
  number?: string | null | undefined;
@@ -180,9 +229,20 @@ export declare const eventPayloadGenerator: {
180
229
  } | {
181
230
  country: string;
182
231
  district: string;
232
+ addressType: "DOMESTIC";
183
233
  province: string;
184
234
  urbanOrRural: "RURAL";
185
235
  village?: string | null | undefined;
236
+ } | {
237
+ country: string;
238
+ state: string;
239
+ addressType: "INTERNATIONAL";
240
+ district2: string;
241
+ cityOrTown?: string | null | undefined;
242
+ addressLine1?: string | null | undefined;
243
+ addressLine2?: string | null | undefined;
244
+ addressLine3?: string | null | undefined;
245
+ postcodeOrZip?: string | null | undefined;
186
246
  } | {
187
247
  type: string;
188
248
  option: string;
@@ -192,8 +252,8 @@ export declare const eventPayloadGenerator: {
192
252
  duplicates: never[];
193
253
  eventId: string;
194
254
  };
195
- archive: (eventId: string, input?: Partial<Pick<ArchivedActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
196
- type: "ARCHIVED";
255
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
256
+ type: "ARCHIVE";
197
257
  transactionId: string;
198
258
  data: Record<string, string | number | boolean | {
199
259
  type: string;
@@ -202,6 +262,7 @@ export declare const eventPayloadGenerator: {
202
262
  } | {
203
263
  country: string;
204
264
  district: string;
265
+ addressType: "DOMESTIC";
205
266
  province: string;
206
267
  urbanOrRural: "URBAN";
207
268
  number?: string | null | undefined;
@@ -212,9 +273,20 @@ export declare const eventPayloadGenerator: {
212
273
  } | {
213
274
  country: string;
214
275
  district: string;
276
+ addressType: "DOMESTIC";
215
277
  province: string;
216
278
  urbanOrRural: "RURAL";
217
279
  village?: string | null | undefined;
280
+ } | {
281
+ country: string;
282
+ state: string;
283
+ addressType: "INTERNATIONAL";
284
+ district2: string;
285
+ cityOrTown?: string | null | undefined;
286
+ addressLine1?: string | null | undefined;
287
+ addressLine2?: string | null | undefined;
288
+ addressLine3?: string | null | undefined;
289
+ postcodeOrZip?: string | null | undefined;
218
290
  } | {
219
291
  type: string;
220
292
  option: string;
@@ -237,6 +309,7 @@ export declare const eventPayloadGenerator: {
237
309
  } | {
238
310
  country: string;
239
311
  district: string;
312
+ addressType: "DOMESTIC";
240
313
  province: string;
241
314
  urbanOrRural: "URBAN";
242
315
  number?: string | null | undefined;
@@ -247,9 +320,20 @@ export declare const eventPayloadGenerator: {
247
320
  } | {
248
321
  country: string;
249
322
  district: string;
323
+ addressType: "DOMESTIC";
250
324
  province: string;
251
325
  urbanOrRural: "RURAL";
252
326
  village?: string | null | undefined;
327
+ } | {
328
+ country: string;
329
+ state: string;
330
+ addressType: "INTERNATIONAL";
331
+ district2: string;
332
+ cityOrTown?: string | null | undefined;
333
+ addressLine1?: string | null | undefined;
334
+ addressLine2?: string | null | undefined;
335
+ addressLine3?: string | null | undefined;
336
+ postcodeOrZip?: string | null | undefined;
253
337
  } | {
254
338
  type: string;
255
339
  option: string;
@@ -269,6 +353,7 @@ export declare const eventPayloadGenerator: {
269
353
  } | {
270
354
  country: string;
271
355
  district: string;
356
+ addressType: "DOMESTIC";
272
357
  province: string;
273
358
  urbanOrRural: "URBAN";
274
359
  number?: string | null | undefined;
@@ -279,9 +364,20 @@ export declare const eventPayloadGenerator: {
279
364
  } | {
280
365
  country: string;
281
366
  district: string;
367
+ addressType: "DOMESTIC";
282
368
  province: string;
283
369
  urbanOrRural: "RURAL";
284
370
  village?: string | null | undefined;
371
+ } | {
372
+ country: string;
373
+ state: string;
374
+ addressType: "INTERNATIONAL";
375
+ district2: string;
376
+ cityOrTown?: string | null | undefined;
377
+ addressLine1?: string | null | undefined;
378
+ addressLine2?: string | null | undefined;
379
+ addressLine3?: string | null | undefined;
380
+ postcodeOrZip?: string | null | undefined;
285
381
  } | {
286
382
  type: string;
287
383
  option: string;
@@ -300,6 +396,7 @@ export declare const eventPayloadGenerator: {
300
396
  } | {
301
397
  country: string;
302
398
  district: string;
399
+ addressType: "DOMESTIC";
303
400
  province: string;
304
401
  urbanOrRural: "URBAN";
305
402
  number?: string | null | undefined;
@@ -310,9 +407,20 @@ export declare const eventPayloadGenerator: {
310
407
  } | {
311
408
  country: string;
312
409
  district: string;
410
+ addressType: "DOMESTIC";
313
411
  province: string;
314
412
  urbanOrRural: "RURAL";
315
413
  village?: string | null | undefined;
414
+ } | {
415
+ country: string;
416
+ state: string;
417
+ addressType: "INTERNATIONAL";
418
+ district2: string;
419
+ cityOrTown?: string | null | undefined;
420
+ addressLine1?: string | null | undefined;
421
+ addressLine2?: string | null | undefined;
422
+ addressLine3?: string | null | undefined;
423
+ postcodeOrZip?: string | null | undefined;
316
424
  } | {
317
425
  type: string;
318
426
  option: string;
@@ -332,6 +440,7 @@ export declare const eventPayloadGenerator: {
332
440
  } | {
333
441
  country: string;
334
442
  district: string;
443
+ addressType: "DOMESTIC";
335
444
  province: string;
336
445
  urbanOrRural: "URBAN";
337
446
  number?: string | null | undefined;
@@ -342,9 +451,20 @@ export declare const eventPayloadGenerator: {
342
451
  } | {
343
452
  country: string;
344
453
  district: string;
454
+ addressType: "DOMESTIC";
345
455
  province: string;
346
456
  urbanOrRural: "RURAL";
347
457
  village?: string | null | undefined;
458
+ } | {
459
+ country: string;
460
+ state: string;
461
+ addressType: "INTERNATIONAL";
462
+ district2: string;
463
+ cityOrTown?: string | null | undefined;
464
+ addressLine1?: string | null | undefined;
465
+ addressLine2?: string | null | undefined;
466
+ addressLine3?: string | null | undefined;
467
+ postcodeOrZip?: string | null | undefined;
348
468
  } | {
349
469
  type: string;
350
470
  option: string;
@@ -364,6 +484,7 @@ export declare const eventPayloadGenerator: {
364
484
  } | {
365
485
  country: string;
366
486
  district: string;
487
+ addressType: "DOMESTIC";
367
488
  province: string;
368
489
  urbanOrRural: "URBAN";
369
490
  number?: string | null | undefined;
@@ -374,9 +495,20 @@ export declare const eventPayloadGenerator: {
374
495
  } | {
375
496
  country: string;
376
497
  district: string;
498
+ addressType: "DOMESTIC";
377
499
  province: string;
378
500
  urbanOrRural: "RURAL";
379
501
  village?: string | null | undefined;
502
+ } | {
503
+ country: string;
504
+ state: string;
505
+ addressType: "INTERNATIONAL";
506
+ district2: string;
507
+ cityOrTown?: string | null | undefined;
508
+ addressLine1?: string | null | undefined;
509
+ addressLine2?: string | null | undefined;
510
+ addressLine3?: string | null | undefined;
511
+ postcodeOrZip?: string | null | undefined;
380
512
  } | {
381
513
  type: string;
382
514
  option: string;
@@ -396,6 +528,7 @@ export declare const eventPayloadGenerator: {
396
528
  } | {
397
529
  country: string;
398
530
  district: string;
531
+ addressType: "DOMESTIC";
399
532
  province: string;
400
533
  urbanOrRural: "URBAN";
401
534
  number?: string | null | undefined;
@@ -406,9 +539,20 @@ export declare const eventPayloadGenerator: {
406
539
  } | {
407
540
  country: string;
408
541
  district: string;
542
+ addressType: "DOMESTIC";
409
543
  province: string;
410
544
  urbanOrRural: "RURAL";
411
545
  village?: string | null | undefined;
546
+ } | {
547
+ country: string;
548
+ state: string;
549
+ addressType: "INTERNATIONAL";
550
+ district2: string;
551
+ cityOrTown?: string | null | undefined;
552
+ addressLine1?: string | null | undefined;
553
+ addressLine2?: string | null | undefined;
554
+ addressLine3?: string | null | undefined;
555
+ postcodeOrZip?: string | null | undefined;
412
556
  } | {
413
557
  type: string;
414
558
  option: string;
@@ -7,6 +7,8 @@ import { FieldConfig } from './FieldConfig';
7
7
  import { WorkqueueConfig } from './WorkqueueConfig';
8
8
  import { EventState } from './ActionDocument';
9
9
  import { FormConfig } from './FormConfig';
10
+ import { Draft } from './Draft';
11
+ import { EventDocument } from './EventDocument';
10
12
  /**
11
13
  * @returns All the fields in the event configuration input.
12
14
  */
@@ -75,6 +77,11 @@ export declare const findActiveActionFormFields: (configuration: EventConfig, ac
75
77
  * Returns all fields for the action type, including review fields, if any.
76
78
  */
77
79
  export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
80
+ export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
81
+ id: string;
82
+ title: TranslationConfig;
83
+ fields: import("./FieldConfig").Inferred[];
84
+ }[];
78
85
  /**
79
86
  * Returns all fields for the action type, including review fields, or throws
80
87
  */
@@ -87,6 +94,7 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
87
94
  } | {
88
95
  country: string;
89
96
  district: string;
97
+ addressType: "DOMESTIC";
90
98
  province: string;
91
99
  urbanOrRural: "URBAN";
92
100
  number?: string | undefined;
@@ -97,13 +105,126 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
97
105
  } | {
98
106
  country: string;
99
107
  district: string;
108
+ addressType: "DOMESTIC";
100
109
  province: string;
101
110
  urbanOrRural: "RURAL";
102
111
  village?: string | undefined;
112
+ } | {
113
+ country: string;
114
+ state: string;
115
+ addressType: "INTERNATIONAL";
116
+ district2: string;
117
+ cityOrTown?: string | undefined;
118
+ addressLine1?: string | undefined;
119
+ addressLine2?: string | undefined;
120
+ addressLine3?: string | undefined;
121
+ postcodeOrZip?: string | undefined;
103
122
  } | {
104
123
  type: string;
105
124
  option: string;
106
125
  filename: string;
107
126
  originalFilename: string;
108
127
  }[]>;
128
+ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
129
+ id: string;
130
+ createdAt: string;
131
+ eventId: string;
132
+ transactionId: string;
133
+ action: {
134
+ type: ActionType;
135
+ data: Record<string, string | number | boolean | {
136
+ type: string;
137
+ filename: string;
138
+ originalFilename: string;
139
+ } | {
140
+ country: string;
141
+ district: string;
142
+ addressType: "DOMESTIC";
143
+ province: string;
144
+ urbanOrRural: "URBAN";
145
+ number?: string | null | undefined;
146
+ town?: string | null | undefined;
147
+ residentialArea?: string | null | undefined;
148
+ street?: string | null | undefined;
149
+ zipCode?: string | null | undefined;
150
+ } | {
151
+ country: string;
152
+ district: string;
153
+ addressType: "DOMESTIC";
154
+ province: string;
155
+ urbanOrRural: "RURAL";
156
+ village?: string | null | undefined;
157
+ } | {
158
+ country: string;
159
+ state: string;
160
+ addressType: "INTERNATIONAL";
161
+ district2: string;
162
+ cityOrTown?: string | null | undefined;
163
+ addressLine1?: string | null | undefined;
164
+ addressLine2?: string | null | undefined;
165
+ addressLine3?: string | null | undefined;
166
+ postcodeOrZip?: string | null | undefined;
167
+ } | {
168
+ type: string;
169
+ option: string;
170
+ filename: string;
171
+ originalFilename: string;
172
+ }[]>;
173
+ createdAt: string;
174
+ createdBy: string;
175
+ createdAtLocation: string;
176
+ metadata?: Record<string, string | number | boolean | {
177
+ type: string;
178
+ filename: string;
179
+ originalFilename: string;
180
+ } | {
181
+ country: string;
182
+ district: string;
183
+ addressType: "DOMESTIC";
184
+ province: string;
185
+ urbanOrRural: "URBAN";
186
+ number?: string | null | undefined;
187
+ town?: string | null | undefined;
188
+ residentialArea?: string | null | undefined;
189
+ street?: string | null | undefined;
190
+ zipCode?: string | null | undefined;
191
+ } | {
192
+ country: string;
193
+ district: string;
194
+ addressType: "DOMESTIC";
195
+ province: string;
196
+ urbanOrRural: "RURAL";
197
+ village?: string | null | undefined;
198
+ } | {
199
+ country: string;
200
+ state: string;
201
+ addressType: "INTERNATIONAL";
202
+ district2: string;
203
+ cityOrTown?: string | null | undefined;
204
+ addressLine1?: string | null | undefined;
205
+ addressLine2?: string | null | undefined;
206
+ addressLine3?: string | null | undefined;
207
+ postcodeOrZip?: string | null | undefined;
208
+ } | {
209
+ type: string;
210
+ option: string;
211
+ filename: string;
212
+ originalFilename: string;
213
+ }[]> | undefined;
214
+ };
215
+ }[];
216
+ export declare function createEmptyDraft(eventId: string, draftId: string, actionType: ActionType): {
217
+ id: string;
218
+ eventId: string;
219
+ createdAt: string;
220
+ transactionId: import("../uuid").UUID;
221
+ action: {
222
+ type: ActionType;
223
+ data: {};
224
+ metadata: {};
225
+ createdAt: string;
226
+ createdBy: string;
227
+ createdAtLocation: string;
228
+ };
229
+ };
109
230
  //# sourceMappingURL=utils.d.ts.map
@@ -239,6 +239,23 @@ function field(fieldId) {
239
239
  }
240
240
  },
241
241
  required: ["$form"]
242
+ }),
243
+ isValidEnglishName: () => defineConditional({
244
+ type: "object",
245
+ properties: {
246
+ $form: {
247
+ type: "object",
248
+ properties: {
249
+ [fieldId]: {
250
+ type: "string",
251
+ pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
252
+ description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
253
+ }
254
+ },
255
+ required: [fieldId]
256
+ }
257
+ },
258
+ required: ["$form"]
242
259
  })
243
260
  };
244
261
  }