@opencrvs/toolkit 1.8.0-rc.f5b8a8a → 1.8.0-rc.f988087
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 +2866 -2895
- 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 +1670 -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 +19 -4
- package/dist/events/index.js +516 -430
- 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,
|
@@ -107,12 +115,16 @@ __export(events_exports, {
|
|
107
115
|
fieldTypes: () => fieldTypes,
|
108
116
|
findActiveActionFields: () => findActiveActionFields,
|
109
117
|
findActiveActionForm: () => findActiveActionForm,
|
118
|
+
findActiveActionFormFields: () => findActiveActionFormFields,
|
119
|
+
findActiveActionFormPages: () => findActiveActionFormPages,
|
110
120
|
findInputPageFields: () => findInputPageFields,
|
111
121
|
findPageFields: () => findPageFields,
|
122
|
+
generateActionDocument: () => generateActionDocument,
|
112
123
|
generateActionInput: () => generateActionInput,
|
113
124
|
generateEventDocument: () => generateEventDocument,
|
114
125
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
115
126
|
generateTransactionId: () => generateTransactionId,
|
127
|
+
getActiveActionFields: () => getActiveActionFields,
|
116
128
|
getAllFields: () => getAllFields,
|
117
129
|
getAllPages: () => getAllPages,
|
118
130
|
getCurrentEventState: () => getCurrentEventState,
|
@@ -137,7 +149,6 @@ __export(events_exports, {
|
|
137
149
|
isLocationFieldType: () => isLocationFieldType,
|
138
150
|
isNumberFieldType: () => isNumberFieldType,
|
139
151
|
isOfficeFieldType: () => isOfficeFieldType,
|
140
|
-
isOptionalUncheckedCheckbox: () => isOptionalUncheckedCheckbox,
|
141
152
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
142
153
|
isParagraphFieldType: () => isParagraphFieldType,
|
143
154
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
@@ -160,7 +171,7 @@ __export(events_exports, {
|
|
160
171
|
module.exports = __toCommonJS(events_exports);
|
161
172
|
|
162
173
|
// ../commons/src/events/ActionConfig.ts
|
163
|
-
var
|
174
|
+
var import_zod7 = require("zod");
|
164
175
|
|
165
176
|
// ../commons/src/events/Conditional.ts
|
166
177
|
var import_zod = require("zod");
|
@@ -189,10 +200,10 @@ var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
|
189
200
|
]);
|
190
201
|
|
191
202
|
// ../commons/src/events/FormConfig.ts
|
192
|
-
var
|
203
|
+
var import_zod6 = require("zod");
|
193
204
|
|
194
205
|
// ../commons/src/events/FieldConfig.ts
|
195
|
-
var
|
206
|
+
var import_zod5 = require("zod");
|
196
207
|
|
197
208
|
// ../commons/src/events/TranslationConfig.ts
|
198
209
|
var import_zod2 = require("zod");
|
@@ -234,11 +245,14 @@ var FieldType = {
|
|
234
245
|
var fieldTypes = Object.values(FieldType);
|
235
246
|
|
236
247
|
// ../commons/src/events/FieldValue.ts
|
248
|
+
var import_zod4 = require("zod");
|
249
|
+
|
250
|
+
// ../commons/src/events/CompositeFieldValue.ts
|
237
251
|
var import_zod3 = require("zod");
|
238
|
-
var
|
239
|
-
|
240
|
-
|
241
|
-
|
252
|
+
var GeographicalArea = {
|
253
|
+
URBAN: "URBAN",
|
254
|
+
RURAL: "RURAL"
|
255
|
+
};
|
242
256
|
var FileFieldValue = import_zod3.z.object({
|
243
257
|
filename: import_zod3.z.string(),
|
244
258
|
originalFilename: import_zod3.z.string(),
|
@@ -249,21 +263,37 @@ var AdminStructure = import_zod3.z.object({
|
|
249
263
|
province: import_zod3.z.string(),
|
250
264
|
district: import_zod3.z.string()
|
251
265
|
});
|
252
|
-
var
|
253
|
-
urbanOrRural: import_zod3.z.literal(
|
266
|
+
var UrbanAddressValue = AdminStructure.extend({
|
267
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
|
254
268
|
town: import_zod3.z.string().optional(),
|
255
269
|
residentialArea: import_zod3.z.string().optional(),
|
256
270
|
street: import_zod3.z.string().optional(),
|
257
271
|
number: import_zod3.z.string().optional(),
|
258
272
|
zipCode: import_zod3.z.string().optional()
|
259
273
|
});
|
260
|
-
var
|
261
|
-
urbanOrRural: import_zod3.z.literal(
|
274
|
+
var RuralAddressValue = AdminStructure.extend({
|
275
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
262
276
|
village: import_zod3.z.string().optional()
|
263
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
|
+
});
|
264
290
|
var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
265
|
-
|
266
|
-
|
291
|
+
UrbanAddressValue,
|
292
|
+
RuralAddressValue
|
293
|
+
]);
|
294
|
+
var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
295
|
+
UrbanAddressUpdateValue,
|
296
|
+
RuralAddressUpdateValue
|
267
297
|
]);
|
268
298
|
var FileFieldValueWithOption = import_zod3.z.object({
|
269
299
|
filename: import_zod3.z.string(),
|
@@ -272,30 +302,46 @@ var FileFieldValueWithOption = import_zod3.z.object({
|
|
272
302
|
option: import_zod3.z.string()
|
273
303
|
});
|
274
304
|
var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
|
275
|
-
|
276
|
-
|
277
|
-
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([
|
278
314
|
TextValue,
|
279
315
|
DateValue,
|
316
|
+
CheckboxFieldValue,
|
317
|
+
NumberFieldValue,
|
280
318
|
FileFieldValue,
|
281
319
|
FileFieldWithOptionValue,
|
320
|
+
UrbanAddressValue,
|
321
|
+
RuralAddressValue
|
322
|
+
]);
|
323
|
+
var FieldUpdateValue = import_zod4.z.union([
|
324
|
+
TextValue,
|
325
|
+
DateValue,
|
282
326
|
CheckboxFieldValue,
|
283
327
|
NumberFieldValue,
|
284
|
-
|
285
|
-
|
328
|
+
FileFieldValue,
|
329
|
+
FileFieldWithOptionValue,
|
330
|
+
UrbanAddressUpdateValue,
|
331
|
+
RuralAddressUpdateValue
|
286
332
|
]);
|
287
333
|
|
288
334
|
// ../commons/src/events/FieldConfig.ts
|
289
|
-
var FieldId =
|
290
|
-
var DependencyExpression =
|
291
|
-
dependsOn:
|
292
|
-
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()
|
293
339
|
});
|
294
|
-
var BaseField =
|
340
|
+
var BaseField = import_zod5.z.object({
|
295
341
|
id: FieldId,
|
296
|
-
defaultValue:
|
342
|
+
defaultValue: import_zod5.z.union([
|
297
343
|
// These are the currently supported default values types
|
298
|
-
|
344
|
+
import_zod5.z.union([
|
299
345
|
TextValue,
|
300
346
|
RequiredTextValue,
|
301
347
|
DateValue,
|
@@ -304,82 +350,82 @@ var BaseField = import_zod4.z.object({
|
|
304
350
|
]),
|
305
351
|
DependencyExpression
|
306
352
|
]).optional(),
|
307
|
-
conditionals:
|
308
|
-
required:
|
309
|
-
disabled:
|
310
|
-
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(),
|
311
357
|
placeholder: TranslationConfig.optional(),
|
312
|
-
validation:
|
313
|
-
|
358
|
+
validation: import_zod5.z.array(
|
359
|
+
import_zod5.z.object({
|
314
360
|
validator: Conditional(),
|
315
361
|
message: TranslationConfig
|
316
362
|
})
|
317
363
|
).default([]).optional(),
|
318
|
-
dependsOn:
|
364
|
+
dependsOn: import_zod5.z.array(FieldId).default([]).optional(),
|
319
365
|
label: TranslationConfig,
|
320
|
-
hideLabel:
|
366
|
+
hideLabel: import_zod5.z.boolean().default(false).optional()
|
321
367
|
});
|
322
368
|
var Divider = BaseField.extend({
|
323
|
-
type:
|
369
|
+
type: import_zod5.z.literal(FieldType.DIVIDER)
|
324
370
|
});
|
325
371
|
var TextField = BaseField.extend({
|
326
|
-
type:
|
327
|
-
defaultValue:
|
328
|
-
configuration:
|
329
|
-
maxLength:
|
330
|
-
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(),
|
331
377
|
prefix: TranslationConfig.optional(),
|
332
378
|
postfix: TranslationConfig.optional()
|
333
379
|
}).default({ type: "text" }).optional()
|
334
380
|
}).describe("Text input");
|
335
381
|
var NumberField = BaseField.extend({
|
336
|
-
type:
|
337
|
-
defaultValue:
|
338
|
-
configuration:
|
339
|
-
min:
|
340
|
-
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"),
|
341
387
|
prefix: TranslationConfig.optional(),
|
342
388
|
postfix: TranslationConfig.optional()
|
343
389
|
}).optional()
|
344
390
|
}).describe("Number input");
|
345
391
|
var TextAreaField = BaseField.extend({
|
346
|
-
type:
|
347
|
-
defaultValue:
|
348
|
-
configuration:
|
349
|
-
maxLength:
|
350
|
-
rows:
|
351
|
-
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"),
|
352
398
|
prefix: TranslationConfig.optional(),
|
353
399
|
postfix: TranslationConfig.optional()
|
354
400
|
}).default({ rows: 4 }).optional()
|
355
401
|
}).describe("Multiline text input");
|
356
402
|
var SignatureField = BaseField.extend({
|
357
|
-
type:
|
403
|
+
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
358
404
|
signaturePromptLabel: TranslationConfig.describe(
|
359
405
|
"Title of the signature modal"
|
360
406
|
),
|
361
|
-
configuration:
|
362
|
-
maxSizeMb:
|
363
|
-
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")
|
364
410
|
}).default({}).optional()
|
365
411
|
}).describe("Signature input field");
|
366
412
|
var EmailField = BaseField.extend({
|
367
|
-
type:
|
368
|
-
configuration:
|
369
|
-
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")
|
370
416
|
}).default({ maxLength: 10 }).optional(),
|
371
|
-
defaultValue:
|
417
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
372
418
|
});
|
373
419
|
var DateField = BaseField.extend({
|
374
|
-
type:
|
375
|
-
defaultValue:
|
376
|
-
configuration:
|
420
|
+
type: import_zod5.z.literal(FieldType.DATE),
|
421
|
+
defaultValue: import_zod5.z.union([DateValue, DependencyExpression]).optional(),
|
422
|
+
configuration: import_zod5.z.object({
|
377
423
|
notice: TranslationConfig.describe(
|
378
424
|
"Text to display above the date input"
|
379
425
|
).optional()
|
380
426
|
}).optional()
|
381
427
|
}).describe("A single date input (dd-mm-YYYY)");
|
382
|
-
var HtmlFontVariant =
|
428
|
+
var HtmlFontVariant = import_zod5.z.enum([
|
383
429
|
"reg12",
|
384
430
|
"reg14",
|
385
431
|
"reg16",
|
@@ -390,97 +436,97 @@ var HtmlFontVariant = import_zod4.z.enum([
|
|
390
436
|
"h1"
|
391
437
|
]);
|
392
438
|
var Paragraph = BaseField.extend({
|
393
|
-
type:
|
394
|
-
defaultValue:
|
395
|
-
configuration:
|
396
|
-
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({
|
397
443
|
fontVariant: HtmlFontVariant.optional()
|
398
444
|
}).optional()
|
399
445
|
}).default({})
|
400
446
|
}).describe("A read-only HTML <p> paragraph");
|
401
447
|
var PageHeader = BaseField.extend({
|
402
|
-
type:
|
403
|
-
defaultValue:
|
448
|
+
type: import_zod5.z.literal(FieldType.PAGE_HEADER),
|
449
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
404
450
|
}).describe("A read-only header component for form pages");
|
405
451
|
var File = BaseField.extend({
|
406
|
-
type:
|
407
|
-
options:
|
408
|
-
style:
|
409
|
-
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(
|
410
456
|
"Whether the file upload button should take the full width of the container or not"
|
411
457
|
)
|
412
458
|
})
|
413
459
|
}).optional()
|
414
460
|
}).describe("File upload");
|
415
|
-
var SelectOption =
|
416
|
-
value:
|
461
|
+
var SelectOption = import_zod5.z.object({
|
462
|
+
value: import_zod5.z.string().describe("The value of the option"),
|
417
463
|
label: TranslationConfig.describe("The label of the option")
|
418
464
|
});
|
419
465
|
var RadioGroup = BaseField.extend({
|
420
|
-
type:
|
421
|
-
defaultValue:
|
422
|
-
options:
|
423
|
-
configuration:
|
424
|
-
styles:
|
425
|
-
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()
|
426
472
|
}).optional()
|
427
473
|
}).optional()
|
428
474
|
}).describe("Grouped radio options");
|
429
475
|
var BulletList = BaseField.extend({
|
430
|
-
type:
|
431
|
-
defaultValue:
|
432
|
-
items:
|
433
|
-
configuration:
|
434
|
-
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({
|
435
481
|
fontVariant: HtmlFontVariant.optional()
|
436
482
|
}).optional()
|
437
483
|
}).default({})
|
438
484
|
}).describe("A list of bullet points");
|
439
485
|
var Select = BaseField.extend({
|
440
|
-
type:
|
441
|
-
defaultValue:
|
442
|
-
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")
|
443
489
|
}).describe("Select input");
|
444
490
|
var Checkbox = BaseField.extend({
|
445
|
-
type:
|
446
|
-
defaultValue:
|
491
|
+
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
492
|
+
defaultValue: import_zod5.z.union([CheckboxFieldValue, DependencyExpression]).optional()
|
447
493
|
}).describe("Boolean checkbox field");
|
448
494
|
var Country = BaseField.extend({
|
449
|
-
type:
|
450
|
-
defaultValue:
|
495
|
+
type: import_zod5.z.literal(FieldType.COUNTRY),
|
496
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
451
497
|
}).describe("Country select field");
|
452
|
-
var AdministrativeAreaConfiguration =
|
453
|
-
partOf:
|
454
|
-
$data:
|
498
|
+
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
499
|
+
partOf: import_zod5.z.object({
|
500
|
+
$data: import_zod5.z.string()
|
455
501
|
}).optional().describe("Parent location"),
|
456
|
-
type:
|
502
|
+
type: import_zod5.z.enum(["ADMIN_STRUCTURE", "HEALTH_FACILITY", "CRVS_OFFICE"])
|
457
503
|
}).describe("Administrative area options");
|
458
504
|
var AdministrativeArea = BaseField.extend({
|
459
|
-
type:
|
460
|
-
defaultValue:
|
505
|
+
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
506
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
461
507
|
configuration: AdministrativeAreaConfiguration
|
462
508
|
}).describe("Administrative area input field e.g. facility, office");
|
463
509
|
var Location = BaseField.extend({
|
464
|
-
type:
|
465
|
-
defaultValue:
|
510
|
+
type: import_zod5.z.literal(FieldType.LOCATION),
|
511
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
466
512
|
}).describe("Input field for a location");
|
467
513
|
var FileUploadWithOptions = BaseField.extend({
|
468
|
-
type:
|
469
|
-
options:
|
514
|
+
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
515
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
470
516
|
}).describe("Select input");
|
471
517
|
var Facility = BaseField.extend({
|
472
|
-
type:
|
473
|
-
defaultValue:
|
518
|
+
type: import_zod5.z.literal(FieldType.FACILITY),
|
519
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
474
520
|
}).describe("Input field for a facility");
|
475
521
|
var Office = BaseField.extend({
|
476
|
-
type:
|
477
|
-
defaultValue:
|
522
|
+
type: import_zod5.z.literal(FieldType.OFFICE),
|
523
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
478
524
|
}).describe("Input field for an office");
|
479
525
|
var Address = BaseField.extend({
|
480
|
-
type:
|
526
|
+
type: import_zod5.z.literal(FieldType.ADDRESS),
|
481
527
|
defaultValue: AddressFieldValue.optional()
|
482
528
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
483
|
-
var FieldConfig =
|
529
|
+
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
484
530
|
Address,
|
485
531
|
TextField,
|
486
532
|
NumberField,
|
@@ -505,28 +551,28 @@ var FieldConfig = import_zod4.z.discriminatedUnion("type", [
|
|
505
551
|
]);
|
506
552
|
|
507
553
|
// ../commons/src/events/FormConfig.ts
|
508
|
-
var FormPage =
|
509
|
-
id:
|
554
|
+
var FormPage = import_zod6.z.object({
|
555
|
+
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
510
556
|
title: TranslationConfig.describe("Header title of the page"),
|
511
|
-
fields:
|
557
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
512
558
|
});
|
513
|
-
var FormConfig =
|
559
|
+
var FormConfig = import_zod6.z.object({
|
514
560
|
label: TranslationConfig.describe("Human readable description of the form"),
|
515
|
-
version:
|
516
|
-
id:
|
561
|
+
version: import_zod6.z.object({
|
562
|
+
id: import_zod6.z.string().describe(
|
517
563
|
"Form version. Semantic versioning recommended. Example: 0.0.1"
|
518
564
|
),
|
519
565
|
label: TranslationConfig.describe(
|
520
566
|
"Human readable description of the version"
|
521
567
|
)
|
522
568
|
}),
|
523
|
-
active:
|
524
|
-
pages:
|
525
|
-
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({
|
526
572
|
title: TranslationConfig.describe(
|
527
573
|
"Title of the form to show in review page"
|
528
574
|
),
|
529
|
-
fields:
|
575
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
|
530
576
|
})
|
531
577
|
});
|
532
578
|
|
@@ -552,87 +598,87 @@ var ActionType = {
|
|
552
598
|
};
|
553
599
|
|
554
600
|
// ../commons/src/events/ActionConfig.ts
|
555
|
-
var ActionConditional2 =
|
601
|
+
var ActionConditional2 = import_zod7.z.discriminatedUnion("type", [
|
556
602
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
557
603
|
ShowConditional,
|
558
604
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
559
605
|
EnableConditional
|
560
606
|
]);
|
561
|
-
var ActionConfigBase =
|
607
|
+
var ActionConfigBase = import_zod7.z.object({
|
562
608
|
label: TranslationConfig,
|
563
|
-
conditionals:
|
564
|
-
draft:
|
565
|
-
forms:
|
609
|
+
conditionals: import_zod7.z.array(ActionConditional2).optional().default([]),
|
610
|
+
draft: import_zod7.z.boolean().optional(),
|
611
|
+
forms: import_zod7.z.array(FormConfig)
|
566
612
|
});
|
567
613
|
var DeclareConfig = ActionConfigBase.merge(
|
568
|
-
|
569
|
-
type:
|
614
|
+
import_zod7.z.object({
|
615
|
+
type: import_zod7.z.literal(ActionType.DECLARE)
|
570
616
|
})
|
571
617
|
);
|
572
618
|
var ValidateConfig = ActionConfigBase.merge(
|
573
|
-
|
574
|
-
type:
|
619
|
+
import_zod7.z.object({
|
620
|
+
type: import_zod7.z.literal(ActionType.VALIDATE)
|
575
621
|
})
|
576
622
|
);
|
577
623
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
578
|
-
|
579
|
-
type:
|
580
|
-
comment:
|
581
|
-
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()
|
582
628
|
})
|
583
629
|
);
|
584
630
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
585
|
-
|
586
|
-
type:
|
587
|
-
comment:
|
588
|
-
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")
|
589
635
|
})
|
590
636
|
);
|
591
637
|
var ArchivedConfig = ActionConfigBase.merge(
|
592
|
-
|
593
|
-
type:
|
594
|
-
comment:
|
595
|
-
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()
|
596
642
|
})
|
597
643
|
);
|
598
644
|
var RegisterConfig = ActionConfigBase.merge(
|
599
|
-
|
600
|
-
type:
|
645
|
+
import_zod7.z.object({
|
646
|
+
type: import_zod7.z.literal(ActionType.REGISTER)
|
601
647
|
})
|
602
648
|
);
|
603
649
|
var DeleteConfig = ActionConfigBase.merge(
|
604
|
-
|
605
|
-
type:
|
650
|
+
import_zod7.z.object({
|
651
|
+
type: import_zod7.z.literal(ActionType.DELETE)
|
606
652
|
})
|
607
653
|
);
|
608
654
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
609
|
-
|
610
|
-
type:
|
655
|
+
import_zod7.z.object({
|
656
|
+
type: import_zod7.z.literal(ActionType.PRINT_CERTIFICATE)
|
611
657
|
})
|
612
658
|
);
|
613
659
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
614
|
-
|
615
|
-
type:
|
616
|
-
onboardingForm:
|
617
|
-
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)
|
618
664
|
})
|
619
665
|
);
|
620
666
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
621
|
-
|
622
|
-
type:
|
667
|
+
import_zod7.z.object({
|
668
|
+
type: import_zod7.z.literal(ActionType.REJECT_CORRECTION)
|
623
669
|
})
|
624
670
|
);
|
625
671
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
626
|
-
|
627
|
-
type:
|
672
|
+
import_zod7.z.object({
|
673
|
+
type: import_zod7.z.literal(ActionType.APPROVE_CORRECTION)
|
628
674
|
})
|
629
675
|
);
|
630
676
|
var CustomConfig = ActionConfigBase.merge(
|
631
|
-
|
632
|
-
type:
|
677
|
+
import_zod7.z.object({
|
678
|
+
type: import_zod7.z.literal(ActionType.CUSTOM)
|
633
679
|
})
|
634
680
|
);
|
635
|
-
var ActionConfig =
|
681
|
+
var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
636
682
|
DeclareConfig,
|
637
683
|
ValidateConfig,
|
638
684
|
RejectDeclarationConfig,
|
@@ -648,97 +694,97 @@ var ActionConfig = import_zod6.z.discriminatedUnion("type", [
|
|
648
694
|
]);
|
649
695
|
|
650
696
|
// ../commons/src/events/offline/CertificateConfig.ts
|
651
|
-
var
|
652
|
-
var FontFamily =
|
653
|
-
normal:
|
654
|
-
bold:
|
655
|
-
italics:
|
656
|
-
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()
|
657
703
|
});
|
658
|
-
var CertificateConfig =
|
659
|
-
id:
|
660
|
-
event:
|
704
|
+
var CertificateConfig = import_zod8.z.object({
|
705
|
+
id: import_zod8.z.string(),
|
706
|
+
event: import_zod8.z.string(),
|
661
707
|
label: TranslationConfig,
|
662
|
-
isDefault:
|
663
|
-
fee:
|
664
|
-
onTime:
|
665
|
-
late:
|
666
|
-
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()
|
667
713
|
}),
|
668
|
-
svgUrl:
|
669
|
-
fonts:
|
714
|
+
svgUrl: import_zod8.z.string(),
|
715
|
+
fonts: import_zod8.z.record(FontFamily).optional()
|
670
716
|
});
|
671
717
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
672
|
-
hash:
|
673
|
-
svg:
|
718
|
+
hash: import_zod8.z.string().optional(),
|
719
|
+
svg: import_zod8.z.string()
|
674
720
|
});
|
675
721
|
|
676
722
|
// ../commons/src/events/offline/LanguageConfig.ts
|
677
|
-
var
|
678
|
-
var LanguageConfig =
|
679
|
-
lang:
|
723
|
+
var import_zod9 = require("zod");
|
724
|
+
var LanguageConfig = import_zod9.z.object({
|
725
|
+
lang: import_zod9.z.string(),
|
680
726
|
/**
|
681
727
|
* client.csv contents
|
682
728
|
*/
|
683
|
-
messages:
|
729
|
+
messages: import_zod9.z.record(import_zod9.z.string())
|
684
730
|
});
|
685
731
|
|
686
732
|
// ../commons/src/events/EventConfig.ts
|
687
|
-
var
|
733
|
+
var import_zod18 = require("zod");
|
688
734
|
|
689
735
|
// ../commons/src/events/DeduplicationConfig.ts
|
690
|
-
var
|
691
|
-
var FieldReference =
|
692
|
-
var Matcher =
|
693
|
-
fieldId:
|
694
|
-
options:
|
695
|
-
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()
|
696
742
|
}).optional().default({})
|
697
743
|
});
|
698
744
|
var FuzzyMatcher = Matcher.extend({
|
699
|
-
type:
|
700
|
-
options:
|
745
|
+
type: import_zod10.z.literal("fuzzy"),
|
746
|
+
options: import_zod10.z.object({
|
701
747
|
/**
|
702
748
|
* Names of length 3 or less characters = 0 edits allowed
|
703
749
|
* Names of length 4 - 6 characters = 1 edit allowed
|
704
750
|
* Names of length >7 characters = 2 edits allowed
|
705
751
|
*/
|
706
|
-
fuzziness:
|
707
|
-
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)
|
708
754
|
}).optional().default({})
|
709
755
|
});
|
710
756
|
var StrictMatcher = Matcher.extend({
|
711
|
-
type:
|
712
|
-
options:
|
713
|
-
boost:
|
757
|
+
type: import_zod10.z.literal("strict"),
|
758
|
+
options: import_zod10.z.object({
|
759
|
+
boost: import_zod10.z.number().optional().default(1)
|
714
760
|
}).optional().default({})
|
715
761
|
});
|
716
762
|
var DateRangeMatcher = Matcher.extend({
|
717
|
-
type:
|
718
|
-
options:
|
719
|
-
days:
|
763
|
+
type: import_zod10.z.literal("dateRange"),
|
764
|
+
options: import_zod10.z.object({
|
765
|
+
days: import_zod10.z.number(),
|
720
766
|
origin: FieldReference,
|
721
|
-
boost:
|
767
|
+
boost: import_zod10.z.number().optional().default(1)
|
722
768
|
})
|
723
769
|
});
|
724
770
|
var DateDistanceMatcher = Matcher.extend({
|
725
|
-
type:
|
726
|
-
options:
|
727
|
-
days:
|
771
|
+
type: import_zod10.z.literal("dateDistance"),
|
772
|
+
options: import_zod10.z.object({
|
773
|
+
days: import_zod10.z.number(),
|
728
774
|
origin: FieldReference,
|
729
|
-
boost:
|
775
|
+
boost: import_zod10.z.number().optional().default(1)
|
730
776
|
})
|
731
777
|
});
|
732
|
-
var And =
|
733
|
-
type:
|
734
|
-
clauses:
|
778
|
+
var And = import_zod10.z.object({
|
779
|
+
type: import_zod10.z.literal("and"),
|
780
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
735
781
|
});
|
736
|
-
var Or =
|
737
|
-
type:
|
738
|
-
clauses:
|
782
|
+
var Or = import_zod10.z.object({
|
783
|
+
type: import_zod10.z.literal("or"),
|
784
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
739
785
|
});
|
740
|
-
var Clause =
|
741
|
-
() =>
|
786
|
+
var Clause = import_zod10.z.lazy(
|
787
|
+
() => import_zod10.z.discriminatedUnion("type", [
|
742
788
|
And,
|
743
789
|
Or,
|
744
790
|
FuzzyMatcher,
|
@@ -747,37 +793,37 @@ var Clause = import_zod9.z.lazy(
|
|
747
793
|
DateDistanceMatcher
|
748
794
|
])
|
749
795
|
);
|
750
|
-
var DeduplicationConfig =
|
751
|
-
id:
|
796
|
+
var DeduplicationConfig = import_zod10.z.object({
|
797
|
+
id: import_zod10.z.string(),
|
752
798
|
label: TranslationConfig,
|
753
799
|
query: Clause
|
754
800
|
});
|
755
801
|
|
756
802
|
// ../commons/src/events/SummaryConfig.ts
|
757
|
-
var
|
758
|
-
var Field =
|
759
|
-
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"),
|
760
806
|
value: TranslationConfig.describe(
|
761
807
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
762
808
|
),
|
763
809
|
label: TranslationConfig,
|
764
810
|
emptyValueMessage: TranslationConfig.optional()
|
765
811
|
});
|
766
|
-
var Title =
|
767
|
-
id:
|
812
|
+
var Title = import_zod11.z.object({
|
813
|
+
id: import_zod11.z.string(),
|
768
814
|
label: TranslationConfig.describe("Title content"),
|
769
815
|
emptyValueMessage: TranslationConfig.optional()
|
770
816
|
});
|
771
|
-
var SummaryConfig =
|
817
|
+
var SummaryConfig = import_zod11.z.object({
|
772
818
|
title: Title.describe("Title of summary view."),
|
773
|
-
fields:
|
819
|
+
fields: import_zod11.z.array(Field).describe("Fields rendered in summary view.")
|
774
820
|
}).describe("Configuration for summary in event.");
|
775
821
|
|
776
822
|
// ../commons/src/events/WorkqueueConfig.ts
|
777
|
-
var
|
823
|
+
var import_zod13 = require("zod");
|
778
824
|
|
779
825
|
// ../commons/src/events/EventMetadata.ts
|
780
|
-
var
|
826
|
+
var import_zod12 = require("zod");
|
781
827
|
var EventStatus = {
|
782
828
|
CREATED: "CREATED",
|
783
829
|
NOTIFIED: "NOTIFIED",
|
@@ -789,18 +835,18 @@ var EventStatus = {
|
|
789
835
|
ARCHIVED: "ARCHIVED"
|
790
836
|
};
|
791
837
|
var eventStatuses = Object.values(EventStatus);
|
792
|
-
var EventStatuses =
|
793
|
-
var EventMetadata =
|
794
|
-
id:
|
795
|
-
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(),
|
796
842
|
status: EventStatuses,
|
797
|
-
createdAt:
|
798
|
-
createdBy:
|
799
|
-
createdAtLocation:
|
800
|
-
modifiedAt:
|
801
|
-
assignedTo:
|
802
|
-
updatedBy:
|
803
|
-
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()
|
804
850
|
});
|
805
851
|
var eventMetadataLabelMap = {
|
806
852
|
"event.assignedTo": {
|
@@ -856,24 +902,24 @@ var eventMetadataLabelMap = {
|
|
856
902
|
};
|
857
903
|
|
858
904
|
// ../commons/src/events/WorkqueueConfig.ts
|
859
|
-
var WorkqueueConfig =
|
860
|
-
id:
|
861
|
-
filters:
|
862
|
-
|
863
|
-
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.")
|
864
910
|
})
|
865
911
|
).describe("Filters to be applied to workqueue.")
|
866
912
|
}).describe("Configuration for workqueue.");
|
867
913
|
|
868
914
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
869
|
-
var
|
870
|
-
var AdvancedSearchConfig =
|
915
|
+
var import_zod14 = require("zod");
|
916
|
+
var AdvancedSearchConfig = import_zod14.z.object({
|
871
917
|
title: TranslationConfig.describe("Advanced search tab title"),
|
872
|
-
fields:
|
873
|
-
|
874
|
-
fieldId:
|
875
|
-
config:
|
876
|
-
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")
|
877
923
|
}).optional().describe("Configuration options for the field")
|
878
924
|
})
|
879
925
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -883,12 +929,12 @@ var AdvancedSearchConfig = import_zod13.z.object({
|
|
883
929
|
var import_lodash = require("lodash");
|
884
930
|
|
885
931
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
886
|
-
var
|
932
|
+
var import_zod16 = require("zod");
|
887
933
|
|
888
934
|
// ../commons/src/workqueues/defaultColumns.ts
|
889
|
-
var
|
890
|
-
var WorkQueueColumnConfig =
|
891
|
-
id:
|
935
|
+
var import_zod15 = require("zod");
|
936
|
+
var WorkQueueColumnConfig = import_zod15.z.object({
|
937
|
+
id: import_zod15.z.string(),
|
892
938
|
label: TranslationConfig
|
893
939
|
});
|
894
940
|
var defaultColumns = {
|
@@ -925,16 +971,16 @@ var defaultColumns = {
|
|
925
971
|
}
|
926
972
|
}
|
927
973
|
};
|
928
|
-
var DefaultColumnKeys =
|
974
|
+
var DefaultColumnKeys = import_zod15.z.enum(
|
929
975
|
Object.keys(defaultColumns)
|
930
976
|
);
|
931
977
|
|
932
978
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
933
|
-
var rootWorkqueueConfig =
|
934
|
-
id:
|
979
|
+
var rootWorkqueueConfig = import_zod16.z.object({
|
980
|
+
id: import_zod16.z.string(),
|
935
981
|
title: TranslationConfig,
|
936
|
-
columns:
|
937
|
-
defaultColumns:
|
982
|
+
columns: import_zod16.z.array(WorkQueueColumnConfig),
|
983
|
+
defaultColumns: import_zod16.z.array(DefaultColumnKeys)
|
938
984
|
});
|
939
985
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
940
986
|
|
@@ -1014,7 +1060,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1014
1060
|
var import_date_fns = require("date-fns");
|
1015
1061
|
|
1016
1062
|
// ../commons/src/events/FieldTypeMapping.ts
|
1017
|
-
var
|
1063
|
+
var import_zod17 = require("zod");
|
1018
1064
|
function mapFieldTypeToZod(type, required) {
|
1019
1065
|
let schema;
|
1020
1066
|
switch (type) {
|
@@ -1054,17 +1100,17 @@ function mapFieldTypeToZod(type, required) {
|
|
1054
1100
|
schema = FileFieldWithOptionValue;
|
1055
1101
|
break;
|
1056
1102
|
case FieldType.ADDRESS:
|
1057
|
-
schema =
|
1103
|
+
schema = AddressFieldUpdateValue;
|
1058
1104
|
break;
|
1059
1105
|
}
|
1060
|
-
return required ? schema : schema.
|
1106
|
+
return required ? schema : schema.nullish();
|
1061
1107
|
}
|
1062
1108
|
function createValidationSchema(config) {
|
1063
1109
|
const shape = {};
|
1064
1110
|
for (const field2 of config) {
|
1065
1111
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1066
1112
|
}
|
1067
|
-
return
|
1113
|
+
return import_zod17.z.object(shape);
|
1068
1114
|
}
|
1069
1115
|
function mapFieldTypeToMockValue(field2, i) {
|
1070
1116
|
switch (field2.type) {
|
@@ -1396,14 +1442,30 @@ var findActiveActionForm = (configuration, action) => {
|
|
1396
1442
|
const form = actionConfig?.forms.find((f) => f.active);
|
1397
1443
|
return form;
|
1398
1444
|
};
|
1445
|
+
var findActiveActionFormPages = (configuration, action) => {
|
1446
|
+
return findActiveActionForm(configuration, action)?.pages;
|
1447
|
+
};
|
1399
1448
|
var getFormFields = (formConfig) => {
|
1400
1449
|
return formConfig.pages.flatMap((p) => p.fields);
|
1401
1450
|
};
|
1451
|
+
var findActiveActionFormFields = (configuration, action) => {
|
1452
|
+
const form = findActiveActionForm(configuration, action);
|
1453
|
+
return form ? getFormFields(form) : void 0;
|
1454
|
+
};
|
1402
1455
|
var findActiveActionFields = (configuration, action) => {
|
1403
1456
|
const form = findActiveActionForm(configuration, action);
|
1404
|
-
const reviewFields = form?.review.fields
|
1405
|
-
|
1457
|
+
const reviewFields = form?.review.fields;
|
1458
|
+
const formFields = form ? getFormFields(form) : void 0;
|
1459
|
+
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1460
|
+
return allFields;
|
1406
1461
|
};
|
1462
|
+
function getActiveActionFields(configuration, action) {
|
1463
|
+
const fields = findActiveActionFields(configuration, action);
|
1464
|
+
if (!fields) {
|
1465
|
+
throw new Error(`No active field config found for action type ${action}`);
|
1466
|
+
}
|
1467
|
+
return fields;
|
1468
|
+
}
|
1407
1469
|
function getEventConfiguration(eventConfigurations, type) {
|
1408
1470
|
const config = eventConfigurations.find((config2) => config2.id === type);
|
1409
1471
|
if (!config) {
|
@@ -1412,16 +1474,13 @@ function getEventConfiguration(eventConfigurations, type) {
|
|
1412
1474
|
return config;
|
1413
1475
|
}
|
1414
1476
|
function isOptionalUncheckedCheckbox(field2, form) {
|
1415
|
-
if (field2.type !==
|
1416
|
-
return false;
|
1417
|
-
}
|
1418
|
-
if (field2.required) {
|
1477
|
+
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1419
1478
|
return false;
|
1420
1479
|
}
|
1421
1480
|
return !form[field2.id];
|
1422
1481
|
}
|
1423
1482
|
function stripHiddenFields(fields, data) {
|
1424
|
-
return (0, import_lodash.omitBy)(data, (
|
1483
|
+
return (0, import_lodash.omitBy)(data, (_2, fieldId) => {
|
1425
1484
|
const field2 = fields.find((f) => f.id === fieldId);
|
1426
1485
|
if (!field2) {
|
1427
1486
|
return true;
|
@@ -1434,16 +1493,16 @@ function stripHiddenFields(fields, data) {
|
|
1434
1493
|
}
|
1435
1494
|
|
1436
1495
|
// ../commons/src/events/EventConfig.ts
|
1437
|
-
var EventConfig =
|
1438
|
-
id:
|
1496
|
+
var EventConfig = import_zod18.z.object({
|
1497
|
+
id: import_zod18.z.string().describe(
|
1439
1498
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1440
1499
|
),
|
1441
1500
|
summary: SummaryConfig,
|
1442
1501
|
label: TranslationConfig,
|
1443
|
-
actions:
|
1444
|
-
workqueues:
|
1445
|
-
deduplication:
|
1446
|
-
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([])
|
1447
1506
|
}).superRefine((event2, ctx) => {
|
1448
1507
|
const allFields = findPageFields(event2);
|
1449
1508
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1476,102 +1535,102 @@ var defineForm = (form) => FormConfig.parse(form);
|
|
1476
1535
|
var defineFormPage = (formPage) => FormPage.parse(formPage);
|
1477
1536
|
|
1478
1537
|
// ../commons/src/events/Draft.ts
|
1479
|
-
var
|
1538
|
+
var import_zod21 = require("zod");
|
1480
1539
|
|
1481
1540
|
// ../commons/src/events/ActionDocument.ts
|
1482
|
-
var
|
1483
|
-
var
|
1484
|
-
var ActionBase =
|
1485
|
-
id:
|
1486
|
-
createdAt:
|
1487
|
-
createdBy:
|
1488
|
-
data:
|
1489
|
-
metadata:
|
1490
|
-
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()
|
1491
1550
|
});
|
1492
1551
|
var AssignedAction = ActionBase.merge(
|
1493
|
-
|
1494
|
-
type:
|
1495
|
-
assignedTo:
|
1552
|
+
import_zod19.z.object({
|
1553
|
+
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1554
|
+
assignedTo: import_zod19.z.string()
|
1496
1555
|
})
|
1497
1556
|
);
|
1498
1557
|
var UnassignedAction = ActionBase.merge(
|
1499
|
-
|
1500
|
-
type:
|
1558
|
+
import_zod19.z.object({
|
1559
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN)
|
1501
1560
|
})
|
1502
1561
|
);
|
1503
1562
|
var RegisterAction = ActionBase.merge(
|
1504
|
-
|
1505
|
-
type:
|
1506
|
-
identifiers:
|
1507
|
-
trackingId:
|
1508
|
-
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()
|
1509
1568
|
})
|
1510
1569
|
})
|
1511
1570
|
);
|
1512
1571
|
var DeclareAction = ActionBase.merge(
|
1513
|
-
|
1514
|
-
type:
|
1572
|
+
import_zod19.z.object({
|
1573
|
+
type: import_zod19.z.literal(ActionType.DECLARE)
|
1515
1574
|
})
|
1516
1575
|
);
|
1517
1576
|
var ValidateAction = ActionBase.merge(
|
1518
|
-
|
1519
|
-
type:
|
1577
|
+
import_zod19.z.object({
|
1578
|
+
type: import_zod19.z.literal(ActionType.VALIDATE)
|
1520
1579
|
})
|
1521
1580
|
);
|
1522
1581
|
var RejectAction = ActionBase.merge(
|
1523
|
-
|
1524
|
-
type:
|
1582
|
+
import_zod19.z.object({
|
1583
|
+
type: import_zod19.z.literal(ActionType.REJECT)
|
1525
1584
|
})
|
1526
1585
|
);
|
1527
1586
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1528
|
-
|
1529
|
-
type:
|
1587
|
+
import_zod19.z.object({
|
1588
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1530
1589
|
})
|
1531
1590
|
);
|
1532
1591
|
var ArchivedAction = ActionBase.merge(
|
1533
|
-
|
1534
|
-
type:
|
1592
|
+
import_zod19.z.object({
|
1593
|
+
type: import_zod19.z.literal(ActionType.ARCHIVED)
|
1535
1594
|
})
|
1536
1595
|
);
|
1537
1596
|
var CreatedAction = ActionBase.merge(
|
1538
|
-
|
1539
|
-
type:
|
1597
|
+
import_zod19.z.object({
|
1598
|
+
type: import_zod19.z.literal(ActionType.CREATE)
|
1540
1599
|
})
|
1541
1600
|
);
|
1542
1601
|
var NotifiedAction = ActionBase.merge(
|
1543
|
-
|
1544
|
-
type:
|
1602
|
+
import_zod19.z.object({
|
1603
|
+
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1545
1604
|
})
|
1546
1605
|
);
|
1547
1606
|
var PrintCertificateAction = ActionBase.merge(
|
1548
|
-
|
1549
|
-
type:
|
1607
|
+
import_zod19.z.object({
|
1608
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
1550
1609
|
})
|
1551
1610
|
);
|
1552
1611
|
var RequestedCorrectionAction = ActionBase.merge(
|
1553
|
-
|
1554
|
-
type:
|
1612
|
+
import_zod19.z.object({
|
1613
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
|
1555
1614
|
})
|
1556
1615
|
);
|
1557
1616
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1558
|
-
|
1559
|
-
type:
|
1560
|
-
requestId:
|
1617
|
+
import_zod19.z.object({
|
1618
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1619
|
+
requestId: import_zod19.z.string()
|
1561
1620
|
})
|
1562
1621
|
);
|
1563
1622
|
var RejectedCorrectionAction = ActionBase.merge(
|
1564
|
-
|
1565
|
-
type:
|
1566
|
-
requestId:
|
1623
|
+
import_zod19.z.object({
|
1624
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1625
|
+
requestId: import_zod19.z.string()
|
1567
1626
|
})
|
1568
1627
|
);
|
1569
1628
|
var CustomAction = ActionBase.merge(
|
1570
|
-
|
1571
|
-
type:
|
1629
|
+
import_zod19.z.object({
|
1630
|
+
type: import_zod19.z.literal(ActionType.CUSTOM)
|
1572
1631
|
})
|
1573
1632
|
);
|
1574
|
-
var ActionDocument =
|
1633
|
+
var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
1575
1634
|
CreatedAction,
|
1576
1635
|
ValidateAction,
|
1577
1636
|
RejectAction,
|
@@ -1588,107 +1647,108 @@ var ActionDocument = import_zod18.z.discriminatedUnion("type", [
|
|
1588
1647
|
PrintCertificateAction,
|
1589
1648
|
CustomAction
|
1590
1649
|
]);
|
1591
|
-
var ResolvedUser =
|
1592
|
-
id:
|
1593
|
-
role:
|
1594
|
-
name:
|
1595
|
-
|
1596
|
-
use:
|
1597
|
-
given:
|
1598
|
-
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()
|
1599
1658
|
})
|
1600
1659
|
)
|
1601
1660
|
});
|
1602
1661
|
|
1603
1662
|
// ../commons/src/events/ActionInput.ts
|
1604
|
-
var
|
1605
|
-
var BaseActionInput =
|
1606
|
-
eventId:
|
1607
|
-
transactionId:
|
1608
|
-
incomplete:
|
1609
|
-
data:
|
1610
|
-
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()
|
1611
1670
|
});
|
1612
1671
|
var CreateActionInput = BaseActionInput.merge(
|
1613
|
-
|
1614
|
-
type:
|
1615
|
-
createdAtLocation:
|
1672
|
+
import_zod20.z.object({
|
1673
|
+
type: import_zod20.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
1674
|
+
createdAtLocation: import_zod20.z.string()
|
1616
1675
|
})
|
1617
1676
|
);
|
1618
1677
|
var RegisterActionInput = BaseActionInput.merge(
|
1619
|
-
|
1620
|
-
type:
|
1621
|
-
identifiers:
|
1622
|
-
trackingId:
|
1623
|
-
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()
|
1624
1683
|
})
|
1625
1684
|
})
|
1626
1685
|
);
|
1627
1686
|
var ValidateActionInput = BaseActionInput.merge(
|
1628
|
-
|
1629
|
-
type:
|
1630
|
-
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())
|
1631
1690
|
})
|
1632
1691
|
);
|
1633
1692
|
var NotifyActionInput = BaseActionInput.merge(
|
1634
|
-
|
1635
|
-
type:
|
1693
|
+
import_zod20.z.object({
|
1694
|
+
type: import_zod20.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
1695
|
+
createdAtLocation: import_zod20.z.string()
|
1636
1696
|
})
|
1637
1697
|
);
|
1638
1698
|
var DeclareActionInput = BaseActionInput.merge(
|
1639
|
-
|
1640
|
-
type:
|
1699
|
+
import_zod20.z.object({
|
1700
|
+
type: import_zod20.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1641
1701
|
})
|
1642
1702
|
);
|
1643
1703
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1644
|
-
|
1645
|
-
type:
|
1704
|
+
import_zod20.z.object({
|
1705
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1646
1706
|
})
|
1647
1707
|
);
|
1648
1708
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1649
|
-
|
1650
|
-
type:
|
1709
|
+
import_zod20.z.object({
|
1710
|
+
type: import_zod20.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1651
1711
|
})
|
1652
1712
|
);
|
1653
1713
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1654
|
-
|
1655
|
-
type:
|
1714
|
+
import_zod20.z.object({
|
1715
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1656
1716
|
})
|
1657
1717
|
);
|
1658
1718
|
var ArchivedActionInput = BaseActionInput.merge(
|
1659
|
-
|
1660
|
-
type:
|
1719
|
+
import_zod20.z.object({
|
1720
|
+
type: import_zod20.z.literal(ActionType.ARCHIVED).default(ActionType.ARCHIVED)
|
1661
1721
|
})
|
1662
1722
|
);
|
1663
1723
|
var AssignActionInput = BaseActionInput.merge(
|
1664
|
-
|
1665
|
-
type:
|
1666
|
-
assignedTo:
|
1724
|
+
import_zod20.z.object({
|
1725
|
+
type: import_zod20.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1726
|
+
assignedTo: import_zod20.z.string()
|
1667
1727
|
})
|
1668
1728
|
);
|
1669
1729
|
var UnassignActionInput = BaseActionInput.merge(
|
1670
|
-
|
1671
|
-
type:
|
1730
|
+
import_zod20.z.object({
|
1731
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
|
1672
1732
|
})
|
1673
1733
|
);
|
1674
1734
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1675
|
-
|
1676
|
-
type:
|
1735
|
+
import_zod20.z.object({
|
1736
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1677
1737
|
})
|
1678
1738
|
);
|
1679
1739
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1680
|
-
|
1681
|
-
requestId:
|
1682
|
-
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)
|
1683
1743
|
})
|
1684
1744
|
);
|
1685
1745
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1686
|
-
|
1687
|
-
requestId:
|
1688
|
-
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)
|
1689
1749
|
})
|
1690
1750
|
);
|
1691
|
-
var ActionInput =
|
1751
|
+
var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
1692
1752
|
CreateActionInput,
|
1693
1753
|
ValidateActionInput,
|
1694
1754
|
RegisterActionInput,
|
@@ -1706,50 +1766,51 @@ var ActionInput = import_zod19.z.discriminatedUnion("type", [
|
|
1706
1766
|
]);
|
1707
1767
|
|
1708
1768
|
// ../commons/src/events/Draft.ts
|
1709
|
-
var Draft =
|
1710
|
-
id:
|
1711
|
-
eventId:
|
1712
|
-
transactionId:
|
1713
|
-
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(),
|
1714
1774
|
action: ActionBase.extend({
|
1715
|
-
type:
|
1775
|
+
type: import_zod21.z.enum(Object.values(ActionType))
|
1716
1776
|
}).omit({ id: true })
|
1717
1777
|
});
|
1718
1778
|
var DraftInput = BaseActionInput.extend({
|
1719
|
-
type:
|
1779
|
+
type: import_zod21.z.enum(Object.values(ActionType))
|
1720
1780
|
});
|
1721
1781
|
|
1722
1782
|
// ../commons/src/events/EventInput.ts
|
1723
|
-
var
|
1724
|
-
var EventInput =
|
1725
|
-
transactionId:
|
1726
|
-
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()
|
1727
1787
|
});
|
1728
1788
|
|
1729
1789
|
// ../commons/src/events/EventDocument.ts
|
1730
|
-
var
|
1731
|
-
var EventDocument =
|
1732
|
-
id:
|
1733
|
-
type:
|
1734
|
-
createdAt:
|
1735
|
-
updatedAt:
|
1736
|
-
actions:
|
1737
|
-
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()
|
1738
1798
|
});
|
1739
1799
|
|
1740
1800
|
// ../commons/src/events/EventIndex.ts
|
1741
|
-
var
|
1801
|
+
var import_zod24 = require("zod");
|
1742
1802
|
var EventIndex = EventMetadata.extend({
|
1743
|
-
data:
|
1803
|
+
data: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any())
|
1744
1804
|
});
|
1745
|
-
var EventSearchIndex =
|
1746
|
-
|
1747
|
-
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()
|
1748
1808
|
// Ensures "type" (event-id) exists and is a string
|
1749
1809
|
})
|
1750
1810
|
);
|
1751
1811
|
|
1752
1812
|
// ../commons/src/events/state/index.ts
|
1813
|
+
var _ = __toESM(require("lodash"));
|
1753
1814
|
function getStatusFromActions(actions) {
|
1754
1815
|
return actions.reduce((status, action) => {
|
1755
1816
|
if (action.type === ActionType.CREATE) {
|
@@ -1770,9 +1831,6 @@ function getStatusFromActions(actions) {
|
|
1770
1831
|
if (action.type === ActionType.ARCHIVED) {
|
1771
1832
|
return EventStatus.ARCHIVED;
|
1772
1833
|
}
|
1773
|
-
if (action.type === ActionType.NOTIFY) {
|
1774
|
-
return EventStatus.NOTIFIED;
|
1775
|
-
}
|
1776
1834
|
return status;
|
1777
1835
|
}, EventStatus.CREATED);
|
1778
1836
|
}
|
@@ -1801,17 +1859,44 @@ function getData(actions) {
|
|
1801
1859
|
if (!requestAction) {
|
1802
1860
|
return status;
|
1803
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) {
|
1804
1874
|
return {
|
1805
|
-
...
|
1806
|
-
|
1875
|
+
...acc,
|
1876
|
+
[key]: value
|
1807
1877
|
};
|
1808
1878
|
}
|
1809
|
-
return
|
1810
|
-
...status,
|
1811
|
-
...action.data
|
1812
|
-
};
|
1879
|
+
return acc;
|
1813
1880
|
}, {});
|
1814
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
|
+
}
|
1815
1900
|
function isUndeclaredDraft(event2) {
|
1816
1901
|
return event2.actions.every(({ type }) => type === ActionType.CREATE);
|
1817
1902
|
}
|
@@ -1823,7 +1908,7 @@ function getCurrentEventState(event2) {
|
|
1823
1908
|
throw new Error(`Event ${event2.id} has no creation action`);
|
1824
1909
|
}
|
1825
1910
|
const latestAction = event2.actions[event2.actions.length - 1];
|
1826
|
-
return {
|
1911
|
+
return deepDropNulls({
|
1827
1912
|
id: event2.id,
|
1828
1913
|
type: event2.type,
|
1829
1914
|
status: getStatusFromActions(event2.actions),
|
@@ -1835,14 +1920,12 @@ function getCurrentEventState(event2) {
|
|
1835
1920
|
updatedBy: latestAction.createdBy,
|
1836
1921
|
data: getData(event2.actions),
|
1837
1922
|
trackingId: event2.trackingId
|
1838
|
-
};
|
1923
|
+
});
|
1839
1924
|
}
|
1840
1925
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
1841
1926
|
const actions = event2.actions.slice().sort();
|
1842
1927
|
const lastAction = actions[actions.length - 1];
|
1843
|
-
const activeDrafts = drafts.filter(({ eventId }) => eventId === event2.id).filter(
|
1844
|
-
({ createdAt }) => new Date(createdAt) > new Date(lastAction.createdAt)
|
1845
|
-
).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) => {
|
1846
1929
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1847
1930
|
return [
|
1848
1931
|
action,
|
@@ -1875,20 +1958,21 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
1875
1958
|
}
|
1876
1959
|
};
|
1877
1960
|
}
|
1878
|
-
function getMetadataForAction(
|
1961
|
+
function getMetadataForAction({
|
1962
|
+
event: event2,
|
1963
|
+
actionType,
|
1964
|
+
drafts
|
1965
|
+
}) {
|
1879
1966
|
const action = event2.actions.find((action2) => actionType === action2.type);
|
1880
|
-
const
|
1967
|
+
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
1881
1968
|
const sorted = [
|
1882
1969
|
...action ? [action] : [],
|
1883
|
-
...
|
1970
|
+
...eventDrafts.map((draft) => draft.action)
|
1884
1971
|
].sort();
|
1885
1972
|
const metadata = sorted.reduce((metadata2, action2) => {
|
1886
|
-
return {
|
1887
|
-
...metadata2,
|
1888
|
-
...action2.metadata
|
1889
|
-
};
|
1973
|
+
return deepMerge(metadata2, action2.metadata ?? {});
|
1890
1974
|
}, {});
|
1891
|
-
return metadata;
|
1975
|
+
return deepDropNulls(metadata);
|
1892
1976
|
}
|
1893
1977
|
|
1894
1978
|
// ../commons/src/events/defineConfig.ts
|
@@ -2779,7 +2863,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
2779
2863
|
review: {
|
2780
2864
|
title: {
|
2781
2865
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
2782
|
-
defaultMessage: "Member declaration for {firstname} {surname}",
|
2866
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
2783
2867
|
description: "Title of the form to show in review page"
|
2784
2868
|
},
|
2785
2869
|
fields: [
|
@@ -3049,7 +3133,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3049
3133
|
],
|
3050
3134
|
actions: [
|
3051
3135
|
{
|
3052
|
-
type:
|
3136
|
+
type: ActionType.DECLARE,
|
3053
3137
|
label: {
|
3054
3138
|
defaultMessage: "Send an application",
|
3055
3139
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3058,25 +3142,25 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3058
3142
|
forms: [TENNIS_CLUB_FORM]
|
3059
3143
|
},
|
3060
3144
|
{
|
3061
|
-
type:
|
3145
|
+
type: ActionType.VALIDATE,
|
3062
3146
|
label: {
|
3063
|
-
defaultMessage: "
|
3147
|
+
defaultMessage: "Validate",
|
3064
3148
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3065
|
-
id: "event.tennis-club-membership.action.
|
3149
|
+
id: "event.tennis-club-membership.action.validate.label"
|
3066
3150
|
},
|
3067
3151
|
forms: [TENNIS_CLUB_FORM]
|
3068
3152
|
},
|
3069
3153
|
{
|
3070
|
-
type:
|
3154
|
+
type: ActionType.REGISTER,
|
3071
3155
|
label: {
|
3072
|
-
defaultMessage: "
|
3156
|
+
defaultMessage: "Register",
|
3073
3157
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3074
|
-
id: "event.tennis-club-membership.action.
|
3158
|
+
id: "event.tennis-club-membership.action.register.label"
|
3075
3159
|
},
|
3076
|
-
forms: []
|
3160
|
+
forms: [TENNIS_CLUB_FORM]
|
3077
3161
|
},
|
3078
3162
|
{
|
3079
|
-
type:
|
3163
|
+
type: ActionType.REQUEST_CORRECTION,
|
3080
3164
|
label: {
|
3081
3165
|
defaultMessage: "Request correction",
|
3082
3166
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3272,7 +3356,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3272
3356
|
]
|
3273
3357
|
},
|
3274
3358
|
{
|
3275
|
-
type:
|
3359
|
+
type: ActionType.APPROVE_CORRECTION,
|
3276
3360
|
forms: [TENNIS_CLUB_FORM],
|
3277
3361
|
label: {
|
3278
3362
|
defaultMessage: "Approve correction",
|
@@ -3347,7 +3431,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3347
3431
|
|
3348
3432
|
// ../commons/src/events/test.utils.ts
|
3349
3433
|
function generateActionInput(configuration, action) {
|
3350
|
-
const fields =
|
3434
|
+
const fields = findActiveActionFormFields(configuration, action) ?? [];
|
3351
3435
|
const data = fields.reduce(
|
3352
3436
|
(acc, field2, i) => ({
|
3353
3437
|
...acc,
|
@@ -3402,7 +3486,7 @@ var eventPayloadGenerator = {
|
|
3402
3486
|
validate: (eventId, input = {}) => ({
|
3403
3487
|
type: ActionType.VALIDATE,
|
3404
3488
|
transactionId: input.transactionId ?? getUUID(),
|
3405
|
-
data: input.data ??
|
3489
|
+
data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
|
3406
3490
|
duplicates: [],
|
3407
3491
|
eventId
|
3408
3492
|
}),
|
@@ -3472,7 +3556,8 @@ var eventPayloadGenerator = {
|
|
3472
3556
|
};
|
3473
3557
|
function generateActionDocument({
|
3474
3558
|
configuration,
|
3475
|
-
action
|
3559
|
+
action,
|
3560
|
+
defaults = {}
|
3476
3561
|
}) {
|
3477
3562
|
const actionBase = {
|
3478
3563
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -3480,7 +3565,8 @@ function generateActionDocument({
|
|
3480
3565
|
id: getUUID(),
|
3481
3566
|
createdAtLocation: "TODO",
|
3482
3567
|
data: generateActionInput(configuration, action),
|
3483
|
-
metadata: {}
|
3568
|
+
metadata: {},
|
3569
|
+
...defaults
|
3484
3570
|
};
|
3485
3571
|
switch (action) {
|
3486
3572
|
case ActionType.DECLARE:
|