@opencrvs/toolkit 1.8.0-rc.fc43738 → 1.8.0-rc.fe799b0
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.
- package/dist/commons/api/router.d.ts +2498 -2498
- package/dist/commons/conditionals/conditionals.d.ts +2 -2
- package/dist/commons/conditionals/validate.d.ts +6 -6
- package/dist/commons/events/ActionDocument.d.ts +1117 -1110
- package/dist/commons/events/ActionInput.d.ts +1664 -1664
- package/dist/commons/events/CompositeFieldValue.d.ts +264 -0
- package/dist/commons/events/Draft.d.ts +152 -152
- package/dist/commons/events/EventDocument.d.ts +1320 -1320
- package/dist/commons/events/EventIndex.d.ts +3 -3
- package/dist/commons/events/EventMetadata.d.ts +3 -3
- package/dist/commons/events/FieldConfig.d.ts +2 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +122 -38
- package/dist/commons/events/FieldValue.d.ts +62 -65
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +72 -66
- package/dist/commons/events/utils.d.ts +2 -3
- package/dist/events/index.js +483 -414
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -36,8 +36,9 @@ __export(events_exports, {
|
|
36
36
|
ActionConfigBase: () => ActionConfigBase,
|
37
37
|
ActionDocument: () => ActionDocument,
|
38
38
|
ActionInput: () => ActionInput,
|
39
|
-
ActionMetadata: () => ActionMetadata,
|
40
39
|
ActionType: () => ActionType,
|
40
|
+
ActionUpdate: () => ActionUpdate,
|
41
|
+
AddressFieldUpdateValue: () => AddressFieldUpdateValue,
|
41
42
|
AddressFieldValue: () => AddressFieldValue,
|
42
43
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
43
44
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
@@ -67,12 +68,14 @@ __export(events_exports, {
|
|
67
68
|
EventStatuses: () => EventStatuses,
|
68
69
|
FieldConfig: () => FieldConfig,
|
69
70
|
FieldType: () => FieldType,
|
71
|
+
FieldUpdateValue: () => FieldUpdateValue,
|
70
72
|
FieldValue: () => FieldValue,
|
71
73
|
FileFieldValue: () => FileFieldValue,
|
72
74
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
73
75
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
74
76
|
FormConfig: () => FormConfig,
|
75
77
|
FormPage: () => FormPage,
|
78
|
+
GeographicalArea: () => GeographicalArea,
|
76
79
|
LanguageConfig: () => LanguageConfig,
|
77
80
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
78
81
|
NotifyActionInput: () => NotifyActionInput,
|
@@ -84,16 +87,21 @@ __export(events_exports, {
|
|
84
87
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
85
88
|
RequiredTextValue: () => RequiredTextValue,
|
86
89
|
ResolvedUser: () => ResolvedUser,
|
90
|
+
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
91
|
+
RuralAddressValue: () => RuralAddressValue,
|
87
92
|
ShowConditional: () => ShowConditional,
|
88
93
|
SummaryConfig: () => SummaryConfig,
|
89
94
|
TextValue: () => TextValue,
|
90
95
|
TranslationConfig: () => TranslationConfig,
|
96
|
+
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
97
|
+
UrbanAddressValue: () => UrbanAddressValue,
|
91
98
|
ValidateActionInput: () => ValidateActionInput,
|
92
99
|
WorkqueueConfig: () => WorkqueueConfig,
|
93
100
|
alwaysTrue: () => alwaysTrue,
|
94
101
|
and: () => and,
|
95
102
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
96
103
|
createValidationSchema: () => createValidationSchema,
|
104
|
+
deepDropNulls: () => deepDropNulls,
|
97
105
|
defineConditional: () => defineConditional,
|
98
106
|
defineConfig: () => defineConfig,
|
99
107
|
defineForm: () => defineForm,
|
@@ -111,6 +119,7 @@ __export(events_exports, {
|
|
111
119
|
findActiveActionFormPages: () => findActiveActionFormPages,
|
112
120
|
findInputPageFields: () => findInputPageFields,
|
113
121
|
findPageFields: () => findPageFields,
|
122
|
+
generateActionDocument: () => generateActionDocument,
|
114
123
|
generateActionInput: () => generateActionInput,
|
115
124
|
generateEventDocument: () => generateEventDocument,
|
116
125
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
@@ -140,7 +149,6 @@ __export(events_exports, {
|
|
140
149
|
isLocationFieldType: () => isLocationFieldType,
|
141
150
|
isNumberFieldType: () => isNumberFieldType,
|
142
151
|
isOfficeFieldType: () => isOfficeFieldType,
|
143
|
-
isOptionalUncheckedCheckbox: () => isOptionalUncheckedCheckbox,
|
144
152
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
145
153
|
isParagraphFieldType: () => isParagraphFieldType,
|
146
154
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
@@ -163,7 +171,7 @@ __export(events_exports, {
|
|
163
171
|
module.exports = __toCommonJS(events_exports);
|
164
172
|
|
165
173
|
// ../commons/src/events/ActionConfig.ts
|
166
|
-
var
|
174
|
+
var import_zod7 = require("zod");
|
167
175
|
|
168
176
|
// ../commons/src/events/Conditional.ts
|
169
177
|
var import_zod = require("zod");
|
@@ -192,10 +200,10 @@ var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
|
192
200
|
]);
|
193
201
|
|
194
202
|
// ../commons/src/events/FormConfig.ts
|
195
|
-
var
|
203
|
+
var import_zod6 = require("zod");
|
196
204
|
|
197
205
|
// ../commons/src/events/FieldConfig.ts
|
198
|
-
var
|
206
|
+
var import_zod5 = require("zod");
|
199
207
|
|
200
208
|
// ../commons/src/events/TranslationConfig.ts
|
201
209
|
var import_zod2 = require("zod");
|
@@ -237,11 +245,14 @@ var FieldType = {
|
|
237
245
|
var fieldTypes = Object.values(FieldType);
|
238
246
|
|
239
247
|
// ../commons/src/events/FieldValue.ts
|
248
|
+
var import_zod4 = require("zod");
|
249
|
+
|
250
|
+
// ../commons/src/events/CompositeFieldValue.ts
|
240
251
|
var import_zod3 = require("zod");
|
241
|
-
var
|
242
|
-
|
243
|
-
|
244
|
-
|
252
|
+
var GeographicalArea = {
|
253
|
+
URBAN: "URBAN",
|
254
|
+
RURAL: "RURAL"
|
255
|
+
};
|
245
256
|
var FileFieldValue = import_zod3.z.object({
|
246
257
|
filename: import_zod3.z.string(),
|
247
258
|
originalFilename: import_zod3.z.string(),
|
@@ -252,21 +263,37 @@ var AdminStructure = import_zod3.z.object({
|
|
252
263
|
province: import_zod3.z.string(),
|
253
264
|
district: import_zod3.z.string()
|
254
265
|
});
|
255
|
-
var
|
256
|
-
urbanOrRural: import_zod3.z.literal(
|
266
|
+
var UrbanAddressValue = AdminStructure.extend({
|
267
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
|
257
268
|
town: import_zod3.z.string().optional(),
|
258
269
|
residentialArea: import_zod3.z.string().optional(),
|
259
270
|
street: import_zod3.z.string().optional(),
|
260
271
|
number: import_zod3.z.string().optional(),
|
261
272
|
zipCode: import_zod3.z.string().optional()
|
262
273
|
});
|
263
|
-
var
|
264
|
-
urbanOrRural: import_zod3.z.literal(
|
274
|
+
var RuralAddressValue = AdminStructure.extend({
|
275
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
265
276
|
village: import_zod3.z.string().optional()
|
266
277
|
});
|
278
|
+
var UrbanAddressUpdateValue = AdminStructure.extend({
|
279
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
|
280
|
+
town: import_zod3.z.string().nullish(),
|
281
|
+
residentialArea: import_zod3.z.string().nullish(),
|
282
|
+
street: import_zod3.z.string().nullish(),
|
283
|
+
number: import_zod3.z.string().nullish(),
|
284
|
+
zipCode: import_zod3.z.string().nullish()
|
285
|
+
});
|
286
|
+
var RuralAddressUpdateValue = AdminStructure.extend({
|
287
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
288
|
+
village: import_zod3.z.string().nullish()
|
289
|
+
});
|
267
290
|
var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
268
|
-
|
269
|
-
|
291
|
+
UrbanAddressValue,
|
292
|
+
RuralAddressValue
|
293
|
+
]);
|
294
|
+
var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
295
|
+
UrbanAddressUpdateValue,
|
296
|
+
RuralAddressUpdateValue
|
270
297
|
]);
|
271
298
|
var FileFieldValueWithOption = import_zod3.z.object({
|
272
299
|
filename: import_zod3.z.string(),
|
@@ -275,30 +302,46 @@ var FileFieldValueWithOption = import_zod3.z.object({
|
|
275
302
|
option: import_zod3.z.string()
|
276
303
|
});
|
277
304
|
var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
|
278
|
-
|
279
|
-
|
280
|
-
var
|
305
|
+
|
306
|
+
// ../commons/src/events/FieldValue.ts
|
307
|
+
var TextValue = import_zod4.z.string();
|
308
|
+
var RequiredTextValue = TextValue.min(1);
|
309
|
+
var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
|
310
|
+
var EmailValue = import_zod4.z.string().email();
|
311
|
+
var CheckboxFieldValue = import_zod4.z.boolean();
|
312
|
+
var NumberFieldValue = import_zod4.z.number();
|
313
|
+
var FieldValue = import_zod4.z.union([
|
281
314
|
TextValue,
|
282
315
|
DateValue,
|
316
|
+
CheckboxFieldValue,
|
317
|
+
NumberFieldValue,
|
283
318
|
FileFieldValue,
|
284
319
|
FileFieldWithOptionValue,
|
320
|
+
UrbanAddressValue,
|
321
|
+
RuralAddressValue
|
322
|
+
]);
|
323
|
+
var FieldUpdateValue = import_zod4.z.union([
|
324
|
+
TextValue,
|
325
|
+
DateValue,
|
285
326
|
CheckboxFieldValue,
|
286
327
|
NumberFieldValue,
|
287
|
-
|
288
|
-
|
328
|
+
FileFieldValue,
|
329
|
+
FileFieldWithOptionValue,
|
330
|
+
UrbanAddressUpdateValue,
|
331
|
+
RuralAddressUpdateValue
|
289
332
|
]);
|
290
333
|
|
291
334
|
// ../commons/src/events/FieldConfig.ts
|
292
|
-
var FieldId =
|
293
|
-
var DependencyExpression =
|
294
|
-
dependsOn:
|
295
|
-
expression:
|
335
|
+
var FieldId = import_zod5.z.string();
|
336
|
+
var DependencyExpression = import_zod5.z.object({
|
337
|
+
dependsOn: import_zod5.z.array(FieldId).default([]),
|
338
|
+
expression: import_zod5.z.string()
|
296
339
|
});
|
297
|
-
var BaseField =
|
340
|
+
var BaseField = import_zod5.z.object({
|
298
341
|
id: FieldId,
|
299
|
-
defaultValue:
|
342
|
+
defaultValue: import_zod5.z.union([
|
300
343
|
// These are the currently supported default values types
|
301
|
-
|
344
|
+
import_zod5.z.union([
|
302
345
|
TextValue,
|
303
346
|
RequiredTextValue,
|
304
347
|
DateValue,
|
@@ -307,82 +350,82 @@ var BaseField = import_zod4.z.object({
|
|
307
350
|
]),
|
308
351
|
DependencyExpression
|
309
352
|
]).optional(),
|
310
|
-
conditionals:
|
311
|
-
required:
|
312
|
-
disabled:
|
313
|
-
hidden:
|
353
|
+
conditionals: import_zod5.z.array(ActionConditional).default([]).optional(),
|
354
|
+
required: import_zod5.z.boolean().default(false).optional(),
|
355
|
+
disabled: import_zod5.z.boolean().default(false).optional(),
|
356
|
+
hidden: import_zod5.z.boolean().default(false).optional(),
|
314
357
|
placeholder: TranslationConfig.optional(),
|
315
|
-
validation:
|
316
|
-
|
358
|
+
validation: import_zod5.z.array(
|
359
|
+
import_zod5.z.object({
|
317
360
|
validator: Conditional(),
|
318
361
|
message: TranslationConfig
|
319
362
|
})
|
320
363
|
).default([]).optional(),
|
321
|
-
dependsOn:
|
364
|
+
dependsOn: import_zod5.z.array(FieldId).default([]).optional(),
|
322
365
|
label: TranslationConfig,
|
323
|
-
hideLabel:
|
366
|
+
hideLabel: import_zod5.z.boolean().default(false).optional()
|
324
367
|
});
|
325
368
|
var Divider = BaseField.extend({
|
326
|
-
type:
|
369
|
+
type: import_zod5.z.literal(FieldType.DIVIDER)
|
327
370
|
});
|
328
371
|
var TextField = BaseField.extend({
|
329
|
-
type:
|
330
|
-
defaultValue:
|
331
|
-
configuration:
|
332
|
-
maxLength:
|
333
|
-
type:
|
372
|
+
type: import_zod5.z.literal(FieldType.TEXT),
|
373
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
374
|
+
configuration: import_zod5.z.object({
|
375
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
376
|
+
type: import_zod5.z.enum(["text", "password"]).optional(),
|
334
377
|
prefix: TranslationConfig.optional(),
|
335
378
|
postfix: TranslationConfig.optional()
|
336
379
|
}).default({ type: "text" }).optional()
|
337
380
|
}).describe("Text input");
|
338
381
|
var NumberField = BaseField.extend({
|
339
|
-
type:
|
340
|
-
defaultValue:
|
341
|
-
configuration:
|
342
|
-
min:
|
343
|
-
max:
|
382
|
+
type: import_zod5.z.literal(FieldType.NUMBER),
|
383
|
+
defaultValue: import_zod5.z.union([NumberFieldValue, DependencyExpression]).optional(),
|
384
|
+
configuration: import_zod5.z.object({
|
385
|
+
min: import_zod5.z.number().optional().describe("Minimum value"),
|
386
|
+
max: import_zod5.z.number().optional().describe("Maximum value"),
|
344
387
|
prefix: TranslationConfig.optional(),
|
345
388
|
postfix: TranslationConfig.optional()
|
346
389
|
}).optional()
|
347
390
|
}).describe("Number input");
|
348
391
|
var TextAreaField = BaseField.extend({
|
349
|
-
type:
|
350
|
-
defaultValue:
|
351
|
-
configuration:
|
352
|
-
maxLength:
|
353
|
-
rows:
|
354
|
-
cols:
|
392
|
+
type: import_zod5.z.literal(FieldType.TEXTAREA),
|
393
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
394
|
+
configuration: import_zod5.z.object({
|
395
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
396
|
+
rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
|
397
|
+
cols: import_zod5.z.number().optional().describe("Number of visible columns"),
|
355
398
|
prefix: TranslationConfig.optional(),
|
356
399
|
postfix: TranslationConfig.optional()
|
357
400
|
}).default({ rows: 4 }).optional()
|
358
401
|
}).describe("Multiline text input");
|
359
402
|
var SignatureField = BaseField.extend({
|
360
|
-
type:
|
403
|
+
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
361
404
|
signaturePromptLabel: TranslationConfig.describe(
|
362
405
|
"Title of the signature modal"
|
363
406
|
),
|
364
|
-
configuration:
|
365
|
-
maxSizeMb:
|
366
|
-
allowedFileFormats:
|
407
|
+
configuration: import_zod5.z.object({
|
408
|
+
maxSizeMb: import_zod5.z.number().optional().describe("Maximum file size in MB"),
|
409
|
+
allowedFileFormats: import_zod5.z.array(import_zod5.z.string()).optional().describe("List of allowed file formats for the signature")
|
367
410
|
}).default({}).optional()
|
368
411
|
}).describe("Signature input field");
|
369
412
|
var EmailField = BaseField.extend({
|
370
|
-
type:
|
371
|
-
configuration:
|
372
|
-
maxLength:
|
413
|
+
type: import_zod5.z.literal(FieldType.EMAIL),
|
414
|
+
configuration: import_zod5.z.object({
|
415
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
|
373
416
|
}).default({ maxLength: 10 }).optional(),
|
374
|
-
defaultValue:
|
417
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
375
418
|
});
|
376
419
|
var DateField = BaseField.extend({
|
377
|
-
type:
|
378
|
-
defaultValue:
|
379
|
-
configuration:
|
420
|
+
type: import_zod5.z.literal(FieldType.DATE),
|
421
|
+
defaultValue: import_zod5.z.union([DateValue, DependencyExpression]).optional(),
|
422
|
+
configuration: import_zod5.z.object({
|
380
423
|
notice: TranslationConfig.describe(
|
381
424
|
"Text to display above the date input"
|
382
425
|
).optional()
|
383
426
|
}).optional()
|
384
427
|
}).describe("A single date input (dd-mm-YYYY)");
|
385
|
-
var HtmlFontVariant =
|
428
|
+
var HtmlFontVariant = import_zod5.z.enum([
|
386
429
|
"reg12",
|
387
430
|
"reg14",
|
388
431
|
"reg16",
|
@@ -393,97 +436,97 @@ var HtmlFontVariant = import_zod4.z.enum([
|
|
393
436
|
"h1"
|
394
437
|
]);
|
395
438
|
var Paragraph = BaseField.extend({
|
396
|
-
type:
|
397
|
-
defaultValue:
|
398
|
-
configuration:
|
399
|
-
styles:
|
439
|
+
type: import_zod5.z.literal(FieldType.PARAGRAPH),
|
440
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
441
|
+
configuration: import_zod5.z.object({
|
442
|
+
styles: import_zod5.z.object({
|
400
443
|
fontVariant: HtmlFontVariant.optional()
|
401
444
|
}).optional()
|
402
445
|
}).default({})
|
403
446
|
}).describe("A read-only HTML <p> paragraph");
|
404
447
|
var PageHeader = BaseField.extend({
|
405
|
-
type:
|
406
|
-
defaultValue:
|
448
|
+
type: import_zod5.z.literal(FieldType.PAGE_HEADER),
|
449
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
407
450
|
}).describe("A read-only header component for form pages");
|
408
451
|
var File = BaseField.extend({
|
409
|
-
type:
|
410
|
-
options:
|
411
|
-
style:
|
412
|
-
fullWidth:
|
452
|
+
type: import_zod5.z.literal(FieldType.FILE),
|
453
|
+
options: import_zod5.z.object({
|
454
|
+
style: import_zod5.z.object({
|
455
|
+
fullWidth: import_zod5.z.boolean().describe(
|
413
456
|
"Whether the file upload button should take the full width of the container or not"
|
414
457
|
)
|
415
458
|
})
|
416
459
|
}).optional()
|
417
460
|
}).describe("File upload");
|
418
|
-
var SelectOption =
|
419
|
-
value:
|
461
|
+
var SelectOption = import_zod5.z.object({
|
462
|
+
value: import_zod5.z.string().describe("The value of the option"),
|
420
463
|
label: TranslationConfig.describe("The label of the option")
|
421
464
|
});
|
422
465
|
var RadioGroup = BaseField.extend({
|
423
|
-
type:
|
424
|
-
defaultValue:
|
425
|
-
options:
|
426
|
-
configuration:
|
427
|
-
styles:
|
428
|
-
size:
|
466
|
+
type: import_zod5.z.literal(FieldType.RADIO_GROUP),
|
467
|
+
defaultValue: import_zod5.z.union([TextValue, DependencyExpression]).optional(),
|
468
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
469
|
+
configuration: import_zod5.z.object({
|
470
|
+
styles: import_zod5.z.object({
|
471
|
+
size: import_zod5.z.enum(["NORMAL", "LARGE"]).optional()
|
429
472
|
}).optional()
|
430
473
|
}).optional()
|
431
474
|
}).describe("Grouped radio options");
|
432
475
|
var BulletList = BaseField.extend({
|
433
|
-
type:
|
434
|
-
defaultValue:
|
435
|
-
items:
|
436
|
-
configuration:
|
437
|
-
styles:
|
476
|
+
type: import_zod5.z.literal(FieldType.BULLET_LIST),
|
477
|
+
defaultValue: import_zod5.z.string().optional(),
|
478
|
+
items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
|
479
|
+
configuration: import_zod5.z.object({
|
480
|
+
styles: import_zod5.z.object({
|
438
481
|
fontVariant: HtmlFontVariant.optional()
|
439
482
|
}).optional()
|
440
483
|
}).default({})
|
441
484
|
}).describe("A list of bullet points");
|
442
485
|
var Select = BaseField.extend({
|
443
|
-
type:
|
444
|
-
defaultValue:
|
445
|
-
options:
|
486
|
+
type: import_zod5.z.literal(FieldType.SELECT),
|
487
|
+
defaultValue: import_zod5.z.union([TextValue, DependencyExpression]).optional(),
|
488
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
446
489
|
}).describe("Select input");
|
447
490
|
var Checkbox = BaseField.extend({
|
448
|
-
type:
|
449
|
-
defaultValue:
|
491
|
+
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
492
|
+
defaultValue: import_zod5.z.union([CheckboxFieldValue, DependencyExpression]).optional()
|
450
493
|
}).describe("Boolean checkbox field");
|
451
494
|
var Country = BaseField.extend({
|
452
|
-
type:
|
453
|
-
defaultValue:
|
495
|
+
type: import_zod5.z.literal(FieldType.COUNTRY),
|
496
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
454
497
|
}).describe("Country select field");
|
455
|
-
var AdministrativeAreaConfiguration =
|
456
|
-
partOf:
|
457
|
-
$data:
|
498
|
+
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
499
|
+
partOf: import_zod5.z.object({
|
500
|
+
$data: import_zod5.z.string()
|
458
501
|
}).optional().describe("Parent location"),
|
459
|
-
type:
|
502
|
+
type: import_zod5.z.enum(["ADMIN_STRUCTURE", "HEALTH_FACILITY", "CRVS_OFFICE"])
|
460
503
|
}).describe("Administrative area options");
|
461
504
|
var AdministrativeArea = BaseField.extend({
|
462
|
-
type:
|
463
|
-
defaultValue:
|
505
|
+
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
506
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
464
507
|
configuration: AdministrativeAreaConfiguration
|
465
508
|
}).describe("Administrative area input field e.g. facility, office");
|
466
509
|
var Location = BaseField.extend({
|
467
|
-
type:
|
468
|
-
defaultValue:
|
510
|
+
type: import_zod5.z.literal(FieldType.LOCATION),
|
511
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
469
512
|
}).describe("Input field for a location");
|
470
513
|
var FileUploadWithOptions = BaseField.extend({
|
471
|
-
type:
|
472
|
-
options:
|
514
|
+
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
515
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
473
516
|
}).describe("Select input");
|
474
517
|
var Facility = BaseField.extend({
|
475
|
-
type:
|
476
|
-
defaultValue:
|
518
|
+
type: import_zod5.z.literal(FieldType.FACILITY),
|
519
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
477
520
|
}).describe("Input field for a facility");
|
478
521
|
var Office = BaseField.extend({
|
479
|
-
type:
|
480
|
-
defaultValue:
|
522
|
+
type: import_zod5.z.literal(FieldType.OFFICE),
|
523
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
481
524
|
}).describe("Input field for an office");
|
482
525
|
var Address = BaseField.extend({
|
483
|
-
type:
|
526
|
+
type: import_zod5.z.literal(FieldType.ADDRESS),
|
484
527
|
defaultValue: AddressFieldValue.optional()
|
485
528
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
486
|
-
var FieldConfig =
|
529
|
+
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
487
530
|
Address,
|
488
531
|
TextField,
|
489
532
|
NumberField,
|
@@ -508,28 +551,28 @@ var FieldConfig = import_zod4.z.discriminatedUnion("type", [
|
|
508
551
|
]);
|
509
552
|
|
510
553
|
// ../commons/src/events/FormConfig.ts
|
511
|
-
var FormPage =
|
512
|
-
id:
|
554
|
+
var FormPage = import_zod6.z.object({
|
555
|
+
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
513
556
|
title: TranslationConfig.describe("Header title of the page"),
|
514
|
-
fields:
|
557
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
515
558
|
});
|
516
|
-
var FormConfig =
|
559
|
+
var FormConfig = import_zod6.z.object({
|
517
560
|
label: TranslationConfig.describe("Human readable description of the form"),
|
518
|
-
version:
|
519
|
-
id:
|
561
|
+
version: import_zod6.z.object({
|
562
|
+
id: import_zod6.z.string().describe(
|
520
563
|
"Form version. Semantic versioning recommended. Example: 0.0.1"
|
521
564
|
),
|
522
565
|
label: TranslationConfig.describe(
|
523
566
|
"Human readable description of the version"
|
524
567
|
)
|
525
568
|
}),
|
526
|
-
active:
|
527
|
-
pages:
|
528
|
-
review:
|
569
|
+
active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
|
570
|
+
pages: import_zod6.z.array(FormPage),
|
571
|
+
review: import_zod6.z.object({
|
529
572
|
title: TranslationConfig.describe(
|
530
573
|
"Title of the form to show in review page"
|
531
574
|
),
|
532
|
-
fields:
|
575
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
|
533
576
|
})
|
534
577
|
});
|
535
578
|
|
@@ -555,87 +598,87 @@ var ActionType = {
|
|
555
598
|
};
|
556
599
|
|
557
600
|
// ../commons/src/events/ActionConfig.ts
|
558
|
-
var ActionConditional2 =
|
601
|
+
var ActionConditional2 = import_zod7.z.discriminatedUnion("type", [
|
559
602
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
560
603
|
ShowConditional,
|
561
604
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
562
605
|
EnableConditional
|
563
606
|
]);
|
564
|
-
var ActionConfigBase =
|
607
|
+
var ActionConfigBase = import_zod7.z.object({
|
565
608
|
label: TranslationConfig,
|
566
|
-
conditionals:
|
567
|
-
draft:
|
568
|
-
forms:
|
609
|
+
conditionals: import_zod7.z.array(ActionConditional2).optional().default([]),
|
610
|
+
draft: import_zod7.z.boolean().optional(),
|
611
|
+
forms: import_zod7.z.array(FormConfig)
|
569
612
|
});
|
570
613
|
var DeclareConfig = ActionConfigBase.merge(
|
571
|
-
|
572
|
-
type:
|
614
|
+
import_zod7.z.object({
|
615
|
+
type: import_zod7.z.literal(ActionType.DECLARE)
|
573
616
|
})
|
574
617
|
);
|
575
618
|
var ValidateConfig = ActionConfigBase.merge(
|
576
|
-
|
577
|
-
type:
|
619
|
+
import_zod7.z.object({
|
620
|
+
type: import_zod7.z.literal(ActionType.VALIDATE)
|
578
621
|
})
|
579
622
|
);
|
580
623
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
581
|
-
|
582
|
-
type:
|
583
|
-
comment:
|
584
|
-
isDuplicate:
|
624
|
+
import_zod7.z.object({
|
625
|
+
type: import_zod7.z.literal(ActionType.REJECT),
|
626
|
+
comment: import_zod7.z.string(),
|
627
|
+
isDuplicate: import_zod7.z.boolean()
|
585
628
|
})
|
586
629
|
);
|
587
630
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
588
|
-
|
589
|
-
type:
|
590
|
-
comment:
|
591
|
-
duplicates:
|
631
|
+
import_zod7.z.object({
|
632
|
+
type: import_zod7.z.literal(ActionType.MARKED_AS_DUPLICATE),
|
633
|
+
comment: import_zod7.z.string(),
|
634
|
+
duplicates: import_zod7.z.array(import_zod7.z.string()).describe("UUIDs of duplicate records")
|
592
635
|
})
|
593
636
|
);
|
594
637
|
var ArchivedConfig = ActionConfigBase.merge(
|
595
|
-
|
596
|
-
type:
|
597
|
-
comment:
|
598
|
-
isDuplicate:
|
638
|
+
import_zod7.z.object({
|
639
|
+
type: import_zod7.z.literal(ActionType.ARCHIVED),
|
640
|
+
comment: import_zod7.z.string(),
|
641
|
+
isDuplicate: import_zod7.z.boolean()
|
599
642
|
})
|
600
643
|
);
|
601
644
|
var RegisterConfig = ActionConfigBase.merge(
|
602
|
-
|
603
|
-
type:
|
645
|
+
import_zod7.z.object({
|
646
|
+
type: import_zod7.z.literal(ActionType.REGISTER)
|
604
647
|
})
|
605
648
|
);
|
606
649
|
var DeleteConfig = ActionConfigBase.merge(
|
607
|
-
|
608
|
-
type:
|
650
|
+
import_zod7.z.object({
|
651
|
+
type: import_zod7.z.literal(ActionType.DELETE)
|
609
652
|
})
|
610
653
|
);
|
611
654
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
612
|
-
|
613
|
-
type:
|
655
|
+
import_zod7.z.object({
|
656
|
+
type: import_zod7.z.literal(ActionType.PRINT_CERTIFICATE)
|
614
657
|
})
|
615
658
|
);
|
616
659
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
617
|
-
|
618
|
-
type:
|
619
|
-
onboardingForm:
|
620
|
-
additionalDetailsForm:
|
660
|
+
import_zod7.z.object({
|
661
|
+
type: import_zod7.z.literal(ActionType.REQUEST_CORRECTION),
|
662
|
+
onboardingForm: import_zod7.z.array(FormPage),
|
663
|
+
additionalDetailsForm: import_zod7.z.array(FormPage)
|
621
664
|
})
|
622
665
|
);
|
623
666
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
624
|
-
|
625
|
-
type:
|
667
|
+
import_zod7.z.object({
|
668
|
+
type: import_zod7.z.literal(ActionType.REJECT_CORRECTION)
|
626
669
|
})
|
627
670
|
);
|
628
671
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
629
|
-
|
630
|
-
type:
|
672
|
+
import_zod7.z.object({
|
673
|
+
type: import_zod7.z.literal(ActionType.APPROVE_CORRECTION)
|
631
674
|
})
|
632
675
|
);
|
633
676
|
var CustomConfig = ActionConfigBase.merge(
|
634
|
-
|
635
|
-
type:
|
677
|
+
import_zod7.z.object({
|
678
|
+
type: import_zod7.z.literal(ActionType.CUSTOM)
|
636
679
|
})
|
637
680
|
);
|
638
|
-
var ActionConfig =
|
681
|
+
var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
639
682
|
DeclareConfig,
|
640
683
|
ValidateConfig,
|
641
684
|
RejectDeclarationConfig,
|
@@ -651,97 +694,97 @@ var ActionConfig = import_zod6.z.discriminatedUnion("type", [
|
|
651
694
|
]);
|
652
695
|
|
653
696
|
// ../commons/src/events/offline/CertificateConfig.ts
|
654
|
-
var
|
655
|
-
var FontFamily =
|
656
|
-
normal:
|
657
|
-
bold:
|
658
|
-
italics:
|
659
|
-
bolditalics:
|
697
|
+
var import_zod8 = require("zod");
|
698
|
+
var FontFamily = import_zod8.z.object({
|
699
|
+
normal: import_zod8.z.string(),
|
700
|
+
bold: import_zod8.z.string(),
|
701
|
+
italics: import_zod8.z.string(),
|
702
|
+
bolditalics: import_zod8.z.string()
|
660
703
|
});
|
661
|
-
var CertificateConfig =
|
662
|
-
id:
|
663
|
-
event:
|
704
|
+
var CertificateConfig = import_zod8.z.object({
|
705
|
+
id: import_zod8.z.string(),
|
706
|
+
event: import_zod8.z.string(),
|
664
707
|
label: TranslationConfig,
|
665
|
-
isDefault:
|
666
|
-
fee:
|
667
|
-
onTime:
|
668
|
-
late:
|
669
|
-
delayed:
|
708
|
+
isDefault: import_zod8.z.boolean(),
|
709
|
+
fee: import_zod8.z.object({
|
710
|
+
onTime: import_zod8.z.number(),
|
711
|
+
late: import_zod8.z.number(),
|
712
|
+
delayed: import_zod8.z.number()
|
670
713
|
}),
|
671
|
-
svgUrl:
|
672
|
-
fonts:
|
714
|
+
svgUrl: import_zod8.z.string(),
|
715
|
+
fonts: import_zod8.z.record(FontFamily).optional()
|
673
716
|
});
|
674
717
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
675
|
-
hash:
|
676
|
-
svg:
|
718
|
+
hash: import_zod8.z.string().optional(),
|
719
|
+
svg: import_zod8.z.string()
|
677
720
|
});
|
678
721
|
|
679
722
|
// ../commons/src/events/offline/LanguageConfig.ts
|
680
|
-
var
|
681
|
-
var LanguageConfig =
|
682
|
-
lang:
|
723
|
+
var import_zod9 = require("zod");
|
724
|
+
var LanguageConfig = import_zod9.z.object({
|
725
|
+
lang: import_zod9.z.string(),
|
683
726
|
/**
|
684
727
|
* client.csv contents
|
685
728
|
*/
|
686
|
-
messages:
|
729
|
+
messages: import_zod9.z.record(import_zod9.z.string())
|
687
730
|
});
|
688
731
|
|
689
732
|
// ../commons/src/events/EventConfig.ts
|
690
|
-
var
|
733
|
+
var import_zod18 = require("zod");
|
691
734
|
|
692
735
|
// ../commons/src/events/DeduplicationConfig.ts
|
693
|
-
var
|
694
|
-
var FieldReference =
|
695
|
-
var Matcher =
|
696
|
-
fieldId:
|
697
|
-
options:
|
698
|
-
boost:
|
736
|
+
var import_zod10 = require("zod");
|
737
|
+
var FieldReference = import_zod10.z.string();
|
738
|
+
var Matcher = import_zod10.z.object({
|
739
|
+
fieldId: import_zod10.z.string(),
|
740
|
+
options: import_zod10.z.object({
|
741
|
+
boost: import_zod10.z.number().optional()
|
699
742
|
}).optional().default({})
|
700
743
|
});
|
701
744
|
var FuzzyMatcher = Matcher.extend({
|
702
|
-
type:
|
703
|
-
options:
|
745
|
+
type: import_zod10.z.literal("fuzzy"),
|
746
|
+
options: import_zod10.z.object({
|
704
747
|
/**
|
705
748
|
* Names of length 3 or less characters = 0 edits allowed
|
706
749
|
* Names of length 4 - 6 characters = 1 edit allowed
|
707
750
|
* Names of length >7 characters = 2 edits allowed
|
708
751
|
*/
|
709
|
-
fuzziness:
|
710
|
-
boost:
|
752
|
+
fuzziness: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number()]).optional().default("AUTO:4,7"),
|
753
|
+
boost: import_zod10.z.number().optional().default(1)
|
711
754
|
}).optional().default({})
|
712
755
|
});
|
713
756
|
var StrictMatcher = Matcher.extend({
|
714
|
-
type:
|
715
|
-
options:
|
716
|
-
boost:
|
757
|
+
type: import_zod10.z.literal("strict"),
|
758
|
+
options: import_zod10.z.object({
|
759
|
+
boost: import_zod10.z.number().optional().default(1)
|
717
760
|
}).optional().default({})
|
718
761
|
});
|
719
762
|
var DateRangeMatcher = Matcher.extend({
|
720
|
-
type:
|
721
|
-
options:
|
722
|
-
days:
|
763
|
+
type: import_zod10.z.literal("dateRange"),
|
764
|
+
options: import_zod10.z.object({
|
765
|
+
days: import_zod10.z.number(),
|
723
766
|
origin: FieldReference,
|
724
|
-
boost:
|
767
|
+
boost: import_zod10.z.number().optional().default(1)
|
725
768
|
})
|
726
769
|
});
|
727
770
|
var DateDistanceMatcher = Matcher.extend({
|
728
|
-
type:
|
729
|
-
options:
|
730
|
-
days:
|
771
|
+
type: import_zod10.z.literal("dateDistance"),
|
772
|
+
options: import_zod10.z.object({
|
773
|
+
days: import_zod10.z.number(),
|
731
774
|
origin: FieldReference,
|
732
|
-
boost:
|
775
|
+
boost: import_zod10.z.number().optional().default(1)
|
733
776
|
})
|
734
777
|
});
|
735
|
-
var And =
|
736
|
-
type:
|
737
|
-
clauses:
|
778
|
+
var And = import_zod10.z.object({
|
779
|
+
type: import_zod10.z.literal("and"),
|
780
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
738
781
|
});
|
739
|
-
var Or =
|
740
|
-
type:
|
741
|
-
clauses:
|
782
|
+
var Or = import_zod10.z.object({
|
783
|
+
type: import_zod10.z.literal("or"),
|
784
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
742
785
|
});
|
743
|
-
var Clause =
|
744
|
-
() =>
|
786
|
+
var Clause = import_zod10.z.lazy(
|
787
|
+
() => import_zod10.z.discriminatedUnion("type", [
|
745
788
|
And,
|
746
789
|
Or,
|
747
790
|
FuzzyMatcher,
|
@@ -750,37 +793,37 @@ var Clause = import_zod9.z.lazy(
|
|
750
793
|
DateDistanceMatcher
|
751
794
|
])
|
752
795
|
);
|
753
|
-
var DeduplicationConfig =
|
754
|
-
id:
|
796
|
+
var DeduplicationConfig = import_zod10.z.object({
|
797
|
+
id: import_zod10.z.string(),
|
755
798
|
label: TranslationConfig,
|
756
799
|
query: Clause
|
757
800
|
});
|
758
801
|
|
759
802
|
// ../commons/src/events/SummaryConfig.ts
|
760
|
-
var
|
761
|
-
var Field =
|
762
|
-
id:
|
803
|
+
var import_zod11 = require("zod");
|
804
|
+
var Field = import_zod11.z.object({
|
805
|
+
id: import_zod11.z.string().describe("Id of summary field"),
|
763
806
|
value: TranslationConfig.describe(
|
764
807
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
765
808
|
),
|
766
809
|
label: TranslationConfig,
|
767
810
|
emptyValueMessage: TranslationConfig.optional()
|
768
811
|
});
|
769
|
-
var Title =
|
770
|
-
id:
|
812
|
+
var Title = import_zod11.z.object({
|
813
|
+
id: import_zod11.z.string(),
|
771
814
|
label: TranslationConfig.describe("Title content"),
|
772
815
|
emptyValueMessage: TranslationConfig.optional()
|
773
816
|
});
|
774
|
-
var SummaryConfig =
|
817
|
+
var SummaryConfig = import_zod11.z.object({
|
775
818
|
title: Title.describe("Title of summary view."),
|
776
|
-
fields:
|
819
|
+
fields: import_zod11.z.array(Field).describe("Fields rendered in summary view.")
|
777
820
|
}).describe("Configuration for summary in event.");
|
778
821
|
|
779
822
|
// ../commons/src/events/WorkqueueConfig.ts
|
780
|
-
var
|
823
|
+
var import_zod13 = require("zod");
|
781
824
|
|
782
825
|
// ../commons/src/events/EventMetadata.ts
|
783
|
-
var
|
826
|
+
var import_zod12 = require("zod");
|
784
827
|
var EventStatus = {
|
785
828
|
CREATED: "CREATED",
|
786
829
|
NOTIFIED: "NOTIFIED",
|
@@ -792,18 +835,18 @@ var EventStatus = {
|
|
792
835
|
ARCHIVED: "ARCHIVED"
|
793
836
|
};
|
794
837
|
var eventStatuses = Object.values(EventStatus);
|
795
|
-
var EventStatuses =
|
796
|
-
var EventMetadata =
|
797
|
-
id:
|
798
|
-
type:
|
838
|
+
var EventStatuses = import_zod12.z.nativeEnum(EventStatus);
|
839
|
+
var EventMetadata = import_zod12.z.object({
|
840
|
+
id: import_zod12.z.string(),
|
841
|
+
type: import_zod12.z.string(),
|
799
842
|
status: EventStatuses,
|
800
|
-
createdAt:
|
801
|
-
createdBy:
|
802
|
-
createdAtLocation:
|
803
|
-
modifiedAt:
|
804
|
-
assignedTo:
|
805
|
-
updatedBy:
|
806
|
-
trackingId:
|
843
|
+
createdAt: import_zod12.z.string().datetime(),
|
844
|
+
createdBy: import_zod12.z.string(),
|
845
|
+
createdAtLocation: import_zod12.z.string(),
|
846
|
+
modifiedAt: import_zod12.z.string().datetime(),
|
847
|
+
assignedTo: import_zod12.z.string().nullish(),
|
848
|
+
updatedBy: import_zod12.z.string(),
|
849
|
+
trackingId: import_zod12.z.string()
|
807
850
|
});
|
808
851
|
var eventMetadataLabelMap = {
|
809
852
|
"event.assignedTo": {
|
@@ -859,24 +902,24 @@ var eventMetadataLabelMap = {
|
|
859
902
|
};
|
860
903
|
|
861
904
|
// ../commons/src/events/WorkqueueConfig.ts
|
862
|
-
var WorkqueueConfig =
|
863
|
-
id:
|
864
|
-
filters:
|
865
|
-
|
866
|
-
status:
|
905
|
+
var WorkqueueConfig = import_zod13.z.object({
|
906
|
+
id: import_zod13.z.string().describe("Unique identifier for workqueue."),
|
907
|
+
filters: import_zod13.z.array(
|
908
|
+
import_zod13.z.object({
|
909
|
+
status: import_zod13.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
867
910
|
})
|
868
911
|
).describe("Filters to be applied to workqueue.")
|
869
912
|
}).describe("Configuration for workqueue.");
|
870
913
|
|
871
914
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
872
|
-
var
|
873
|
-
var AdvancedSearchConfig =
|
915
|
+
var import_zod14 = require("zod");
|
916
|
+
var AdvancedSearchConfig = import_zod14.z.object({
|
874
917
|
title: TranslationConfig.describe("Advanced search tab title"),
|
875
|
-
fields:
|
876
|
-
|
877
|
-
fieldId:
|
878
|
-
config:
|
879
|
-
type:
|
918
|
+
fields: import_zod14.z.array(
|
919
|
+
import_zod14.z.object({
|
920
|
+
fieldId: import_zod14.z.string(),
|
921
|
+
config: import_zod14.z.object({
|
922
|
+
type: import_zod14.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
880
923
|
}).optional().describe("Configuration options for the field")
|
881
924
|
})
|
882
925
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -886,12 +929,12 @@ var AdvancedSearchConfig = import_zod13.z.object({
|
|
886
929
|
var import_lodash = require("lodash");
|
887
930
|
|
888
931
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
889
|
-
var
|
932
|
+
var import_zod16 = require("zod");
|
890
933
|
|
891
934
|
// ../commons/src/workqueues/defaultColumns.ts
|
892
|
-
var
|
893
|
-
var WorkQueueColumnConfig =
|
894
|
-
id:
|
935
|
+
var import_zod15 = require("zod");
|
936
|
+
var WorkQueueColumnConfig = import_zod15.z.object({
|
937
|
+
id: import_zod15.z.string(),
|
895
938
|
label: TranslationConfig
|
896
939
|
});
|
897
940
|
var defaultColumns = {
|
@@ -928,16 +971,16 @@ var defaultColumns = {
|
|
928
971
|
}
|
929
972
|
}
|
930
973
|
};
|
931
|
-
var DefaultColumnKeys =
|
974
|
+
var DefaultColumnKeys = import_zod15.z.enum(
|
932
975
|
Object.keys(defaultColumns)
|
933
976
|
);
|
934
977
|
|
935
978
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
936
|
-
var rootWorkqueueConfig =
|
937
|
-
id:
|
979
|
+
var rootWorkqueueConfig = import_zod16.z.object({
|
980
|
+
id: import_zod16.z.string(),
|
938
981
|
title: TranslationConfig,
|
939
|
-
columns:
|
940
|
-
defaultColumns:
|
982
|
+
columns: import_zod16.z.array(WorkQueueColumnConfig),
|
983
|
+
defaultColumns: import_zod16.z.array(DefaultColumnKeys)
|
941
984
|
});
|
942
985
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
943
986
|
|
@@ -1017,7 +1060,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1017
1060
|
var import_date_fns = require("date-fns");
|
1018
1061
|
|
1019
1062
|
// ../commons/src/events/FieldTypeMapping.ts
|
1020
|
-
var
|
1063
|
+
var import_zod17 = require("zod");
|
1021
1064
|
function mapFieldTypeToZod(type, required) {
|
1022
1065
|
let schema;
|
1023
1066
|
switch (type) {
|
@@ -1057,17 +1100,17 @@ function mapFieldTypeToZod(type, required) {
|
|
1057
1100
|
schema = FileFieldWithOptionValue;
|
1058
1101
|
break;
|
1059
1102
|
case FieldType.ADDRESS:
|
1060
|
-
schema =
|
1103
|
+
schema = AddressFieldUpdateValue;
|
1061
1104
|
break;
|
1062
1105
|
}
|
1063
|
-
return required ? schema : schema.
|
1106
|
+
return required ? schema : schema.nullish();
|
1064
1107
|
}
|
1065
1108
|
function createValidationSchema(config) {
|
1066
1109
|
const shape = {};
|
1067
1110
|
for (const field2 of config) {
|
1068
1111
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1069
1112
|
}
|
1070
|
-
return
|
1113
|
+
return import_zod17.z.object(shape);
|
1071
1114
|
}
|
1072
1115
|
function mapFieldTypeToMockValue(field2, i) {
|
1073
1116
|
switch (field2.type) {
|
@@ -1431,16 +1474,13 @@ function getEventConfiguration(eventConfigurations, type) {
|
|
1431
1474
|
return config;
|
1432
1475
|
}
|
1433
1476
|
function isOptionalUncheckedCheckbox(field2, form) {
|
1434
|
-
if (field2.type !== FieldType.CHECKBOX) {
|
1435
|
-
return false;
|
1436
|
-
}
|
1437
|
-
if (field2.required) {
|
1477
|
+
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1438
1478
|
return false;
|
1439
1479
|
}
|
1440
1480
|
return !form[field2.id];
|
1441
1481
|
}
|
1442
1482
|
function stripHiddenFields(fields, data) {
|
1443
|
-
return (0, import_lodash.omitBy)(data, (
|
1483
|
+
return (0, import_lodash.omitBy)(data, (_2, fieldId) => {
|
1444
1484
|
const field2 = fields.find((f) => f.id === fieldId);
|
1445
1485
|
if (!field2) {
|
1446
1486
|
return true;
|
@@ -1453,16 +1493,16 @@ function stripHiddenFields(fields, data) {
|
|
1453
1493
|
}
|
1454
1494
|
|
1455
1495
|
// ../commons/src/events/EventConfig.ts
|
1456
|
-
var EventConfig =
|
1457
|
-
id:
|
1496
|
+
var EventConfig = import_zod18.z.object({
|
1497
|
+
id: import_zod18.z.string().describe(
|
1458
1498
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1459
1499
|
),
|
1460
1500
|
summary: SummaryConfig,
|
1461
1501
|
label: TranslationConfig,
|
1462
|
-
actions:
|
1463
|
-
workqueues:
|
1464
|
-
deduplication:
|
1465
|
-
advancedSearch:
|
1502
|
+
actions: import_zod18.z.array(ActionConfig),
|
1503
|
+
workqueues: import_zod18.z.array(WorkqueueConfig),
|
1504
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
1505
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
1466
1506
|
}).superRefine((event2, ctx) => {
|
1467
1507
|
const allFields = findPageFields(event2);
|
1468
1508
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1495,102 +1535,102 @@ var defineForm = (form) => FormConfig.parse(form);
|
|
1495
1535
|
var defineFormPage = (formPage) => FormPage.parse(formPage);
|
1496
1536
|
|
1497
1537
|
// ../commons/src/events/Draft.ts
|
1498
|
-
var
|
1538
|
+
var import_zod21 = require("zod");
|
1499
1539
|
|
1500
1540
|
// ../commons/src/events/ActionDocument.ts
|
1501
|
-
var
|
1502
|
-
var
|
1503
|
-
var ActionBase =
|
1504
|
-
id:
|
1505
|
-
createdAt:
|
1506
|
-
createdBy:
|
1507
|
-
data:
|
1508
|
-
metadata:
|
1509
|
-
createdAtLocation:
|
1541
|
+
var import_zod19 = require("zod");
|
1542
|
+
var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
|
1543
|
+
var ActionBase = import_zod19.z.object({
|
1544
|
+
id: import_zod19.z.string(),
|
1545
|
+
createdAt: import_zod19.z.string().datetime(),
|
1546
|
+
createdBy: import_zod19.z.string(),
|
1547
|
+
data: ActionUpdate,
|
1548
|
+
metadata: ActionUpdate.optional(),
|
1549
|
+
createdAtLocation: import_zod19.z.string()
|
1510
1550
|
});
|
1511
1551
|
var AssignedAction = ActionBase.merge(
|
1512
|
-
|
1513
|
-
type:
|
1514
|
-
assignedTo:
|
1552
|
+
import_zod19.z.object({
|
1553
|
+
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1554
|
+
assignedTo: import_zod19.z.string()
|
1515
1555
|
})
|
1516
1556
|
);
|
1517
1557
|
var UnassignedAction = ActionBase.merge(
|
1518
|
-
|
1519
|
-
type:
|
1558
|
+
import_zod19.z.object({
|
1559
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN)
|
1520
1560
|
})
|
1521
1561
|
);
|
1522
1562
|
var RegisterAction = ActionBase.merge(
|
1523
|
-
|
1524
|
-
type:
|
1525
|
-
identifiers:
|
1526
|
-
trackingId:
|
1527
|
-
registrationNumber:
|
1563
|
+
import_zod19.z.object({
|
1564
|
+
type: import_zod19.z.literal(ActionType.REGISTER),
|
1565
|
+
identifiers: import_zod19.z.object({
|
1566
|
+
trackingId: import_zod19.z.string(),
|
1567
|
+
registrationNumber: import_zod19.z.string()
|
1528
1568
|
})
|
1529
1569
|
})
|
1530
1570
|
);
|
1531
1571
|
var DeclareAction = ActionBase.merge(
|
1532
|
-
|
1533
|
-
type:
|
1572
|
+
import_zod19.z.object({
|
1573
|
+
type: import_zod19.z.literal(ActionType.DECLARE)
|
1534
1574
|
})
|
1535
1575
|
);
|
1536
1576
|
var ValidateAction = ActionBase.merge(
|
1537
|
-
|
1538
|
-
type:
|
1577
|
+
import_zod19.z.object({
|
1578
|
+
type: import_zod19.z.literal(ActionType.VALIDATE)
|
1539
1579
|
})
|
1540
1580
|
);
|
1541
1581
|
var RejectAction = ActionBase.merge(
|
1542
|
-
|
1543
|
-
type:
|
1582
|
+
import_zod19.z.object({
|
1583
|
+
type: import_zod19.z.literal(ActionType.REJECT)
|
1544
1584
|
})
|
1545
1585
|
);
|
1546
1586
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1547
|
-
|
1548
|
-
type:
|
1587
|
+
import_zod19.z.object({
|
1588
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1549
1589
|
})
|
1550
1590
|
);
|
1551
1591
|
var ArchivedAction = ActionBase.merge(
|
1552
|
-
|
1553
|
-
type:
|
1592
|
+
import_zod19.z.object({
|
1593
|
+
type: import_zod19.z.literal(ActionType.ARCHIVED)
|
1554
1594
|
})
|
1555
1595
|
);
|
1556
1596
|
var CreatedAction = ActionBase.merge(
|
1557
|
-
|
1558
|
-
type:
|
1597
|
+
import_zod19.z.object({
|
1598
|
+
type: import_zod19.z.literal(ActionType.CREATE)
|
1559
1599
|
})
|
1560
1600
|
);
|
1561
1601
|
var NotifiedAction = ActionBase.merge(
|
1562
|
-
|
1563
|
-
type:
|
1602
|
+
import_zod19.z.object({
|
1603
|
+
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1564
1604
|
})
|
1565
1605
|
);
|
1566
1606
|
var PrintCertificateAction = ActionBase.merge(
|
1567
|
-
|
1568
|
-
type:
|
1607
|
+
import_zod19.z.object({
|
1608
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
1569
1609
|
})
|
1570
1610
|
);
|
1571
1611
|
var RequestedCorrectionAction = ActionBase.merge(
|
1572
|
-
|
1573
|
-
type:
|
1612
|
+
import_zod19.z.object({
|
1613
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
|
1574
1614
|
})
|
1575
1615
|
);
|
1576
1616
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1577
|
-
|
1578
|
-
type:
|
1579
|
-
requestId:
|
1617
|
+
import_zod19.z.object({
|
1618
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1619
|
+
requestId: import_zod19.z.string()
|
1580
1620
|
})
|
1581
1621
|
);
|
1582
1622
|
var RejectedCorrectionAction = ActionBase.merge(
|
1583
|
-
|
1584
|
-
type:
|
1585
|
-
requestId:
|
1623
|
+
import_zod19.z.object({
|
1624
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1625
|
+
requestId: import_zod19.z.string()
|
1586
1626
|
})
|
1587
1627
|
);
|
1588
1628
|
var CustomAction = ActionBase.merge(
|
1589
|
-
|
1590
|
-
type:
|
1629
|
+
import_zod19.z.object({
|
1630
|
+
type: import_zod19.z.literal(ActionType.CUSTOM)
|
1591
1631
|
})
|
1592
1632
|
);
|
1593
|
-
var ActionDocument =
|
1633
|
+
var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
1594
1634
|
CreatedAction,
|
1595
1635
|
ValidateAction,
|
1596
1636
|
RejectAction,
|
@@ -1607,108 +1647,108 @@ var ActionDocument = import_zod18.z.discriminatedUnion("type", [
|
|
1607
1647
|
PrintCertificateAction,
|
1608
1648
|
CustomAction
|
1609
1649
|
]);
|
1610
|
-
var ResolvedUser =
|
1611
|
-
id:
|
1612
|
-
role:
|
1613
|
-
name:
|
1614
|
-
|
1615
|
-
use:
|
1616
|
-
given:
|
1617
|
-
family:
|
1650
|
+
var ResolvedUser = import_zod19.z.object({
|
1651
|
+
id: import_zod19.z.string(),
|
1652
|
+
role: import_zod19.z.string(),
|
1653
|
+
name: import_zod19.z.array(
|
1654
|
+
import_zod19.z.object({
|
1655
|
+
use: import_zod19.z.string(),
|
1656
|
+
given: import_zod19.z.array(import_zod19.z.string()),
|
1657
|
+
family: import_zod19.z.string()
|
1618
1658
|
})
|
1619
1659
|
)
|
1620
1660
|
});
|
1621
1661
|
|
1622
1662
|
// ../commons/src/events/ActionInput.ts
|
1623
|
-
var
|
1624
|
-
var BaseActionInput =
|
1625
|
-
eventId:
|
1626
|
-
transactionId:
|
1627
|
-
incomplete:
|
1628
|
-
data:
|
1629
|
-
metadata:
|
1663
|
+
var import_zod20 = require("zod");
|
1664
|
+
var BaseActionInput = import_zod20.z.object({
|
1665
|
+
eventId: import_zod20.z.string(),
|
1666
|
+
transactionId: import_zod20.z.string(),
|
1667
|
+
incomplete: import_zod20.z.boolean().optional().default(false).describe("Allows action with partial data to be saved"),
|
1668
|
+
data: ActionUpdate,
|
1669
|
+
metadata: ActionUpdate.optional()
|
1630
1670
|
});
|
1631
1671
|
var CreateActionInput = BaseActionInput.merge(
|
1632
|
-
|
1633
|
-
type:
|
1634
|
-
createdAtLocation:
|
1672
|
+
import_zod20.z.object({
|
1673
|
+
type: import_zod20.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
1674
|
+
createdAtLocation: import_zod20.z.string()
|
1635
1675
|
})
|
1636
1676
|
);
|
1637
1677
|
var RegisterActionInput = BaseActionInput.merge(
|
1638
|
-
|
1639
|
-
type:
|
1640
|
-
identifiers:
|
1641
|
-
trackingId:
|
1642
|
-
registrationNumber:
|
1678
|
+
import_zod20.z.object({
|
1679
|
+
type: import_zod20.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
1680
|
+
identifiers: import_zod20.z.object({
|
1681
|
+
trackingId: import_zod20.z.string(),
|
1682
|
+
registrationNumber: import_zod20.z.string()
|
1643
1683
|
})
|
1644
1684
|
})
|
1645
1685
|
);
|
1646
1686
|
var ValidateActionInput = BaseActionInput.merge(
|
1647
|
-
|
1648
|
-
type:
|
1649
|
-
duplicates:
|
1687
|
+
import_zod20.z.object({
|
1688
|
+
type: import_zod20.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
1689
|
+
duplicates: import_zod20.z.array(import_zod20.z.string())
|
1650
1690
|
})
|
1651
1691
|
);
|
1652
1692
|
var NotifyActionInput = BaseActionInput.merge(
|
1653
|
-
|
1654
|
-
type:
|
1655
|
-
createdAtLocation:
|
1693
|
+
import_zod20.z.object({
|
1694
|
+
type: import_zod20.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
1695
|
+
createdAtLocation: import_zod20.z.string()
|
1656
1696
|
})
|
1657
1697
|
);
|
1658
1698
|
var DeclareActionInput = BaseActionInput.merge(
|
1659
|
-
|
1660
|
-
type:
|
1699
|
+
import_zod20.z.object({
|
1700
|
+
type: import_zod20.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1661
1701
|
})
|
1662
1702
|
);
|
1663
1703
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1664
|
-
|
1665
|
-
type:
|
1704
|
+
import_zod20.z.object({
|
1705
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1666
1706
|
})
|
1667
1707
|
);
|
1668
1708
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1669
|
-
|
1670
|
-
type:
|
1709
|
+
import_zod20.z.object({
|
1710
|
+
type: import_zod20.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1671
1711
|
})
|
1672
1712
|
);
|
1673
1713
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1674
|
-
|
1675
|
-
type:
|
1714
|
+
import_zod20.z.object({
|
1715
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1676
1716
|
})
|
1677
1717
|
);
|
1678
1718
|
var ArchivedActionInput = BaseActionInput.merge(
|
1679
|
-
|
1680
|
-
type:
|
1719
|
+
import_zod20.z.object({
|
1720
|
+
type: import_zod20.z.literal(ActionType.ARCHIVED).default(ActionType.ARCHIVED)
|
1681
1721
|
})
|
1682
1722
|
);
|
1683
1723
|
var AssignActionInput = BaseActionInput.merge(
|
1684
|
-
|
1685
|
-
type:
|
1686
|
-
assignedTo:
|
1724
|
+
import_zod20.z.object({
|
1725
|
+
type: import_zod20.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1726
|
+
assignedTo: import_zod20.z.string()
|
1687
1727
|
})
|
1688
1728
|
);
|
1689
1729
|
var UnassignActionInput = BaseActionInput.merge(
|
1690
|
-
|
1691
|
-
type:
|
1730
|
+
import_zod20.z.object({
|
1731
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
|
1692
1732
|
})
|
1693
1733
|
);
|
1694
1734
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1695
|
-
|
1696
|
-
type:
|
1735
|
+
import_zod20.z.object({
|
1736
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1697
1737
|
})
|
1698
1738
|
);
|
1699
1739
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1700
|
-
|
1701
|
-
requestId:
|
1702
|
-
type:
|
1740
|
+
import_zod20.z.object({
|
1741
|
+
requestId: import_zod20.z.string(),
|
1742
|
+
type: import_zod20.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
1703
1743
|
})
|
1704
1744
|
);
|
1705
1745
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1706
|
-
|
1707
|
-
requestId:
|
1708
|
-
type:
|
1746
|
+
import_zod20.z.object({
|
1747
|
+
requestId: import_zod20.z.string(),
|
1748
|
+
type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
1709
1749
|
})
|
1710
1750
|
);
|
1711
|
-
var ActionInput =
|
1751
|
+
var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
1712
1752
|
CreateActionInput,
|
1713
1753
|
ValidateActionInput,
|
1714
1754
|
RegisterActionInput,
|
@@ -1726,50 +1766,51 @@ var ActionInput = import_zod19.z.discriminatedUnion("type", [
|
|
1726
1766
|
]);
|
1727
1767
|
|
1728
1768
|
// ../commons/src/events/Draft.ts
|
1729
|
-
var Draft =
|
1730
|
-
id:
|
1731
|
-
eventId:
|
1732
|
-
transactionId:
|
1733
|
-
createdAt:
|
1769
|
+
var Draft = import_zod21.z.object({
|
1770
|
+
id: import_zod21.z.string(),
|
1771
|
+
eventId: import_zod21.z.string(),
|
1772
|
+
transactionId: import_zod21.z.string(),
|
1773
|
+
createdAt: import_zod21.z.string().datetime(),
|
1734
1774
|
action: ActionBase.extend({
|
1735
|
-
type:
|
1775
|
+
type: import_zod21.z.enum(Object.values(ActionType))
|
1736
1776
|
}).omit({ id: true })
|
1737
1777
|
});
|
1738
1778
|
var DraftInput = BaseActionInput.extend({
|
1739
|
-
type:
|
1779
|
+
type: import_zod21.z.enum(Object.values(ActionType))
|
1740
1780
|
});
|
1741
1781
|
|
1742
1782
|
// ../commons/src/events/EventInput.ts
|
1743
|
-
var
|
1744
|
-
var EventInput =
|
1745
|
-
transactionId:
|
1746
|
-
type:
|
1783
|
+
var import_zod22 = require("zod");
|
1784
|
+
var EventInput = import_zod22.z.object({
|
1785
|
+
transactionId: import_zod22.z.string(),
|
1786
|
+
type: import_zod22.z.string()
|
1747
1787
|
});
|
1748
1788
|
|
1749
1789
|
// ../commons/src/events/EventDocument.ts
|
1750
|
-
var
|
1751
|
-
var EventDocument =
|
1752
|
-
id:
|
1753
|
-
type:
|
1754
|
-
createdAt:
|
1755
|
-
updatedAt:
|
1756
|
-
actions:
|
1757
|
-
trackingId:
|
1790
|
+
var import_zod23 = require("zod");
|
1791
|
+
var EventDocument = import_zod23.z.object({
|
1792
|
+
id: import_zod23.z.string(),
|
1793
|
+
type: import_zod23.z.string(),
|
1794
|
+
createdAt: import_zod23.z.string().datetime(),
|
1795
|
+
updatedAt: import_zod23.z.string().datetime(),
|
1796
|
+
actions: import_zod23.z.array(ActionDocument),
|
1797
|
+
trackingId: import_zod23.z.string()
|
1758
1798
|
});
|
1759
1799
|
|
1760
1800
|
// ../commons/src/events/EventIndex.ts
|
1761
|
-
var
|
1801
|
+
var import_zod24 = require("zod");
|
1762
1802
|
var EventIndex = EventMetadata.extend({
|
1763
|
-
data:
|
1803
|
+
data: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any())
|
1764
1804
|
});
|
1765
|
-
var EventSearchIndex =
|
1766
|
-
|
1767
|
-
type:
|
1805
|
+
var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
|
1806
|
+
import_zod24.z.object({
|
1807
|
+
type: import_zod24.z.string()
|
1768
1808
|
// Ensures "type" (event-id) exists and is a string
|
1769
1809
|
})
|
1770
1810
|
);
|
1771
1811
|
|
1772
1812
|
// ../commons/src/events/state/index.ts
|
1813
|
+
var _ = __toESM(require("lodash"));
|
1773
1814
|
function getStatusFromActions(actions) {
|
1774
1815
|
return actions.reduce((status, action) => {
|
1775
1816
|
if (action.type === ActionType.CREATE) {
|
@@ -1818,17 +1859,44 @@ function getData(actions) {
|
|
1818
1859
|
if (!requestAction) {
|
1819
1860
|
return status;
|
1820
1861
|
}
|
1862
|
+
return deepMerge(status, requestAction.data);
|
1863
|
+
}
|
1864
|
+
return deepMerge(status, action.data);
|
1865
|
+
}, {});
|
1866
|
+
}
|
1867
|
+
function deepDropNulls(obj) {
|
1868
|
+
if (!_.isObject(obj)) return obj;
|
1869
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
1870
|
+
if (_.isObject(value)) {
|
1871
|
+
value = deepDropNulls(value);
|
1872
|
+
}
|
1873
|
+
if (value !== null) {
|
1821
1874
|
return {
|
1822
|
-
...
|
1823
|
-
|
1875
|
+
...acc,
|
1876
|
+
[key]: value
|
1824
1877
|
};
|
1825
1878
|
}
|
1826
|
-
return
|
1827
|
-
...status,
|
1828
|
-
...action.data
|
1829
|
-
};
|
1879
|
+
return acc;
|
1830
1880
|
}, {});
|
1831
1881
|
}
|
1882
|
+
function deepMerge(currentDocument, actionDocument) {
|
1883
|
+
return _.mergeWith(
|
1884
|
+
currentDocument,
|
1885
|
+
actionDocument,
|
1886
|
+
(previousValue, incomingValue) => {
|
1887
|
+
if (incomingValue === void 0) {
|
1888
|
+
return previousValue;
|
1889
|
+
}
|
1890
|
+
if (_.isArray(incomingValue)) {
|
1891
|
+
return incomingValue;
|
1892
|
+
}
|
1893
|
+
if (_.isObject(previousValue) && _.isObject(incomingValue)) {
|
1894
|
+
return void 0;
|
1895
|
+
}
|
1896
|
+
return incomingValue;
|
1897
|
+
}
|
1898
|
+
);
|
1899
|
+
}
|
1832
1900
|
function isUndeclaredDraft(event2) {
|
1833
1901
|
return event2.actions.every(({ type }) => type === ActionType.CREATE);
|
1834
1902
|
}
|
@@ -1840,7 +1908,7 @@ function getCurrentEventState(event2) {
|
|
1840
1908
|
throw new Error(`Event ${event2.id} has no creation action`);
|
1841
1909
|
}
|
1842
1910
|
const latestAction = event2.actions[event2.actions.length - 1];
|
1843
|
-
return {
|
1911
|
+
return deepDropNulls({
|
1844
1912
|
id: event2.id,
|
1845
1913
|
type: event2.type,
|
1846
1914
|
status: getStatusFromActions(event2.actions),
|
@@ -1852,14 +1920,12 @@ function getCurrentEventState(event2) {
|
|
1852
1920
|
updatedBy: latestAction.createdBy,
|
1853
1921
|
data: getData(event2.actions),
|
1854
1922
|
trackingId: event2.trackingId
|
1855
|
-
};
|
1923
|
+
});
|
1856
1924
|
}
|
1857
1925
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
1858
1926
|
const actions = event2.actions.slice().sort();
|
1859
1927
|
const lastAction = actions[actions.length - 1];
|
1860
|
-
const activeDrafts = drafts.filter(({ eventId }) => eventId === event2.id).filter(
|
1861
|
-
({ createdAt }) => new Date(createdAt) > new Date(lastAction.createdAt)
|
1862
|
-
).map((draft) => draft.action).flatMap((action) => {
|
1928
|
+
const activeDrafts = drafts.filter(({ eventId }) => eventId === event2.id).filter(({ createdAt }) => createdAt > lastAction.createdAt).map((draft) => draft.action).flatMap((action) => {
|
1863
1929
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1864
1930
|
return [
|
1865
1931
|
action,
|
@@ -1892,20 +1958,21 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
1892
1958
|
}
|
1893
1959
|
};
|
1894
1960
|
}
|
1895
|
-
function getMetadataForAction(
|
1961
|
+
function getMetadataForAction({
|
1962
|
+
event: event2,
|
1963
|
+
actionType,
|
1964
|
+
drafts
|
1965
|
+
}) {
|
1896
1966
|
const action = event2.actions.find((action2) => actionType === action2.type);
|
1897
|
-
const
|
1967
|
+
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
1898
1968
|
const sorted = [
|
1899
1969
|
...action ? [action] : [],
|
1900
|
-
...
|
1970
|
+
...eventDrafts.map((draft) => draft.action)
|
1901
1971
|
].sort();
|
1902
1972
|
const metadata = sorted.reduce((metadata2, action2) => {
|
1903
|
-
return {
|
1904
|
-
...metadata2,
|
1905
|
-
...action2.metadata
|
1906
|
-
};
|
1973
|
+
return deepMerge(metadata2, action2.metadata ?? {});
|
1907
1974
|
}, {});
|
1908
|
-
return metadata;
|
1975
|
+
return deepDropNulls(metadata);
|
1909
1976
|
}
|
1910
1977
|
|
1911
1978
|
// ../commons/src/events/defineConfig.ts
|
@@ -2796,7 +2863,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
2796
2863
|
review: {
|
2797
2864
|
title: {
|
2798
2865
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
2799
|
-
defaultMessage: "Member declaration{
|
2866
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
2800
2867
|
description: "Title of the form to show in review page"
|
2801
2868
|
},
|
2802
2869
|
fields: [
|
@@ -3489,7 +3556,8 @@ var eventPayloadGenerator = {
|
|
3489
3556
|
};
|
3490
3557
|
function generateActionDocument({
|
3491
3558
|
configuration,
|
3492
|
-
action
|
3559
|
+
action,
|
3560
|
+
defaults = {}
|
3493
3561
|
}) {
|
3494
3562
|
const actionBase = {
|
3495
3563
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -3497,7 +3565,8 @@ function generateActionDocument({
|
|
3497
3565
|
id: getUUID(),
|
3498
3566
|
createdAtLocation: "TODO",
|
3499
3567
|
data: generateActionInput(configuration, action),
|
3500
|
-
metadata: {}
|
3568
|
+
metadata: {},
|
3569
|
+
...defaults
|
3501
3570
|
};
|
3502
3571
|
switch (action) {
|
3503
3572
|
case ActionType.DECLARE:
|