@opencrvs/toolkit 1.8.0-rc.f5b8a8a → 1.8.0-rc.f7e8fb5
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 +2883 -2930
- package/dist/commons/conditionals/conditionals.d.ts +2 -2
- package/dist/commons/conditionals/validate.d.ts +6 -6
- package/dist/commons/events/ActionConfig.d.ts +6 -24
- package/dist/commons/events/ActionDocument.d.ts +1120 -1113
- package/dist/commons/events/ActionInput.d.ts +1676 -1754
- package/dist/commons/events/ActionType.d.ts +1 -1
- package/dist/commons/events/CompositeFieldValue.d.ts +264 -0
- package/dist/commons/events/Draft.d.ts +152 -155
- package/dist/commons/events/EventConfig.d.ts +4 -28
- package/dist/commons/events/EventDocument.d.ts +1325 -1325
- 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 +3 -0
- package/dist/commons/events/FieldType.d.ts +4 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +122 -38
- package/dist/commons/events/FieldValue.d.ts +62 -65
- package/dist/commons/events/TemplateConfig.d.ts +38 -0
- package/dist/commons/events/defineConfig.d.ts +1 -7
- package/dist/commons/events/index.d.ts +2 -0
- package/dist/commons/events/test.utils.d.ts +75 -69
- package/dist/commons/events/utils.d.ts +104 -4
- package/dist/events/index.js +633 -451
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -36,12 +36,14 @@ __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,
|
43
|
+
AdministrativeAreas: () => AdministrativeAreas,
|
42
44
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
43
45
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
44
|
-
|
46
|
+
ArchiveActionInput: () => ArchiveActionInput,
|
45
47
|
BaseActionInput: () => BaseActionInput,
|
46
48
|
CertificateConfig: () => CertificateConfig,
|
47
49
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
@@ -67,12 +69,14 @@ __export(events_exports, {
|
|
67
69
|
EventStatuses: () => EventStatuses,
|
68
70
|
FieldConfig: () => FieldConfig,
|
69
71
|
FieldType: () => FieldType,
|
72
|
+
FieldUpdateValue: () => FieldUpdateValue,
|
70
73
|
FieldValue: () => FieldValue,
|
71
74
|
FileFieldValue: () => FileFieldValue,
|
72
75
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
73
76
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
74
77
|
FormConfig: () => FormConfig,
|
75
78
|
FormPage: () => FormPage,
|
79
|
+
GeographicalArea: () => GeographicalArea,
|
76
80
|
LanguageConfig: () => LanguageConfig,
|
77
81
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
78
82
|
NotifyActionInput: () => NotifyActionInput,
|
@@ -84,16 +88,23 @@ __export(events_exports, {
|
|
84
88
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
85
89
|
RequiredTextValue: () => RequiredTextValue,
|
86
90
|
ResolvedUser: () => ResolvedUser,
|
91
|
+
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
92
|
+
RuralAddressValue: () => RuralAddressValue,
|
87
93
|
ShowConditional: () => ShowConditional,
|
88
94
|
SummaryConfig: () => SummaryConfig,
|
89
95
|
TextValue: () => TextValue,
|
90
96
|
TranslationConfig: () => TranslationConfig,
|
97
|
+
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
98
|
+
UrbanAddressValue: () => UrbanAddressValue,
|
91
99
|
ValidateActionInput: () => ValidateActionInput,
|
92
100
|
WorkqueueConfig: () => WorkqueueConfig,
|
93
101
|
alwaysTrue: () => alwaysTrue,
|
94
102
|
and: () => and,
|
95
103
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
104
|
+
compositeFieldTypes: () => compositeFieldTypes,
|
105
|
+
createEmptyDraft: () => createEmptyDraft,
|
96
106
|
createValidationSchema: () => createValidationSchema,
|
107
|
+
deepDropNulls: () => deepDropNulls,
|
97
108
|
defineConditional: () => defineConditional,
|
98
109
|
defineConfig: () => defineConfig,
|
99
110
|
defineForm: () => defineForm,
|
@@ -107,12 +118,18 @@ __export(events_exports, {
|
|
107
118
|
fieldTypes: () => fieldTypes,
|
108
119
|
findActiveActionFields: () => findActiveActionFields,
|
109
120
|
findActiveActionForm: () => findActiveActionForm,
|
121
|
+
findActiveActionFormFields: () => findActiveActionFormFields,
|
122
|
+
findActiveActionFormPages: () => findActiveActionFormPages,
|
123
|
+
findActiveDrafts: () => findActiveDrafts,
|
110
124
|
findInputPageFields: () => findInputPageFields,
|
111
125
|
findPageFields: () => findPageFields,
|
126
|
+
generateActionDocument: () => generateActionDocument,
|
112
127
|
generateActionInput: () => generateActionInput,
|
113
128
|
generateEventDocument: () => generateEventDocument,
|
114
129
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
115
130
|
generateTransactionId: () => generateTransactionId,
|
131
|
+
getActiveActionFields: () => getActiveActionFields,
|
132
|
+
getActiveActionFormPages: () => getActiveActionFormPages,
|
116
133
|
getAllFields: () => getAllFields,
|
117
134
|
getAllPages: () => getAllPages,
|
118
135
|
getCurrentEventState: () => getCurrentEventState,
|
@@ -130,19 +147,22 @@ __export(events_exports, {
|
|
130
147
|
isDividerFieldType: () => isDividerFieldType,
|
131
148
|
isEmailFieldType: () => isEmailFieldType,
|
132
149
|
isFacilityFieldType: () => isFacilityFieldType,
|
150
|
+
isFieldConfigDefaultValue: () => isFieldConfigDefaultValue,
|
133
151
|
isFieldEnabled: () => isFieldEnabled,
|
152
|
+
isFieldValue: () => isFieldValue,
|
153
|
+
isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
|
134
154
|
isFieldVisible: () => isFieldVisible,
|
135
155
|
isFileFieldType: () => isFileFieldType,
|
136
156
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
137
157
|
isLocationFieldType: () => isLocationFieldType,
|
138
158
|
isNumberFieldType: () => isNumberFieldType,
|
139
159
|
isOfficeFieldType: () => isOfficeFieldType,
|
140
|
-
isOptionalUncheckedCheckbox: () => isOptionalUncheckedCheckbox,
|
141
160
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
142
161
|
isParagraphFieldType: () => isParagraphFieldType,
|
143
162
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
144
163
|
isSelectFieldType: () => isSelectFieldType,
|
145
164
|
isSignatureFieldType: () => isSignatureFieldType,
|
165
|
+
isTemplateVariable: () => isTemplateVariable,
|
146
166
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
147
167
|
isTextFieldType: () => isTextFieldType,
|
148
168
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
@@ -160,7 +180,7 @@ __export(events_exports, {
|
|
160
180
|
module.exports = __toCommonJS(events_exports);
|
161
181
|
|
162
182
|
// ../commons/src/events/ActionConfig.ts
|
163
|
-
var
|
183
|
+
var import_zod7 = require("zod");
|
164
184
|
|
165
185
|
// ../commons/src/events/Conditional.ts
|
166
186
|
var import_zod = require("zod");
|
@@ -189,10 +209,10 @@ var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
|
189
209
|
]);
|
190
210
|
|
191
211
|
// ../commons/src/events/FormConfig.ts
|
192
|
-
var
|
212
|
+
var import_zod6 = require("zod");
|
193
213
|
|
194
214
|
// ../commons/src/events/FieldConfig.ts
|
195
|
-
var
|
215
|
+
var import_zod5 = require("zod");
|
196
216
|
|
197
217
|
// ../commons/src/events/TranslationConfig.ts
|
198
218
|
var import_zod2 = require("zod");
|
@@ -232,13 +252,21 @@ var FieldType = {
|
|
232
252
|
SIGNATURE: "SIGNATURE"
|
233
253
|
};
|
234
254
|
var fieldTypes = Object.values(FieldType);
|
255
|
+
var compositeFieldTypes = [
|
256
|
+
FieldType.ADDRESS,
|
257
|
+
FieldType.FILE_WITH_OPTIONS,
|
258
|
+
FieldType.FILE
|
259
|
+
];
|
235
260
|
|
236
261
|
// ../commons/src/events/FieldValue.ts
|
262
|
+
var import_zod4 = require("zod");
|
263
|
+
|
264
|
+
// ../commons/src/events/CompositeFieldValue.ts
|
237
265
|
var import_zod3 = require("zod");
|
238
|
-
var
|
239
|
-
|
240
|
-
|
241
|
-
|
266
|
+
var GeographicalArea = {
|
267
|
+
URBAN: "URBAN",
|
268
|
+
RURAL: "RURAL"
|
269
|
+
};
|
242
270
|
var FileFieldValue = import_zod3.z.object({
|
243
271
|
filename: import_zod3.z.string(),
|
244
272
|
originalFilename: import_zod3.z.string(),
|
@@ -249,21 +277,37 @@ var AdminStructure = import_zod3.z.object({
|
|
249
277
|
province: import_zod3.z.string(),
|
250
278
|
district: import_zod3.z.string()
|
251
279
|
});
|
252
|
-
var
|
253
|
-
urbanOrRural: import_zod3.z.literal(
|
280
|
+
var UrbanAddressValue = AdminStructure.extend({
|
281
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
|
254
282
|
town: import_zod3.z.string().optional(),
|
255
283
|
residentialArea: import_zod3.z.string().optional(),
|
256
284
|
street: import_zod3.z.string().optional(),
|
257
285
|
number: import_zod3.z.string().optional(),
|
258
286
|
zipCode: import_zod3.z.string().optional()
|
259
287
|
});
|
260
|
-
var
|
261
|
-
urbanOrRural: import_zod3.z.literal(
|
288
|
+
var RuralAddressValue = AdminStructure.extend({
|
289
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
262
290
|
village: import_zod3.z.string().optional()
|
263
291
|
});
|
292
|
+
var UrbanAddressUpdateValue = AdminStructure.extend({
|
293
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
|
294
|
+
town: import_zod3.z.string().nullish(),
|
295
|
+
residentialArea: import_zod3.z.string().nullish(),
|
296
|
+
street: import_zod3.z.string().nullish(),
|
297
|
+
number: import_zod3.z.string().nullish(),
|
298
|
+
zipCode: import_zod3.z.string().nullish()
|
299
|
+
});
|
300
|
+
var RuralAddressUpdateValue = AdminStructure.extend({
|
301
|
+
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
302
|
+
village: import_zod3.z.string().nullish()
|
303
|
+
});
|
264
304
|
var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
265
|
-
|
266
|
-
|
305
|
+
UrbanAddressValue,
|
306
|
+
RuralAddressValue
|
307
|
+
]);
|
308
|
+
var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
|
309
|
+
UrbanAddressUpdateValue,
|
310
|
+
RuralAddressUpdateValue
|
267
311
|
]);
|
268
312
|
var FileFieldValueWithOption = import_zod3.z.object({
|
269
313
|
filename: import_zod3.z.string(),
|
@@ -272,30 +316,46 @@ var FileFieldValueWithOption = import_zod3.z.object({
|
|
272
316
|
option: import_zod3.z.string()
|
273
317
|
});
|
274
318
|
var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
|
275
|
-
|
276
|
-
|
277
|
-
var
|
319
|
+
|
320
|
+
// ../commons/src/events/FieldValue.ts
|
321
|
+
var TextValue = import_zod4.z.string();
|
322
|
+
var RequiredTextValue = TextValue.min(1);
|
323
|
+
var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
|
324
|
+
var EmailValue = import_zod4.z.string().email();
|
325
|
+
var CheckboxFieldValue = import_zod4.z.boolean();
|
326
|
+
var NumberFieldValue = import_zod4.z.number();
|
327
|
+
var FieldValue = import_zod4.z.union([
|
278
328
|
TextValue,
|
279
329
|
DateValue,
|
330
|
+
CheckboxFieldValue,
|
331
|
+
NumberFieldValue,
|
280
332
|
FileFieldValue,
|
281
333
|
FileFieldWithOptionValue,
|
334
|
+
UrbanAddressValue,
|
335
|
+
RuralAddressValue
|
336
|
+
]);
|
337
|
+
var FieldUpdateValue = import_zod4.z.union([
|
338
|
+
TextValue,
|
339
|
+
DateValue,
|
282
340
|
CheckboxFieldValue,
|
283
341
|
NumberFieldValue,
|
284
|
-
|
285
|
-
|
342
|
+
FileFieldValue,
|
343
|
+
FileFieldWithOptionValue,
|
344
|
+
UrbanAddressUpdateValue,
|
345
|
+
RuralAddressUpdateValue
|
286
346
|
]);
|
287
347
|
|
288
348
|
// ../commons/src/events/FieldConfig.ts
|
289
|
-
var FieldId =
|
290
|
-
var DependencyExpression =
|
291
|
-
dependsOn:
|
292
|
-
expression:
|
349
|
+
var FieldId = import_zod5.z.string();
|
350
|
+
var DependencyExpression = import_zod5.z.object({
|
351
|
+
dependsOn: import_zod5.z.array(FieldId).default([]),
|
352
|
+
expression: import_zod5.z.string()
|
293
353
|
});
|
294
|
-
var BaseField =
|
354
|
+
var BaseField = import_zod5.z.object({
|
295
355
|
id: FieldId,
|
296
|
-
defaultValue:
|
356
|
+
defaultValue: import_zod5.z.union([
|
297
357
|
// These are the currently supported default values types
|
298
|
-
|
358
|
+
import_zod5.z.union([
|
299
359
|
TextValue,
|
300
360
|
RequiredTextValue,
|
301
361
|
DateValue,
|
@@ -304,82 +364,82 @@ var BaseField = import_zod4.z.object({
|
|
304
364
|
]),
|
305
365
|
DependencyExpression
|
306
366
|
]).optional(),
|
307
|
-
conditionals:
|
308
|
-
required:
|
309
|
-
disabled:
|
310
|
-
hidden:
|
367
|
+
conditionals: import_zod5.z.array(ActionConditional).default([]).optional(),
|
368
|
+
required: import_zod5.z.boolean().default(false).optional(),
|
369
|
+
disabled: import_zod5.z.boolean().default(false).optional(),
|
370
|
+
hidden: import_zod5.z.boolean().default(false).optional(),
|
311
371
|
placeholder: TranslationConfig.optional(),
|
312
|
-
validation:
|
313
|
-
|
372
|
+
validation: import_zod5.z.array(
|
373
|
+
import_zod5.z.object({
|
314
374
|
validator: Conditional(),
|
315
375
|
message: TranslationConfig
|
316
376
|
})
|
317
377
|
).default([]).optional(),
|
318
|
-
dependsOn:
|
378
|
+
dependsOn: import_zod5.z.array(FieldId).default([]).optional(),
|
319
379
|
label: TranslationConfig,
|
320
|
-
hideLabel:
|
380
|
+
hideLabel: import_zod5.z.boolean().default(false).optional()
|
321
381
|
});
|
322
382
|
var Divider = BaseField.extend({
|
323
|
-
type:
|
383
|
+
type: import_zod5.z.literal(FieldType.DIVIDER)
|
324
384
|
});
|
325
385
|
var TextField = BaseField.extend({
|
326
|
-
type:
|
327
|
-
defaultValue:
|
328
|
-
configuration:
|
329
|
-
maxLength:
|
330
|
-
type:
|
386
|
+
type: import_zod5.z.literal(FieldType.TEXT),
|
387
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
388
|
+
configuration: import_zod5.z.object({
|
389
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
390
|
+
type: import_zod5.z.enum(["text", "password"]).optional(),
|
331
391
|
prefix: TranslationConfig.optional(),
|
332
392
|
postfix: TranslationConfig.optional()
|
333
393
|
}).default({ type: "text" }).optional()
|
334
394
|
}).describe("Text input");
|
335
395
|
var NumberField = BaseField.extend({
|
336
|
-
type:
|
337
|
-
defaultValue:
|
338
|
-
configuration:
|
339
|
-
min:
|
340
|
-
max:
|
396
|
+
type: import_zod5.z.literal(FieldType.NUMBER),
|
397
|
+
defaultValue: import_zod5.z.union([NumberFieldValue, DependencyExpression]).optional(),
|
398
|
+
configuration: import_zod5.z.object({
|
399
|
+
min: import_zod5.z.number().optional().describe("Minimum value"),
|
400
|
+
max: import_zod5.z.number().optional().describe("Maximum value"),
|
341
401
|
prefix: TranslationConfig.optional(),
|
342
402
|
postfix: TranslationConfig.optional()
|
343
403
|
}).optional()
|
344
404
|
}).describe("Number input");
|
345
405
|
var TextAreaField = BaseField.extend({
|
346
|
-
type:
|
347
|
-
defaultValue:
|
348
|
-
configuration:
|
349
|
-
maxLength:
|
350
|
-
rows:
|
351
|
-
cols:
|
406
|
+
type: import_zod5.z.literal(FieldType.TEXTAREA),
|
407
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
408
|
+
configuration: import_zod5.z.object({
|
409
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
410
|
+
rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
|
411
|
+
cols: import_zod5.z.number().optional().describe("Number of visible columns"),
|
352
412
|
prefix: TranslationConfig.optional(),
|
353
413
|
postfix: TranslationConfig.optional()
|
354
414
|
}).default({ rows: 4 }).optional()
|
355
415
|
}).describe("Multiline text input");
|
356
416
|
var SignatureField = BaseField.extend({
|
357
|
-
type:
|
417
|
+
type: import_zod5.z.literal(FieldType.SIGNATURE),
|
358
418
|
signaturePromptLabel: TranslationConfig.describe(
|
359
419
|
"Title of the signature modal"
|
360
420
|
),
|
361
|
-
configuration:
|
362
|
-
maxSizeMb:
|
363
|
-
allowedFileFormats:
|
421
|
+
configuration: import_zod5.z.object({
|
422
|
+
maxSizeMb: import_zod5.z.number().optional().describe("Maximum file size in MB"),
|
423
|
+
allowedFileFormats: import_zod5.z.array(import_zod5.z.string()).optional().describe("List of allowed file formats for the signature")
|
364
424
|
}).default({}).optional()
|
365
425
|
}).describe("Signature input field");
|
366
426
|
var EmailField = BaseField.extend({
|
367
|
-
type:
|
368
|
-
configuration:
|
369
|
-
maxLength:
|
427
|
+
type: import_zod5.z.literal(FieldType.EMAIL),
|
428
|
+
configuration: import_zod5.z.object({
|
429
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
|
370
430
|
}).default({ maxLength: 10 }).optional(),
|
371
|
-
defaultValue:
|
431
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
372
432
|
});
|
373
433
|
var DateField = BaseField.extend({
|
374
|
-
type:
|
375
|
-
defaultValue:
|
376
|
-
configuration:
|
434
|
+
type: import_zod5.z.literal(FieldType.DATE),
|
435
|
+
defaultValue: import_zod5.z.union([DateValue, DependencyExpression]).optional(),
|
436
|
+
configuration: import_zod5.z.object({
|
377
437
|
notice: TranslationConfig.describe(
|
378
438
|
"Text to display above the date input"
|
379
439
|
).optional()
|
380
440
|
}).optional()
|
381
441
|
}).describe("A single date input (dd-mm-YYYY)");
|
382
|
-
var HtmlFontVariant =
|
442
|
+
var HtmlFontVariant = import_zod5.z.enum([
|
383
443
|
"reg12",
|
384
444
|
"reg14",
|
385
445
|
"reg16",
|
@@ -390,97 +450,102 @@ var HtmlFontVariant = import_zod4.z.enum([
|
|
390
450
|
"h1"
|
391
451
|
]);
|
392
452
|
var Paragraph = BaseField.extend({
|
393
|
-
type:
|
394
|
-
defaultValue:
|
395
|
-
configuration:
|
396
|
-
styles:
|
453
|
+
type: import_zod5.z.literal(FieldType.PARAGRAPH),
|
454
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
455
|
+
configuration: import_zod5.z.object({
|
456
|
+
styles: import_zod5.z.object({
|
397
457
|
fontVariant: HtmlFontVariant.optional()
|
398
458
|
}).optional()
|
399
459
|
}).default({})
|
400
460
|
}).describe("A read-only HTML <p> paragraph");
|
401
461
|
var PageHeader = BaseField.extend({
|
402
|
-
type:
|
403
|
-
defaultValue:
|
462
|
+
type: import_zod5.z.literal(FieldType.PAGE_HEADER),
|
463
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
404
464
|
}).describe("A read-only header component for form pages");
|
405
465
|
var File = BaseField.extend({
|
406
|
-
type:
|
407
|
-
options:
|
408
|
-
style:
|
409
|
-
fullWidth:
|
466
|
+
type: import_zod5.z.literal(FieldType.FILE),
|
467
|
+
options: import_zod5.z.object({
|
468
|
+
style: import_zod5.z.object({
|
469
|
+
fullWidth: import_zod5.z.boolean().describe(
|
410
470
|
"Whether the file upload button should take the full width of the container or not"
|
411
471
|
)
|
412
472
|
})
|
413
473
|
}).optional()
|
414
474
|
}).describe("File upload");
|
415
|
-
var SelectOption =
|
416
|
-
value:
|
475
|
+
var SelectOption = import_zod5.z.object({
|
476
|
+
value: import_zod5.z.string().describe("The value of the option"),
|
417
477
|
label: TranslationConfig.describe("The label of the option")
|
418
478
|
});
|
419
479
|
var RadioGroup = BaseField.extend({
|
420
|
-
type:
|
421
|
-
defaultValue:
|
422
|
-
options:
|
423
|
-
configuration:
|
424
|
-
styles:
|
425
|
-
size:
|
480
|
+
type: import_zod5.z.literal(FieldType.RADIO_GROUP),
|
481
|
+
defaultValue: import_zod5.z.union([TextValue, DependencyExpression]).optional(),
|
482
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
483
|
+
configuration: import_zod5.z.object({
|
484
|
+
styles: import_zod5.z.object({
|
485
|
+
size: import_zod5.z.enum(["NORMAL", "LARGE"]).optional()
|
426
486
|
}).optional()
|
427
487
|
}).optional()
|
428
488
|
}).describe("Grouped radio options");
|
429
489
|
var BulletList = BaseField.extend({
|
430
|
-
type:
|
431
|
-
defaultValue:
|
432
|
-
items:
|
433
|
-
configuration:
|
434
|
-
styles:
|
490
|
+
type: import_zod5.z.literal(FieldType.BULLET_LIST),
|
491
|
+
defaultValue: import_zod5.z.string().optional(),
|
492
|
+
items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
|
493
|
+
configuration: import_zod5.z.object({
|
494
|
+
styles: import_zod5.z.object({
|
435
495
|
fontVariant: HtmlFontVariant.optional()
|
436
496
|
}).optional()
|
437
497
|
}).default({})
|
438
498
|
}).describe("A list of bullet points");
|
439
499
|
var Select = BaseField.extend({
|
440
|
-
type:
|
441
|
-
defaultValue:
|
442
|
-
options:
|
500
|
+
type: import_zod5.z.literal(FieldType.SELECT),
|
501
|
+
defaultValue: import_zod5.z.union([TextValue, DependencyExpression]).optional(),
|
502
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
443
503
|
}).describe("Select input");
|
444
504
|
var Checkbox = BaseField.extend({
|
445
|
-
type:
|
446
|
-
defaultValue:
|
505
|
+
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
506
|
+
defaultValue: import_zod5.z.union([CheckboxFieldValue, DependencyExpression]).optional()
|
447
507
|
}).describe("Boolean checkbox field");
|
448
508
|
var Country = BaseField.extend({
|
449
|
-
type:
|
450
|
-
defaultValue:
|
509
|
+
type: import_zod5.z.literal(FieldType.COUNTRY),
|
510
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
451
511
|
}).describe("Country select field");
|
452
|
-
var
|
453
|
-
|
454
|
-
|
512
|
+
var AdministrativeAreas = import_zod5.z.enum([
|
513
|
+
"ADMIN_STRUCTURE",
|
514
|
+
"HEALTH_FACILITY",
|
515
|
+
"CRVS_OFFICE"
|
516
|
+
]);
|
517
|
+
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
518
|
+
partOf: import_zod5.z.object({
|
519
|
+
$data: import_zod5.z.string()
|
455
520
|
}).optional().describe("Parent location"),
|
456
|
-
type:
|
521
|
+
type: AdministrativeAreas
|
457
522
|
}).describe("Administrative area options");
|
458
523
|
var AdministrativeArea = BaseField.extend({
|
459
|
-
type:
|
460
|
-
defaultValue:
|
524
|
+
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
525
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
461
526
|
configuration: AdministrativeAreaConfiguration
|
462
527
|
}).describe("Administrative area input field e.g. facility, office");
|
463
528
|
var Location = BaseField.extend({
|
464
|
-
type:
|
465
|
-
defaultValue:
|
529
|
+
type: import_zod5.z.literal(FieldType.LOCATION),
|
530
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
466
531
|
}).describe("Input field for a location");
|
467
532
|
var FileUploadWithOptions = BaseField.extend({
|
468
|
-
type:
|
469
|
-
options:
|
533
|
+
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
534
|
+
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
470
535
|
}).describe("Select input");
|
471
536
|
var Facility = BaseField.extend({
|
472
|
-
type:
|
473
|
-
defaultValue:
|
537
|
+
type: import_zod5.z.literal(FieldType.FACILITY),
|
538
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
474
539
|
}).describe("Input field for a facility");
|
475
540
|
var Office = BaseField.extend({
|
476
|
-
type:
|
477
|
-
defaultValue:
|
541
|
+
type: import_zod5.z.literal(FieldType.OFFICE),
|
542
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
478
543
|
}).describe("Input field for an office");
|
479
544
|
var Address = BaseField.extend({
|
480
|
-
type:
|
545
|
+
type: import_zod5.z.literal(FieldType.ADDRESS),
|
481
546
|
defaultValue: AddressFieldValue.optional()
|
482
547
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
483
|
-
var FieldConfig =
|
548
|
+
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
484
549
|
Address,
|
485
550
|
TextField,
|
486
551
|
NumberField,
|
@@ -505,28 +570,28 @@ var FieldConfig = import_zod4.z.discriminatedUnion("type", [
|
|
505
570
|
]);
|
506
571
|
|
507
572
|
// ../commons/src/events/FormConfig.ts
|
508
|
-
var FormPage =
|
509
|
-
id:
|
573
|
+
var FormPage = import_zod6.z.object({
|
574
|
+
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
510
575
|
title: TranslationConfig.describe("Header title of the page"),
|
511
|
-
fields:
|
576
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page")
|
512
577
|
});
|
513
|
-
var FormConfig =
|
578
|
+
var FormConfig = import_zod6.z.object({
|
514
579
|
label: TranslationConfig.describe("Human readable description of the form"),
|
515
|
-
version:
|
516
|
-
id:
|
580
|
+
version: import_zod6.z.object({
|
581
|
+
id: import_zod6.z.string().describe(
|
517
582
|
"Form version. Semantic versioning recommended. Example: 0.0.1"
|
518
583
|
),
|
519
584
|
label: TranslationConfig.describe(
|
520
585
|
"Human readable description of the version"
|
521
586
|
)
|
522
587
|
}),
|
523
|
-
active:
|
524
|
-
pages:
|
525
|
-
review:
|
588
|
+
active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
|
589
|
+
pages: import_zod6.z.array(FormPage),
|
590
|
+
review: import_zod6.z.object({
|
526
591
|
title: TranslationConfig.describe(
|
527
592
|
"Title of the form to show in review page"
|
528
593
|
),
|
529
|
-
fields:
|
594
|
+
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
|
530
595
|
})
|
531
596
|
});
|
532
597
|
|
@@ -548,96 +613,90 @@ var ActionType = {
|
|
548
613
|
CUSTOM: "CUSTOM",
|
549
614
|
REJECT: "REJECT",
|
550
615
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
551
|
-
|
616
|
+
ARCHIVE: "ARCHIVE"
|
552
617
|
};
|
553
618
|
|
554
619
|
// ../commons/src/events/ActionConfig.ts
|
555
|
-
var ActionConditional2 =
|
620
|
+
var ActionConditional2 = import_zod7.z.discriminatedUnion("type", [
|
556
621
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
557
622
|
ShowConditional,
|
558
623
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
559
624
|
EnableConditional
|
560
625
|
]);
|
561
|
-
var ActionConfigBase =
|
626
|
+
var ActionConfigBase = import_zod7.z.object({
|
562
627
|
label: TranslationConfig,
|
563
|
-
conditionals:
|
564
|
-
draft:
|
565
|
-
forms:
|
628
|
+
conditionals: import_zod7.z.array(ActionConditional2).optional().default([]),
|
629
|
+
draft: import_zod7.z.boolean().optional(),
|
630
|
+
forms: import_zod7.z.array(FormConfig)
|
566
631
|
});
|
567
632
|
var DeclareConfig = ActionConfigBase.merge(
|
568
|
-
|
569
|
-
type:
|
633
|
+
import_zod7.z.object({
|
634
|
+
type: import_zod7.z.literal(ActionType.DECLARE)
|
570
635
|
})
|
571
636
|
);
|
572
637
|
var ValidateConfig = ActionConfigBase.merge(
|
573
|
-
|
574
|
-
type:
|
638
|
+
import_zod7.z.object({
|
639
|
+
type: import_zod7.z.literal(ActionType.VALIDATE)
|
575
640
|
})
|
576
641
|
);
|
577
642
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
578
|
-
|
579
|
-
type:
|
580
|
-
comment: import_zod6.z.string(),
|
581
|
-
isDuplicate: import_zod6.z.boolean()
|
643
|
+
import_zod7.z.object({
|
644
|
+
type: import_zod7.z.literal(ActionType.REJECT)
|
582
645
|
})
|
583
646
|
);
|
584
647
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
585
|
-
|
586
|
-
type:
|
587
|
-
comment: import_zod6.z.string(),
|
588
|
-
duplicates: import_zod6.z.array(import_zod6.z.string()).describe("UUIDs of duplicate records")
|
648
|
+
import_zod7.z.object({
|
649
|
+
type: import_zod7.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
589
650
|
})
|
590
651
|
);
|
591
|
-
var
|
592
|
-
|
593
|
-
type:
|
594
|
-
comment: import_zod6.z.string(),
|
595
|
-
isDuplicate: import_zod6.z.boolean()
|
652
|
+
var ArchiveConfig = ActionConfigBase.merge(
|
653
|
+
import_zod7.z.object({
|
654
|
+
type: import_zod7.z.literal(ActionType.ARCHIVE)
|
596
655
|
})
|
597
656
|
);
|
598
657
|
var RegisterConfig = ActionConfigBase.merge(
|
599
|
-
|
600
|
-
type:
|
658
|
+
import_zod7.z.object({
|
659
|
+
type: import_zod7.z.literal(ActionType.REGISTER)
|
601
660
|
})
|
602
661
|
);
|
603
662
|
var DeleteConfig = ActionConfigBase.merge(
|
604
|
-
|
605
|
-
type:
|
663
|
+
import_zod7.z.object({
|
664
|
+
type: import_zod7.z.literal(ActionType.DELETE)
|
606
665
|
})
|
607
666
|
);
|
608
667
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
609
|
-
|
610
|
-
type:
|
668
|
+
import_zod7.z.object({
|
669
|
+
type: import_zod7.z.literal(ActionType.PRINT_CERTIFICATE)
|
611
670
|
})
|
612
671
|
);
|
613
672
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
614
|
-
|
615
|
-
type:
|
616
|
-
onboardingForm:
|
617
|
-
additionalDetailsForm:
|
673
|
+
import_zod7.z.object({
|
674
|
+
type: import_zod7.z.literal(ActionType.REQUEST_CORRECTION),
|
675
|
+
onboardingForm: import_zod7.z.array(FormPage),
|
676
|
+
additionalDetailsForm: import_zod7.z.array(FormPage)
|
618
677
|
})
|
619
678
|
);
|
620
679
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
621
|
-
|
622
|
-
type:
|
680
|
+
import_zod7.z.object({
|
681
|
+
type: import_zod7.z.literal(ActionType.REJECT_CORRECTION)
|
623
682
|
})
|
624
683
|
);
|
625
684
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
626
|
-
|
627
|
-
type:
|
685
|
+
import_zod7.z.object({
|
686
|
+
type: import_zod7.z.literal(ActionType.APPROVE_CORRECTION)
|
628
687
|
})
|
629
688
|
);
|
630
689
|
var CustomConfig = ActionConfigBase.merge(
|
631
|
-
|
632
|
-
type:
|
690
|
+
import_zod7.z.object({
|
691
|
+
type: import_zod7.z.literal(ActionType.CUSTOM)
|
633
692
|
})
|
634
693
|
);
|
635
|
-
var ActionConfig =
|
694
|
+
var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
636
695
|
DeclareConfig,
|
637
696
|
ValidateConfig,
|
638
697
|
RejectDeclarationConfig,
|
639
698
|
MarkedAsDuplicateConfig,
|
640
|
-
|
699
|
+
ArchiveConfig,
|
641
700
|
RegisterConfig,
|
642
701
|
DeleteConfig,
|
643
702
|
PrintCertificateActionConfig,
|
@@ -648,97 +707,97 @@ var ActionConfig = import_zod6.z.discriminatedUnion("type", [
|
|
648
707
|
]);
|
649
708
|
|
650
709
|
// ../commons/src/events/offline/CertificateConfig.ts
|
651
|
-
var
|
652
|
-
var FontFamily =
|
653
|
-
normal:
|
654
|
-
bold:
|
655
|
-
italics:
|
656
|
-
bolditalics:
|
710
|
+
var import_zod8 = require("zod");
|
711
|
+
var FontFamily = import_zod8.z.object({
|
712
|
+
normal: import_zod8.z.string(),
|
713
|
+
bold: import_zod8.z.string(),
|
714
|
+
italics: import_zod8.z.string(),
|
715
|
+
bolditalics: import_zod8.z.string()
|
657
716
|
});
|
658
|
-
var CertificateConfig =
|
659
|
-
id:
|
660
|
-
event:
|
717
|
+
var CertificateConfig = import_zod8.z.object({
|
718
|
+
id: import_zod8.z.string(),
|
719
|
+
event: import_zod8.z.string(),
|
661
720
|
label: TranslationConfig,
|
662
|
-
isDefault:
|
663
|
-
fee:
|
664
|
-
onTime:
|
665
|
-
late:
|
666
|
-
delayed:
|
721
|
+
isDefault: import_zod8.z.boolean(),
|
722
|
+
fee: import_zod8.z.object({
|
723
|
+
onTime: import_zod8.z.number(),
|
724
|
+
late: import_zod8.z.number(),
|
725
|
+
delayed: import_zod8.z.number()
|
667
726
|
}),
|
668
|
-
svgUrl:
|
669
|
-
fonts:
|
727
|
+
svgUrl: import_zod8.z.string(),
|
728
|
+
fonts: import_zod8.z.record(FontFamily).optional()
|
670
729
|
});
|
671
730
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
672
|
-
hash:
|
673
|
-
svg:
|
731
|
+
hash: import_zod8.z.string().optional(),
|
732
|
+
svg: import_zod8.z.string()
|
674
733
|
});
|
675
734
|
|
676
735
|
// ../commons/src/events/offline/LanguageConfig.ts
|
677
|
-
var
|
678
|
-
var LanguageConfig =
|
679
|
-
lang:
|
736
|
+
var import_zod9 = require("zod");
|
737
|
+
var LanguageConfig = import_zod9.z.object({
|
738
|
+
lang: import_zod9.z.string(),
|
680
739
|
/**
|
681
740
|
* client.csv contents
|
682
741
|
*/
|
683
|
-
messages:
|
742
|
+
messages: import_zod9.z.record(import_zod9.z.string())
|
684
743
|
});
|
685
744
|
|
686
745
|
// ../commons/src/events/EventConfig.ts
|
687
|
-
var
|
746
|
+
var import_zod18 = require("zod");
|
688
747
|
|
689
748
|
// ../commons/src/events/DeduplicationConfig.ts
|
690
|
-
var
|
691
|
-
var FieldReference =
|
692
|
-
var Matcher =
|
693
|
-
fieldId:
|
694
|
-
options:
|
695
|
-
boost:
|
749
|
+
var import_zod10 = require("zod");
|
750
|
+
var FieldReference = import_zod10.z.string();
|
751
|
+
var Matcher = import_zod10.z.object({
|
752
|
+
fieldId: import_zod10.z.string(),
|
753
|
+
options: import_zod10.z.object({
|
754
|
+
boost: import_zod10.z.number().optional()
|
696
755
|
}).optional().default({})
|
697
756
|
});
|
698
757
|
var FuzzyMatcher = Matcher.extend({
|
699
|
-
type:
|
700
|
-
options:
|
758
|
+
type: import_zod10.z.literal("fuzzy"),
|
759
|
+
options: import_zod10.z.object({
|
701
760
|
/**
|
702
761
|
* Names of length 3 or less characters = 0 edits allowed
|
703
762
|
* Names of length 4 - 6 characters = 1 edit allowed
|
704
763
|
* Names of length >7 characters = 2 edits allowed
|
705
764
|
*/
|
706
|
-
fuzziness:
|
707
|
-
boost:
|
765
|
+
fuzziness: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number()]).optional().default("AUTO:4,7"),
|
766
|
+
boost: import_zod10.z.number().optional().default(1)
|
708
767
|
}).optional().default({})
|
709
768
|
});
|
710
769
|
var StrictMatcher = Matcher.extend({
|
711
|
-
type:
|
712
|
-
options:
|
713
|
-
boost:
|
770
|
+
type: import_zod10.z.literal("strict"),
|
771
|
+
options: import_zod10.z.object({
|
772
|
+
boost: import_zod10.z.number().optional().default(1)
|
714
773
|
}).optional().default({})
|
715
774
|
});
|
716
775
|
var DateRangeMatcher = Matcher.extend({
|
717
|
-
type:
|
718
|
-
options:
|
719
|
-
days:
|
776
|
+
type: import_zod10.z.literal("dateRange"),
|
777
|
+
options: import_zod10.z.object({
|
778
|
+
days: import_zod10.z.number(),
|
720
779
|
origin: FieldReference,
|
721
|
-
boost:
|
780
|
+
boost: import_zod10.z.number().optional().default(1)
|
722
781
|
})
|
723
782
|
});
|
724
783
|
var DateDistanceMatcher = Matcher.extend({
|
725
|
-
type:
|
726
|
-
options:
|
727
|
-
days:
|
784
|
+
type: import_zod10.z.literal("dateDistance"),
|
785
|
+
options: import_zod10.z.object({
|
786
|
+
days: import_zod10.z.number(),
|
728
787
|
origin: FieldReference,
|
729
|
-
boost:
|
788
|
+
boost: import_zod10.z.number().optional().default(1)
|
730
789
|
})
|
731
790
|
});
|
732
|
-
var And =
|
733
|
-
type:
|
734
|
-
clauses:
|
791
|
+
var And = import_zod10.z.object({
|
792
|
+
type: import_zod10.z.literal("and"),
|
793
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
735
794
|
});
|
736
|
-
var Or =
|
737
|
-
type:
|
738
|
-
clauses:
|
795
|
+
var Or = import_zod10.z.object({
|
796
|
+
type: import_zod10.z.literal("or"),
|
797
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
739
798
|
});
|
740
|
-
var Clause =
|
741
|
-
() =>
|
799
|
+
var Clause = import_zod10.z.lazy(
|
800
|
+
() => import_zod10.z.discriminatedUnion("type", [
|
742
801
|
And,
|
743
802
|
Or,
|
744
803
|
FuzzyMatcher,
|
@@ -747,37 +806,37 @@ var Clause = import_zod9.z.lazy(
|
|
747
806
|
DateDistanceMatcher
|
748
807
|
])
|
749
808
|
);
|
750
|
-
var DeduplicationConfig =
|
751
|
-
id:
|
809
|
+
var DeduplicationConfig = import_zod10.z.object({
|
810
|
+
id: import_zod10.z.string(),
|
752
811
|
label: TranslationConfig,
|
753
812
|
query: Clause
|
754
813
|
});
|
755
814
|
|
756
815
|
// ../commons/src/events/SummaryConfig.ts
|
757
|
-
var
|
758
|
-
var Field =
|
759
|
-
id:
|
816
|
+
var import_zod11 = require("zod");
|
817
|
+
var Field = import_zod11.z.object({
|
818
|
+
id: import_zod11.z.string().describe("Id of summary field"),
|
760
819
|
value: TranslationConfig.describe(
|
761
820
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
762
821
|
),
|
763
822
|
label: TranslationConfig,
|
764
823
|
emptyValueMessage: TranslationConfig.optional()
|
765
824
|
});
|
766
|
-
var Title =
|
767
|
-
id:
|
825
|
+
var Title = import_zod11.z.object({
|
826
|
+
id: import_zod11.z.string(),
|
768
827
|
label: TranslationConfig.describe("Title content"),
|
769
828
|
emptyValueMessage: TranslationConfig.optional()
|
770
829
|
});
|
771
|
-
var SummaryConfig =
|
830
|
+
var SummaryConfig = import_zod11.z.object({
|
772
831
|
title: Title.describe("Title of summary view."),
|
773
|
-
fields:
|
832
|
+
fields: import_zod11.z.array(Field).describe("Fields rendered in summary view.")
|
774
833
|
}).describe("Configuration for summary in event.");
|
775
834
|
|
776
835
|
// ../commons/src/events/WorkqueueConfig.ts
|
777
|
-
var
|
836
|
+
var import_zod13 = require("zod");
|
778
837
|
|
779
838
|
// ../commons/src/events/EventMetadata.ts
|
780
|
-
var
|
839
|
+
var import_zod12 = require("zod");
|
781
840
|
var EventStatus = {
|
782
841
|
CREATED: "CREATED",
|
783
842
|
NOTIFIED: "NOTIFIED",
|
@@ -789,18 +848,18 @@ var EventStatus = {
|
|
789
848
|
ARCHIVED: "ARCHIVED"
|
790
849
|
};
|
791
850
|
var eventStatuses = Object.values(EventStatus);
|
792
|
-
var EventStatuses =
|
793
|
-
var EventMetadata =
|
794
|
-
id:
|
795
|
-
type:
|
851
|
+
var EventStatuses = import_zod12.z.nativeEnum(EventStatus);
|
852
|
+
var EventMetadata = import_zod12.z.object({
|
853
|
+
id: import_zod12.z.string(),
|
854
|
+
type: import_zod12.z.string(),
|
796
855
|
status: EventStatuses,
|
797
|
-
createdAt:
|
798
|
-
createdBy:
|
799
|
-
createdAtLocation:
|
800
|
-
modifiedAt:
|
801
|
-
assignedTo:
|
802
|
-
updatedBy:
|
803
|
-
trackingId:
|
856
|
+
createdAt: import_zod12.z.string().datetime(),
|
857
|
+
createdBy: import_zod12.z.string(),
|
858
|
+
createdAtLocation: import_zod12.z.string(),
|
859
|
+
modifiedAt: import_zod12.z.string().datetime(),
|
860
|
+
assignedTo: import_zod12.z.string().nullish(),
|
861
|
+
updatedBy: import_zod12.z.string(),
|
862
|
+
trackingId: import_zod12.z.string()
|
804
863
|
});
|
805
864
|
var eventMetadataLabelMap = {
|
806
865
|
"event.assignedTo": {
|
@@ -856,24 +915,24 @@ var eventMetadataLabelMap = {
|
|
856
915
|
};
|
857
916
|
|
858
917
|
// ../commons/src/events/WorkqueueConfig.ts
|
859
|
-
var WorkqueueConfig =
|
860
|
-
id:
|
861
|
-
filters:
|
862
|
-
|
863
|
-
status:
|
918
|
+
var WorkqueueConfig = import_zod13.z.object({
|
919
|
+
id: import_zod13.z.string().describe("Unique identifier for workqueue."),
|
920
|
+
filters: import_zod13.z.array(
|
921
|
+
import_zod13.z.object({
|
922
|
+
status: import_zod13.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
864
923
|
})
|
865
924
|
).describe("Filters to be applied to workqueue.")
|
866
925
|
}).describe("Configuration for workqueue.");
|
867
926
|
|
868
927
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
869
|
-
var
|
870
|
-
var AdvancedSearchConfig =
|
928
|
+
var import_zod14 = require("zod");
|
929
|
+
var AdvancedSearchConfig = import_zod14.z.object({
|
871
930
|
title: TranslationConfig.describe("Advanced search tab title"),
|
872
|
-
fields:
|
873
|
-
|
874
|
-
fieldId:
|
875
|
-
config:
|
876
|
-
type:
|
931
|
+
fields: import_zod14.z.array(
|
932
|
+
import_zod14.z.object({
|
933
|
+
fieldId: import_zod14.z.string(),
|
934
|
+
config: import_zod14.z.object({
|
935
|
+
type: import_zod14.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
877
936
|
}).optional().describe("Configuration options for the field")
|
878
937
|
})
|
879
938
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -883,12 +942,12 @@ var AdvancedSearchConfig = import_zod13.z.object({
|
|
883
942
|
var import_lodash = require("lodash");
|
884
943
|
|
885
944
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
886
|
-
var
|
945
|
+
var import_zod16 = require("zod");
|
887
946
|
|
888
947
|
// ../commons/src/workqueues/defaultColumns.ts
|
889
|
-
var
|
890
|
-
var WorkQueueColumnConfig =
|
891
|
-
id:
|
948
|
+
var import_zod15 = require("zod");
|
949
|
+
var WorkQueueColumnConfig = import_zod15.z.object({
|
950
|
+
id: import_zod15.z.string(),
|
892
951
|
label: TranslationConfig
|
893
952
|
});
|
894
953
|
var defaultColumns = {
|
@@ -925,16 +984,16 @@ var defaultColumns = {
|
|
925
984
|
}
|
926
985
|
}
|
927
986
|
};
|
928
|
-
var DefaultColumnKeys =
|
987
|
+
var DefaultColumnKeys = import_zod15.z.enum(
|
929
988
|
Object.keys(defaultColumns)
|
930
989
|
);
|
931
990
|
|
932
991
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
933
|
-
var rootWorkqueueConfig =
|
934
|
-
id:
|
992
|
+
var rootWorkqueueConfig = import_zod16.z.object({
|
993
|
+
id: import_zod16.z.string(),
|
935
994
|
title: TranslationConfig,
|
936
|
-
columns:
|
937
|
-
defaultColumns:
|
995
|
+
columns: import_zod16.z.array(WorkQueueColumnConfig),
|
996
|
+
defaultColumns: import_zod16.z.array(DefaultColumnKeys)
|
938
997
|
});
|
939
998
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
940
999
|
|
@@ -1014,7 +1073,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1014
1073
|
var import_date_fns = require("date-fns");
|
1015
1074
|
|
1016
1075
|
// ../commons/src/events/FieldTypeMapping.ts
|
1017
|
-
var
|
1076
|
+
var import_zod17 = require("zod");
|
1018
1077
|
function mapFieldTypeToZod(type, required) {
|
1019
1078
|
let schema;
|
1020
1079
|
switch (type) {
|
@@ -1054,17 +1113,17 @@ function mapFieldTypeToZod(type, required) {
|
|
1054
1113
|
schema = FileFieldWithOptionValue;
|
1055
1114
|
break;
|
1056
1115
|
case FieldType.ADDRESS:
|
1057
|
-
schema =
|
1116
|
+
schema = AddressFieldUpdateValue;
|
1058
1117
|
break;
|
1059
1118
|
}
|
1060
|
-
return required ? schema : schema.
|
1119
|
+
return required ? schema : schema.nullish();
|
1061
1120
|
}
|
1062
1121
|
function createValidationSchema(config) {
|
1063
1122
|
const shape = {};
|
1064
1123
|
for (const field2 of config) {
|
1065
1124
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1066
1125
|
}
|
1067
|
-
return
|
1126
|
+
return import_zod17.z.object(shape);
|
1068
1127
|
}
|
1069
1128
|
function mapFieldTypeToMockValue(field2, i) {
|
1070
1129
|
switch (field2.type) {
|
@@ -1317,6 +1376,20 @@ function validateFieldInput({
|
|
1317
1376
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1318
1377
|
}
|
1319
1378
|
|
1379
|
+
// ../commons/src/utils.ts
|
1380
|
+
function getOrThrow(x, message) {
|
1381
|
+
if (x === void 0 || x === null) {
|
1382
|
+
throw new Error(message);
|
1383
|
+
}
|
1384
|
+
return x;
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
// ../commons/src/uuid.ts
|
1388
|
+
var import_uuid = require("uuid");
|
1389
|
+
function getUUID() {
|
1390
|
+
return (0, import_uuid.v4)();
|
1391
|
+
}
|
1392
|
+
|
1320
1393
|
// ../commons/src/events/utils.ts
|
1321
1394
|
function isMetadataField(field2) {
|
1322
1395
|
return field2 in eventMetadataLabelMap;
|
@@ -1396,14 +1469,36 @@ var findActiveActionForm = (configuration, action) => {
|
|
1396
1469
|
const form = actionConfig?.forms.find((f) => f.active);
|
1397
1470
|
return form;
|
1398
1471
|
};
|
1472
|
+
var findActiveActionFormPages = (configuration, action) => {
|
1473
|
+
return findActiveActionForm(configuration, action)?.pages;
|
1474
|
+
};
|
1399
1475
|
var getFormFields = (formConfig) => {
|
1400
1476
|
return formConfig.pages.flatMap((p) => p.fields);
|
1401
1477
|
};
|
1478
|
+
var findActiveActionFormFields = (configuration, action) => {
|
1479
|
+
const form = findActiveActionForm(configuration, action);
|
1480
|
+
return form ? getFormFields(form) : void 0;
|
1481
|
+
};
|
1402
1482
|
var findActiveActionFields = (configuration, action) => {
|
1403
1483
|
const form = findActiveActionForm(configuration, action);
|
1404
|
-
const reviewFields = form?.review.fields
|
1405
|
-
|
1484
|
+
const reviewFields = form?.review.fields;
|
1485
|
+
const formFields = form ? getFormFields(form) : void 0;
|
1486
|
+
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1487
|
+
return allFields;
|
1406
1488
|
};
|
1489
|
+
var getActiveActionFormPages = (configuration, action) => {
|
1490
|
+
return getOrThrow(
|
1491
|
+
findActiveActionForm(configuration, action)?.pages,
|
1492
|
+
"Form configuration not found for type: " + configuration.id
|
1493
|
+
);
|
1494
|
+
};
|
1495
|
+
function getActiveActionFields(configuration, action) {
|
1496
|
+
const fields = findActiveActionFields(configuration, action);
|
1497
|
+
if (!fields) {
|
1498
|
+
throw new Error(`No active field config found for action type ${action}`);
|
1499
|
+
}
|
1500
|
+
return fields;
|
1501
|
+
}
|
1407
1502
|
function getEventConfiguration(eventConfigurations, type) {
|
1408
1503
|
const config = eventConfigurations.find((config2) => config2.id === type);
|
1409
1504
|
if (!config) {
|
@@ -1412,16 +1507,13 @@ function getEventConfiguration(eventConfigurations, type) {
|
|
1412
1507
|
return config;
|
1413
1508
|
}
|
1414
1509
|
function isOptionalUncheckedCheckbox(field2, form) {
|
1415
|
-
if (field2.type !==
|
1416
|
-
return false;
|
1417
|
-
}
|
1418
|
-
if (field2.required) {
|
1510
|
+
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1419
1511
|
return false;
|
1420
1512
|
}
|
1421
1513
|
return !form[field2.id];
|
1422
1514
|
}
|
1423
1515
|
function stripHiddenFields(fields, data) {
|
1424
|
-
return (0, import_lodash.omitBy)(data, (
|
1516
|
+
return (0, import_lodash.omitBy)(data, (_2, fieldId) => {
|
1425
1517
|
const field2 = fields.find((f) => f.id === fieldId);
|
1426
1518
|
if (!field2) {
|
1427
1519
|
return true;
|
@@ -1432,18 +1524,39 @@ function stripHiddenFields(fields, data) {
|
|
1432
1524
|
return !isFieldVisible(field2, data);
|
1433
1525
|
});
|
1434
1526
|
}
|
1527
|
+
function findActiveDrafts(event2, drafts) {
|
1528
|
+
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1529
|
+
const lastAction = actions[actions.length - 1];
|
1530
|
+
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
1531
|
+
}
|
1532
|
+
function createEmptyDraft(eventId, draftId, actionType) {
|
1533
|
+
return {
|
1534
|
+
id: draftId,
|
1535
|
+
eventId,
|
1536
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1537
|
+
transactionId: getUUID(),
|
1538
|
+
action: {
|
1539
|
+
type: actionType,
|
1540
|
+
data: {},
|
1541
|
+
metadata: {},
|
1542
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1543
|
+
createdBy: "@todo",
|
1544
|
+
createdAtLocation: "@todo"
|
1545
|
+
}
|
1546
|
+
};
|
1547
|
+
}
|
1435
1548
|
|
1436
1549
|
// ../commons/src/events/EventConfig.ts
|
1437
|
-
var EventConfig =
|
1438
|
-
id:
|
1550
|
+
var EventConfig = import_zod18.z.object({
|
1551
|
+
id: import_zod18.z.string().describe(
|
1439
1552
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1440
1553
|
),
|
1441
1554
|
summary: SummaryConfig,
|
1442
1555
|
label: TranslationConfig,
|
1443
|
-
actions:
|
1444
|
-
workqueues:
|
1445
|
-
deduplication:
|
1446
|
-
advancedSearch:
|
1556
|
+
actions: import_zod18.z.array(ActionConfig),
|
1557
|
+
workqueues: import_zod18.z.array(WorkqueueConfig),
|
1558
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
1559
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
1447
1560
|
}).superRefine((event2, ctx) => {
|
1448
1561
|
const allFields = findPageFields(event2);
|
1449
1562
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1476,107 +1589,107 @@ var defineForm = (form) => FormConfig.parse(form);
|
|
1476
1589
|
var defineFormPage = (formPage) => FormPage.parse(formPage);
|
1477
1590
|
|
1478
1591
|
// ../commons/src/events/Draft.ts
|
1479
|
-
var
|
1592
|
+
var import_zod21 = require("zod");
|
1480
1593
|
|
1481
1594
|
// ../commons/src/events/ActionDocument.ts
|
1482
|
-
var
|
1483
|
-
var
|
1484
|
-
var ActionBase =
|
1485
|
-
id:
|
1486
|
-
createdAt:
|
1487
|
-
createdBy:
|
1488
|
-
data:
|
1489
|
-
metadata:
|
1490
|
-
createdAtLocation:
|
1595
|
+
var import_zod19 = require("zod");
|
1596
|
+
var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
|
1597
|
+
var ActionBase = import_zod19.z.object({
|
1598
|
+
id: import_zod19.z.string(),
|
1599
|
+
createdAt: import_zod19.z.string().datetime(),
|
1600
|
+
createdBy: import_zod19.z.string(),
|
1601
|
+
data: ActionUpdate,
|
1602
|
+
metadata: ActionUpdate.optional(),
|
1603
|
+
createdAtLocation: import_zod19.z.string()
|
1491
1604
|
});
|
1492
1605
|
var AssignedAction = ActionBase.merge(
|
1493
|
-
|
1494
|
-
type:
|
1495
|
-
assignedTo:
|
1606
|
+
import_zod19.z.object({
|
1607
|
+
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1608
|
+
assignedTo: import_zod19.z.string()
|
1496
1609
|
})
|
1497
1610
|
);
|
1498
1611
|
var UnassignedAction = ActionBase.merge(
|
1499
|
-
|
1500
|
-
type:
|
1612
|
+
import_zod19.z.object({
|
1613
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN)
|
1501
1614
|
})
|
1502
1615
|
);
|
1503
1616
|
var RegisterAction = ActionBase.merge(
|
1504
|
-
|
1505
|
-
type:
|
1506
|
-
identifiers:
|
1507
|
-
trackingId:
|
1508
|
-
registrationNumber:
|
1617
|
+
import_zod19.z.object({
|
1618
|
+
type: import_zod19.z.literal(ActionType.REGISTER),
|
1619
|
+
identifiers: import_zod19.z.object({
|
1620
|
+
trackingId: import_zod19.z.string(),
|
1621
|
+
registrationNumber: import_zod19.z.string()
|
1509
1622
|
})
|
1510
1623
|
})
|
1511
1624
|
);
|
1512
1625
|
var DeclareAction = ActionBase.merge(
|
1513
|
-
|
1514
|
-
type:
|
1626
|
+
import_zod19.z.object({
|
1627
|
+
type: import_zod19.z.literal(ActionType.DECLARE)
|
1515
1628
|
})
|
1516
1629
|
);
|
1517
1630
|
var ValidateAction = ActionBase.merge(
|
1518
|
-
|
1519
|
-
type:
|
1631
|
+
import_zod19.z.object({
|
1632
|
+
type: import_zod19.z.literal(ActionType.VALIDATE)
|
1520
1633
|
})
|
1521
1634
|
);
|
1522
1635
|
var RejectAction = ActionBase.merge(
|
1523
|
-
|
1524
|
-
type:
|
1636
|
+
import_zod19.z.object({
|
1637
|
+
type: import_zod19.z.literal(ActionType.REJECT)
|
1525
1638
|
})
|
1526
1639
|
);
|
1527
1640
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1528
|
-
|
1529
|
-
type:
|
1641
|
+
import_zod19.z.object({
|
1642
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1530
1643
|
})
|
1531
1644
|
);
|
1532
|
-
var
|
1533
|
-
|
1534
|
-
type:
|
1645
|
+
var ArchiveAction = ActionBase.merge(
|
1646
|
+
import_zod19.z.object({
|
1647
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE)
|
1535
1648
|
})
|
1536
1649
|
);
|
1537
1650
|
var CreatedAction = ActionBase.merge(
|
1538
|
-
|
1539
|
-
type:
|
1651
|
+
import_zod19.z.object({
|
1652
|
+
type: import_zod19.z.literal(ActionType.CREATE)
|
1540
1653
|
})
|
1541
1654
|
);
|
1542
1655
|
var NotifiedAction = ActionBase.merge(
|
1543
|
-
|
1544
|
-
type:
|
1656
|
+
import_zod19.z.object({
|
1657
|
+
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1545
1658
|
})
|
1546
1659
|
);
|
1547
1660
|
var PrintCertificateAction = ActionBase.merge(
|
1548
|
-
|
1549
|
-
type:
|
1661
|
+
import_zod19.z.object({
|
1662
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
1550
1663
|
})
|
1551
1664
|
);
|
1552
1665
|
var RequestedCorrectionAction = ActionBase.merge(
|
1553
|
-
|
1554
|
-
type:
|
1666
|
+
import_zod19.z.object({
|
1667
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
|
1555
1668
|
})
|
1556
1669
|
);
|
1557
1670
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1558
|
-
|
1559
|
-
type:
|
1560
|
-
requestId:
|
1671
|
+
import_zod19.z.object({
|
1672
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1673
|
+
requestId: import_zod19.z.string()
|
1561
1674
|
})
|
1562
1675
|
);
|
1563
1676
|
var RejectedCorrectionAction = ActionBase.merge(
|
1564
|
-
|
1565
|
-
type:
|
1566
|
-
requestId:
|
1677
|
+
import_zod19.z.object({
|
1678
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1679
|
+
requestId: import_zod19.z.string()
|
1567
1680
|
})
|
1568
1681
|
);
|
1569
1682
|
var CustomAction = ActionBase.merge(
|
1570
|
-
|
1571
|
-
type:
|
1683
|
+
import_zod19.z.object({
|
1684
|
+
type: import_zod19.z.literal(ActionType.CUSTOM)
|
1572
1685
|
})
|
1573
1686
|
);
|
1574
|
-
var ActionDocument =
|
1687
|
+
var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
1575
1688
|
CreatedAction,
|
1576
1689
|
ValidateAction,
|
1577
1690
|
RejectAction,
|
1578
1691
|
MarkAsDuplicateAction,
|
1579
|
-
|
1692
|
+
ArchiveAction,
|
1580
1693
|
NotifiedAction,
|
1581
1694
|
RegisterAction,
|
1582
1695
|
DeclareAction,
|
@@ -1588,107 +1701,106 @@ var ActionDocument = import_zod18.z.discriminatedUnion("type", [
|
|
1588
1701
|
PrintCertificateAction,
|
1589
1702
|
CustomAction
|
1590
1703
|
]);
|
1591
|
-
var ResolvedUser =
|
1592
|
-
id:
|
1593
|
-
role:
|
1594
|
-
name:
|
1595
|
-
|
1596
|
-
use:
|
1597
|
-
given:
|
1598
|
-
family:
|
1704
|
+
var ResolvedUser = import_zod19.z.object({
|
1705
|
+
id: import_zod19.z.string(),
|
1706
|
+
role: import_zod19.z.string(),
|
1707
|
+
name: import_zod19.z.array(
|
1708
|
+
import_zod19.z.object({
|
1709
|
+
use: import_zod19.z.string(),
|
1710
|
+
given: import_zod19.z.array(import_zod19.z.string()),
|
1711
|
+
family: import_zod19.z.string()
|
1599
1712
|
})
|
1600
1713
|
)
|
1601
1714
|
});
|
1602
1715
|
|
1603
1716
|
// ../commons/src/events/ActionInput.ts
|
1604
|
-
var
|
1605
|
-
var BaseActionInput =
|
1606
|
-
eventId:
|
1607
|
-
transactionId:
|
1608
|
-
|
1609
|
-
|
1610
|
-
metadata: import_zod19.z.record(import_zod19.z.string(), FieldValue).optional()
|
1717
|
+
var import_zod20 = require("zod");
|
1718
|
+
var BaseActionInput = import_zod20.z.object({
|
1719
|
+
eventId: import_zod20.z.string(),
|
1720
|
+
transactionId: import_zod20.z.string(),
|
1721
|
+
data: ActionUpdate,
|
1722
|
+
metadata: ActionUpdate.optional()
|
1611
1723
|
});
|
1612
1724
|
var CreateActionInput = BaseActionInput.merge(
|
1613
|
-
|
1614
|
-
type:
|
1615
|
-
createdAtLocation:
|
1725
|
+
import_zod20.z.object({
|
1726
|
+
type: import_zod20.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
1727
|
+
createdAtLocation: import_zod20.z.string()
|
1616
1728
|
})
|
1617
1729
|
);
|
1618
1730
|
var RegisterActionInput = BaseActionInput.merge(
|
1619
|
-
|
1620
|
-
type:
|
1621
|
-
identifiers:
|
1622
|
-
trackingId:
|
1623
|
-
registrationNumber:
|
1731
|
+
import_zod20.z.object({
|
1732
|
+
type: import_zod20.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
1733
|
+
identifiers: import_zod20.z.object({
|
1734
|
+
trackingId: import_zod20.z.string(),
|
1735
|
+
registrationNumber: import_zod20.z.string()
|
1624
1736
|
})
|
1625
1737
|
})
|
1626
1738
|
);
|
1627
1739
|
var ValidateActionInput = BaseActionInput.merge(
|
1628
|
-
|
1629
|
-
type:
|
1630
|
-
duplicates:
|
1740
|
+
import_zod20.z.object({
|
1741
|
+
type: import_zod20.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
1742
|
+
duplicates: import_zod20.z.array(import_zod20.z.string())
|
1631
1743
|
})
|
1632
1744
|
);
|
1633
1745
|
var NotifyActionInput = BaseActionInput.merge(
|
1634
|
-
|
1635
|
-
type:
|
1746
|
+
import_zod20.z.object({
|
1747
|
+
type: import_zod20.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1636
1748
|
})
|
1637
1749
|
);
|
1638
1750
|
var DeclareActionInput = BaseActionInput.merge(
|
1639
|
-
|
1640
|
-
type:
|
1751
|
+
import_zod20.z.object({
|
1752
|
+
type: import_zod20.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1641
1753
|
})
|
1642
1754
|
);
|
1643
1755
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1644
|
-
|
1645
|
-
type:
|
1756
|
+
import_zod20.z.object({
|
1757
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1646
1758
|
})
|
1647
1759
|
);
|
1648
1760
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1649
|
-
|
1650
|
-
type:
|
1761
|
+
import_zod20.z.object({
|
1762
|
+
type: import_zod20.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1651
1763
|
})
|
1652
1764
|
);
|
1653
1765
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1654
|
-
|
1655
|
-
type:
|
1766
|
+
import_zod20.z.object({
|
1767
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1656
1768
|
})
|
1657
1769
|
);
|
1658
|
-
var
|
1659
|
-
|
1660
|
-
type:
|
1770
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
1771
|
+
import_zod20.z.object({
|
1772
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1661
1773
|
})
|
1662
1774
|
);
|
1663
1775
|
var AssignActionInput = BaseActionInput.merge(
|
1664
|
-
|
1665
|
-
type:
|
1666
|
-
assignedTo:
|
1776
|
+
import_zod20.z.object({
|
1777
|
+
type: import_zod20.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1778
|
+
assignedTo: import_zod20.z.string()
|
1667
1779
|
})
|
1668
1780
|
);
|
1669
1781
|
var UnassignActionInput = BaseActionInput.merge(
|
1670
|
-
|
1671
|
-
type:
|
1782
|
+
import_zod20.z.object({
|
1783
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
|
1672
1784
|
})
|
1673
1785
|
);
|
1674
1786
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1675
|
-
|
1676
|
-
type:
|
1787
|
+
import_zod20.z.object({
|
1788
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1677
1789
|
})
|
1678
1790
|
);
|
1679
1791
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1680
|
-
|
1681
|
-
requestId:
|
1682
|
-
type:
|
1792
|
+
import_zod20.z.object({
|
1793
|
+
requestId: import_zod20.z.string(),
|
1794
|
+
type: import_zod20.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
1683
1795
|
})
|
1684
1796
|
);
|
1685
1797
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1686
|
-
|
1687
|
-
requestId:
|
1688
|
-
type:
|
1798
|
+
import_zod20.z.object({
|
1799
|
+
requestId: import_zod20.z.string(),
|
1800
|
+
type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
1689
1801
|
})
|
1690
1802
|
);
|
1691
|
-
var ActionInput =
|
1803
|
+
var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
1692
1804
|
CreateActionInput,
|
1693
1805
|
ValidateActionInput,
|
1694
1806
|
RegisterActionInput,
|
@@ -1696,7 +1808,7 @@ var ActionInput = import_zod19.z.discriminatedUnion("type", [
|
|
1696
1808
|
DeclareActionInput,
|
1697
1809
|
RejectDeclarationActionInput,
|
1698
1810
|
MarkedAsDuplicateActionInput,
|
1699
|
-
|
1811
|
+
ArchiveActionInput,
|
1700
1812
|
AssignActionInput,
|
1701
1813
|
UnassignActionInput,
|
1702
1814
|
PrintCertificateActionInput,
|
@@ -1706,50 +1818,51 @@ var ActionInput = import_zod19.z.discriminatedUnion("type", [
|
|
1706
1818
|
]);
|
1707
1819
|
|
1708
1820
|
// ../commons/src/events/Draft.ts
|
1709
|
-
var Draft =
|
1710
|
-
id:
|
1711
|
-
eventId:
|
1712
|
-
transactionId:
|
1713
|
-
createdAt:
|
1821
|
+
var Draft = import_zod21.z.object({
|
1822
|
+
id: import_zod21.z.string(),
|
1823
|
+
eventId: import_zod21.z.string(),
|
1824
|
+
transactionId: import_zod21.z.string(),
|
1825
|
+
createdAt: import_zod21.z.string().datetime(),
|
1714
1826
|
action: ActionBase.extend({
|
1715
|
-
type:
|
1827
|
+
type: import_zod21.z.enum(Object.values(ActionType))
|
1716
1828
|
}).omit({ id: true })
|
1717
1829
|
});
|
1718
1830
|
var DraftInput = BaseActionInput.extend({
|
1719
|
-
type:
|
1831
|
+
type: import_zod21.z.enum(Object.values(ActionType))
|
1720
1832
|
});
|
1721
1833
|
|
1722
1834
|
// ../commons/src/events/EventInput.ts
|
1723
|
-
var
|
1724
|
-
var EventInput =
|
1725
|
-
transactionId:
|
1726
|
-
type:
|
1835
|
+
var import_zod22 = require("zod");
|
1836
|
+
var EventInput = import_zod22.z.object({
|
1837
|
+
transactionId: import_zod22.z.string(),
|
1838
|
+
type: import_zod22.z.string()
|
1727
1839
|
});
|
1728
1840
|
|
1729
1841
|
// ../commons/src/events/EventDocument.ts
|
1730
|
-
var
|
1731
|
-
var EventDocument =
|
1732
|
-
id:
|
1733
|
-
type:
|
1734
|
-
createdAt:
|
1735
|
-
updatedAt:
|
1736
|
-
actions:
|
1737
|
-
trackingId:
|
1842
|
+
var import_zod23 = require("zod");
|
1843
|
+
var EventDocument = import_zod23.z.object({
|
1844
|
+
id: import_zod23.z.string(),
|
1845
|
+
type: import_zod23.z.string(),
|
1846
|
+
createdAt: import_zod23.z.string().datetime(),
|
1847
|
+
updatedAt: import_zod23.z.string().datetime(),
|
1848
|
+
actions: import_zod23.z.array(ActionDocument),
|
1849
|
+
trackingId: import_zod23.z.string()
|
1738
1850
|
});
|
1739
1851
|
|
1740
1852
|
// ../commons/src/events/EventIndex.ts
|
1741
|
-
var
|
1853
|
+
var import_zod24 = require("zod");
|
1742
1854
|
var EventIndex = EventMetadata.extend({
|
1743
|
-
data:
|
1855
|
+
data: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any())
|
1744
1856
|
});
|
1745
|
-
var EventSearchIndex =
|
1746
|
-
|
1747
|
-
type:
|
1857
|
+
var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
|
1858
|
+
import_zod24.z.object({
|
1859
|
+
type: import_zod24.z.string()
|
1748
1860
|
// Ensures "type" (event-id) exists and is a string
|
1749
1861
|
})
|
1750
1862
|
);
|
1751
1863
|
|
1752
1864
|
// ../commons/src/events/state/index.ts
|
1865
|
+
var _ = __toESM(require("lodash"));
|
1753
1866
|
function getStatusFromActions(actions) {
|
1754
1867
|
return actions.reduce((status, action) => {
|
1755
1868
|
if (action.type === ActionType.CREATE) {
|
@@ -1767,7 +1880,7 @@ function getStatusFromActions(actions) {
|
|
1767
1880
|
if (action.type === ActionType.REJECT) {
|
1768
1881
|
return EventStatus.REJECTED;
|
1769
1882
|
}
|
1770
|
-
if (action.type === ActionType.
|
1883
|
+
if (action.type === ActionType.ARCHIVE) {
|
1771
1884
|
return EventStatus.ARCHIVED;
|
1772
1885
|
}
|
1773
1886
|
if (action.type === ActionType.NOTIFY) {
|
@@ -1801,19 +1914,46 @@ function getData(actions) {
|
|
1801
1914
|
if (!requestAction) {
|
1802
1915
|
return status;
|
1803
1916
|
}
|
1917
|
+
return deepMerge(status, requestAction.data);
|
1918
|
+
}
|
1919
|
+
return deepMerge(status, action.data);
|
1920
|
+
}, {});
|
1921
|
+
}
|
1922
|
+
function deepDropNulls(obj) {
|
1923
|
+
if (!_.isObject(obj)) return obj;
|
1924
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
1925
|
+
if (_.isObject(value)) {
|
1926
|
+
value = deepDropNulls(value);
|
1927
|
+
}
|
1928
|
+
if (value !== null) {
|
1804
1929
|
return {
|
1805
|
-
...
|
1806
|
-
|
1930
|
+
...acc,
|
1931
|
+
[key]: value
|
1807
1932
|
};
|
1808
1933
|
}
|
1809
|
-
return
|
1810
|
-
...status,
|
1811
|
-
...action.data
|
1812
|
-
};
|
1934
|
+
return acc;
|
1813
1935
|
}, {});
|
1814
1936
|
}
|
1815
|
-
function
|
1816
|
-
return
|
1937
|
+
function deepMerge(currentDocument, actionDocument) {
|
1938
|
+
return _.mergeWith(
|
1939
|
+
currentDocument,
|
1940
|
+
actionDocument,
|
1941
|
+
(previousValue, incomingValue) => {
|
1942
|
+
if (incomingValue === void 0) {
|
1943
|
+
return previousValue;
|
1944
|
+
}
|
1945
|
+
if (_.isArray(incomingValue)) {
|
1946
|
+
return incomingValue;
|
1947
|
+
}
|
1948
|
+
if (_.isObject(previousValue) && _.isObject(incomingValue)) {
|
1949
|
+
return void 0;
|
1950
|
+
}
|
1951
|
+
return incomingValue;
|
1952
|
+
}
|
1953
|
+
);
|
1954
|
+
}
|
1955
|
+
function isUndeclaredDraft(status) {
|
1956
|
+
return status === EventStatus.CREATED;
|
1817
1957
|
}
|
1818
1958
|
function getCurrentEventState(event2) {
|
1819
1959
|
const creationAction = event2.actions.find(
|
@@ -1823,7 +1963,7 @@ function getCurrentEventState(event2) {
|
|
1823
1963
|
throw new Error(`Event ${event2.id} has no creation action`);
|
1824
1964
|
}
|
1825
1965
|
const latestAction = event2.actions[event2.actions.length - 1];
|
1826
|
-
return {
|
1966
|
+
return deepDropNulls({
|
1827
1967
|
id: event2.id,
|
1828
1968
|
type: event2.type,
|
1829
1969
|
status: getStatusFromActions(event2.actions),
|
@@ -1835,14 +1975,11 @@ function getCurrentEventState(event2) {
|
|
1835
1975
|
updatedBy: latestAction.createdBy,
|
1836
1976
|
data: getData(event2.actions),
|
1837
1977
|
trackingId: event2.trackingId
|
1838
|
-
};
|
1978
|
+
});
|
1839
1979
|
}
|
1840
1980
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
1841
|
-
const actions = event2.actions.slice().sort();
|
1842
|
-
const
|
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) => {
|
1981
|
+
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1982
|
+
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
1846
1983
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1847
1984
|
return [
|
1848
1985
|
action,
|
@@ -1875,20 +2012,21 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
1875
2012
|
}
|
1876
2013
|
};
|
1877
2014
|
}
|
1878
|
-
function getMetadataForAction(
|
2015
|
+
function getMetadataForAction({
|
2016
|
+
event: event2,
|
2017
|
+
actionType,
|
2018
|
+
drafts
|
2019
|
+
}) {
|
1879
2020
|
const action = event2.actions.find((action2) => actionType === action2.type);
|
1880
|
-
const
|
2021
|
+
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
1881
2022
|
const sorted = [
|
1882
2023
|
...action ? [action] : [],
|
1883
|
-
...
|
2024
|
+
...eventDrafts.map((draft) => draft.action)
|
1884
2025
|
].sort();
|
1885
2026
|
const metadata = sorted.reduce((metadata2, action2) => {
|
1886
|
-
return {
|
1887
|
-
...metadata2,
|
1888
|
-
...action2.metadata
|
1889
|
-
};
|
2027
|
+
return deepMerge(metadata2, action2.metadata ?? {});
|
1890
2028
|
}, {});
|
1891
|
-
return metadata;
|
2029
|
+
return deepDropNulls(metadata);
|
1892
2030
|
}
|
1893
2031
|
|
1894
2032
|
// ../commons/src/events/defineConfig.ts
|
@@ -1902,12 +2040,6 @@ var defineConfig = (config) => {
|
|
1902
2040
|
});
|
1903
2041
|
};
|
1904
2042
|
|
1905
|
-
// ../commons/src/uuid.ts
|
1906
|
-
var import_uuid = require("uuid");
|
1907
|
-
function getUUID() {
|
1908
|
-
return (0, import_uuid.v4)();
|
1909
|
-
}
|
1910
|
-
|
1911
2043
|
// ../commons/src/events/transactions.ts
|
1912
2044
|
function generateTransactionId() {
|
1913
2045
|
return getUUID();
|
@@ -2779,7 +2911,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
2779
2911
|
review: {
|
2780
2912
|
title: {
|
2781
2913
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
2782
|
-
defaultMessage: "Member declaration for {firstname} {surname}",
|
2914
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
2783
2915
|
description: "Title of the form to show in review page"
|
2784
2916
|
},
|
2785
2917
|
fields: [
|
@@ -3049,7 +3181,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3049
3181
|
],
|
3050
3182
|
actions: [
|
3051
3183
|
{
|
3052
|
-
type:
|
3184
|
+
type: ActionType.DECLARE,
|
3053
3185
|
label: {
|
3054
3186
|
defaultMessage: "Send an application",
|
3055
3187
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3058,25 +3190,25 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3058
3190
|
forms: [TENNIS_CLUB_FORM]
|
3059
3191
|
},
|
3060
3192
|
{
|
3061
|
-
type:
|
3193
|
+
type: ActionType.VALIDATE,
|
3062
3194
|
label: {
|
3063
|
-
defaultMessage: "
|
3195
|
+
defaultMessage: "Validate",
|
3064
3196
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3065
|
-
id: "event.tennis-club-membership.action.
|
3197
|
+
id: "event.tennis-club-membership.action.validate.label"
|
3066
3198
|
},
|
3067
3199
|
forms: [TENNIS_CLUB_FORM]
|
3068
3200
|
},
|
3069
3201
|
{
|
3070
|
-
type:
|
3202
|
+
type: ActionType.REGISTER,
|
3071
3203
|
label: {
|
3072
|
-
defaultMessage: "
|
3204
|
+
defaultMessage: "Register",
|
3073
3205
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3074
|
-
id: "event.tennis-club-membership.action.
|
3206
|
+
id: "event.tennis-club-membership.action.register.label"
|
3075
3207
|
},
|
3076
|
-
forms: []
|
3208
|
+
forms: [TENNIS_CLUB_FORM]
|
3077
3209
|
},
|
3078
3210
|
{
|
3079
|
-
type:
|
3211
|
+
type: ActionType.REQUEST_CORRECTION,
|
3080
3212
|
label: {
|
3081
3213
|
defaultMessage: "Request correction",
|
3082
3214
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3272,7 +3404,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3272
3404
|
]
|
3273
3405
|
},
|
3274
3406
|
{
|
3275
|
-
type:
|
3407
|
+
type: ActionType.APPROVE_CORRECTION,
|
3276
3408
|
forms: [TENNIS_CLUB_FORM],
|
3277
3409
|
label: {
|
3278
3410
|
defaultMessage: "Approve correction",
|
@@ -3327,6 +3459,24 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3327
3459
|
})
|
3328
3460
|
}
|
3329
3461
|
]
|
3462
|
+
},
|
3463
|
+
{
|
3464
|
+
type: ActionType.ARCHIVE,
|
3465
|
+
label: {
|
3466
|
+
id: "v2.event.tennis-club-membership.action.archive.label",
|
3467
|
+
defaultMessage: "Archive",
|
3468
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3469
|
+
},
|
3470
|
+
forms: [TENNIS_CLUB_FORM]
|
3471
|
+
},
|
3472
|
+
{
|
3473
|
+
type: ActionType.REJECT,
|
3474
|
+
label: {
|
3475
|
+
id: "v2.event.tennis-club-membership.action.reject.label",
|
3476
|
+
defaultMessage: "Reject",
|
3477
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3478
|
+
},
|
3479
|
+
forms: [TENNIS_CLUB_FORM]
|
3330
3480
|
}
|
3331
3481
|
],
|
3332
3482
|
advancedSearch: [
|
@@ -3347,7 +3497,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3347
3497
|
|
3348
3498
|
// ../commons/src/events/test.utils.ts
|
3349
3499
|
function generateActionInput(configuration, action) {
|
3350
|
-
const fields =
|
3500
|
+
const fields = findActiveActionFormFields(configuration, action) ?? [];
|
3351
3501
|
const data = fields.reduce(
|
3352
3502
|
(acc, field2, i) => ({
|
3353
3503
|
...acc,
|
@@ -3402,12 +3552,12 @@ var eventPayloadGenerator = {
|
|
3402
3552
|
validate: (eventId, input = {}) => ({
|
3403
3553
|
type: ActionType.VALIDATE,
|
3404
3554
|
transactionId: input.transactionId ?? getUUID(),
|
3405
|
-
data: input.data ??
|
3555
|
+
data: input.data ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
|
3406
3556
|
duplicates: [],
|
3407
3557
|
eventId
|
3408
3558
|
}),
|
3409
3559
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3410
|
-
type: ActionType.
|
3560
|
+
type: ActionType.ARCHIVE,
|
3411
3561
|
transactionId: input.transactionId ?? getUUID(),
|
3412
3562
|
data: input.data ?? {},
|
3413
3563
|
metadata: { isDuplicate: isDuplicate ?? false },
|
@@ -3472,15 +3622,17 @@ var eventPayloadGenerator = {
|
|
3472
3622
|
};
|
3473
3623
|
function generateActionDocument({
|
3474
3624
|
configuration,
|
3475
|
-
action
|
3625
|
+
action,
|
3626
|
+
defaults = {}
|
3476
3627
|
}) {
|
3477
3628
|
const actionBase = {
|
3478
|
-
createdAt:
|
3629
|
+
createdAt: new Date(Date.now() - 500).toISOString(),
|
3479
3630
|
createdBy: getUUID(),
|
3480
3631
|
id: getUUID(),
|
3481
3632
|
createdAtLocation: "TODO",
|
3482
3633
|
data: generateActionInput(configuration, action),
|
3483
|
-
metadata: {}
|
3634
|
+
metadata: {},
|
3635
|
+
...defaults
|
3484
3636
|
};
|
3485
3637
|
switch (action) {
|
3486
3638
|
case ActionType.DECLARE:
|
@@ -3491,7 +3643,7 @@ function generateActionDocument({
|
|
3491
3643
|
return { ...actionBase, assignedTo: getUUID(), type: action };
|
3492
3644
|
case ActionType.VALIDATE:
|
3493
3645
|
return { ...actionBase, type: action };
|
3494
|
-
case ActionType.
|
3646
|
+
case ActionType.ARCHIVE:
|
3495
3647
|
return { ...actionBase, type: action };
|
3496
3648
|
case ActionType.REJECT:
|
3497
3649
|
return { ...actionBase, type: action };
|
@@ -3529,9 +3681,9 @@ function generateEventDocument({
|
|
3529
3681
|
actions: actions.map(
|
3530
3682
|
(action) => generateActionDocument({ configuration, action })
|
3531
3683
|
),
|
3532
|
-
createdAt:
|
3684
|
+
createdAt: new Date(Date.now() - 1e3).toISOString(),
|
3533
3685
|
id: getUUID(),
|
3534
|
-
updatedAt:
|
3686
|
+
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
3535
3687
|
};
|
3536
3688
|
}
|
3537
3689
|
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, data = {}) {
|
@@ -3571,3 +3723,33 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3571
3723
|
},
|
3572
3724
|
trackingId: overrides.trackingId ?? "M3F8YQ"
|
3573
3725
|
});
|
3726
|
+
|
3727
|
+
// ../commons/src/events/TemplateConfig.ts
|
3728
|
+
function isTemplateVariable(value) {
|
3729
|
+
return typeof value === "string" && value.startsWith("$");
|
3730
|
+
}
|
3731
|
+
function isFieldValue(value) {
|
3732
|
+
return FieldValue.safeParse(value).success;
|
3733
|
+
}
|
3734
|
+
function isFieldValueWithoutTemplates(value) {
|
3735
|
+
if (isTemplateVariable(value)) {
|
3736
|
+
return false;
|
3737
|
+
}
|
3738
|
+
if (typeof value === "object" && Object.values(value).some((val) => isTemplateVariable(val))) {
|
3739
|
+
return false;
|
3740
|
+
}
|
3741
|
+
return true;
|
3742
|
+
}
|
3743
|
+
function isFieldConfigDefaultValue(value) {
|
3744
|
+
if (!value) return false;
|
3745
|
+
if (isFieldValue(value)) {
|
3746
|
+
return true;
|
3747
|
+
}
|
3748
|
+
if (isTemplateVariable(value)) {
|
3749
|
+
return true;
|
3750
|
+
}
|
3751
|
+
if (typeof value === "object" && Object.values(value).every((v) => typeof v === "object" && v !== null)) {
|
3752
|
+
return Object.values(value).every((v) => isFieldConfigDefaultValue(v));
|
3753
|
+
}
|
3754
|
+
return false;
|
3755
|
+
}
|