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