@opencrvs/toolkit 1.8.0-rc.fc43738 → 1.8.0-rc.fd6feaa

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,4 +1,5 @@
1
- import { ArchivedActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
1
+ import { ActionDocument } from './ActionDocument';
2
+ import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
2
3
  import { ActionType } from './ActionType';
3
4
  import { Draft } from './Draft';
4
5
  import { EventConfig } from './EventConfig';
@@ -26,6 +27,15 @@ export declare function generateActionInput(configuration: EventConfig, action:
26
27
  province: string;
27
28
  urbanOrRural: "RURAL";
28
29
  village?: string | undefined;
30
+ } | {
31
+ country: string;
32
+ state: string;
33
+ district2: string;
34
+ cityOrTown?: string | undefined;
35
+ addressLine1?: string | undefined;
36
+ addressLine2?: string | undefined;
37
+ addressLine3?: string | undefined;
38
+ postcodeOrZip?: string | undefined;
29
39
  } | {
30
40
  type: string;
31
41
  option: string;
@@ -79,17 +89,26 @@ export declare const eventPayloadGenerator: {
79
89
  district: string;
80
90
  province: string;
81
91
  urbanOrRural: "URBAN";
82
- number?: string | undefined;
83
- town?: string | undefined;
84
- residentialArea?: string | undefined;
85
- street?: string | undefined;
86
- zipCode?: string | undefined;
92
+ number?: string | null | undefined;
93
+ town?: string | null | undefined;
94
+ residentialArea?: string | null | undefined;
95
+ street?: string | null | undefined;
96
+ zipCode?: string | null | undefined;
87
97
  } | {
88
98
  country: string;
89
99
  district: string;
90
100
  province: string;
91
101
  urbanOrRural: "RURAL";
92
- village?: string | undefined;
102
+ village?: string | null | undefined;
103
+ } | {
104
+ country: string;
105
+ state: string;
106
+ district2: string;
107
+ cityOrTown?: string | null | undefined;
108
+ addressLine1?: string | null | undefined;
109
+ addressLine2?: string | null | undefined;
110
+ addressLine3?: string | null | undefined;
111
+ postcodeOrZip?: string | null | undefined;
93
112
  } | {
94
113
  type: string;
95
114
  option: string;
@@ -108,17 +127,26 @@ export declare const eventPayloadGenerator: {
108
127
  district: string;
109
128
  province: string;
110
129
  urbanOrRural: "URBAN";
111
- number?: string | undefined;
112
- town?: string | undefined;
113
- residentialArea?: string | undefined;
114
- street?: string | undefined;
115
- zipCode?: string | undefined;
130
+ number?: string | null | undefined;
131
+ town?: string | null | undefined;
132
+ residentialArea?: string | null | undefined;
133
+ street?: string | null | undefined;
134
+ zipCode?: string | null | undefined;
116
135
  } | {
117
136
  country: string;
118
137
  district: string;
119
138
  province: string;
120
139
  urbanOrRural: "RURAL";
121
- village?: string | undefined;
140
+ village?: string | null | undefined;
141
+ } | {
142
+ country: string;
143
+ state: string;
144
+ district2: string;
145
+ cityOrTown?: string | null | undefined;
146
+ addressLine1?: string | null | undefined;
147
+ addressLine2?: string | null | undefined;
148
+ addressLine3?: string | null | undefined;
149
+ postcodeOrZip?: string | null | undefined;
122
150
  } | {
123
151
  type: string;
124
152
  option: string;
@@ -140,17 +168,26 @@ export declare const eventPayloadGenerator: {
140
168
  district: string;
141
169
  province: string;
142
170
  urbanOrRural: "URBAN";
143
- number?: string | undefined;
144
- town?: string | undefined;
145
- residentialArea?: string | undefined;
146
- street?: string | undefined;
147
- zipCode?: string | undefined;
171
+ number?: string | null | undefined;
172
+ town?: string | null | undefined;
173
+ residentialArea?: string | null | undefined;
174
+ street?: string | null | undefined;
175
+ zipCode?: string | null | undefined;
148
176
  } | {
149
177
  country: string;
150
178
  district: string;
151
179
  province: string;
152
180
  urbanOrRural: "RURAL";
153
- village?: string | undefined;
181
+ village?: string | null | undefined;
182
+ } | {
183
+ country: string;
184
+ state: string;
185
+ district2: string;
186
+ cityOrTown?: string | null | undefined;
187
+ addressLine1?: string | null | undefined;
188
+ addressLine2?: string | null | undefined;
189
+ addressLine3?: string | null | undefined;
190
+ postcodeOrZip?: string | null | undefined;
154
191
  } | {
155
192
  type: string;
156
193
  option: string;
@@ -171,17 +208,26 @@ export declare const eventPayloadGenerator: {
171
208
  district: string;
172
209
  province: string;
173
210
  urbanOrRural: "URBAN";
174
- number?: string | undefined;
175
- town?: string | undefined;
176
- residentialArea?: string | undefined;
177
- street?: string | undefined;
178
- zipCode?: string | undefined;
211
+ number?: string | null | undefined;
212
+ town?: string | null | undefined;
213
+ residentialArea?: string | null | undefined;
214
+ street?: string | null | undefined;
215
+ zipCode?: string | null | undefined;
179
216
  } | {
180
217
  country: string;
181
218
  district: string;
182
219
  province: string;
183
220
  urbanOrRural: "RURAL";
184
- village?: string | undefined;
221
+ village?: string | null | undefined;
222
+ } | {
223
+ country: string;
224
+ state: string;
225
+ district2: string;
226
+ cityOrTown?: string | null | undefined;
227
+ addressLine1?: string | null | undefined;
228
+ addressLine2?: string | null | undefined;
229
+ addressLine3?: string | null | undefined;
230
+ postcodeOrZip?: string | null | undefined;
185
231
  } | {
186
232
  type: string;
187
233
  option: string;
@@ -191,8 +237,8 @@ export declare const eventPayloadGenerator: {
191
237
  duplicates: never[];
192
238
  eventId: string;
193
239
  };
194
- archive: (eventId: string, input?: Partial<Pick<ArchivedActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
195
- type: "ARCHIVED";
240
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
241
+ type: "ARCHIVE";
196
242
  transactionId: string;
197
243
  data: Record<string, string | number | boolean | {
198
244
  type: string;
@@ -203,17 +249,26 @@ export declare const eventPayloadGenerator: {
203
249
  district: string;
204
250
  province: string;
205
251
  urbanOrRural: "URBAN";
206
- number?: string | undefined;
207
- town?: string | undefined;
208
- residentialArea?: string | undefined;
209
- street?: string | undefined;
210
- zipCode?: string | undefined;
252
+ number?: string | null | undefined;
253
+ town?: string | null | undefined;
254
+ residentialArea?: string | null | undefined;
255
+ street?: string | null | undefined;
256
+ zipCode?: string | null | undefined;
211
257
  } | {
212
258
  country: string;
213
259
  district: string;
214
260
  province: string;
215
261
  urbanOrRural: "RURAL";
216
- village?: string | undefined;
262
+ village?: string | null | undefined;
263
+ } | {
264
+ country: string;
265
+ state: string;
266
+ district2: string;
267
+ cityOrTown?: string | null | undefined;
268
+ addressLine1?: string | null | undefined;
269
+ addressLine2?: string | null | undefined;
270
+ addressLine3?: string | null | undefined;
271
+ postcodeOrZip?: string | null | undefined;
217
272
  } | {
218
273
  type: string;
219
274
  option: string;
@@ -238,17 +293,26 @@ export declare const eventPayloadGenerator: {
238
293
  district: string;
239
294
  province: string;
240
295
  urbanOrRural: "URBAN";
241
- number?: string | undefined;
242
- town?: string | undefined;
243
- residentialArea?: string | undefined;
244
- street?: string | undefined;
245
- zipCode?: string | undefined;
296
+ number?: string | null | undefined;
297
+ town?: string | null | undefined;
298
+ residentialArea?: string | null | undefined;
299
+ street?: string | null | undefined;
300
+ zipCode?: string | null | undefined;
246
301
  } | {
247
302
  country: string;
248
303
  district: string;
249
304
  province: string;
250
305
  urbanOrRural: "RURAL";
251
- village?: string | undefined;
306
+ village?: string | null | undefined;
307
+ } | {
308
+ country: string;
309
+ state: string;
310
+ district2: string;
311
+ cityOrTown?: string | null | undefined;
312
+ addressLine1?: string | null | undefined;
313
+ addressLine2?: string | null | undefined;
314
+ addressLine3?: string | null | undefined;
315
+ postcodeOrZip?: string | null | undefined;
252
316
  } | {
253
317
  type: string;
254
318
  option: string;
@@ -270,17 +334,26 @@ export declare const eventPayloadGenerator: {
270
334
  district: string;
271
335
  province: string;
272
336
  urbanOrRural: "URBAN";
273
- number?: string | undefined;
274
- town?: string | undefined;
275
- residentialArea?: string | undefined;
276
- street?: string | undefined;
277
- zipCode?: string | undefined;
337
+ number?: string | null | undefined;
338
+ town?: string | null | undefined;
339
+ residentialArea?: string | null | undefined;
340
+ street?: string | null | undefined;
341
+ zipCode?: string | null | undefined;
278
342
  } | {
279
343
  country: string;
280
344
  district: string;
281
345
  province: string;
282
346
  urbanOrRural: "RURAL";
283
- village?: string | undefined;
347
+ village?: string | null | undefined;
348
+ } | {
349
+ country: string;
350
+ state: string;
351
+ district2: string;
352
+ cityOrTown?: string | null | undefined;
353
+ addressLine1?: string | null | undefined;
354
+ addressLine2?: string | null | undefined;
355
+ addressLine3?: string | null | undefined;
356
+ postcodeOrZip?: string | null | undefined;
284
357
  } | {
285
358
  type: string;
286
359
  option: string;
@@ -301,17 +374,26 @@ export declare const eventPayloadGenerator: {
301
374
  district: string;
302
375
  province: string;
303
376
  urbanOrRural: "URBAN";
304
- number?: string | undefined;
305
- town?: string | undefined;
306
- residentialArea?: string | undefined;
307
- street?: string | undefined;
308
- zipCode?: string | undefined;
377
+ number?: string | null | undefined;
378
+ town?: string | null | undefined;
379
+ residentialArea?: string | null | undefined;
380
+ street?: string | null | undefined;
381
+ zipCode?: string | null | undefined;
309
382
  } | {
310
383
  country: string;
311
384
  district: string;
312
385
  province: string;
313
386
  urbanOrRural: "RURAL";
314
- village?: string | undefined;
387
+ village?: string | null | undefined;
388
+ } | {
389
+ country: string;
390
+ state: string;
391
+ district2: string;
392
+ cityOrTown?: string | null | undefined;
393
+ addressLine1?: string | null | undefined;
394
+ addressLine2?: string | null | undefined;
395
+ addressLine3?: string | null | undefined;
396
+ postcodeOrZip?: string | null | undefined;
315
397
  } | {
316
398
  type: string;
317
399
  option: string;
@@ -333,17 +415,26 @@ export declare const eventPayloadGenerator: {
333
415
  district: string;
334
416
  province: string;
335
417
  urbanOrRural: "URBAN";
336
- number?: string | undefined;
337
- town?: string | undefined;
338
- residentialArea?: string | undefined;
339
- street?: string | undefined;
340
- zipCode?: string | undefined;
418
+ number?: string | null | undefined;
419
+ town?: string | null | undefined;
420
+ residentialArea?: string | null | undefined;
421
+ street?: string | null | undefined;
422
+ zipCode?: string | null | undefined;
341
423
  } | {
342
424
  country: string;
343
425
  district: string;
344
426
  province: string;
345
427
  urbanOrRural: "RURAL";
346
- village?: string | undefined;
428
+ village?: string | null | undefined;
429
+ } | {
430
+ country: string;
431
+ state: string;
432
+ district2: string;
433
+ cityOrTown?: string | null | undefined;
434
+ addressLine1?: string | null | undefined;
435
+ addressLine2?: string | null | undefined;
436
+ addressLine3?: string | null | undefined;
437
+ postcodeOrZip?: string | null | undefined;
347
438
  } | {
348
439
  type: string;
349
440
  option: string;
@@ -365,17 +456,26 @@ export declare const eventPayloadGenerator: {
365
456
  district: string;
366
457
  province: string;
367
458
  urbanOrRural: "URBAN";
368
- number?: string | undefined;
369
- town?: string | undefined;
370
- residentialArea?: string | undefined;
371
- street?: string | undefined;
372
- zipCode?: string | undefined;
459
+ number?: string | null | undefined;
460
+ town?: string | null | undefined;
461
+ residentialArea?: string | null | undefined;
462
+ street?: string | null | undefined;
463
+ zipCode?: string | null | undefined;
373
464
  } | {
374
465
  country: string;
375
466
  district: string;
376
467
  province: string;
377
468
  urbanOrRural: "RURAL";
378
- village?: string | undefined;
469
+ village?: string | null | undefined;
470
+ } | {
471
+ country: string;
472
+ state: string;
473
+ district2: string;
474
+ cityOrTown?: string | null | undefined;
475
+ addressLine1?: string | null | undefined;
476
+ addressLine2?: string | null | undefined;
477
+ addressLine3?: string | null | undefined;
478
+ postcodeOrZip?: string | null | undefined;
379
479
  } | {
380
480
  type: string;
381
481
  option: string;
@@ -397,17 +497,26 @@ export declare const eventPayloadGenerator: {
397
497
  district: string;
398
498
  province: string;
399
499
  urbanOrRural: "URBAN";
400
- number?: string | undefined;
401
- town?: string | undefined;
402
- residentialArea?: string | undefined;
403
- street?: string | undefined;
404
- zipCode?: string | undefined;
500
+ number?: string | null | undefined;
501
+ town?: string | null | undefined;
502
+ residentialArea?: string | null | undefined;
503
+ street?: string | null | undefined;
504
+ zipCode?: string | null | undefined;
405
505
  } | {
406
506
  country: string;
407
507
  district: string;
408
508
  province: string;
409
509
  urbanOrRural: "RURAL";
410
- village?: string | undefined;
510
+ village?: string | null | undefined;
511
+ } | {
512
+ country: string;
513
+ state: string;
514
+ district2: string;
515
+ cityOrTown?: string | null | undefined;
516
+ addressLine1?: string | null | undefined;
517
+ addressLine2?: string | null | undefined;
518
+ addressLine3?: string | null | undefined;
519
+ postcodeOrZip?: string | null | undefined;
411
520
  } | {
412
521
  type: string;
413
522
  option: string;
@@ -420,6 +529,11 @@ export declare const eventPayloadGenerator: {
420
529
  };
421
530
  };
422
531
  };
532
+ export declare function generateActionDocument({ configuration, action, defaults }: {
533
+ configuration: EventConfig;
534
+ action: ActionType;
535
+ defaults?: Partial<ActionDocument>;
536
+ }): ActionDocument;
423
537
  export declare function generateEventDocument({ configuration, actions }: {
424
538
  configuration: EventConfig;
425
539
  actions: ActionType[];
@@ -5,8 +5,10 @@ import { EventConfigInput } from './EventConfigInput';
5
5
  import { EventMetadataKeys } from './EventMetadata';
6
6
  import { FieldConfig } from './FieldConfig';
7
7
  import { WorkqueueConfig } from './WorkqueueConfig';
8
- import { ActionFormData } from './ActionDocument';
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,13 +77,17 @@ 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
  */
81
88
  export declare function getActiveActionFields(configuration: EventConfig, action: ActionType): FieldConfig[];
82
89
  export declare function getEventConfiguration(eventConfigurations: EventConfig[], type: string): EventConfig;
83
- export declare function isOptionalUncheckedCheckbox(field: FieldConfig, form: ActionFormData): boolean;
84
- export declare function stripHiddenFields(fields: FieldConfig[], data: ActionFormData): import("lodash").Dictionary<string | number | boolean | {
90
+ export declare function stripHiddenFields(fields: FieldConfig[], data: EventState): import("lodash").Dictionary<string | number | boolean | {
85
91
  type: string;
86
92
  filename: string;
87
93
  originalFilename: string;
@@ -101,10 +107,115 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: ActionFor
101
107
  province: string;
102
108
  urbanOrRural: "RURAL";
103
109
  village?: string | undefined;
110
+ } | {
111
+ country: string;
112
+ state: string;
113
+ district2: string;
114
+ cityOrTown?: string | undefined;
115
+ addressLine1?: string | undefined;
116
+ addressLine2?: string | undefined;
117
+ addressLine3?: string | undefined;
118
+ postcodeOrZip?: string | undefined;
104
119
  } | {
105
120
  type: string;
106
121
  option: string;
107
122
  filename: string;
108
123
  originalFilename: string;
109
124
  }[]>;
125
+ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
126
+ id: string;
127
+ createdAt: string;
128
+ eventId: string;
129
+ transactionId: string;
130
+ action: {
131
+ type: ActionType;
132
+ data: Record<string, string | number | boolean | {
133
+ type: string;
134
+ filename: string;
135
+ originalFilename: string;
136
+ } | {
137
+ country: string;
138
+ district: string;
139
+ province: string;
140
+ urbanOrRural: "URBAN";
141
+ number?: string | null | undefined;
142
+ town?: string | null | undefined;
143
+ residentialArea?: string | null | undefined;
144
+ street?: string | null | undefined;
145
+ zipCode?: string | null | undefined;
146
+ } | {
147
+ country: string;
148
+ district: string;
149
+ province: string;
150
+ urbanOrRural: "RURAL";
151
+ village?: string | null | undefined;
152
+ } | {
153
+ country: string;
154
+ state: string;
155
+ district2: string;
156
+ cityOrTown?: string | null | undefined;
157
+ addressLine1?: string | null | undefined;
158
+ addressLine2?: string | null | undefined;
159
+ addressLine3?: string | null | undefined;
160
+ postcodeOrZip?: string | null | undefined;
161
+ } | {
162
+ type: string;
163
+ option: string;
164
+ filename: string;
165
+ originalFilename: string;
166
+ }[]>;
167
+ createdAt: string;
168
+ createdBy: string;
169
+ createdAtLocation: string;
170
+ metadata?: Record<string, string | number | boolean | {
171
+ type: string;
172
+ filename: string;
173
+ originalFilename: string;
174
+ } | {
175
+ country: string;
176
+ district: string;
177
+ province: string;
178
+ urbanOrRural: "URBAN";
179
+ number?: string | null | undefined;
180
+ town?: string | null | undefined;
181
+ residentialArea?: string | null | undefined;
182
+ street?: string | null | undefined;
183
+ zipCode?: string | null | undefined;
184
+ } | {
185
+ country: string;
186
+ district: string;
187
+ province: string;
188
+ urbanOrRural: "RURAL";
189
+ village?: string | null | undefined;
190
+ } | {
191
+ country: string;
192
+ state: string;
193
+ district2: string;
194
+ cityOrTown?: string | null | undefined;
195
+ addressLine1?: string | null | undefined;
196
+ addressLine2?: string | null | undefined;
197
+ addressLine3?: string | null | undefined;
198
+ postcodeOrZip?: string | null | undefined;
199
+ } | {
200
+ type: string;
201
+ option: string;
202
+ filename: string;
203
+ originalFilename: string;
204
+ }[]> | undefined;
205
+ };
206
+ }[];
207
+ export declare function createEmptyDraft(eventId: string, draftId: string, actionType: ActionType): {
208
+ id: string;
209
+ eventId: string;
210
+ createdAt: string;
211
+ transactionId: import("../uuid").UUID;
212
+ action: {
213
+ type: ActionType;
214
+ data: {};
215
+ metadata: {};
216
+ createdAt: string;
217
+ createdBy: string;
218
+ createdAtLocation: string;
219
+ };
220
+ };
110
221
  //# sourceMappingURL=utils.d.ts.map