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