@opencrvs/toolkit 1.8.1-rc.c39f8f6 → 1.8.1-rc.c7fcaa3
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 +394 -393
- package/dist/commons/conditionals/validate.d.ts +11 -2
- package/dist/commons/events/ActionConfig.d.ts +3924 -642
- package/dist/commons/events/ActionDocument.d.ts +736 -736
- package/dist/commons/events/ActionInput.d.ts +600 -600
- package/dist/commons/events/AdvancedSearchConfig.d.ts +49 -31
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
- package/dist/commons/events/Draft.d.ts +56 -56
- package/dist/commons/events/EventConfig.d.ts +1259 -240
- package/dist/commons/events/EventDocument.d.ts +432 -432
- package/dist/commons/events/EventIndex.d.ts +62 -62
- package/dist/commons/events/EventMetadata.d.ts +9 -9
- package/dist/commons/events/FieldConfig.d.ts +1064 -71
- package/dist/commons/events/FieldType.d.ts +5 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/FormConfig.d.ts +1956 -378
- package/dist/commons/events/PageConfig.d.ts +524 -82
- package/dist/commons/events/WorkqueueConfig.d.ts +199 -164
- package/dist/commons/events/defineConfig.d.ts +181 -46
- package/dist/commons/events/event.d.ts +61 -7
- package/dist/commons/events/test.utils.d.ts +14 -13
- package/dist/commons/events/utils.d.ts +341 -195
- package/dist/conditionals/index.js +3 -2
- package/dist/events/index.js +1071 -860
- package/package.json +1 -1
- package/tsconfig.json +1 -1
- package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
- package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
- package/dist/commons/conditionals/validate.test.d.ts +0 -2
- package/dist/commons/events/utils.test.d.ts +0 -2
package/dist/events/index.js
CHANGED
@@ -40,6 +40,7 @@ __export(events_exports, {
|
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
42
|
ActionDocument: () => ActionDocument,
|
43
|
+
ActionFlag: () => ActionFlag,
|
43
44
|
ActionFormConfig: () => ActionFormConfig,
|
44
45
|
ActionInput: () => ActionInput,
|
45
46
|
ActionStatus: () => ActionStatus,
|
@@ -51,6 +52,7 @@ __export(events_exports, {
|
|
51
52
|
AddressType: () => AddressType,
|
52
53
|
AdministrativeAreas: () => AdministrativeAreas,
|
53
54
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
55
|
+
AnyFileField: () => AnyFileField,
|
54
56
|
AnyOf: () => AnyOf,
|
55
57
|
AnyOfStatus: () => AnyOfStatus,
|
56
58
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
@@ -95,6 +97,7 @@ __export(events_exports, {
|
|
95
97
|
EventDocument: () => EventDocument,
|
96
98
|
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
97
99
|
EventFieldId: () => EventFieldId,
|
100
|
+
EventFieldIdInput: () => EventFieldIdInput,
|
98
101
|
EventIndex: () => EventIndex,
|
99
102
|
EventInput: () => EventInput,
|
100
103
|
EventMetadata: () => EventMetadata,
|
@@ -115,6 +118,7 @@ __export(events_exports, {
|
|
115
118
|
FieldType: () => FieldType,
|
116
119
|
FieldUpdateValue: () => FieldUpdateValue,
|
117
120
|
FieldValue: () => FieldValue,
|
121
|
+
FileFieldType: () => FileFieldType,
|
118
122
|
FileFieldValue: () => FileFieldValue,
|
119
123
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
120
124
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
@@ -129,8 +133,10 @@ __export(events_exports, {
|
|
129
133
|
InherentFlags: () => InherentFlags,
|
130
134
|
LanguageConfig: () => LanguageConfig,
|
131
135
|
LegalStatuses: () => LegalStatuses,
|
136
|
+
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
132
137
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
133
138
|
MimeType: () => MimeType,
|
139
|
+
NameConfig: () => NameConfig,
|
134
140
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
135
141
|
NameFieldValue: () => NameFieldValue,
|
136
142
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
@@ -168,6 +174,7 @@ __export(events_exports, {
|
|
168
174
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
169
175
|
TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
|
170
176
|
TestUserRole: () => TestUserRole,
|
177
|
+
TextField: () => TextField,
|
171
178
|
TextValue: () => TextValue,
|
172
179
|
TimeValue: () => TimeValue,
|
173
180
|
TranslationConfig: () => TranslationConfig,
|
@@ -179,7 +186,6 @@ __export(events_exports, {
|
|
179
186
|
ValidationConfig: () => ValidationConfig,
|
180
187
|
VerificationActionConfig: () => VerificationActionConfig,
|
181
188
|
VerificationPageConfig: () => VerificationPageConfig,
|
182
|
-
VisibleStatus: () => VisibleStatus,
|
183
189
|
WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
|
184
190
|
Within: () => Within,
|
185
191
|
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
@@ -197,13 +203,15 @@ __export(events_exports, {
|
|
197
203
|
and: () => and,
|
198
204
|
annotationActions: () => annotationActions,
|
199
205
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
200
|
-
|
206
|
+
applyDraftToEventIndex: () => applyDraftToEventIndex,
|
207
|
+
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
201
208
|
areConditionsMet: () => areConditionsMet,
|
202
209
|
compositeFieldTypes: () => compositeFieldTypes,
|
203
210
|
createEmptyDraft: () => createEmptyDraft,
|
204
211
|
createFieldConditionals: () => createFieldConditionals,
|
205
212
|
createPrng: () => createPrng,
|
206
213
|
createValidationSchema: () => createValidationSchema,
|
214
|
+
dangerouslyGetCurrentEventStateWithDrafts: () => dangerouslyGetCurrentEventStateWithDrafts,
|
207
215
|
deepDropNulls: () => deepDropNulls,
|
208
216
|
deepMerge: () => deepMerge,
|
209
217
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -225,7 +233,7 @@ __export(events_exports, {
|
|
225
233
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
226
234
|
field: () => field,
|
227
235
|
fieldTypes: () => fieldTypes,
|
228
|
-
|
236
|
+
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
229
237
|
findAllFields: () => findAllFields,
|
230
238
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
231
239
|
findRecordActionPages: () => findRecordActionPages,
|
@@ -253,7 +261,6 @@ __export(events_exports, {
|
|
253
261
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
254
262
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
255
263
|
getCurrentEventState: () => getCurrentEventState,
|
256
|
-
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
257
264
|
getDeclaration: () => getDeclaration,
|
258
265
|
getDeclarationFieldById: () => getDeclarationFieldById,
|
259
266
|
getDeclarationFields: () => getDeclarationFields,
|
@@ -313,6 +320,7 @@ __export(events_exports, {
|
|
313
320
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
314
321
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
315
322
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
323
|
+
mergeDrafts: () => mergeDrafts,
|
316
324
|
never: () => never,
|
317
325
|
not: () => not,
|
318
326
|
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
@@ -321,6 +329,7 @@ __export(events_exports, {
|
|
321
329
|
or: () => or,
|
322
330
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
323
331
|
runFieldValidations: () => runFieldValidations,
|
332
|
+
runStructuralValidations: () => runStructuralValidations,
|
324
333
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
325
334
|
user: () => user,
|
326
335
|
validate: () => validate,
|
@@ -335,7 +344,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
335
344
|
var BIRTH_EVENT = "v2-birth";
|
336
345
|
|
337
346
|
// ../commons/src/events/ActionConfig.ts
|
338
|
-
var
|
347
|
+
var import_zod11 = require("zod");
|
339
348
|
|
340
349
|
// ../commons/src/events/Conditional.ts
|
341
350
|
var import_zod = require("zod");
|
@@ -505,9 +514,10 @@ function isMetaAction(actionType) {
|
|
505
514
|
}
|
506
515
|
|
507
516
|
// ../commons/src/events/FieldConfig.ts
|
508
|
-
var
|
517
|
+
var import_zod8 = require("zod");
|
509
518
|
|
510
519
|
// ../commons/src/events/FieldType.ts
|
520
|
+
var import_zod4 = require("zod");
|
511
521
|
var FieldType = {
|
512
522
|
NAME: "NAME",
|
513
523
|
PHONE: "PHONE",
|
@@ -540,6 +550,11 @@ var FieldType = {
|
|
540
550
|
SIGNATURE: "SIGNATURE",
|
541
551
|
DATA: "DATA"
|
542
552
|
};
|
553
|
+
var FileFieldType = import_zod4.z.enum([
|
554
|
+
FieldType.FILE,
|
555
|
+
FieldType.FILE_WITH_OPTIONS,
|
556
|
+
FieldType.SIGNATURE
|
557
|
+
]);
|
543
558
|
var fieldTypes = Object.values(FieldType);
|
544
559
|
var compositeFieldTypes = [
|
545
560
|
FieldType.DATE_RANGE,
|
@@ -549,24 +564,24 @@ var compositeFieldTypes = [
|
|
549
564
|
];
|
550
565
|
|
551
566
|
// ../commons/src/events/FieldValue.ts
|
552
|
-
var
|
567
|
+
var import_zod7 = require("zod");
|
553
568
|
|
554
569
|
// ../commons/src/documents.ts
|
555
|
-
var
|
570
|
+
var import_zod5 = require("zod");
|
556
571
|
var import_zod_openapi3 = require("zod-openapi");
|
557
|
-
(0, import_zod_openapi3.extendZodWithOpenApi)(
|
558
|
-
var
|
572
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
573
|
+
var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
|
559
574
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
560
575
|
);
|
561
|
-
var FullDocumentPath =
|
576
|
+
var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
562
577
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
563
578
|
);
|
564
|
-
var DocumentPath =
|
579
|
+
var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
|
565
580
|
"A full identifier starting from the root of the S3 bucket, e.g. /document-id.jpg or /directory/document-id.jpg but never /bucket-name/document-id.jpg"
|
566
581
|
);
|
567
582
|
|
568
583
|
// ../commons/src/events/CompositeFieldValue.ts
|
569
|
-
var
|
584
|
+
var import_zod6 = require("zod");
|
570
585
|
var GeographicalArea = {
|
571
586
|
URBAN: "URBAN",
|
572
587
|
RURAL: "RURAL"
|
@@ -575,110 +590,110 @@ var AddressType = {
|
|
575
590
|
DOMESTIC: "DOMESTIC",
|
576
591
|
INTERNATIONAL: "INTERNATIONAL"
|
577
592
|
};
|
578
|
-
var FileFieldValue =
|
593
|
+
var FileFieldValue = import_zod6.z.object({
|
579
594
|
path: FullDocumentPath,
|
580
|
-
originalFilename:
|
581
|
-
type:
|
595
|
+
originalFilename: import_zod6.z.string(),
|
596
|
+
type: import_zod6.z.string()
|
582
597
|
});
|
583
|
-
var AdminStructure =
|
584
|
-
country:
|
585
|
-
addressType:
|
586
|
-
province:
|
587
|
-
district:
|
598
|
+
var AdminStructure = import_zod6.z.object({
|
599
|
+
country: import_zod6.z.string(),
|
600
|
+
addressType: import_zod6.z.literal(AddressType.DOMESTIC),
|
601
|
+
province: import_zod6.z.string(),
|
602
|
+
district: import_zod6.z.string()
|
588
603
|
});
|
589
604
|
var UrbanAddressValue = AdminStructure.extend({
|
590
|
-
urbanOrRural:
|
591
|
-
town:
|
592
|
-
residentialArea:
|
593
|
-
street:
|
594
|
-
number:
|
595
|
-
zipCode:
|
605
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.URBAN),
|
606
|
+
town: import_zod6.z.string().optional(),
|
607
|
+
residentialArea: import_zod6.z.string().optional(),
|
608
|
+
street: import_zod6.z.string().optional(),
|
609
|
+
number: import_zod6.z.string().optional(),
|
610
|
+
zipCode: import_zod6.z.string().optional()
|
596
611
|
});
|
597
612
|
var RuralAddressValue = AdminStructure.extend({
|
598
|
-
urbanOrRural:
|
599
|
-
village:
|
613
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.RURAL),
|
614
|
+
village: import_zod6.z.string().optional()
|
600
615
|
});
|
601
616
|
var UrbanAddressUpdateValue = AdminStructure.extend({
|
602
|
-
urbanOrRural:
|
603
|
-
town:
|
604
|
-
residentialArea:
|
605
|
-
street:
|
606
|
-
number:
|
607
|
-
zipCode:
|
617
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.URBAN),
|
618
|
+
town: import_zod6.z.string().nullish(),
|
619
|
+
residentialArea: import_zod6.z.string().nullish(),
|
620
|
+
street: import_zod6.z.string().nullish(),
|
621
|
+
number: import_zod6.z.string().nullish(),
|
622
|
+
zipCode: import_zod6.z.string().nullish()
|
608
623
|
});
|
609
|
-
var NameFieldValue =
|
610
|
-
firstname:
|
611
|
-
surname:
|
612
|
-
middlename:
|
624
|
+
var NameFieldValue = import_zod6.z.object({
|
625
|
+
firstname: import_zod6.z.string(),
|
626
|
+
surname: import_zod6.z.string(),
|
627
|
+
middlename: import_zod6.z.string().optional()
|
613
628
|
});
|
614
|
-
var NameFieldUpdateValue =
|
615
|
-
firstname:
|
616
|
-
surname:
|
617
|
-
middlename:
|
618
|
-
}).or(
|
629
|
+
var NameFieldUpdateValue = import_zod6.z.object({
|
630
|
+
firstname: import_zod6.z.string(),
|
631
|
+
surname: import_zod6.z.string(),
|
632
|
+
middlename: import_zod6.z.string().nullish()
|
633
|
+
}).or(import_zod6.z.null()).or(import_zod6.z.undefined());
|
619
634
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
620
|
-
urbanOrRural:
|
621
|
-
village:
|
635
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.RURAL),
|
636
|
+
village: import_zod6.z.string().nullish()
|
622
637
|
});
|
623
|
-
var GenericAddressValue =
|
624
|
-
country:
|
625
|
-
addressType:
|
626
|
-
state:
|
627
|
-
district2:
|
628
|
-
cityOrTown:
|
629
|
-
addressLine1:
|
630
|
-
addressLine2:
|
631
|
-
addressLine3:
|
632
|
-
postcodeOrZip:
|
638
|
+
var GenericAddressValue = import_zod6.z.object({
|
639
|
+
country: import_zod6.z.string(),
|
640
|
+
addressType: import_zod6.z.literal(AddressType.INTERNATIONAL),
|
641
|
+
state: import_zod6.z.string(),
|
642
|
+
district2: import_zod6.z.string(),
|
643
|
+
cityOrTown: import_zod6.z.string().optional(),
|
644
|
+
addressLine1: import_zod6.z.string().optional(),
|
645
|
+
addressLine2: import_zod6.z.string().optional(),
|
646
|
+
addressLine3: import_zod6.z.string().optional(),
|
647
|
+
postcodeOrZip: import_zod6.z.string().optional()
|
633
648
|
});
|
634
|
-
var AddressFieldValue =
|
635
|
-
var GenericAddressUpdateValue =
|
636
|
-
country:
|
637
|
-
addressType:
|
638
|
-
state:
|
639
|
-
district2:
|
640
|
-
cityOrTown:
|
641
|
-
addressLine1:
|
642
|
-
addressLine2:
|
643
|
-
addressLine3:
|
644
|
-
postcodeOrZip:
|
649
|
+
var AddressFieldValue = import_zod6.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
650
|
+
var GenericAddressUpdateValue = import_zod6.z.object({
|
651
|
+
country: import_zod6.z.string(),
|
652
|
+
addressType: import_zod6.z.literal(AddressType.INTERNATIONAL),
|
653
|
+
state: import_zod6.z.string(),
|
654
|
+
district2: import_zod6.z.string(),
|
655
|
+
cityOrTown: import_zod6.z.string().nullish(),
|
656
|
+
addressLine1: import_zod6.z.string().nullish(),
|
657
|
+
addressLine2: import_zod6.z.string().nullish(),
|
658
|
+
addressLine3: import_zod6.z.string().nullish(),
|
659
|
+
postcodeOrZip: import_zod6.z.string().nullish()
|
645
660
|
});
|
646
|
-
var AddressFieldUpdateValue =
|
661
|
+
var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("urbanOrRural", [
|
647
662
|
UrbanAddressUpdateValue,
|
648
663
|
RuralAddressUpdateValue
|
649
664
|
]).or(GenericAddressUpdateValue);
|
650
|
-
var FileFieldValueWithOption =
|
665
|
+
var FileFieldValueWithOption = import_zod6.z.object({
|
651
666
|
path: FullDocumentPath,
|
652
|
-
originalFilename:
|
653
|
-
type:
|
654
|
-
option:
|
667
|
+
originalFilename: import_zod6.z.string(),
|
668
|
+
type: import_zod6.z.string(),
|
669
|
+
option: import_zod6.z.string()
|
655
670
|
});
|
656
|
-
var FileFieldWithOptionValue =
|
671
|
+
var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
|
657
672
|
|
658
673
|
// ../commons/src/events/FieldValue.ts
|
659
|
-
var TextValue =
|
674
|
+
var TextValue = import_zod7.z.string();
|
660
675
|
var NonEmptyTextValue = TextValue.min(1);
|
661
|
-
var DateValue =
|
662
|
-
var TimeValue =
|
663
|
-
var DatetimeValue =
|
664
|
-
var SelectDateRangeValue =
|
676
|
+
var DateValue = import_zod7.z.string().date().describe("Date in the format YYYY-MM-DD");
|
677
|
+
var TimeValue = import_zod7.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
678
|
+
var DatetimeValue = import_zod7.z.string().datetime();
|
679
|
+
var SelectDateRangeValue = import_zod7.z.enum([
|
665
680
|
"last7Days",
|
666
681
|
"last30Days",
|
667
682
|
"last90Days",
|
668
683
|
"last365Days"
|
669
684
|
]);
|
670
|
-
var DateRangeFieldValue =
|
685
|
+
var DateRangeFieldValue = import_zod7.z.object({
|
671
686
|
start: DateValue,
|
672
687
|
end: DateValue
|
673
688
|
}).or(DateValue).describe(
|
674
689
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
675
690
|
);
|
676
|
-
var EmailValue =
|
677
|
-
var CheckboxFieldValue =
|
678
|
-
var NumberFieldValue =
|
679
|
-
var DataFieldValue =
|
680
|
-
var SignatureFieldValue =
|
681
|
-
var FieldValue =
|
691
|
+
var EmailValue = import_zod7.z.string().email();
|
692
|
+
var CheckboxFieldValue = import_zod7.z.boolean();
|
693
|
+
var NumberFieldValue = import_zod7.z.number();
|
694
|
+
var DataFieldValue = import_zod7.z.undefined();
|
695
|
+
var SignatureFieldValue = import_zod7.z.string();
|
696
|
+
var FieldValue = import_zod7.z.union([
|
682
697
|
TextValue,
|
683
698
|
DateValue,
|
684
699
|
TimeValue,
|
@@ -695,7 +710,7 @@ var FieldValue = import_zod6.z.union([
|
|
695
710
|
NameFieldValue,
|
696
711
|
NameFieldUpdateValue
|
697
712
|
]);
|
698
|
-
var FieldUpdateValue =
|
713
|
+
var FieldUpdateValue = import_zod7.z.union([
|
699
714
|
TextValue,
|
700
715
|
DateValue,
|
701
716
|
TimeValue,
|
@@ -714,67 +729,67 @@ var FieldUpdateValue = import_zod6.z.union([
|
|
714
729
|
|
715
730
|
// ../commons/src/events/FieldConfig.ts
|
716
731
|
var import_zod_openapi4 = require("zod-openapi");
|
717
|
-
(0, import_zod_openapi4.extendZodWithOpenApi)(
|
718
|
-
var FieldId =
|
719
|
-
var FieldReference =
|
732
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod8.z);
|
733
|
+
var FieldId = import_zod8.z.string().describe("Unique identifier for the field");
|
734
|
+
var FieldReference = import_zod8.z.object({
|
720
735
|
$$field: FieldId
|
721
736
|
}).describe("Reference to a field by its ID");
|
722
|
-
var ValidationConfig =
|
737
|
+
var ValidationConfig = import_zod8.z.object({
|
723
738
|
validator: Conditional,
|
724
739
|
message: TranslationConfig
|
725
740
|
});
|
726
|
-
var BaseField =
|
741
|
+
var BaseField = import_zod8.z.object({
|
727
742
|
id: FieldId,
|
728
743
|
label: TranslationConfig,
|
729
744
|
parent: FieldReference.optional().describe(
|
730
745
|
"Reference to a parent field. If a field has a parent, it will be reset when the parent field is changed."
|
731
746
|
),
|
732
|
-
required:
|
733
|
-
conditionals:
|
734
|
-
secured:
|
747
|
+
required: import_zod8.z.boolean().default(false).optional(),
|
748
|
+
conditionals: import_zod8.z.array(FieldConditional).default([]).optional(),
|
749
|
+
secured: import_zod8.z.boolean().default(false).optional(),
|
735
750
|
placeholder: TranslationConfig.optional(),
|
736
|
-
validation:
|
751
|
+
validation: import_zod8.z.array(ValidationConfig).default([]).optional(),
|
737
752
|
helperText: TranslationConfig.optional(),
|
738
|
-
hideLabel:
|
739
|
-
uncorrectable:
|
753
|
+
hideLabel: import_zod8.z.boolean().default(false).optional(),
|
754
|
+
uncorrectable: import_zod8.z.boolean().default(false).optional().describe(
|
740
755
|
"Indicates if the field can be changed during a record correction."
|
741
756
|
)
|
742
757
|
});
|
743
758
|
var Divider = BaseField.extend({
|
744
|
-
type:
|
759
|
+
type: import_zod8.z.literal(FieldType.DIVIDER)
|
745
760
|
});
|
746
761
|
var TextField = BaseField.extend({
|
747
|
-
type:
|
762
|
+
type: import_zod8.z.literal(FieldType.TEXT),
|
748
763
|
defaultValue: NonEmptyTextValue.optional(),
|
749
|
-
configuration:
|
750
|
-
maxLength:
|
751
|
-
type:
|
764
|
+
configuration: import_zod8.z.object({
|
765
|
+
maxLength: import_zod8.z.number().optional().describe("Maximum length of the text"),
|
766
|
+
type: import_zod8.z.enum(["text", "password"]).optional(),
|
752
767
|
prefix: TranslationConfig.optional(),
|
753
768
|
postfix: TranslationConfig.optional()
|
754
769
|
}).default({ type: "text" }).optional()
|
755
770
|
}).describe("Text input");
|
756
771
|
var NumberField = BaseField.extend({
|
757
|
-
type:
|
772
|
+
type: import_zod8.z.literal(FieldType.NUMBER),
|
758
773
|
defaultValue: NumberFieldValue.optional(),
|
759
|
-
configuration:
|
760
|
-
min:
|
761
|
-
max:
|
774
|
+
configuration: import_zod8.z.object({
|
775
|
+
min: import_zod8.z.number().optional().describe("Minimum value"),
|
776
|
+
max: import_zod8.z.number().optional().describe("Maximum value"),
|
762
777
|
prefix: TranslationConfig.optional(),
|
763
778
|
postfix: TranslationConfig.optional()
|
764
779
|
}).optional()
|
765
780
|
}).describe("Number input");
|
766
781
|
var TextAreaField = BaseField.extend({
|
767
|
-
type:
|
782
|
+
type: import_zod8.z.literal(FieldType.TEXTAREA),
|
768
783
|
defaultValue: NonEmptyTextValue.optional(),
|
769
|
-
configuration:
|
770
|
-
maxLength:
|
771
|
-
rows:
|
772
|
-
cols:
|
784
|
+
configuration: import_zod8.z.object({
|
785
|
+
maxLength: import_zod8.z.number().optional().describe("Maximum length of the text"),
|
786
|
+
rows: import_zod8.z.number().optional().describe("Number of visible text lines"),
|
787
|
+
cols: import_zod8.z.number().optional().describe("Number of visible columns"),
|
773
788
|
prefix: TranslationConfig.optional(),
|
774
789
|
postfix: TranslationConfig.optional()
|
775
790
|
}).default({ rows: 4 }).optional()
|
776
791
|
}).describe("Multiline text input");
|
777
|
-
var ImageMimeType =
|
792
|
+
var ImageMimeType = import_zod8.z.enum([
|
778
793
|
"image/png",
|
779
794
|
"image/jpg",
|
780
795
|
"image/jpeg",
|
@@ -783,53 +798,53 @@ var ImageMimeType = import_zod7.z.enum([
|
|
783
798
|
var MimeType = ImageMimeType;
|
784
799
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
785
800
|
var SignatureField = BaseField.extend({
|
786
|
-
type:
|
801
|
+
type: import_zod8.z.literal(FieldType.SIGNATURE),
|
787
802
|
signaturePromptLabel: TranslationConfig.describe(
|
788
803
|
"Title of the signature modal"
|
789
804
|
),
|
790
805
|
defaultValue: SignatureFieldValue.optional(),
|
791
|
-
configuration:
|
792
|
-
maxFileSize:
|
806
|
+
configuration: import_zod8.z.object({
|
807
|
+
maxFileSize: import_zod8.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
793
808
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
794
809
|
}).default({
|
795
810
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
796
811
|
})
|
797
812
|
}).describe("Signature input field");
|
798
813
|
var EmailField = BaseField.extend({
|
799
|
-
type:
|
800
|
-
configuration:
|
801
|
-
maxLength:
|
814
|
+
type: import_zod8.z.literal(FieldType.EMAIL),
|
815
|
+
configuration: import_zod8.z.object({
|
816
|
+
maxLength: import_zod8.z.number().optional().describe("Maximum length of the text")
|
802
817
|
}).default({ maxLength: 10 }).optional(),
|
803
818
|
defaultValue: NonEmptyTextValue.optional()
|
804
819
|
});
|
805
820
|
var DateField = BaseField.extend({
|
806
|
-
type:
|
821
|
+
type: import_zod8.z.literal(FieldType.DATE),
|
807
822
|
defaultValue: DateValue.optional(),
|
808
|
-
configuration:
|
823
|
+
configuration: import_zod8.z.object({
|
809
824
|
notice: TranslationConfig.describe(
|
810
825
|
"Text to display above the date input"
|
811
826
|
).optional()
|
812
827
|
}).optional()
|
813
828
|
}).describe("A single date input (yyyy-MM-dd)");
|
814
829
|
var TimeField = BaseField.extend({
|
815
|
-
type:
|
830
|
+
type: import_zod8.z.literal(FieldType.TIME),
|
816
831
|
defaultValue: TimeValue.optional(),
|
817
|
-
configuration:
|
832
|
+
configuration: import_zod8.z.object({
|
818
833
|
notice: TranslationConfig.describe(
|
819
834
|
"Text to display above the time input"
|
820
835
|
).optional()
|
821
836
|
}).optional()
|
822
837
|
}).describe("A single date input (HH-mm)");
|
823
838
|
var DateRangeField = BaseField.extend({
|
824
|
-
type:
|
839
|
+
type: import_zod8.z.literal(FieldType.DATE_RANGE),
|
825
840
|
defaultValue: DateRangeFieldValue.optional(),
|
826
|
-
configuration:
|
841
|
+
configuration: import_zod8.z.object({
|
827
842
|
notice: TranslationConfig.describe(
|
828
843
|
"Text to display above the date input"
|
829
844
|
).optional()
|
830
845
|
}).optional()
|
831
846
|
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
832
|
-
var HtmlFontVariant =
|
847
|
+
var HtmlFontVariant = import_zod8.z.enum([
|
833
848
|
"reg12",
|
834
849
|
"reg14",
|
835
850
|
"reg16",
|
@@ -839,31 +854,31 @@ var HtmlFontVariant = import_zod7.z.enum([
|
|
839
854
|
"h2",
|
840
855
|
"h1"
|
841
856
|
]);
|
842
|
-
var ParagraphConfiguration =
|
843
|
-
styles:
|
857
|
+
var ParagraphConfiguration = import_zod8.z.object({
|
858
|
+
styles: import_zod8.z.object({
|
844
859
|
fontVariant: HtmlFontVariant.optional().describe(
|
845
860
|
"Font variant to use for the paragraph text"
|
846
861
|
),
|
847
|
-
hint:
|
862
|
+
hint: import_zod8.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
|
848
863
|
}).optional()
|
849
864
|
}).default({});
|
850
865
|
var Paragraph = BaseField.extend({
|
851
|
-
type:
|
866
|
+
type: import_zod8.z.literal(FieldType.PARAGRAPH),
|
852
867
|
defaultValue: NonEmptyTextValue.optional(),
|
853
868
|
configuration: ParagraphConfiguration
|
854
869
|
}).describe("A read-only HTML <p> paragraph");
|
855
870
|
var PageHeader = BaseField.extend({
|
856
|
-
type:
|
871
|
+
type: import_zod8.z.literal(FieldType.PAGE_HEADER),
|
857
872
|
defaultValue: NonEmptyTextValue.optional()
|
858
873
|
}).describe("A read-only header component for form pages");
|
859
874
|
var File = BaseField.extend({
|
860
|
-
type:
|
875
|
+
type: import_zod8.z.literal(FieldType.FILE),
|
861
876
|
defaultValue: FileFieldValue.optional(),
|
862
|
-
configuration:
|
863
|
-
maxFileSize:
|
877
|
+
configuration: import_zod8.z.object({
|
878
|
+
maxFileSize: import_zod8.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
864
879
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
865
|
-
style:
|
866
|
-
width:
|
880
|
+
style: import_zod8.z.object({
|
881
|
+
width: import_zod8.z.enum(["full", "auto"]).optional().describe(
|
867
882
|
"Whether the file upload button should take the full width of the container or not"
|
868
883
|
)
|
869
884
|
}).optional(),
|
@@ -872,140 +887,176 @@ var File = BaseField.extend({
|
|
872
887
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
873
888
|
})
|
874
889
|
}).describe("File upload");
|
875
|
-
var SelectOption =
|
876
|
-
value:
|
890
|
+
var SelectOption = import_zod8.z.object({
|
891
|
+
value: import_zod8.z.string().describe("The value of the option"),
|
877
892
|
label: TranslationConfig.describe("The label of the option")
|
878
893
|
});
|
879
894
|
var RadioGroup = BaseField.extend({
|
880
|
-
type:
|
895
|
+
type: import_zod8.z.literal(FieldType.RADIO_GROUP),
|
881
896
|
defaultValue: TextValue.optional(),
|
882
|
-
options:
|
883
|
-
configuration:
|
884
|
-
styles:
|
885
|
-
size:
|
897
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options"),
|
898
|
+
configuration: import_zod8.z.object({
|
899
|
+
styles: import_zod8.z.object({
|
900
|
+
size: import_zod8.z.enum(["NORMAL", "LARGE"]).optional()
|
886
901
|
}).optional()
|
887
902
|
}).optional()
|
888
903
|
}).describe("Grouped radio options");
|
889
904
|
var BulletList = BaseField.extend({
|
890
|
-
type:
|
905
|
+
type: import_zod8.z.literal(FieldType.BULLET_LIST),
|
891
906
|
defaultValue: TextValue.optional(),
|
892
|
-
items:
|
893
|
-
configuration:
|
894
|
-
styles:
|
907
|
+
items: import_zod8.z.array(TranslationConfig).describe("A list of items"),
|
908
|
+
configuration: import_zod8.z.object({
|
909
|
+
styles: import_zod8.z.object({
|
895
910
|
fontVariant: HtmlFontVariant.optional()
|
896
911
|
}).optional()
|
897
912
|
}).default({})
|
898
913
|
}).describe("A list of bullet points");
|
899
914
|
var Select = BaseField.extend({
|
900
|
-
type:
|
915
|
+
type: import_zod8.z.literal(FieldType.SELECT),
|
901
916
|
defaultValue: TextValue.optional(),
|
902
|
-
options:
|
917
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options")
|
903
918
|
}).describe("Select input");
|
904
|
-
var SelectDateRangeOption =
|
919
|
+
var SelectDateRangeOption = import_zod8.z.object({
|
905
920
|
value: SelectDateRangeValue.describe("The value of the option"),
|
906
921
|
label: TranslationConfig.describe("The label of the option")
|
907
922
|
});
|
908
923
|
var SelectDateRangeField = BaseField.extend({
|
909
|
-
type:
|
924
|
+
type: import_zod8.z.literal(FieldType.SELECT_DATE_RANGE),
|
910
925
|
defaultValue: SelectDateRangeValue.optional(),
|
911
|
-
options:
|
926
|
+
options: import_zod8.z.array(SelectDateRangeOption).describe("A list of options")
|
912
927
|
}).describe("Select input with date range options");
|
928
|
+
var NameConfig = import_zod8.z.object({
|
929
|
+
firstname: import_zod8.z.object({ required: import_zod8.z.boolean(), label: TranslationConfig.optional() }).optional(),
|
930
|
+
middlename: import_zod8.z.object({ required: import_zod8.z.boolean(), label: TranslationConfig.optional() }).optional(),
|
931
|
+
surname: import_zod8.z.object({ required: import_zod8.z.boolean(), label: TranslationConfig.optional() }).optional()
|
932
|
+
});
|
913
933
|
var NameField = BaseField.extend({
|
914
|
-
type:
|
915
|
-
defaultValue:
|
916
|
-
firstname: NonEmptyTextValue,
|
917
|
-
|
934
|
+
type: import_zod8.z.literal(FieldType.NAME),
|
935
|
+
defaultValue: import_zod8.z.object({
|
936
|
+
firstname: NonEmptyTextValue.optional(),
|
937
|
+
middlename: NonEmptyTextValue.optional(),
|
938
|
+
surname: NonEmptyTextValue.optional()
|
918
939
|
}).optional(),
|
919
|
-
configuration:
|
920
|
-
|
940
|
+
configuration: import_zod8.z.object({
|
941
|
+
name: NameConfig.default({
|
942
|
+
firstname: { required: true },
|
943
|
+
surname: { required: true }
|
944
|
+
}).optional(),
|
945
|
+
order: import_zod8.z.array(import_zod8.z.enum(["firstname", "middlename", "surname"])).optional(),
|
946
|
+
maxLength: import_zod8.z.number().optional().describe("Maximum length of the text"),
|
921
947
|
prefix: TranslationConfig.optional(),
|
922
|
-
postfix: TranslationConfig.optional()
|
923
|
-
|
924
|
-
|
948
|
+
postfix: TranslationConfig.optional()
|
949
|
+
}).default({
|
950
|
+
name: {
|
951
|
+
firstname: { required: true },
|
952
|
+
surname: { required: true }
|
953
|
+
}
|
925
954
|
}).optional()
|
926
955
|
}).describe("Name input field");
|
927
956
|
var PhoneField = BaseField.extend({
|
928
957
|
defaultValue: NonEmptyTextValue.optional(),
|
929
|
-
type:
|
958
|
+
type: import_zod8.z.literal(FieldType.PHONE)
|
930
959
|
}).describe("Phone input field");
|
931
960
|
var IdField = BaseField.extend({
|
932
961
|
defaultValue: NonEmptyTextValue.optional(),
|
933
|
-
type:
|
962
|
+
type: import_zod8.z.literal(FieldType.ID)
|
934
963
|
}).describe("ID input field");
|
935
964
|
var Checkbox = BaseField.extend({
|
936
|
-
type:
|
965
|
+
type: import_zod8.z.literal(FieldType.CHECKBOX),
|
937
966
|
defaultValue: CheckboxFieldValue.optional()
|
938
967
|
}).describe("Boolean checkbox field");
|
939
968
|
var Country = BaseField.extend({
|
940
|
-
type:
|
969
|
+
type: import_zod8.z.literal(FieldType.COUNTRY),
|
941
970
|
defaultValue: NonEmptyTextValue.optional()
|
942
971
|
}).describe("Country select field");
|
943
|
-
var AdministrativeAreas =
|
972
|
+
var AdministrativeAreas = import_zod8.z.enum([
|
944
973
|
"ADMIN_STRUCTURE",
|
945
974
|
"HEALTH_FACILITY",
|
946
975
|
"CRVS_OFFICE"
|
947
976
|
]);
|
948
|
-
var AdministrativeAreaConfiguration =
|
949
|
-
partOf:
|
950
|
-
$declaration:
|
977
|
+
var AdministrativeAreaConfiguration = import_zod8.z.object({
|
978
|
+
partOf: import_zod8.z.object({
|
979
|
+
$declaration: import_zod8.z.string()
|
951
980
|
}).optional().describe("Parent location"),
|
952
981
|
type: AdministrativeAreas
|
953
982
|
}).describe("Administrative area options");
|
954
983
|
var AdministrativeArea = BaseField.extend({
|
955
|
-
type:
|
984
|
+
type: import_zod8.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
956
985
|
defaultValue: NonEmptyTextValue.optional(),
|
957
986
|
configuration: AdministrativeAreaConfiguration
|
958
987
|
}).describe("Administrative area input field e.g. facility, office");
|
959
988
|
var Location = BaseField.extend({
|
960
|
-
type:
|
989
|
+
type: import_zod8.z.literal(FieldType.LOCATION),
|
961
990
|
defaultValue: NonEmptyTextValue.optional(),
|
962
|
-
configuration:
|
963
|
-
searchableResource:
|
991
|
+
configuration: import_zod8.z.object({
|
992
|
+
searchableResource: import_zod8.z.array(import_zod8.z.enum(["locations", "facilities", "offices"])).optional()
|
964
993
|
}).optional()
|
965
994
|
}).describe("Input field for a location");
|
966
995
|
var FileUploadWithOptions = BaseField.extend({
|
967
|
-
type:
|
968
|
-
options:
|
996
|
+
type: import_zod8.z.literal(FieldType.FILE_WITH_OPTIONS),
|
997
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options"),
|
969
998
|
defaultValue: FileFieldWithOptionValue.optional(),
|
970
|
-
configuration:
|
971
|
-
maxFileSize:
|
999
|
+
configuration: import_zod8.z.object({
|
1000
|
+
maxFileSize: import_zod8.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
972
1001
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
973
1002
|
}).default({
|
974
1003
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
975
1004
|
})
|
976
1005
|
});
|
977
1006
|
var Facility = BaseField.extend({
|
978
|
-
type:
|
1007
|
+
type: import_zod8.z.literal(FieldType.FACILITY),
|
979
1008
|
defaultValue: NonEmptyTextValue.optional()
|
980
1009
|
}).describe("Input field for a facility");
|
981
1010
|
var Office = BaseField.extend({
|
982
|
-
type:
|
1011
|
+
type: import_zod8.z.literal(FieldType.OFFICE),
|
983
1012
|
defaultValue: NonEmptyTextValue.optional()
|
984
1013
|
}).describe("Input field for an office");
|
985
1014
|
var Address = BaseField.extend({
|
986
|
-
type:
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
1015
|
+
type: import_zod8.z.literal(FieldType.ADDRESS),
|
1016
|
+
configuration: import_zod8.z.object({
|
1017
|
+
lineSeparator: import_zod8.z.string().optional(),
|
1018
|
+
fields: import_zod8.z.array(
|
1019
|
+
import_zod8.z.enum([
|
1020
|
+
"number",
|
1021
|
+
"country",
|
1022
|
+
"province",
|
1023
|
+
"addressType",
|
1024
|
+
"district",
|
1025
|
+
"urbanOrRural",
|
1026
|
+
"town",
|
1027
|
+
"residentialArea",
|
1028
|
+
"street",
|
1029
|
+
"zipCode",
|
1030
|
+
"village",
|
1031
|
+
"state",
|
1032
|
+
"district2",
|
1033
|
+
"cityOrTown",
|
1034
|
+
"addressLine1",
|
1035
|
+
"addressLine2",
|
1036
|
+
"addressLine3",
|
1037
|
+
"postcodeOrZip"
|
1038
|
+
])
|
1039
|
+
).optional()
|
1040
|
+
}).optional(),
|
1041
|
+
defaultValue: AddressFieldValue.optional()
|
991
1042
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
992
|
-
var DataEntry =
|
993
|
-
|
1043
|
+
var DataEntry = import_zod8.z.union([
|
1044
|
+
import_zod8.z.object({
|
994
1045
|
label: TranslationConfig,
|
995
|
-
value: TranslationConfig.or(
|
1046
|
+
value: TranslationConfig.or(import_zod8.z.string())
|
996
1047
|
}),
|
997
|
-
|
998
|
-
fieldId:
|
1048
|
+
import_zod8.z.object({
|
1049
|
+
fieldId: import_zod8.z.string()
|
999
1050
|
})
|
1000
1051
|
]);
|
1001
1052
|
var DataField = BaseField.extend({
|
1002
|
-
type:
|
1003
|
-
configuration:
|
1053
|
+
type: import_zod8.z.literal(FieldType.DATA),
|
1054
|
+
configuration: import_zod8.z.object({
|
1004
1055
|
subtitle: TranslationConfig.optional(),
|
1005
|
-
data:
|
1056
|
+
data: import_zod8.z.array(DataEntry)
|
1006
1057
|
})
|
1007
1058
|
}).describe("Data field for displaying read-only data");
|
1008
|
-
var FieldConfig =
|
1059
|
+
var FieldConfig = import_zod8.z.discriminatedUnion("type", [
|
1009
1060
|
Address,
|
1010
1061
|
TextField,
|
1011
1062
|
NumberField,
|
@@ -1038,19 +1089,24 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1038
1089
|
description: "Form field configuration",
|
1039
1090
|
ref: "FieldConfig"
|
1040
1091
|
});
|
1092
|
+
var AnyFileField = import_zod8.z.discriminatedUnion("type", [
|
1093
|
+
SignatureField,
|
1094
|
+
File,
|
1095
|
+
FileUploadWithOptions
|
1096
|
+
]);
|
1041
1097
|
|
1042
1098
|
// ../commons/src/events/FormConfig.ts
|
1043
|
-
var
|
1099
|
+
var import_zod10 = require("zod");
|
1044
1100
|
|
1045
1101
|
// ../commons/src/events/PageConfig.ts
|
1046
|
-
var
|
1102
|
+
var import_zod9 = require("zod");
|
1047
1103
|
var import_zod_openapi5 = require("zod-openapi");
|
1048
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(
|
1049
|
-
var PageTypes =
|
1050
|
-
var PageConfigBase =
|
1051
|
-
id:
|
1104
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
1105
|
+
var PageTypes = import_zod9.z.enum(["FORM", "VERIFICATION"]);
|
1106
|
+
var PageConfigBase = import_zod9.z.object({
|
1107
|
+
id: import_zod9.z.string().describe("Unique identifier for the page"),
|
1052
1108
|
title: TranslationConfig.describe("Header title of the page"),
|
1053
|
-
fields:
|
1109
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
1054
1110
|
conditional: Conditional.optional().describe(
|
1055
1111
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
1056
1112
|
)
|
@@ -1059,13 +1115,13 @@ var PageConfigBase = import_zod8.z.object({
|
|
1059
1115
|
ref: "FormPageConfig"
|
1060
1116
|
});
|
1061
1117
|
var FormPageConfig = PageConfigBase.extend({
|
1062
|
-
type:
|
1118
|
+
type: import_zod9.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
1063
1119
|
});
|
1064
|
-
var VerificationActionConfig =
|
1065
|
-
verify:
|
1066
|
-
cancel:
|
1120
|
+
var VerificationActionConfig = import_zod9.z.object({
|
1121
|
+
verify: import_zod9.z.object({ label: TranslationConfig }),
|
1122
|
+
cancel: import_zod9.z.object({
|
1067
1123
|
label: TranslationConfig,
|
1068
|
-
confirmation:
|
1124
|
+
confirmation: import_zod9.z.object({
|
1069
1125
|
title: TranslationConfig,
|
1070
1126
|
body: TranslationConfig
|
1071
1127
|
})
|
@@ -1075,110 +1131,110 @@ var VerificationActionConfig = import_zod8.z.object({
|
|
1075
1131
|
ref: "VerificationActionConfig"
|
1076
1132
|
});
|
1077
1133
|
var VerificationPageConfig = FormPageConfig.extend({
|
1078
|
-
type:
|
1134
|
+
type: import_zod9.z.literal(PageTypes.enum.VERIFICATION),
|
1079
1135
|
actions: VerificationActionConfig
|
1080
1136
|
});
|
1081
|
-
var PageConfig =
|
1137
|
+
var PageConfig = import_zod9.z.discriminatedUnion("type", [
|
1082
1138
|
FormPageConfig,
|
1083
1139
|
VerificationPageConfig
|
1084
1140
|
]);
|
1085
1141
|
|
1086
1142
|
// ../commons/src/events/FormConfig.ts
|
1087
|
-
var DeclarationFormConfig =
|
1143
|
+
var DeclarationFormConfig = import_zod10.z.object({
|
1088
1144
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1089
|
-
pages:
|
1145
|
+
pages: import_zod10.z.array(FormPageConfig)
|
1090
1146
|
}).describe("Configuration for a declaration form");
|
1091
|
-
var ActionFormConfig =
|
1147
|
+
var ActionFormConfig = import_zod10.z.object({
|
1092
1148
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1093
|
-
pages:
|
1149
|
+
pages: import_zod10.z.array(PageConfig)
|
1094
1150
|
});
|
1095
|
-
var FormConfig =
|
1151
|
+
var FormConfig = import_zod10.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1096
1152
|
|
1097
1153
|
// ../commons/src/events/ActionConfig.ts
|
1098
1154
|
var import_zod_openapi6 = require("zod-openapi");
|
1099
|
-
(0, import_zod_openapi6.extendZodWithOpenApi)(
|
1100
|
-
var ActionConditional2 =
|
1155
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod11.z);
|
1156
|
+
var ActionConditional2 = import_zod11.z.discriminatedUnion("type", [
|
1101
1157
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1102
1158
|
ShowConditional,
|
1103
1159
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1104
1160
|
EnableConditional
|
1105
1161
|
]);
|
1106
|
-
var DeclarationReviewConfig =
|
1162
|
+
var DeclarationReviewConfig = import_zod11.z.object({
|
1107
1163
|
title: TranslationConfig.describe("Title of the review page"),
|
1108
|
-
fields:
|
1164
|
+
fields: import_zod11.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1109
1165
|
}).describe("Configuration for **declaration** review page.");
|
1110
|
-
var ActionConfigBase =
|
1166
|
+
var ActionConfigBase = import_zod11.z.object({
|
1111
1167
|
label: TranslationConfig,
|
1112
|
-
conditionals:
|
1113
|
-
draft:
|
1168
|
+
conditionals: import_zod11.z.array(ActionConditional2).optional().default([]),
|
1169
|
+
draft: import_zod11.z.boolean().optional()
|
1114
1170
|
});
|
1115
1171
|
var ReadActionConfig = ActionConfigBase.merge(
|
1116
|
-
|
1117
|
-
type:
|
1172
|
+
import_zod11.z.object({
|
1173
|
+
type: import_zod11.z.literal(ActionType.READ),
|
1118
1174
|
review: DeclarationReviewConfig
|
1119
1175
|
})
|
1120
1176
|
);
|
1121
1177
|
var DeclareConfig = ActionConfigBase.merge(
|
1122
|
-
|
1123
|
-
type:
|
1178
|
+
import_zod11.z.object({
|
1179
|
+
type: import_zod11.z.literal(ActionType.DECLARE),
|
1124
1180
|
review: DeclarationReviewConfig
|
1125
1181
|
})
|
1126
1182
|
);
|
1127
1183
|
var ValidateConfig = ActionConfigBase.merge(
|
1128
|
-
|
1129
|
-
type:
|
1184
|
+
import_zod11.z.object({
|
1185
|
+
type: import_zod11.z.literal(ActionType.VALIDATE),
|
1130
1186
|
review: DeclarationReviewConfig
|
1131
1187
|
})
|
1132
1188
|
);
|
1133
1189
|
var RegisterConfig = ActionConfigBase.merge(
|
1134
|
-
|
1135
|
-
type:
|
1190
|
+
import_zod11.z.object({
|
1191
|
+
type: import_zod11.z.literal(ActionType.REGISTER),
|
1136
1192
|
review: DeclarationReviewConfig
|
1137
1193
|
})
|
1138
1194
|
);
|
1139
1195
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1140
|
-
|
1141
|
-
type:
|
1196
|
+
import_zod11.z.object({
|
1197
|
+
type: import_zod11.z.literal(ActionType.REJECT)
|
1142
1198
|
})
|
1143
1199
|
);
|
1144
1200
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1145
|
-
|
1146
|
-
type:
|
1201
|
+
import_zod11.z.object({
|
1202
|
+
type: import_zod11.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1147
1203
|
})
|
1148
1204
|
);
|
1149
1205
|
var ArchiveConfig = ActionConfigBase.merge(
|
1150
|
-
|
1151
|
-
type:
|
1206
|
+
import_zod11.z.object({
|
1207
|
+
type: import_zod11.z.literal(ActionType.ARCHIVE)
|
1152
1208
|
})
|
1153
1209
|
);
|
1154
1210
|
var DeleteConfig = ActionConfigBase.merge(
|
1155
|
-
|
1156
|
-
type:
|
1211
|
+
import_zod11.z.object({
|
1212
|
+
type: import_zod11.z.literal(ActionType.DELETE)
|
1157
1213
|
})
|
1158
1214
|
);
|
1159
1215
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1160
|
-
|
1161
|
-
type:
|
1216
|
+
import_zod11.z.object({
|
1217
|
+
type: import_zod11.z.literal(ActionType.PRINT_CERTIFICATE),
|
1162
1218
|
printForm: ActionFormConfig
|
1163
1219
|
})
|
1164
1220
|
);
|
1165
1221
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1166
|
-
|
1167
|
-
type:
|
1222
|
+
import_zod11.z.object({
|
1223
|
+
type: import_zod11.z.literal(ActionType.REQUEST_CORRECTION),
|
1168
1224
|
correctionForm: ActionFormConfig
|
1169
1225
|
})
|
1170
1226
|
);
|
1171
1227
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1172
|
-
|
1173
|
-
type:
|
1228
|
+
import_zod11.z.object({
|
1229
|
+
type: import_zod11.z.literal(ActionType.REJECT_CORRECTION)
|
1174
1230
|
})
|
1175
1231
|
);
|
1176
1232
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1177
|
-
|
1178
|
-
type:
|
1233
|
+
import_zod11.z.object({
|
1234
|
+
type: import_zod11.z.literal(ActionType.APPROVE_CORRECTION)
|
1179
1235
|
})
|
1180
1236
|
);
|
1181
|
-
var ActionConfig =
|
1237
|
+
var ActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1182
1238
|
/*
|
1183
1239
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1184
1240
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1198,108 +1254,109 @@ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
|
|
1198
1254
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1199
1255
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1200
1256
|
]).openapi({ ref: "ActionConfig" });
|
1201
|
-
var DeclarationActionConfig =
|
1257
|
+
var DeclarationActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1202
1258
|
DeclareConfig,
|
1203
1259
|
ValidateConfig,
|
1204
1260
|
RegisterConfig
|
1205
1261
|
]);
|
1206
1262
|
|
1207
1263
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1208
|
-
var
|
1209
|
-
var FontFamily =
|
1210
|
-
normal:
|
1211
|
-
bold:
|
1212
|
-
italics:
|
1213
|
-
bolditalics:
|
1264
|
+
var import_zod12 = require("zod");
|
1265
|
+
var FontFamily = import_zod12.z.object({
|
1266
|
+
normal: import_zod12.z.string(),
|
1267
|
+
bold: import_zod12.z.string(),
|
1268
|
+
italics: import_zod12.z.string(),
|
1269
|
+
bolditalics: import_zod12.z.string()
|
1214
1270
|
});
|
1215
|
-
var CertificateConfig =
|
1216
|
-
id:
|
1217
|
-
event:
|
1271
|
+
var CertificateConfig = import_zod12.z.object({
|
1272
|
+
id: import_zod12.z.string(),
|
1273
|
+
event: import_zod12.z.string(),
|
1218
1274
|
label: TranslationConfig,
|
1219
|
-
isDefault:
|
1220
|
-
fee:
|
1221
|
-
onTime:
|
1222
|
-
late:
|
1223
|
-
delayed:
|
1275
|
+
isDefault: import_zod12.z.boolean(),
|
1276
|
+
fee: import_zod12.z.object({
|
1277
|
+
onTime: import_zod12.z.number(),
|
1278
|
+
late: import_zod12.z.number(),
|
1279
|
+
delayed: import_zod12.z.number()
|
1224
1280
|
}),
|
1225
|
-
svgUrl:
|
1226
|
-
fonts:
|
1281
|
+
svgUrl: import_zod12.z.string(),
|
1282
|
+
fonts: import_zod12.z.record(FontFamily).optional(),
|
1283
|
+
conditionals: import_zod12.z.array(ShowConditional).optional()
|
1227
1284
|
});
|
1228
1285
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1229
|
-
hash:
|
1230
|
-
svg:
|
1286
|
+
hash: import_zod12.z.string().optional(),
|
1287
|
+
svg: import_zod12.z.string()
|
1231
1288
|
});
|
1232
1289
|
|
1233
1290
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1234
|
-
var
|
1235
|
-
var LanguageConfig =
|
1236
|
-
lang:
|
1291
|
+
var import_zod13 = require("zod");
|
1292
|
+
var LanguageConfig = import_zod13.z.object({
|
1293
|
+
lang: import_zod13.z.string(),
|
1237
1294
|
/**
|
1238
1295
|
* client.csv contents
|
1239
1296
|
*/
|
1240
|
-
messages:
|
1297
|
+
messages: import_zod13.z.record(import_zod13.z.string())
|
1241
1298
|
});
|
1242
1299
|
|
1243
1300
|
// ../commons/src/events/EventConfig.ts
|
1244
|
-
var
|
1301
|
+
var import_zod22 = require("zod");
|
1245
1302
|
|
1246
1303
|
// ../commons/src/events/DeduplicationConfig.ts
|
1247
|
-
var
|
1304
|
+
var import_zod14 = require("zod");
|
1248
1305
|
var import_zod_openapi7 = require("zod-openapi");
|
1249
|
-
(0, import_zod_openapi7.extendZodWithOpenApi)(
|
1250
|
-
var FieldReference2 =
|
1251
|
-
var Matcher =
|
1252
|
-
fieldId:
|
1253
|
-
options:
|
1254
|
-
boost:
|
1306
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod14.z);
|
1307
|
+
var FieldReference2 = import_zod14.z.string();
|
1308
|
+
var Matcher = import_zod14.z.object({
|
1309
|
+
fieldId: import_zod14.z.string(),
|
1310
|
+
options: import_zod14.z.object({
|
1311
|
+
boost: import_zod14.z.number().optional()
|
1255
1312
|
}).optional().default({})
|
1256
1313
|
});
|
1257
1314
|
var FuzzyMatcher = Matcher.extend({
|
1258
|
-
type:
|
1259
|
-
options:
|
1315
|
+
type: import_zod14.z.literal("fuzzy"),
|
1316
|
+
options: import_zod14.z.object({
|
1260
1317
|
/**
|
1261
1318
|
* Names of length 3 or less characters = 0 edits allowed
|
1262
1319
|
* Names of length 4 - 6 characters = 1 edit allowed
|
1263
1320
|
* Names of length >7 characters = 2 edits allowed
|
1264
1321
|
*/
|
1265
|
-
fuzziness:
|
1266
|
-
boost:
|
1322
|
+
fuzziness: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.number()]).optional().default("AUTO:4,7"),
|
1323
|
+
boost: import_zod14.z.number().optional().default(1)
|
1267
1324
|
}).optional().default({})
|
1268
1325
|
});
|
1269
1326
|
var StrictMatcher = Matcher.extend({
|
1270
|
-
type:
|
1271
|
-
options:
|
1272
|
-
boost:
|
1327
|
+
type: import_zod14.z.literal("strict"),
|
1328
|
+
options: import_zod14.z.object({
|
1329
|
+
boost: import_zod14.z.number().optional().default(1)
|
1273
1330
|
}).optional().default({})
|
1274
1331
|
});
|
1275
1332
|
var DateRangeMatcher = Matcher.extend({
|
1276
|
-
type:
|
1277
|
-
options:
|
1278
|
-
days:
|
1333
|
+
type: import_zod14.z.literal("dateRange"),
|
1334
|
+
options: import_zod14.z.object({
|
1335
|
+
days: import_zod14.z.number(),
|
1279
1336
|
origin: FieldReference2,
|
1280
|
-
boost:
|
1337
|
+
boost: import_zod14.z.number().optional().default(1)
|
1281
1338
|
})
|
1282
1339
|
});
|
1283
1340
|
var DateDistanceMatcher = Matcher.extend({
|
1284
|
-
type:
|
1285
|
-
options:
|
1286
|
-
days:
|
1341
|
+
type: import_zod14.z.literal("dateDistance"),
|
1342
|
+
options: import_zod14.z.object({
|
1343
|
+
days: import_zod14.z.number(),
|
1287
1344
|
origin: FieldReference2,
|
1288
|
-
boost:
|
1345
|
+
boost: import_zod14.z.number().optional().default(1)
|
1289
1346
|
})
|
1290
1347
|
});
|
1291
|
-
var And =
|
1292
|
-
type:
|
1348
|
+
var And = import_zod14.z.object({
|
1349
|
+
type: import_zod14.z.literal("and"),
|
1293
1350
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1294
|
-
clauses:
|
1351
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1295
1352
|
});
|
1296
|
-
var Or =
|
1297
|
-
type:
|
1353
|
+
var Or = import_zod14.z.object({
|
1354
|
+
type: import_zod14.z.literal("or"),
|
1298
1355
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1299
|
-
clauses:
|
1356
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1300
1357
|
});
|
1301
|
-
var Clause =
|
1302
|
-
() =>
|
1358
|
+
var Clause = import_zod14.z.lazy(
|
1359
|
+
() => import_zod14.z.discriminatedUnion("type", [
|
1303
1360
|
And,
|
1304
1361
|
Or,
|
1305
1362
|
FuzzyMatcher,
|
@@ -1310,43 +1367,43 @@ var Clause = import_zod13.z.lazy(
|
|
1310
1367
|
).openapi({
|
1311
1368
|
ref: "Clause"
|
1312
1369
|
});
|
1313
|
-
var DeduplicationConfig =
|
1314
|
-
id:
|
1370
|
+
var DeduplicationConfig = import_zod14.z.object({
|
1371
|
+
id: import_zod14.z.string(),
|
1315
1372
|
label: TranslationConfig,
|
1316
1373
|
query: Clause
|
1317
1374
|
});
|
1318
1375
|
|
1319
1376
|
// ../commons/src/events/SummaryConfig.ts
|
1320
|
-
var
|
1321
|
-
var BaseField2 =
|
1377
|
+
var import_zod15 = require("zod");
|
1378
|
+
var BaseField2 = import_zod15.z.object({
|
1322
1379
|
emptyValueMessage: TranslationConfig.optional(),
|
1323
|
-
conditionals:
|
1380
|
+
conditionals: import_zod15.z.array(ShowConditional).default([]).optional()
|
1324
1381
|
});
|
1325
1382
|
var ReferenceField = BaseField2.extend({
|
1326
|
-
fieldId:
|
1383
|
+
fieldId: import_zod15.z.string(),
|
1327
1384
|
label: TranslationConfig.optional().describe(
|
1328
1385
|
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1329
1386
|
)
|
1330
1387
|
}).describe("Field directly referencing event data with field id");
|
1331
1388
|
var Field = BaseField2.extend({
|
1332
|
-
id:
|
1389
|
+
id: import_zod15.z.string().describe("Id of summary field"),
|
1333
1390
|
value: TranslationConfig.describe(
|
1334
1391
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1335
1392
|
),
|
1336
1393
|
label: TranslationConfig
|
1337
1394
|
}).describe("Custom configured field");
|
1338
|
-
var SummaryConfig =
|
1339
|
-
fields:
|
1395
|
+
var SummaryConfig = import_zod15.z.object({
|
1396
|
+
fields: import_zod15.z.array(import_zod15.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
1340
1397
|
}).describe("Configuration for summary in event.");
|
1341
1398
|
|
1342
1399
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1343
|
-
var
|
1344
|
-
var MatchType =
|
1345
|
-
var BaseField3 =
|
1346
|
-
config:
|
1400
|
+
var import_zod16 = require("zod");
|
1401
|
+
var MatchType = import_zod16.z.enum(["fuzzy", "exact", "range", "within"]);
|
1402
|
+
var BaseField3 = import_zod16.z.object({
|
1403
|
+
config: import_zod16.z.object({
|
1347
1404
|
type: MatchType.describe("Determines the type of field")
|
1348
1405
|
}),
|
1349
|
-
options:
|
1406
|
+
options: import_zod16.z.array(SelectOption).optional(),
|
1350
1407
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1351
1408
|
`
|
1352
1409
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
@@ -1367,7 +1424,7 @@ var BaseField3 = import_zod15.z.object({
|
|
1367
1424
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1368
1425
|
`
|
1369
1426
|
),
|
1370
|
-
conditionals:
|
1427
|
+
conditionals: import_zod16.z.array(FieldConditional).default([]).optional().describe(
|
1371
1428
|
`
|
1372
1429
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1373
1430
|
|
@@ -1381,60 +1438,68 @@ var BaseField3 = import_zod15.z.object({
|
|
1381
1438
|
are always rendered in the advanced search form.
|
1382
1439
|
`
|
1383
1440
|
),
|
1384
|
-
validations:
|
1441
|
+
validations: import_zod16.z.array(ValidationConfig).default([]).optional().describe(
|
1385
1442
|
`In advanced search, we sometimes need to override the default field validations.`
|
1386
1443
|
)
|
1387
1444
|
});
|
1388
|
-
var SearchQueryParams =
|
1389
|
-
eventType:
|
1445
|
+
var SearchQueryParams = import_zod16.z.object({
|
1446
|
+
eventType: import_zod16.z.string().optional().describe(
|
1390
1447
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1391
1448
|
)
|
1392
1449
|
}).catchall(FieldValue);
|
1393
1450
|
var FieldConfigSchema = BaseField3.extend({
|
1394
|
-
fieldId:
|
1395
|
-
fieldType:
|
1396
|
-
alternateFieldIds:
|
1451
|
+
fieldId: import_zod16.z.string(),
|
1452
|
+
fieldType: import_zod16.z.literal("field"),
|
1453
|
+
alternateFieldIds: import_zod16.z.array(import_zod16.z.string()).optional().describe(
|
1397
1454
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1398
|
-
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1455
|
+
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1399
1456
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1400
1457
|
),
|
1401
|
-
excludeInSearchQuery:
|
1402
|
-
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1458
|
+
excludeInSearchQuery: import_zod16.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1459
|
+
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1403
1460
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1404
1461
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1405
1462
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1406
1463
|
});
|
1407
|
-
var
|
1464
|
+
var EventFieldIdInput = import_zod16.z.enum([
|
1408
1465
|
"trackingId",
|
1409
1466
|
"status",
|
1410
1467
|
"legalStatuses.REGISTERED.acceptedAt",
|
1411
1468
|
"legalStatuses.REGISTERED.createdAtLocation",
|
1412
1469
|
"updatedAt"
|
1413
1470
|
]);
|
1471
|
+
var METADATA_FIELD_PREFIX = "event.";
|
1472
|
+
var EventFieldId = import_zod16.z.enum([
|
1473
|
+
`${METADATA_FIELD_PREFIX}trackingId`,
|
1474
|
+
`${METADATA_FIELD_PREFIX}status`,
|
1475
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
1476
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
1477
|
+
`${METADATA_FIELD_PREFIX}updatedAt`
|
1478
|
+
]);
|
1414
1479
|
var EventFieldConfigSchema = BaseField3.extend({
|
1415
1480
|
fieldId: EventFieldId,
|
1416
|
-
fieldType:
|
1481
|
+
fieldType: import_zod16.z.literal("event")
|
1417
1482
|
});
|
1418
|
-
var SearchField =
|
1483
|
+
var SearchField = import_zod16.z.discriminatedUnion("fieldType", [
|
1419
1484
|
FieldConfigSchema,
|
1420
1485
|
EventFieldConfigSchema
|
1421
1486
|
]);
|
1422
|
-
var AdvancedSearchConfig =
|
1487
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
1423
1488
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1424
|
-
fields:
|
1489
|
+
fields: import_zod16.z.array(SearchField).describe("Advanced search fields.")
|
1425
1490
|
});
|
1426
1491
|
|
1427
1492
|
// ../commons/src/events/utils.ts
|
1428
1493
|
var import_lodash = require("lodash");
|
1429
1494
|
|
1430
1495
|
// ../commons/src/events/ActionDocument.ts
|
1431
|
-
var
|
1496
|
+
var import_zod20 = require("zod");
|
1432
1497
|
var import_zod_openapi8 = require("zod-openapi");
|
1433
1498
|
|
1434
1499
|
// ../commons/src/uuid.ts
|
1435
1500
|
var import_uuid = require("uuid");
|
1436
|
-
var
|
1437
|
-
var UUID =
|
1501
|
+
var import_zod17 = require("zod");
|
1502
|
+
var UUID = import_zod17.z.string().uuid().brand("UUID");
|
1438
1503
|
function getUUID() {
|
1439
1504
|
return (0, import_uuid.v4)();
|
1440
1505
|
}
|
@@ -1444,10 +1509,10 @@ var CreatedAtLocation = UUID.nullish();
|
|
1444
1509
|
|
1445
1510
|
// ../commons/src/authentication.ts
|
1446
1511
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1447
|
-
var
|
1512
|
+
var import_zod19 = require("zod");
|
1448
1513
|
|
1449
1514
|
// ../commons/src/scopes.ts
|
1450
|
-
var
|
1515
|
+
var import_zod18 = require("zod");
|
1451
1516
|
var SCOPES = {
|
1452
1517
|
// TODO v1.8 legacy scopes
|
1453
1518
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -1560,108 +1625,108 @@ var SCOPES = {
|
|
1560
1625
|
// data seeding
|
1561
1626
|
USER_DATA_SEEDING: "user.data-seeding"
|
1562
1627
|
};
|
1563
|
-
var LegacyScopes =
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1628
|
+
var LegacyScopes = import_zod18.z.union([
|
1629
|
+
import_zod18.z.literal(SCOPES.NATLSYSADMIN),
|
1630
|
+
import_zod18.z.literal(SCOPES.BYPASSRATELIMIT),
|
1631
|
+
import_zod18.z.literal(SCOPES.DECLARE),
|
1632
|
+
import_zod18.z.literal(SCOPES.REGISTER),
|
1633
|
+
import_zod18.z.literal(SCOPES.VALIDATE),
|
1634
|
+
import_zod18.z.literal(SCOPES.DEMO),
|
1635
|
+
import_zod18.z.literal(SCOPES.CERTIFY),
|
1636
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE),
|
1637
|
+
import_zod18.z.literal(SCOPES.SYSADMIN),
|
1638
|
+
import_zod18.z.literal(SCOPES.TEAMS),
|
1639
|
+
import_zod18.z.literal(SCOPES.CONFIG)
|
1575
1640
|
]);
|
1576
|
-
var IntegrationScopes =
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1641
|
+
var IntegrationScopes = import_zod18.z.union([
|
1642
|
+
import_zod18.z.literal(SCOPES.WEBHOOK),
|
1643
|
+
import_zod18.z.literal(SCOPES.NATIONALID),
|
1644
|
+
import_zod18.z.literal(SCOPES.NOTIFICATION_API),
|
1645
|
+
import_zod18.z.literal(SCOPES.RECORDSEARCH)
|
1581
1646
|
]);
|
1582
|
-
var DeclareScopes =
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1647
|
+
var DeclareScopes = import_zod18.z.union([
|
1648
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE),
|
1649
|
+
import_zod18.z.literal(SCOPES.RECORD_IMPORT),
|
1650
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
1651
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
1652
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
1653
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
1654
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
1655
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
1656
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
1657
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
1593
1658
|
]);
|
1594
|
-
var UnassignScope =
|
1595
|
-
var ValidateScopes =
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1659
|
+
var UnassignScope = import_zod18.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
1660
|
+
var ValidateScopes = import_zod18.z.union([
|
1661
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
1662
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
1663
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
1664
|
+
import_zod18.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
1665
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
1666
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
1602
1667
|
]);
|
1603
|
-
var RegisterScope =
|
1604
|
-
var CertifyScopes =
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1668
|
+
var RegisterScope = import_zod18.z.literal(SCOPES.RECORD_REGISTER);
|
1669
|
+
var CertifyScopes = import_zod18.z.union([
|
1670
|
+
import_zod18.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
1671
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
1672
|
+
import_zod18.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
1673
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
1674
|
+
import_zod18.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
1675
|
+
import_zod18.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
1676
|
+
import_zod18.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
1677
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
|
1613
1678
|
]);
|
1614
|
-
var CorrectionScopes =
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1679
|
+
var CorrectionScopes = import_zod18.z.union([
|
1680
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
1681
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
1682
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
1683
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
1684
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
1685
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
1686
|
+
import_zod18.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
1687
|
+
import_zod18.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
1623
1688
|
]);
|
1624
|
-
var SearchScopes =
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1689
|
+
var SearchScopes = import_zod18.z.union([
|
1690
|
+
import_zod18.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
1691
|
+
import_zod18.z.literal(SCOPES.SEARCH_BIRTH),
|
1692
|
+
import_zod18.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
1693
|
+
import_zod18.z.literal(SCOPES.SEARCH_DEATH),
|
1694
|
+
import_zod18.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
1695
|
+
import_zod18.z.literal(SCOPES.SEARCH_MARRIAGE)
|
1631
1696
|
]);
|
1632
|
-
var AuditScopes =
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1697
|
+
var AuditScopes = import_zod18.z.union([
|
1698
|
+
import_zod18.z.literal(SCOPES.RECORD_READ),
|
1699
|
+
import_zod18.z.literal(SCOPES.RECORD_READ_AUDIT),
|
1700
|
+
import_zod18.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
1701
|
+
import_zod18.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
|
1637
1702
|
]);
|
1638
|
-
var ProfileScopes =
|
1639
|
-
|
1640
|
-
|
1703
|
+
var ProfileScopes = import_zod18.z.union([
|
1704
|
+
import_zod18.z.literal(SCOPES.PROFILE_UPDATE),
|
1705
|
+
import_zod18.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1641
1706
|
]);
|
1642
|
-
var PerformanceScopes =
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1707
|
+
var PerformanceScopes = import_zod18.z.union([
|
1708
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE_READ),
|
1709
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
1710
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
1646
1711
|
]);
|
1647
|
-
var OrganisationScopes =
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1712
|
+
var OrganisationScopes = import_zod18.z.union([
|
1713
|
+
import_zod18.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
1714
|
+
import_zod18.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
1715
|
+
import_zod18.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
1651
1716
|
]);
|
1652
|
-
var UserScopes =
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1717
|
+
var UserScopes = import_zod18.z.union([
|
1718
|
+
import_zod18.z.literal(SCOPES.USER_READ),
|
1719
|
+
import_zod18.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
1720
|
+
import_zod18.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
1721
|
+
import_zod18.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
1722
|
+
import_zod18.z.literal(SCOPES.USER_CREATE),
|
1723
|
+
import_zod18.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
1724
|
+
import_zod18.z.literal(SCOPES.USER_UPDATE),
|
1725
|
+
import_zod18.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
1661
1726
|
]);
|
1662
|
-
var ConfigScope =
|
1663
|
-
var DataSeedingScope =
|
1664
|
-
var LiteralScopes =
|
1727
|
+
var ConfigScope = import_zod18.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
1728
|
+
var DataSeedingScope = import_zod18.z.literal(SCOPES.USER_DATA_SEEDING);
|
1729
|
+
var LiteralScopes = import_zod18.z.union([
|
1665
1730
|
LegacyScopes,
|
1666
1731
|
IntegrationScopes,
|
1667
1732
|
UnassignScope,
|
@@ -1680,39 +1745,39 @@ var LiteralScopes = import_zod17.z.union([
|
|
1680
1745
|
DataSeedingScope
|
1681
1746
|
]);
|
1682
1747
|
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1683
|
-
var rawConfigurableScope =
|
1684
|
-
var CreateUserScope =
|
1685
|
-
type:
|
1686
|
-
options:
|
1687
|
-
role:
|
1748
|
+
var rawConfigurableScope = import_zod18.z.string().regex(rawConfigurableScopeRegex);
|
1749
|
+
var CreateUserScope = import_zod18.z.object({
|
1750
|
+
type: import_zod18.z.literal("user.create"),
|
1751
|
+
options: import_zod18.z.object({
|
1752
|
+
role: import_zod18.z.array(import_zod18.z.string())
|
1688
1753
|
})
|
1689
1754
|
});
|
1690
|
-
var EditUserScope =
|
1691
|
-
type:
|
1692
|
-
options:
|
1693
|
-
role:
|
1755
|
+
var EditUserScope = import_zod18.z.object({
|
1756
|
+
type: import_zod18.z.literal("user.edit"),
|
1757
|
+
options: import_zod18.z.object({
|
1758
|
+
role: import_zod18.z.array(import_zod18.z.string())
|
1694
1759
|
})
|
1695
1760
|
});
|
1696
|
-
var WorkqueueScope =
|
1697
|
-
type:
|
1698
|
-
options:
|
1699
|
-
id:
|
1761
|
+
var WorkqueueScope = import_zod18.z.object({
|
1762
|
+
type: import_zod18.z.literal("workqueue"),
|
1763
|
+
options: import_zod18.z.object({
|
1764
|
+
id: import_zod18.z.array(import_zod18.z.string())
|
1700
1765
|
})
|
1701
1766
|
});
|
1702
|
-
var NotifyRecordScope =
|
1703
|
-
type:
|
1704
|
-
options:
|
1705
|
-
event:
|
1767
|
+
var NotifyRecordScope = import_zod18.z.object({
|
1768
|
+
type: import_zod18.z.literal("record.notify"),
|
1769
|
+
options: import_zod18.z.object({
|
1770
|
+
event: import_zod18.z.array(import_zod18.z.string())
|
1706
1771
|
})
|
1707
1772
|
});
|
1708
|
-
var SearchScope =
|
1709
|
-
type:
|
1710
|
-
options:
|
1711
|
-
event:
|
1712
|
-
access:
|
1773
|
+
var SearchScope = import_zod18.z.object({
|
1774
|
+
type: import_zod18.z.literal("search"),
|
1775
|
+
options: import_zod18.z.object({
|
1776
|
+
event: import_zod18.z.array(import_zod18.z.string()).length(1),
|
1777
|
+
access: import_zod18.z.array(import_zod18.z.enum(["my-jurisdiction", "all"])).length(1)
|
1713
1778
|
})
|
1714
1779
|
});
|
1715
|
-
var ConfigurableRawScopes =
|
1780
|
+
var ConfigurableRawScopes = import_zod18.z.discriminatedUnion("type", [
|
1716
1781
|
SearchScope,
|
1717
1782
|
CreateUserScope,
|
1718
1783
|
EditUserScope,
|
@@ -1720,7 +1785,7 @@ var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
|
|
1720
1785
|
NotifyRecordScope
|
1721
1786
|
]);
|
1722
1787
|
var scopes = Object.values(SCOPES);
|
1723
|
-
var ActionScopes =
|
1788
|
+
var ActionScopes = import_zod18.z.union([
|
1724
1789
|
DeclareScopes,
|
1725
1790
|
ValidateScopes,
|
1726
1791
|
RegisterScope,
|
@@ -1871,30 +1936,30 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
1871
1936
|
]
|
1872
1937
|
}
|
1873
1938
|
];
|
1874
|
-
var TokenUserType =
|
1875
|
-
var TokenWithBearer =
|
1939
|
+
var TokenUserType = import_zod19.z.enum(["user", "system"]);
|
1940
|
+
var TokenWithBearer = import_zod19.z.string().regex(/^Bearer\s/);
|
1876
1941
|
|
1877
1942
|
// ../commons/src/events/ActionDocument.ts
|
1878
|
-
(0, import_zod_openapi8.extendZodWithOpenApi)(
|
1879
|
-
var ActionUpdate =
|
1880
|
-
var EventState =
|
1943
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
|
1944
|
+
var ActionUpdate = import_zod20.z.record(import_zod20.z.string(), FieldUpdateValue);
|
1945
|
+
var EventState = import_zod20.z.record(import_zod20.z.string(), FieldValue);
|
1881
1946
|
var ActionStatus = {
|
1882
1947
|
Requested: "Requested",
|
1883
1948
|
Accepted: "Accepted",
|
1884
1949
|
Rejected: "Rejected"
|
1885
1950
|
};
|
1886
|
-
var ActionBase =
|
1951
|
+
var ActionBase = import_zod20.z.object({
|
1887
1952
|
id: UUID,
|
1888
|
-
transactionId:
|
1953
|
+
transactionId: import_zod20.z.string(),
|
1889
1954
|
createdByUserType: TokenUserType,
|
1890
|
-
createdAt:
|
1891
|
-
createdBy:
|
1892
|
-
createdByRole:
|
1893
|
-
createdBySignature:
|
1955
|
+
createdAt: import_zod20.z.string().datetime(),
|
1956
|
+
createdBy: import_zod20.z.string(),
|
1957
|
+
createdByRole: import_zod20.z.string(),
|
1958
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1894
1959
|
createdAtLocation: CreatedAtLocation,
|
1895
1960
|
declaration: ActionUpdate,
|
1896
1961
|
annotation: ActionUpdate.optional().nullable(),
|
1897
|
-
status:
|
1962
|
+
status: import_zod20.z.enum([
|
1898
1963
|
ActionStatus.Requested,
|
1899
1964
|
ActionStatus.Accepted,
|
1900
1965
|
ActionStatus.Rejected
|
@@ -1908,102 +1973,102 @@ var ActionBase = import_zod19.z.object({
|
|
1908
1973
|
// See PrintCertificateAction
|
1909
1974
|
});
|
1910
1975
|
var AssignedAction = ActionBase.merge(
|
1911
|
-
|
1912
|
-
type:
|
1913
|
-
assignedTo:
|
1976
|
+
import_zod20.z.object({
|
1977
|
+
type: import_zod20.z.literal(ActionType.ASSIGN),
|
1978
|
+
assignedTo: import_zod20.z.string()
|
1914
1979
|
// TODO move into 'content' property
|
1915
1980
|
})
|
1916
1981
|
);
|
1917
1982
|
var UnassignedAction = ActionBase.merge(
|
1918
|
-
|
1919
|
-
type:
|
1983
|
+
import_zod20.z.object({
|
1984
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN)
|
1920
1985
|
})
|
1921
1986
|
);
|
1922
1987
|
var RegisterAction = ActionBase.merge(
|
1923
|
-
|
1924
|
-
type:
|
1925
|
-
registrationNumber:
|
1988
|
+
import_zod20.z.object({
|
1989
|
+
type: import_zod20.z.literal(ActionType.REGISTER),
|
1990
|
+
registrationNumber: import_zod20.z.string().optional()
|
1926
1991
|
// TODO move into 'content' property
|
1927
1992
|
})
|
1928
1993
|
);
|
1929
1994
|
var DeclareAction = ActionBase.merge(
|
1930
|
-
|
1931
|
-
type:
|
1995
|
+
import_zod20.z.object({
|
1996
|
+
type: import_zod20.z.literal(ActionType.DECLARE)
|
1932
1997
|
})
|
1933
1998
|
);
|
1934
1999
|
var ValidateAction = ActionBase.merge(
|
1935
|
-
|
1936
|
-
type:
|
2000
|
+
import_zod20.z.object({
|
2001
|
+
type: import_zod20.z.literal(ActionType.VALIDATE)
|
1937
2002
|
})
|
1938
2003
|
);
|
1939
|
-
var RejectionReason =
|
1940
|
-
message:
|
1941
|
-
isDuplicate:
|
2004
|
+
var RejectionReason = import_zod20.z.object({
|
2005
|
+
message: import_zod20.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
2006
|
+
isDuplicate: import_zod20.z.boolean().optional().describe("If a declaration is duplicated")
|
1942
2007
|
});
|
1943
2008
|
var RejectAction = ActionBase.merge(
|
1944
|
-
|
1945
|
-
type:
|
2009
|
+
import_zod20.z.object({
|
2010
|
+
type: import_zod20.z.literal(ActionType.REJECT),
|
1946
2011
|
reason: RejectionReason
|
1947
2012
|
// TODO move into 'content' property
|
1948
2013
|
})
|
1949
2014
|
);
|
1950
2015
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1951
|
-
|
1952
|
-
type:
|
2016
|
+
import_zod20.z.object({
|
2017
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1953
2018
|
})
|
1954
2019
|
);
|
1955
2020
|
var ArchiveAction = ActionBase.merge(
|
1956
|
-
|
1957
|
-
type:
|
2021
|
+
import_zod20.z.object({
|
2022
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE),
|
1958
2023
|
reason: RejectionReason
|
1959
2024
|
// TODO move into 'content' property
|
1960
2025
|
})
|
1961
2026
|
);
|
1962
2027
|
var CreatedAction = ActionBase.merge(
|
1963
|
-
|
1964
|
-
type:
|
2028
|
+
import_zod20.z.object({
|
2029
|
+
type: import_zod20.z.literal(ActionType.CREATE)
|
1965
2030
|
})
|
1966
2031
|
);
|
1967
2032
|
var NotifiedAction = ActionBase.merge(
|
1968
|
-
|
1969
|
-
type:
|
2033
|
+
import_zod20.z.object({
|
2034
|
+
type: import_zod20.z.literal(ActionType.NOTIFY)
|
1970
2035
|
})
|
1971
2036
|
);
|
1972
|
-
var PrintContent =
|
1973
|
-
templateId:
|
2037
|
+
var PrintContent = import_zod20.z.object({
|
2038
|
+
templateId: import_zod20.z.string().optional()
|
1974
2039
|
});
|
1975
2040
|
var PrintCertificateAction = ActionBase.merge(
|
1976
|
-
|
1977
|
-
type:
|
2041
|
+
import_zod20.z.object({
|
2042
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE),
|
1978
2043
|
content: PrintContent.optional().nullable()
|
1979
2044
|
})
|
1980
2045
|
);
|
1981
2046
|
var RequestedCorrectionAction = ActionBase.merge(
|
1982
|
-
|
1983
|
-
type:
|
2047
|
+
import_zod20.z.object({
|
2048
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION)
|
1984
2049
|
})
|
1985
2050
|
);
|
1986
2051
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1987
|
-
|
1988
|
-
type:
|
1989
|
-
requestId:
|
2052
|
+
import_zod20.z.object({
|
2053
|
+
type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION),
|
2054
|
+
requestId: import_zod20.z.string()
|
1990
2055
|
// TODO move into 'content' property
|
1991
2056
|
})
|
1992
2057
|
);
|
1993
2058
|
var RejectedCorrectionAction = ActionBase.merge(
|
1994
|
-
|
1995
|
-
type:
|
1996
|
-
requestId:
|
2059
|
+
import_zod20.z.object({
|
2060
|
+
type: import_zod20.z.literal(ActionType.REJECT_CORRECTION),
|
2061
|
+
requestId: import_zod20.z.string(),
|
1997
2062
|
// TODO move into 'content' property
|
1998
2063
|
reason: RejectionReason
|
1999
2064
|
})
|
2000
2065
|
);
|
2001
2066
|
var ReadAction = ActionBase.merge(
|
2002
|
-
|
2003
|
-
type:
|
2067
|
+
import_zod20.z.object({
|
2068
|
+
type: import_zod20.z.literal(ActionType.READ)
|
2004
2069
|
})
|
2005
2070
|
);
|
2006
|
-
var ActionDocument =
|
2071
|
+
var ActionDocument = import_zod20.z.discriminatedUnion("type", [
|
2007
2072
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
2008
2073
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
2009
2074
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -2026,31 +2091,31 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
2026
2091
|
declaration: true,
|
2027
2092
|
annotation: true
|
2028
2093
|
}).merge(
|
2029
|
-
|
2030
|
-
type:
|
2031
|
-
status:
|
2094
|
+
import_zod20.z.object({
|
2095
|
+
type: import_zod20.z.enum(ConfirmableActions),
|
2096
|
+
status: import_zod20.z.literal(ActionStatus.Rejected)
|
2032
2097
|
})
|
2033
2098
|
);
|
2034
|
-
var Action =
|
2035
|
-
var ResolvedUser =
|
2036
|
-
id:
|
2037
|
-
role:
|
2038
|
-
name:
|
2039
|
-
|
2040
|
-
use:
|
2041
|
-
given:
|
2042
|
-
family:
|
2099
|
+
var Action = import_zod20.z.union([ActionDocument, AsyncRejectActionDocument]);
|
2100
|
+
var ResolvedUser = import_zod20.z.object({
|
2101
|
+
id: import_zod20.z.string(),
|
2102
|
+
role: import_zod20.z.string(),
|
2103
|
+
name: import_zod20.z.array(
|
2104
|
+
import_zod20.z.object({
|
2105
|
+
use: import_zod20.z.string(),
|
2106
|
+
given: import_zod20.z.array(import_zod20.z.string()),
|
2107
|
+
family: import_zod20.z.string()
|
2043
2108
|
})
|
2044
2109
|
)
|
2045
2110
|
});
|
2046
2111
|
|
2047
2112
|
// ../commons/src/conditionals/validate.ts
|
2048
|
-
var
|
2113
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
2049
2114
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
2050
2115
|
var import_date_fns = require("date-fns");
|
2051
2116
|
|
2052
2117
|
// ../commons/src/events/FieldTypeMapping.ts
|
2053
|
-
var
|
2118
|
+
var import_zod21 = require("zod");
|
2054
2119
|
function mapFieldTypeToZod(type, required) {
|
2055
2120
|
let schema;
|
2056
2121
|
switch (type) {
|
@@ -2116,7 +2181,7 @@ function createValidationSchema(config) {
|
|
2116
2181
|
for (const field2 of config) {
|
2117
2182
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2118
2183
|
}
|
2119
|
-
return
|
2184
|
+
return import_zod21.z.object(shape);
|
2120
2185
|
}
|
2121
2186
|
function mapFieldTypeToEmptyValue(field2) {
|
2122
2187
|
switch (field2.type) {
|
@@ -2259,9 +2324,11 @@ var isNonInteractiveFieldType = (field2) => {
|
|
2259
2324
|
};
|
2260
2325
|
|
2261
2326
|
// ../commons/src/conditionals/validate.ts
|
2262
|
-
var ajv = new
|
2327
|
+
var ajv = new import__.default({
|
2263
2328
|
$data: true,
|
2264
|
-
allowUnionTypes: true
|
2329
|
+
allowUnionTypes: true,
|
2330
|
+
strict: false
|
2331
|
+
// Allow minContains and other newer features
|
2265
2332
|
});
|
2266
2333
|
(0, import_ajv_formats.default)(ajv);
|
2267
2334
|
ajv.addKeyword({
|
@@ -2434,6 +2501,23 @@ function validateFieldInput({
|
|
2434
2501
|
const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
|
2435
2502
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
2436
2503
|
}
|
2504
|
+
function runStructuralValidations({
|
2505
|
+
field: field2,
|
2506
|
+
values
|
2507
|
+
}) {
|
2508
|
+
if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
|
2509
|
+
return {
|
2510
|
+
errors: []
|
2511
|
+
};
|
2512
|
+
}
|
2513
|
+
const fieldValidationResult = validateFieldInput({
|
2514
|
+
field: field2,
|
2515
|
+
value: values[field2.id]
|
2516
|
+
});
|
2517
|
+
return {
|
2518
|
+
errors: fieldValidationResult
|
2519
|
+
};
|
2520
|
+
}
|
2437
2521
|
function runFieldValidations({
|
2438
2522
|
field: field2,
|
2439
2523
|
values
|
@@ -2499,6 +2583,11 @@ function getValidatorsForField(fieldId, validations) {
|
|
2499
2583
|
};
|
2500
2584
|
}).filter((x) => x !== null);
|
2501
2585
|
}
|
2586
|
+
function areCertificateConditionsMet(conditions, values) {
|
2587
|
+
return conditions.every((condition) => {
|
2588
|
+
return ajv.validate(condition.conditional, values);
|
2589
|
+
});
|
2590
|
+
}
|
2502
2591
|
|
2503
2592
|
// ../commons/src/utils.ts
|
2504
2593
|
function getOrThrow(x, message) {
|
@@ -2600,10 +2689,16 @@ function omitHiddenPaginatedFields(formConfig, declaration) {
|
|
2600
2689
|
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
2601
2690
|
return omitHiddenFields(visiblePagesFormFields, declaration);
|
2602
2691
|
}
|
2603
|
-
function
|
2604
|
-
const actions =
|
2692
|
+
function findActiveDraftForEvent(event2, draft) {
|
2693
|
+
const actions = (0, import_lodash.orderBy)(
|
2694
|
+
event2.actions.filter(({ type }) => type !== ActionType.READ),
|
2695
|
+
["createdAt"],
|
2696
|
+
["asc"]
|
2697
|
+
);
|
2605
2698
|
const lastAction = actions[actions.length - 1];
|
2606
|
-
|
2699
|
+
const isDraftActive = draft.createdAt >= lastAction.createdAt;
|
2700
|
+
const isDraftForEvent = event2.id === draft.eventId;
|
2701
|
+
return isDraftActive && isDraftForEvent ? draft : void 0;
|
2607
2702
|
}
|
2608
2703
|
function createEmptyDraft(eventId, draftId, actionType) {
|
2609
2704
|
return {
|
@@ -2719,16 +2814,16 @@ function timePeriodToDateRange(value) {
|
|
2719
2814
|
let startDate;
|
2720
2815
|
switch (value) {
|
2721
2816
|
case "last7Days":
|
2722
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2817
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
|
2723
2818
|
break;
|
2724
2819
|
case "last30Days":
|
2725
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2820
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
|
2726
2821
|
break;
|
2727
2822
|
case "last90Days":
|
2728
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2823
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
|
2729
2824
|
break;
|
2730
2825
|
case "last365Days":
|
2731
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2826
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
|
2732
2827
|
break;
|
2733
2828
|
}
|
2734
2829
|
return {
|
@@ -2736,12 +2831,35 @@ function timePeriodToDateRange(value) {
|
|
2736
2831
|
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2737
2832
|
};
|
2738
2833
|
}
|
2834
|
+
function mergeDrafts(currentDraft, incomingDraft) {
|
2835
|
+
if (currentDraft.eventId !== incomingDraft.eventId) {
|
2836
|
+
throw new Error(
|
2837
|
+
`Cannot merge drafts for different events: ${currentDraft.eventId} and ${incomingDraft.eventId}`
|
2838
|
+
);
|
2839
|
+
}
|
2840
|
+
return {
|
2841
|
+
...currentDraft,
|
2842
|
+
...incomingDraft,
|
2843
|
+
action: {
|
2844
|
+
...currentDraft.action,
|
2845
|
+
...incomingDraft.action,
|
2846
|
+
declaration: deepMerge(
|
2847
|
+
currentDraft.action.declaration,
|
2848
|
+
incomingDraft.action.declaration
|
2849
|
+
),
|
2850
|
+
annotation: deepMerge(
|
2851
|
+
currentDraft.action.annotation ?? {},
|
2852
|
+
incomingDraft.action.annotation ?? {}
|
2853
|
+
)
|
2854
|
+
}
|
2855
|
+
};
|
2856
|
+
}
|
2739
2857
|
|
2740
2858
|
// ../commons/src/events/EventConfig.ts
|
2741
2859
|
var import_zod_openapi9 = require("zod-openapi");
|
2742
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
2743
|
-
var EventConfig =
|
2744
|
-
id:
|
2860
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2861
|
+
var EventConfig = import_zod22.z.object({
|
2862
|
+
id: import_zod22.z.string().describe(
|
2745
2863
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2746
2864
|
),
|
2747
2865
|
dateOfEvent: FieldReference.optional(),
|
@@ -2751,10 +2869,10 @@ var EventConfig = import_zod21.z.object({
|
|
2751
2869
|
),
|
2752
2870
|
summary: SummaryConfig,
|
2753
2871
|
label: TranslationConfig,
|
2754
|
-
actions:
|
2872
|
+
actions: import_zod22.z.array(ActionConfig),
|
2755
2873
|
declaration: DeclarationFormConfig,
|
2756
|
-
deduplication:
|
2757
|
-
advancedSearch:
|
2874
|
+
deduplication: import_zod22.z.array(DeduplicationConfig).optional().default([]),
|
2875
|
+
advancedSearch: import_zod22.z.array(AdvancedSearchConfig).optional().default([])
|
2758
2876
|
}).superRefine((event2, ctx) => {
|
2759
2877
|
const allFields = findAllFields(event2);
|
2760
2878
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2838,12 +2956,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2838
2956
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2839
2957
|
|
2840
2958
|
// ../commons/src/events/WorkqueueConfig.ts
|
2841
|
-
var
|
2959
|
+
var import_zod29 = require("zod");
|
2842
2960
|
|
2843
2961
|
// ../commons/src/events/serializers/user/serializer.ts
|
2844
|
-
var
|
2845
|
-
var SerializedUserField =
|
2846
|
-
$userField:
|
2962
|
+
var import_zod23 = require("zod");
|
2963
|
+
var SerializedUserField = import_zod23.z.object({
|
2964
|
+
$userField: import_zod23.z.enum([
|
2847
2965
|
"id",
|
2848
2966
|
"name",
|
2849
2967
|
"role",
|
@@ -3095,8 +3213,9 @@ function createFieldConditionals(fieldId) {
|
|
3095
3213
|
properties: {
|
3096
3214
|
[fieldId]: {
|
3097
3215
|
type: "string",
|
3098
|
-
|
3099
|
-
|
3216
|
+
minLength: 1,
|
3217
|
+
pattern: "^[\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*( [\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*)*$",
|
3218
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
3100
3219
|
}
|
3101
3220
|
}
|
3102
3221
|
}),
|
@@ -3209,7 +3328,7 @@ function createSearchConfig(baseField) {
|
|
3209
3328
|
// ../commons/src/event-config/event-configuration.ts
|
3210
3329
|
function createEventFieldConfig(fieldId) {
|
3211
3330
|
const baseField = {
|
3212
|
-
fieldId
|
3331
|
+
fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
|
3213
3332
|
fieldType: "event"
|
3214
3333
|
};
|
3215
3334
|
return createSearchConfig(baseField);
|
@@ -3222,32 +3341,107 @@ function eventFn(fieldId) {
|
|
3222
3341
|
var event = Object.assign(eventFn, {
|
3223
3342
|
/**
|
3224
3343
|
* Checks if the event contains a specific action type.
|
3344
|
+
* Can be used directly as a conditional or chained with additional methods.
|
3225
3345
|
* @param action - The action type to check for.
|
3226
3346
|
*/
|
3227
|
-
hasAction: (action) =>
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3347
|
+
hasAction: (action) => {
|
3348
|
+
const basicConditional = defineConditional({
|
3349
|
+
type: "object",
|
3350
|
+
properties: {
|
3351
|
+
$event: {
|
3352
|
+
type: "object",
|
3353
|
+
properties: {
|
3354
|
+
actions: {
|
3355
|
+
type: "array",
|
3356
|
+
contains: {
|
3357
|
+
type: "object",
|
3358
|
+
properties: {
|
3359
|
+
type: {
|
3360
|
+
const: action
|
3361
|
+
}
|
3362
|
+
},
|
3363
|
+
required: ["type"]
|
3364
|
+
}
|
3365
|
+
}
|
3366
|
+
},
|
3367
|
+
required: ["actions"]
|
3368
|
+
}
|
3369
|
+
},
|
3370
|
+
required: ["$event"]
|
3371
|
+
});
|
3372
|
+
const buildActionConstraints = (additionalFields) => {
|
3373
|
+
const actionProperties = {
|
3374
|
+
type: { const: action }
|
3375
|
+
};
|
3376
|
+
const requiredFields = ["type"];
|
3377
|
+
if (additionalFields) {
|
3378
|
+
Object.entries(additionalFields).forEach(([key, value]) => {
|
3379
|
+
actionProperties[key] = { const: value };
|
3380
|
+
requiredFields.push(key);
|
3381
|
+
});
|
3382
|
+
}
|
3383
|
+
return { actionProperties, requiredFields };
|
3384
|
+
};
|
3385
|
+
const createCountConditional = (countType, count, additionalFields) => {
|
3386
|
+
const { actionProperties, requiredFields } = buildActionConstraints(additionalFields);
|
3387
|
+
return defineConditional({
|
3231
3388
|
type: "object",
|
3232
3389
|
properties: {
|
3233
|
-
|
3234
|
-
type: "
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3390
|
+
$event: {
|
3391
|
+
type: "object",
|
3392
|
+
properties: {
|
3393
|
+
actions: {
|
3394
|
+
type: "array",
|
3395
|
+
contains: {
|
3396
|
+
type: "object",
|
3397
|
+
properties: actionProperties,
|
3398
|
+
required: requiredFields
|
3399
|
+
},
|
3400
|
+
[countType]: count
|
3401
|
+
}
|
3402
|
+
},
|
3403
|
+
required: ["actions"]
|
3244
3404
|
}
|
3245
3405
|
},
|
3246
|
-
required: ["
|
3247
|
-
}
|
3248
|
-
}
|
3249
|
-
|
3250
|
-
|
3406
|
+
required: ["$event"]
|
3407
|
+
});
|
3408
|
+
};
|
3409
|
+
const withMinMax = (additionalFields) => {
|
3410
|
+
return {
|
3411
|
+
/**
|
3412
|
+
* Creates a conditional that checks if the event contains a specific action type
|
3413
|
+
* with a minimum count of occurrences.
|
3414
|
+
*
|
3415
|
+
* @param minCount - The minimum number of actions required.
|
3416
|
+
*/
|
3417
|
+
minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
|
3418
|
+
/**
|
3419
|
+
* Builds a conditional that sets a maximum count for the number of actions.
|
3420
|
+
* This is useful for limiting the number of actions of a specific type in a single event.
|
3421
|
+
*/
|
3422
|
+
maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
|
3423
|
+
};
|
3424
|
+
};
|
3425
|
+
const chainableMethods = {
|
3426
|
+
/**
|
3427
|
+
* Adds additional field constraints to the action matching.
|
3428
|
+
*
|
3429
|
+
* @param fields - Object containing additional fields to match on the action.
|
3430
|
+
*/
|
3431
|
+
withFields: (fields) => withMinMax(fields),
|
3432
|
+
/**
|
3433
|
+
* Adds template ID constraint to the action matching.
|
3434
|
+
* This is a convenience method that adds content.templateId to the fields.
|
3435
|
+
*
|
3436
|
+
* @param id - The template ID to match against.
|
3437
|
+
*/
|
3438
|
+
withTemplate: (id) => withMinMax({
|
3439
|
+
content: { templateId: id }
|
3440
|
+
}),
|
3441
|
+
...withMinMax()
|
3442
|
+
};
|
3443
|
+
return { ...basicConditional, ...chainableMethods };
|
3444
|
+
},
|
3251
3445
|
field(field2) {
|
3252
3446
|
return {
|
3253
3447
|
$event: field2
|
@@ -3256,83 +3450,82 @@ var event = Object.assign(eventFn, {
|
|
3256
3450
|
});
|
3257
3451
|
|
3258
3452
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3259
|
-
var
|
3453
|
+
var import_zod25 = require("zod");
|
3260
3454
|
|
3261
3455
|
// ../commons/src/events/EventMetadata.ts
|
3262
|
-
var
|
3263
|
-
var EventStatus =
|
3456
|
+
var import_zod24 = require("zod");
|
3457
|
+
var EventStatus = import_zod24.z.enum([
|
3264
3458
|
"CREATED",
|
3265
3459
|
"NOTIFIED",
|
3266
3460
|
"DECLARED",
|
3267
3461
|
"VALIDATED",
|
3268
3462
|
"REGISTERED",
|
3269
|
-
"CERTIFIED",
|
3270
3463
|
"ARCHIVED"
|
3271
3464
|
]);
|
3272
|
-
var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
|
3273
3465
|
var InherentFlags = {
|
3274
|
-
|
3466
|
+
PENDING_CERTIFICATION: "pending-certification",
|
3275
3467
|
INCOMPLETE: "incomplete",
|
3276
3468
|
REJECTED: "rejected",
|
3277
3469
|
CORRECTION_REQUESTED: "correction-requested"
|
3278
3470
|
};
|
3279
|
-
var
|
3471
|
+
var ActionFlag = import_zod24.z.string().regex(
|
3280
3472
|
new RegExp(
|
3281
3473
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3282
3474
|
ActionStatus
|
3283
3475
|
).join("|").toLowerCase()})$`
|
3284
3476
|
),
|
3285
3477
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3286
|
-
)
|
3287
|
-
var
|
3288
|
-
var
|
3289
|
-
|
3290
|
-
|
3478
|
+
);
|
3479
|
+
var Flag = ActionFlag.or(import_zod24.z.nativeEnum(InherentFlags));
|
3480
|
+
var ZodDate = import_zod24.z.string().date();
|
3481
|
+
var ActionCreationMetadata = import_zod24.z.object({
|
3482
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the action request was created."),
|
3483
|
+
createdBy: import_zod24.z.string().describe("ID of the user who created the action request."),
|
3291
3484
|
createdAtLocation: CreatedAtLocation.describe(
|
3292
3485
|
"Location of the user who created the action request."
|
3293
3486
|
),
|
3294
|
-
createdByUserType:
|
3295
|
-
acceptedAt:
|
3296
|
-
createdByRole:
|
3297
|
-
createdBySignature:
|
3487
|
+
createdByUserType: import_zod24.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3488
|
+
acceptedAt: import_zod24.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
3489
|
+
createdByRole: import_zod24.z.string().describe("Role of the user at the time of action request creation."),
|
3490
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the action request.")
|
3298
3491
|
});
|
3299
3492
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3300
|
-
registrationNumber:
|
3493
|
+
registrationNumber: import_zod24.z.string().describe(
|
3301
3494
|
"Registration number of the event. Always present for accepted registrations."
|
3302
3495
|
)
|
3303
3496
|
});
|
3304
|
-
var LegalStatuses =
|
3497
|
+
var LegalStatuses = import_zod24.z.object({
|
3305
3498
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3306
3499
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3307
3500
|
});
|
3308
|
-
var EventMetadata =
|
3501
|
+
var EventMetadata = import_zod24.z.object({
|
3309
3502
|
id: UUID,
|
3310
|
-
type:
|
3503
|
+
type: import_zod24.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3311
3504
|
status: EventStatus,
|
3312
3505
|
legalStatuses: LegalStatuses.describe(
|
3313
3506
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3314
3507
|
),
|
3315
|
-
createdAt:
|
3508
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3316
3509
|
dateOfEvent: ZodDate.nullish(),
|
3317
|
-
createdBy:
|
3318
|
-
createdByUserType:
|
3319
|
-
updatedByUserRole:
|
3510
|
+
createdBy: import_zod24.z.string().describe("ID of the user who created the event."),
|
3511
|
+
createdByUserType: import_zod24.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3512
|
+
updatedByUserRole: import_zod24.z.string().describe("Role of the user who last changed the status."),
|
3320
3513
|
createdAtLocation: CreatedAtLocation.describe(
|
3321
3514
|
"Location of the user who created the event."
|
3322
3515
|
),
|
3323
|
-
createdBySignature:
|
3516
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the event."),
|
3324
3517
|
updatedAtLocation: UUID.nullish().describe(
|
3325
3518
|
"Location of the user who last changed the status."
|
3326
3519
|
),
|
3327
|
-
updatedAt:
|
3520
|
+
updatedAt: import_zod24.z.string().datetime().describe(
|
3328
3521
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3329
3522
|
),
|
3330
|
-
assignedTo:
|
3331
|
-
updatedBy:
|
3332
|
-
trackingId:
|
3523
|
+
assignedTo: import_zod24.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
3524
|
+
updatedBy: import_zod24.z.string().nullish().describe("ID of the user who last changed the status."),
|
3525
|
+
trackingId: import_zod24.z.string().describe(
|
3333
3526
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3334
3527
|
),
|
3335
|
-
flags:
|
3528
|
+
flags: import_zod24.z.array(Flag)
|
3336
3529
|
});
|
3337
3530
|
var EventMetadataKeysArray = [
|
3338
3531
|
"id",
|
@@ -3352,7 +3545,7 @@ var EventMetadataKeysArray = [
|
|
3352
3545
|
"legalStatuses",
|
3353
3546
|
"flags"
|
3354
3547
|
];
|
3355
|
-
var EventMetadataKeys =
|
3548
|
+
var EventMetadataKeys = import_zod24.z.enum(EventMetadataKeysArray);
|
3356
3549
|
var eventMetadataLabelMap = {
|
3357
3550
|
"event.assignedTo": {
|
3358
3551
|
id: "event.assignedTo.label",
|
@@ -3437,11 +3630,11 @@ var WorkqueueColumnKeysArray = [
|
|
3437
3630
|
"title",
|
3438
3631
|
"outbox"
|
3439
3632
|
];
|
3440
|
-
var WorkqueueColumnKeys =
|
3441
|
-
var WorkqueueColumnValue =
|
3633
|
+
var WorkqueueColumnKeys = import_zod25.z.enum(WorkqueueColumnKeysArray);
|
3634
|
+
var WorkqueueColumnValue = import_zod25.z.object({
|
3442
3635
|
$event: WorkqueueColumnKeys
|
3443
3636
|
});
|
3444
|
-
var WorkqueueColumn =
|
3637
|
+
var WorkqueueColumn = import_zod25.z.object({
|
3445
3638
|
label: TranslationConfig,
|
3446
3639
|
value: WorkqueueColumnValue
|
3447
3640
|
});
|
@@ -3452,120 +3645,120 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3452
3645
|
}
|
3453
3646
|
|
3454
3647
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3455
|
-
var
|
3648
|
+
var import_zod27 = require("zod");
|
3456
3649
|
|
3457
3650
|
// ../commons/src/events/EventIndex.ts
|
3458
|
-
var
|
3651
|
+
var import_zod26 = require("zod");
|
3459
3652
|
var import_zod_openapi10 = require("zod-openapi");
|
3460
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3653
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3461
3654
|
var EventIndex = EventMetadata.extend({
|
3462
3655
|
declaration: EventState
|
3463
3656
|
}).openapi({
|
3464
3657
|
ref: "EventIndex"
|
3465
3658
|
});
|
3466
|
-
var EventSearchIndex =
|
3467
|
-
|
3468
|
-
type:
|
3659
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
3660
|
+
import_zod26.z.object({
|
3661
|
+
type: import_zod26.z.string()
|
3469
3662
|
// Ensures "type" (event-id) exists and is a string
|
3470
3663
|
})
|
3471
3664
|
).openapi({
|
3472
3665
|
ref: "EventSearchIndex"
|
3473
3666
|
});
|
3474
|
-
var Fuzzy =
|
3667
|
+
var Fuzzy = import_zod26.z.object({ type: import_zod26.z.literal("fuzzy"), term: import_zod26.z.string() }).openapi({
|
3475
3668
|
ref: "Fuzzy"
|
3476
3669
|
});
|
3477
|
-
var Exact =
|
3670
|
+
var Exact = import_zod26.z.object({ type: import_zod26.z.literal("exact"), term: import_zod26.z.string() }).openapi({
|
3478
3671
|
ref: "Exact"
|
3479
3672
|
});
|
3480
|
-
var ExactStatus =
|
3481
|
-
type:
|
3673
|
+
var ExactStatus = import_zod26.z.object({
|
3674
|
+
type: import_zod26.z.literal("exact"),
|
3482
3675
|
term: EventStatus
|
3483
3676
|
}).openapi({
|
3484
3677
|
ref: "ExactStatus"
|
3485
3678
|
});
|
3486
|
-
var ExactUserType =
|
3487
|
-
type:
|
3679
|
+
var ExactUserType = import_zod26.z.object({
|
3680
|
+
type: import_zod26.z.literal("exact"),
|
3488
3681
|
term: TokenUserType
|
3489
3682
|
}).openapi({
|
3490
3683
|
ref: "ExactUserType"
|
3491
3684
|
});
|
3492
|
-
var AnyOf =
|
3493
|
-
type:
|
3494
|
-
terms:
|
3685
|
+
var AnyOf = import_zod26.z.object({
|
3686
|
+
type: import_zod26.z.literal("anyOf"),
|
3687
|
+
terms: import_zod26.z.array(import_zod26.z.string())
|
3495
3688
|
}).openapi({
|
3496
3689
|
ref: "AnyOf"
|
3497
3690
|
});
|
3498
|
-
var AnyOfStatus =
|
3499
|
-
type:
|
3500
|
-
terms:
|
3691
|
+
var AnyOfStatus = import_zod26.z.object({
|
3692
|
+
type: import_zod26.z.literal("anyOf"),
|
3693
|
+
terms: import_zod26.z.array(EventStatus)
|
3501
3694
|
}).openapi({
|
3502
3695
|
ref: "AnyOfStatus"
|
3503
3696
|
});
|
3504
|
-
var Range =
|
3505
|
-
type:
|
3506
|
-
gte:
|
3507
|
-
lte:
|
3697
|
+
var Range = import_zod26.z.object({
|
3698
|
+
type: import_zod26.z.literal("range"),
|
3699
|
+
gte: import_zod26.z.string(),
|
3700
|
+
lte: import_zod26.z.string()
|
3508
3701
|
}).openapi({
|
3509
3702
|
ref: "Range"
|
3510
3703
|
});
|
3511
|
-
var ContainsFlags =
|
3512
|
-
anyOf:
|
3513
|
-
noneOf:
|
3704
|
+
var ContainsFlags = import_zod26.z.object({
|
3705
|
+
anyOf: import_zod26.z.array(Flag).optional(),
|
3706
|
+
noneOf: import_zod26.z.array(Flag).optional()
|
3514
3707
|
}).openapi({
|
3515
3708
|
ref: "ContainsFlags"
|
3516
3709
|
});
|
3517
|
-
var Within =
|
3710
|
+
var Within = import_zod26.z.object({ type: import_zod26.z.literal("within"), location: import_zod26.z.string() }).openapi({
|
3518
3711
|
ref: "Within"
|
3519
3712
|
});
|
3520
|
-
var RangeDate =
|
3521
|
-
type:
|
3522
|
-
gte:
|
3523
|
-
lte:
|
3713
|
+
var RangeDate = import_zod26.z.object({
|
3714
|
+
type: import_zod26.z.literal("range"),
|
3715
|
+
gte: import_zod26.z.string().date().or(import_zod26.z.string().datetime()),
|
3716
|
+
lte: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3524
3717
|
}).openapi({ ref: "RangeDate" });
|
3525
3718
|
var ExactDate = Exact.extend({
|
3526
|
-
term:
|
3719
|
+
term: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3527
3720
|
}).openapi({
|
3528
3721
|
ref: "ExactDate"
|
3529
3722
|
});
|
3530
|
-
var TimePeriod =
|
3531
|
-
type:
|
3723
|
+
var TimePeriod = import_zod26.z.object({
|
3724
|
+
type: import_zod26.z.literal("timePeriod"),
|
3532
3725
|
term: SelectDateRangeValue
|
3533
3726
|
}).openapi({
|
3534
3727
|
ref: "TimePeriod"
|
3535
3728
|
});
|
3536
|
-
var DateCondition =
|
3729
|
+
var DateCondition = import_zod26.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3537
3730
|
ref: "DateCondition"
|
3538
3731
|
});
|
3539
|
-
var QueryInput =
|
3540
|
-
() =>
|
3541
|
-
|
3542
|
-
|
3732
|
+
var QueryInput = import_zod26.z.lazy(
|
3733
|
+
() => import_zod26.z.union([
|
3734
|
+
import_zod26.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
3735
|
+
import_zod26.z.record(import_zod26.z.string(), QueryInput)
|
3543
3736
|
])
|
3544
3737
|
).openapi({
|
3545
3738
|
ref: "QueryInput"
|
3546
3739
|
});
|
3547
|
-
var QueryExpression =
|
3548
|
-
id:
|
3549
|
-
eventType:
|
3550
|
-
status:
|
3551
|
-
createdAt:
|
3552
|
-
updatedAt:
|
3553
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
3554
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
3555
|
-
|
3740
|
+
var QueryExpression = import_zod26.z.object({
|
3741
|
+
id: import_zod26.z.optional(import_zod26.z.string()),
|
3742
|
+
eventType: import_zod26.z.string(),
|
3743
|
+
status: import_zod26.z.optional(import_zod26.z.union([AnyOfStatus, ExactStatus])),
|
3744
|
+
createdAt: import_zod26.z.optional(DateCondition),
|
3745
|
+
updatedAt: import_zod26.z.optional(DateCondition),
|
3746
|
+
"legalStatuses.REGISTERED.acceptedAt": import_zod26.z.optional(DateCondition),
|
3747
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod26.z.optional(
|
3748
|
+
import_zod26.z.union([Within, Exact])
|
3556
3749
|
),
|
3557
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3558
|
-
|
3750
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3751
|
+
import_zod26.z.union([Within, Exact])
|
3559
3752
|
),
|
3560
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3561
|
-
createdAtLocation:
|
3562
|
-
updatedAtLocation:
|
3563
|
-
assignedTo:
|
3564
|
-
createdByUserType:
|
3565
|
-
createdBy:
|
3566
|
-
updatedBy:
|
3567
|
-
trackingId:
|
3568
|
-
flags:
|
3753
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod26.z.optional(Exact),
|
3754
|
+
createdAtLocation: import_zod26.z.optional(import_zod26.z.union([Within, Exact])),
|
3755
|
+
updatedAtLocation: import_zod26.z.optional(import_zod26.z.union([Within, Exact])),
|
3756
|
+
assignedTo: import_zod26.z.optional(Exact),
|
3757
|
+
createdByUserType: import_zod26.z.optional(ExactUserType),
|
3758
|
+
createdBy: import_zod26.z.optional(Exact),
|
3759
|
+
updatedBy: import_zod26.z.optional(Exact),
|
3760
|
+
trackingId: import_zod26.z.optional(Exact),
|
3761
|
+
flags: import_zod26.z.optional(ContainsFlags),
|
3569
3762
|
// @todo: The type for this comes out as "any"
|
3570
3763
|
data: QueryInput
|
3571
3764
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
@@ -3573,9 +3766,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3573
3766
|
}).openapi({
|
3574
3767
|
ref: "QueryExpression"
|
3575
3768
|
});
|
3576
|
-
var QueryType =
|
3577
|
-
type:
|
3578
|
-
clauses:
|
3769
|
+
var QueryType = import_zod26.z.object({
|
3770
|
+
type: import_zod26.z.literal("and").or(import_zod26.z.literal("or")).openapi({ default: "and" }),
|
3771
|
+
clauses: import_zod26.z.preprocess(
|
3579
3772
|
(val) => {
|
3580
3773
|
if (typeof val === "string") {
|
3581
3774
|
return [JSON.parse(val)];
|
@@ -3585,7 +3778,7 @@ var QueryType = import_zod25.z.object({
|
|
3585
3778
|
}
|
3586
3779
|
return val;
|
3587
3780
|
},
|
3588
|
-
|
3781
|
+
import_zod26.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3589
3782
|
default: [
|
3590
3783
|
{
|
3591
3784
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3612,56 +3805,56 @@ var SearchScopeAccessLevels = {
|
|
3612
3805
|
};
|
3613
3806
|
|
3614
3807
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3615
|
-
var SerializableExact =
|
3616
|
-
type:
|
3617
|
-
term:
|
3808
|
+
var SerializableExact = import_zod27.z.object({
|
3809
|
+
type: import_zod27.z.literal("exact"),
|
3810
|
+
term: import_zod27.z.union([import_zod27.z.string(), SerializedUserField])
|
3618
3811
|
});
|
3619
|
-
var SerializableWithin =
|
3620
|
-
type:
|
3621
|
-
location:
|
3812
|
+
var SerializableWithin = import_zod27.z.object({
|
3813
|
+
type: import_zod27.z.literal("within"),
|
3814
|
+
location: import_zod27.z.union([import_zod27.z.string(), SerializedUserField])
|
3622
3815
|
});
|
3623
|
-
var SerializedQueryExpression =
|
3624
|
-
eventType:
|
3625
|
-
status:
|
3626
|
-
createdAt:
|
3627
|
-
updatedAt:
|
3628
|
-
"legalStatuses.REGISTERED.createdAt":
|
3629
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3630
|
-
|
3816
|
+
var SerializedQueryExpression = import_zod27.z.object({
|
3817
|
+
eventType: import_zod27.z.string(),
|
3818
|
+
status: import_zod27.z.optional(import_zod27.z.union([AnyOfStatus, ExactStatus])),
|
3819
|
+
createdAt: import_zod27.z.optional(DateCondition),
|
3820
|
+
updatedAt: import_zod27.z.optional(DateCondition),
|
3821
|
+
"legalStatuses.REGISTERED.createdAt": import_zod27.z.optional(DateCondition),
|
3822
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod27.z.optional(
|
3823
|
+
import_zod27.z.union([Within, Exact])
|
3631
3824
|
),
|
3632
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3633
|
-
createdAtLocation:
|
3634
|
-
|
3825
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod27.z.optional(Exact),
|
3826
|
+
createdAtLocation: import_zod27.z.optional(
|
3827
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3635
3828
|
),
|
3636
|
-
updatedAtLocation:
|
3637
|
-
|
3829
|
+
updatedAtLocation: import_zod27.z.optional(
|
3830
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3638
3831
|
),
|
3639
|
-
assignedTo:
|
3640
|
-
createdBy:
|
3832
|
+
assignedTo: import_zod27.z.optional(SerializableExact),
|
3833
|
+
createdBy: import_zod27.z.optional(SerializableExact),
|
3641
3834
|
createdByUserType: ExactUserType,
|
3642
|
-
updatedBy:
|
3643
|
-
trackingId:
|
3644
|
-
flags:
|
3835
|
+
updatedBy: import_zod27.z.optional(SerializableExact),
|
3836
|
+
trackingId: import_zod27.z.optional(Exact),
|
3837
|
+
flags: import_zod27.z.optional(ContainsFlags),
|
3645
3838
|
data: QueryInput
|
3646
3839
|
}).partial();
|
3647
|
-
var Or2 =
|
3648
|
-
type:
|
3649
|
-
clauses:
|
3840
|
+
var Or2 = import_zod27.z.object({
|
3841
|
+
type: import_zod27.z.literal("or"),
|
3842
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3650
3843
|
});
|
3651
|
-
var And2 =
|
3652
|
-
type:
|
3653
|
-
clauses:
|
3844
|
+
var And2 = import_zod27.z.object({
|
3845
|
+
type: import_zod27.z.literal("and"),
|
3846
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3654
3847
|
});
|
3655
|
-
var CountryConfigQueryType =
|
3656
|
-
var CountryConfigQueryInputType =
|
3848
|
+
var CountryConfigQueryType = import_zod27.z.discriminatedUnion("type", [And2, Or2]);
|
3849
|
+
var CountryConfigQueryInputType = import_zod27.z.union([
|
3657
3850
|
SerializedQueryExpression,
|
3658
3851
|
And2,
|
3659
3852
|
Or2
|
3660
3853
|
]);
|
3661
3854
|
|
3662
3855
|
// ../commons/src/icons.ts
|
3663
|
-
var
|
3664
|
-
var AvailableIcons =
|
3856
|
+
var import_zod28 = require("zod");
|
3857
|
+
var AvailableIcons = import_zod28.z.enum([
|
3665
3858
|
"Archived",
|
3666
3859
|
"Assigned",
|
3667
3860
|
"Certified",
|
@@ -3782,43 +3975,45 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3782
3975
|
value: event.field("updatedAt")
|
3783
3976
|
}
|
3784
3977
|
]);
|
3785
|
-
var WorkqueueActionsWithDefault =
|
3978
|
+
var WorkqueueActionsWithDefault = import_zod29.z.enum([
|
3786
3979
|
...workqueueActions.options,
|
3787
3980
|
"DEFAULT"
|
3788
3981
|
]);
|
3789
|
-
var WorkqueueConfig =
|
3790
|
-
slug:
|
3982
|
+
var WorkqueueConfig = import_zod29.z.object({
|
3983
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3791
3984
|
name: TranslationConfig.describe(
|
3792
3985
|
"Title of the workflow (both in navigation and on the page)"
|
3793
3986
|
),
|
3794
3987
|
query: CountryConfigQueryType,
|
3795
|
-
actions:
|
3796
|
-
|
3988
|
+
actions: import_zod29.z.array(
|
3989
|
+
import_zod29.z.object({
|
3797
3990
|
type: WorkqueueActionsWithDefault,
|
3798
|
-
conditionals:
|
3991
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3799
3992
|
})
|
3800
3993
|
),
|
3801
|
-
columns:
|
3802
|
-
icon: AvailableIcons
|
3994
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3995
|
+
icon: AvailableIcons,
|
3996
|
+
emptyMessage: TranslationConfig.optional()
|
3803
3997
|
}).describe("Configuration for workqueue.");
|
3804
3998
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3805
3999
|
query: true,
|
3806
4000
|
columns: true
|
3807
4001
|
});
|
3808
|
-
var WorkqueueConfigInput =
|
3809
|
-
slug:
|
4002
|
+
var WorkqueueConfigInput = import_zod29.z.object({
|
4003
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3810
4004
|
name: TranslationConfig.describe(
|
3811
4005
|
"Title of the workflow (both in navigation and on the page)"
|
3812
4006
|
),
|
3813
4007
|
query: CountryConfigQueryInputType,
|
3814
|
-
actions:
|
3815
|
-
|
4008
|
+
actions: import_zod29.z.array(
|
4009
|
+
import_zod29.z.object({
|
3816
4010
|
type: WorkqueueActionsWithDefault,
|
3817
|
-
conditionals:
|
4011
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3818
4012
|
})
|
3819
4013
|
),
|
3820
|
-
columns:
|
3821
|
-
icon: AvailableIcons
|
4014
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
4015
|
+
icon: AvailableIcons,
|
4016
|
+
emptyMessage: TranslationConfig.optional()
|
3822
4017
|
});
|
3823
4018
|
function defineWorkqueue(workqueueInput) {
|
3824
4019
|
const queryInput = workqueueInput.query;
|
@@ -3828,10 +4023,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3828
4023
|
function defineWorkqueues(workqueues) {
|
3829
4024
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3830
4025
|
}
|
3831
|
-
var WorkqueueCountInput =
|
3832
|
-
|
4026
|
+
var WorkqueueCountInput = import_zod29.z.array(
|
4027
|
+
import_zod29.z.object({ slug: import_zod29.z.string(), query: QueryType })
|
3833
4028
|
);
|
3834
|
-
var WorkqueueCountOutput =
|
4029
|
+
var WorkqueueCountOutput = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.number());
|
3835
4030
|
|
3836
4031
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3837
4032
|
var defaultWorkqueueColumns = [
|
@@ -3854,42 +4049,42 @@ var defaultWorkqueueColumns = [
|
|
3854
4049
|
];
|
3855
4050
|
|
3856
4051
|
// ../commons/src/events/Draft.ts
|
3857
|
-
var
|
4052
|
+
var import_zod31 = require("zod");
|
3858
4053
|
|
3859
4054
|
// ../commons/src/events/ActionInput.ts
|
3860
|
-
var
|
4055
|
+
var import_zod30 = require("zod");
|
3861
4056
|
var import_zod_openapi11 = require("zod-openapi");
|
3862
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
3863
|
-
var BaseActionInput =
|
4057
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod30.z);
|
4058
|
+
var BaseActionInput = import_zod30.z.object({
|
3864
4059
|
eventId: UUID,
|
3865
|
-
transactionId:
|
4060
|
+
transactionId: import_zod30.z.string(),
|
3866
4061
|
declaration: ActionUpdate.default({}),
|
3867
4062
|
annotation: ActionUpdate.optional(),
|
3868
4063
|
originalActionId: UUID.optional(),
|
3869
4064
|
// should not be part of base action.
|
3870
|
-
keepAssignment:
|
4065
|
+
keepAssignment: import_zod30.z.boolean().optional()
|
3871
4066
|
});
|
3872
4067
|
var CreateActionInput = BaseActionInput.merge(
|
3873
|
-
|
3874
|
-
type:
|
4068
|
+
import_zod30.z.object({
|
4069
|
+
type: import_zod30.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3875
4070
|
createdAtLocation: CreatedAtLocation
|
3876
4071
|
})
|
3877
4072
|
);
|
3878
4073
|
var RegisterActionInput = BaseActionInput.merge(
|
3879
|
-
|
3880
|
-
type:
|
3881
|
-
registrationNumber:
|
4074
|
+
import_zod30.z.object({
|
4075
|
+
type: import_zod30.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
4076
|
+
registrationNumber: import_zod30.z.string().optional()
|
3882
4077
|
})
|
3883
4078
|
).strict();
|
3884
4079
|
var ValidateActionInput = BaseActionInput.merge(
|
3885
|
-
|
3886
|
-
type:
|
3887
|
-
duplicates:
|
4080
|
+
import_zod30.z.object({
|
4081
|
+
type: import_zod30.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
4082
|
+
duplicates: import_zod30.z.array(import_zod30.z.string())
|
3888
4083
|
})
|
3889
4084
|
);
|
3890
4085
|
var NotifyActionInput = BaseActionInput.merge(
|
3891
|
-
|
3892
|
-
type:
|
4086
|
+
import_zod30.z.object({
|
4087
|
+
type: import_zod30.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3893
4088
|
})
|
3894
4089
|
).openapi({
|
3895
4090
|
default: {
|
@@ -3901,70 +4096,70 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3901
4096
|
}
|
3902
4097
|
});
|
3903
4098
|
var DeclareActionInput = BaseActionInput.merge(
|
3904
|
-
|
3905
|
-
type:
|
4099
|
+
import_zod30.z.object({
|
4100
|
+
type: import_zod30.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3906
4101
|
})
|
3907
4102
|
);
|
3908
4103
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3909
|
-
|
3910
|
-
type:
|
4104
|
+
import_zod30.z.object({
|
4105
|
+
type: import_zod30.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
3911
4106
|
content: PrintContent.optional()
|
3912
4107
|
})
|
3913
4108
|
);
|
3914
4109
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3915
|
-
|
3916
|
-
type:
|
4110
|
+
import_zod30.z.object({
|
4111
|
+
type: import_zod30.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3917
4112
|
reason: RejectionReason
|
3918
4113
|
})
|
3919
4114
|
);
|
3920
4115
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3921
|
-
|
3922
|
-
type:
|
4116
|
+
import_zod30.z.object({
|
4117
|
+
type: import_zod30.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3923
4118
|
})
|
3924
4119
|
);
|
3925
4120
|
var ArchiveActionInput = BaseActionInput.merge(
|
3926
|
-
|
3927
|
-
type:
|
4121
|
+
import_zod30.z.object({
|
4122
|
+
type: import_zod30.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3928
4123
|
reason: RejectionReason
|
3929
4124
|
})
|
3930
4125
|
);
|
3931
4126
|
var AssignActionInput = BaseActionInput.merge(
|
3932
|
-
|
3933
|
-
type:
|
3934
|
-
assignedTo:
|
4127
|
+
import_zod30.z.object({
|
4128
|
+
type: import_zod30.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
4129
|
+
assignedTo: import_zod30.z.string()
|
3935
4130
|
})
|
3936
4131
|
);
|
3937
4132
|
var UnassignActionInput = BaseActionInput.merge(
|
3938
|
-
|
3939
|
-
type:
|
3940
|
-
assignedTo:
|
4133
|
+
import_zod30.z.object({
|
4134
|
+
type: import_zod30.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
4135
|
+
assignedTo: import_zod30.z.literal(null).default(null)
|
3941
4136
|
})
|
3942
4137
|
);
|
3943
4138
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3944
|
-
|
3945
|
-
type:
|
4139
|
+
import_zod30.z.object({
|
4140
|
+
type: import_zod30.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3946
4141
|
})
|
3947
4142
|
);
|
3948
4143
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3949
|
-
|
3950
|
-
requestId:
|
3951
|
-
type:
|
4144
|
+
import_zod30.z.object({
|
4145
|
+
requestId: import_zod30.z.string(),
|
4146
|
+
type: import_zod30.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
3952
4147
|
reason: RejectionReason
|
3953
4148
|
})
|
3954
4149
|
);
|
3955
4150
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3956
|
-
|
3957
|
-
requestId:
|
3958
|
-
type:
|
4151
|
+
import_zod30.z.object({
|
4152
|
+
requestId: import_zod30.z.string(),
|
4153
|
+
type: import_zod30.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3959
4154
|
})
|
3960
4155
|
);
|
3961
4156
|
var ReadActionInput = BaseActionInput.merge(
|
3962
|
-
|
3963
|
-
type:
|
4157
|
+
import_zod30.z.object({
|
4158
|
+
type: import_zod30.z.literal(ActionType.READ).default(ActionType.READ)
|
3964
4159
|
})
|
3965
4160
|
);
|
3966
|
-
var DeleteActionInput =
|
3967
|
-
var ActionInput =
|
4161
|
+
var DeleteActionInput = import_zod30.z.object({ eventId: UUID });
|
4162
|
+
var ActionInput = import_zod30.z.discriminatedUnion("type", [
|
3968
4163
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3969
4164
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3970
4165
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -3993,18 +4188,18 @@ var ActionInput = import_zod29.z.discriminatedUnion("type", [
|
|
3993
4188
|
});
|
3994
4189
|
|
3995
4190
|
// ../commons/src/events/Draft.ts
|
3996
|
-
var Draft =
|
4191
|
+
var Draft = import_zod31.z.object({
|
3997
4192
|
id: UUID,
|
3998
4193
|
eventId: UUID,
|
3999
|
-
transactionId:
|
4000
|
-
createdAt:
|
4194
|
+
transactionId: import_zod31.z.string(),
|
4195
|
+
createdAt: import_zod31.z.string().datetime(),
|
4001
4196
|
action: ActionBase.extend({
|
4002
|
-
type: ActionTypes
|
4197
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
|
4003
4198
|
}).omit({ id: true })
|
4004
4199
|
});
|
4005
4200
|
var DraftInput = BaseActionInput.extend({
|
4006
|
-
type: ActionTypes,
|
4007
|
-
status:
|
4201
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
|
4202
|
+
status: import_zod31.z.enum([
|
4008
4203
|
ActionStatus.Requested,
|
4009
4204
|
ActionStatus.Accepted,
|
4010
4205
|
ActionStatus.Rejected
|
@@ -4012,26 +4207,29 @@ var DraftInput = BaseActionInput.extend({
|
|
4012
4207
|
});
|
4013
4208
|
|
4014
4209
|
// ../commons/src/events/EventInput.ts
|
4015
|
-
var
|
4210
|
+
var import_zod32 = require("zod");
|
4016
4211
|
var import_uuid8 = require("uuid");
|
4017
|
-
var EventInput =
|
4018
|
-
transactionId:
|
4019
|
-
type:
|
4212
|
+
var EventInput = import_zod32.z.object({
|
4213
|
+
transactionId: import_zod32.z.string(),
|
4214
|
+
type: import_zod32.z.string()
|
4020
4215
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
4021
4216
|
|
4022
4217
|
// ../commons/src/events/EventDocument.ts
|
4023
|
-
var
|
4218
|
+
var import_zod33 = require("zod");
|
4024
4219
|
var import_zod_openapi12 = require("zod-openapi");
|
4025
|
-
(0, import_zod_openapi12.extendZodWithOpenApi)(
|
4026
|
-
var EventDocument =
|
4220
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod33.z);
|
4221
|
+
var EventDocument = import_zod33.z.object({
|
4027
4222
|
id: UUID,
|
4028
|
-
type:
|
4029
|
-
createdAt:
|
4030
|
-
updatedAt:
|
4031
|
-
actions:
|
4032
|
-
trackingId:
|
4223
|
+
type: import_zod33.z.string(),
|
4224
|
+
createdAt: import_zod33.z.string().datetime(),
|
4225
|
+
updatedAt: import_zod33.z.string().datetime(),
|
4226
|
+
actions: import_zod33.z.array(Action),
|
4227
|
+
trackingId: import_zod33.z.string()
|
4033
4228
|
}).openapi({ ref: "EventDocument" });
|
4034
4229
|
|
4230
|
+
// ../commons/src/events/state/index.ts
|
4231
|
+
var import_lodash3 = require("lodash");
|
4232
|
+
|
4035
4233
|
// ../commons/src/events/state/utils.ts
|
4036
4234
|
var import_lodash2 = require("lodash");
|
4037
4235
|
function getActionRequests(actionType, actions) {
|
@@ -4120,16 +4318,19 @@ function getLegalStatuses(actions) {
|
|
4120
4318
|
}
|
4121
4319
|
|
4122
4320
|
// ../commons/src/events/state/flags.ts
|
4123
|
-
function
|
4321
|
+
function isPendingCertification(actions) {
|
4322
|
+
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4323
|
+
return false;
|
4324
|
+
}
|
4124
4325
|
return actions.reduce((prev, { type }) => {
|
4125
4326
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
4126
|
-
return
|
4327
|
+
return false;
|
4127
4328
|
}
|
4128
4329
|
if (type === ActionType.APPROVE_CORRECTION) {
|
4129
|
-
return
|
4330
|
+
return true;
|
4130
4331
|
}
|
4131
4332
|
return prev;
|
4132
|
-
},
|
4333
|
+
}, true);
|
4133
4334
|
}
|
4134
4335
|
function isCorrectionRequested(actions) {
|
4135
4336
|
return actions.reduce((prev, { type }) => {
|
@@ -4164,8 +4365,8 @@ function getFlagsFromActions(actions) {
|
|
4164
4365
|
const flag = joinValues([type, status], ":").toLowerCase();
|
4165
4366
|
return flag;
|
4166
4367
|
});
|
4167
|
-
if (
|
4168
|
-
flags.push(InherentFlags.
|
4368
|
+
if (isPendingCertification(sortedActions)) {
|
4369
|
+
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
4169
4370
|
}
|
4170
4371
|
if (isCorrectionRequested(sortedActions)) {
|
4171
4372
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -4196,7 +4397,6 @@ function getStatusFromActions(actions) {
|
|
4196
4397
|
case ActionType.NOTIFY:
|
4197
4398
|
return EventStatus.enum.NOTIFIED;
|
4198
4399
|
case ActionType.PRINT_CERTIFICATE:
|
4199
|
-
return EventStatus.enum.CERTIFIED;
|
4200
4400
|
case ActionType.ASSIGN:
|
4201
4401
|
case ActionType.UNASSIGN:
|
4202
4402
|
case ActionType.REJECT:
|
@@ -4319,30 +4519,36 @@ function getCurrentEventState(event2, config) {
|
|
4319
4519
|
flags: getFlagsFromActions(event2.actions)
|
4320
4520
|
});
|
4321
4521
|
}
|
4322
|
-
function
|
4522
|
+
function dangerouslyGetCurrentEventStateWithDrafts({
|
4323
4523
|
event: event2,
|
4324
|
-
|
4524
|
+
draft,
|
4325
4525
|
configuration
|
4326
4526
|
}) {
|
4327
4527
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
4328
|
-
const
|
4329
|
-
|
4330
|
-
|
4331
|
-
|
4332
|
-
|
4333
|
-
|
4334
|
-
|
4335
|
-
|
4336
|
-
|
4337
|
-
|
4338
|
-
|
4339
|
-
|
4340
|
-
|
4341
|
-
|
4528
|
+
const draftActions = draft.action.type === ActionType.REQUEST_CORRECTION ? (
|
4529
|
+
/*
|
4530
|
+
* If the action encountered is "REQUEST_CORRECTION", we want to pretend like it was approved
|
4531
|
+
* so previews etc are shown correctly
|
4532
|
+
*/
|
4533
|
+
[
|
4534
|
+
draft.action,
|
4535
|
+
{
|
4536
|
+
id: getUUID(),
|
4537
|
+
...draft.action,
|
4538
|
+
type: ActionType.APPROVE_CORRECTION
|
4539
|
+
}
|
4540
|
+
]
|
4541
|
+
) : [{ ...draft.action, id: getUUID() }];
|
4542
|
+
const actionsWithDraft = (0, import_lodash3.orderBy)(
|
4543
|
+
[...actions, ...draftActions],
|
4544
|
+
["createdAt"],
|
4545
|
+
"asc"
|
4546
|
+
);
|
4547
|
+
const eventWithDraft = {
|
4342
4548
|
...event2,
|
4343
|
-
actions:
|
4549
|
+
actions: actionsWithDraft
|
4344
4550
|
};
|
4345
|
-
return getCurrentEventState(
|
4551
|
+
return getCurrentEventState(eventWithDraft, configuration);
|
4346
4552
|
}
|
4347
4553
|
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4348
4554
|
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
@@ -4356,18 +4562,18 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
4356
4562
|
declaration: updatedDeclaration
|
4357
4563
|
};
|
4358
4564
|
}
|
4359
|
-
function
|
4565
|
+
function applyDraftToEventIndex(eventIndex, draft, eventConfiguration) {
|
4360
4566
|
const indexedAt = eventIndex.updatedAt;
|
4361
|
-
const
|
4362
|
-
if (
|
4567
|
+
const activeDraft = draft && draft.createdAt >= indexedAt ? draft : void 0;
|
4568
|
+
if (!activeDraft) {
|
4363
4569
|
return eventIndex;
|
4364
4570
|
}
|
4365
4571
|
return applyDeclarationToEventIndex(
|
4366
4572
|
{
|
4367
4573
|
...eventIndex,
|
4368
|
-
updatedAt:
|
4574
|
+
updatedAt: activeDraft.createdAt
|
4369
4575
|
},
|
4370
|
-
|
4576
|
+
activeDraft.action.declaration,
|
4371
4577
|
eventConfiguration
|
4372
4578
|
);
|
4373
4579
|
}
|
@@ -4381,18 +4587,17 @@ function getAnnotationFromDrafts(drafts) {
|
|
4381
4587
|
function getActionAnnotation({
|
4382
4588
|
event: event2,
|
4383
4589
|
actionType,
|
4384
|
-
|
4590
|
+
draft
|
4385
4591
|
}) {
|
4386
4592
|
const activeActions = getAcceptedActions(event2);
|
4387
|
-
const action = activeActions.
|
4388
|
-
|
4593
|
+
const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
|
4594
|
+
const matchingDraft = draft?.action.type === actionType ? draft : void 0;
|
4595
|
+
const sortedActions = (0, import_lodash3.orderBy)(
|
4596
|
+
[action, matchingDraft?.action].filter((a) => a !== void 0),
|
4597
|
+
"createdAt",
|
4598
|
+
"asc"
|
4389
4599
|
);
|
4390
|
-
const
|
4391
|
-
const sorted = [
|
4392
|
-
...action ? [action] : [],
|
4393
|
-
...eventDrafts.map((draft) => draft.action)
|
4394
|
-
].sort();
|
4395
|
-
const annotation = sorted.reduce((ann, sortedAction) => {
|
4600
|
+
const annotation = sortedActions.reduce((ann, sortedAction) => {
|
4396
4601
|
return deepMerge(ann, sortedAction.annotation ?? {});
|
4397
4602
|
}, {});
|
4398
4603
|
return deepDropNulls(annotation);
|
@@ -4410,23 +4615,23 @@ function generateTransactionId() {
|
|
4410
4615
|
}
|
4411
4616
|
|
4412
4617
|
// ../commons/src/events/User.ts
|
4413
|
-
var
|
4414
|
-
var User =
|
4415
|
-
id:
|
4416
|
-
name:
|
4417
|
-
|
4418
|
-
use:
|
4419
|
-
given:
|
4420
|
-
family:
|
4618
|
+
var import_zod34 = require("zod");
|
4619
|
+
var User = import_zod34.z.object({
|
4620
|
+
id: import_zod34.z.string(),
|
4621
|
+
name: import_zod34.z.array(
|
4622
|
+
import_zod34.z.object({
|
4623
|
+
use: import_zod34.z.string(),
|
4624
|
+
given: import_zod34.z.array(import_zod34.z.string()),
|
4625
|
+
family: import_zod34.z.string()
|
4421
4626
|
})
|
4422
4627
|
),
|
4423
|
-
role:
|
4628
|
+
role: import_zod34.z.string(),
|
4424
4629
|
avatar: FullDocumentPath.optional(),
|
4425
4630
|
signature: FullDocumentPath.optional()
|
4426
4631
|
});
|
4427
4632
|
|
4428
4633
|
// ../commons/src/events/test.utils.ts
|
4429
|
-
var
|
4634
|
+
var import_lodash4 = require("lodash");
|
4430
4635
|
var import_date_fns4 = require("date-fns");
|
4431
4636
|
|
4432
4637
|
// ../commons/src/field-config/field-configuration.ts
|
@@ -5161,7 +5366,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5161
5366
|
defaultMessage: "Applicant's name",
|
5162
5367
|
description: "This is the label for the field",
|
5163
5368
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
5164
|
-
}
|
5369
|
+
},
|
5370
|
+
configuration: {
|
5371
|
+
name: {
|
5372
|
+
firstname: { required: true },
|
5373
|
+
middlename: { required: false },
|
5374
|
+
surname: { required: true }
|
5375
|
+
}
|
5376
|
+
},
|
5377
|
+
validation: [
|
5378
|
+
{
|
5379
|
+
validator: field("applicant.name").object({
|
5380
|
+
firstname: field("firstname").isValidEnglishName(),
|
5381
|
+
surname: field("surname").isValidEnglishName()
|
5382
|
+
}),
|
5383
|
+
message: {
|
5384
|
+
defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
|
5385
|
+
description: "This is the error message for invalid name",
|
5386
|
+
id: "v2.error.invalidName"
|
5387
|
+
}
|
5388
|
+
}
|
5389
|
+
]
|
5165
5390
|
},
|
5166
5391
|
{
|
5167
5392
|
id: "applicant.email",
|
@@ -5383,22 +5608,6 @@ var statusOptions = [
|
|
5383
5608
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5384
5609
|
}
|
5385
5610
|
},
|
5386
|
-
{
|
5387
|
-
value: EventStatus.enum.CERTIFIED,
|
5388
|
-
label: {
|
5389
|
-
defaultMessage: "Certified",
|
5390
|
-
description: "Option for form field: status of record",
|
5391
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
5392
|
-
}
|
5393
|
-
},
|
5394
|
-
{
|
5395
|
-
value: VisibleStatus.enum.REJECTED,
|
5396
|
-
label: {
|
5397
|
-
defaultMessage: "Rejected",
|
5398
|
-
description: "Option for form field: status of record",
|
5399
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
5400
|
-
}
|
5401
|
-
},
|
5402
5611
|
{
|
5403
5612
|
value: EventStatus.enum.ARCHIVED,
|
5404
5613
|
label: {
|
@@ -6424,9 +6633,9 @@ var v2BirthEvent = defineConfig({
|
|
6424
6633
|
});
|
6425
6634
|
|
6426
6635
|
// ../commons/src/events/test.utils.ts
|
6427
|
-
var
|
6636
|
+
var import_zod35 = require("zod");
|
6428
6637
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6429
|
-
var TestUserRole =
|
6638
|
+
var TestUserRole = import_zod35.z.enum([
|
6430
6639
|
"FIELD_AGENT",
|
6431
6640
|
"LOCAL_REGISTRAR",
|
6432
6641
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6591,7 +6800,7 @@ function eventPayloadGenerator(rng) {
|
|
6591
6800
|
eventId,
|
6592
6801
|
actionType,
|
6593
6802
|
annotation
|
6594
|
-
}, input = {}) => (0,
|
6803
|
+
}, input = {}) => (0, import_lodash4.merge)(
|
6595
6804
|
{
|
6596
6805
|
id: getUUID(),
|
6597
6806
|
eventId,
|
@@ -6650,13 +6859,13 @@ function eventPayloadGenerator(rng) {
|
|
6650
6859
|
notify: (eventId, input = {}) => {
|
6651
6860
|
let declaration = input.declaration;
|
6652
6861
|
if (!declaration) {
|
6653
|
-
const partialDeclaration = (0,
|
6862
|
+
const partialDeclaration = (0, import_lodash4.omitBy)(
|
6654
6863
|
generateActionDeclarationInput(
|
6655
6864
|
tennisClubMembershipEvent,
|
6656
6865
|
ActionType.DECLARE,
|
6657
6866
|
rng
|
6658
6867
|
),
|
6659
|
-
|
6868
|
+
import_lodash4.isString
|
6660
6869
|
);
|
6661
6870
|
declaration = partialDeclaration;
|
6662
6871
|
}
|
@@ -6703,7 +6912,6 @@ function eventPayloadGenerator(rng) {
|
|
6703
6912
|
type: ActionType.ARCHIVE,
|
6704
6913
|
transactionId: input.transactionId ?? getUUID(),
|
6705
6914
|
declaration: {},
|
6706
|
-
// @TODO: Check whether generator is needed?
|
6707
6915
|
annotation: {},
|
6708
6916
|
duplicates: [],
|
6709
6917
|
eventId,
|
@@ -6759,7 +6967,7 @@ function eventPayloadGenerator(rng) {
|
|
6759
6967
|
request: (eventId, input = {}) => ({
|
6760
6968
|
type: ActionType.REQUEST_CORRECTION,
|
6761
6969
|
transactionId: input.transactionId ?? getUUID(),
|
6762
|
-
declaration: input.declaration ?? (0,
|
6970
|
+
declaration: input.declaration ?? (0, import_lodash4.omit)(
|
6763
6971
|
generateActionDeclarationInput(
|
6764
6972
|
tennisClubMembershipEvent,
|
6765
6973
|
ActionType.REQUEST_CORRECTION,
|
@@ -6850,7 +7058,11 @@ function generateActionDocument({
|
|
6850
7058
|
case ActionType.NOTIFY:
|
6851
7059
|
return { ...actionBase, type: action };
|
6852
7060
|
case ActionType.PRINT_CERTIFICATE:
|
6853
|
-
return {
|
7061
|
+
return {
|
7062
|
+
...actionBase,
|
7063
|
+
type: action,
|
7064
|
+
content: defaults.content
|
7065
|
+
};
|
6854
7066
|
case ActionType.REQUEST_CORRECTION:
|
6855
7067
|
return { ...actionBase, type: action };
|
6856
7068
|
case ActionType.APPROVE_CORRECTION:
|
@@ -6913,7 +7125,8 @@ function generateEventDraftDocument({
|
|
6913
7125
|
declaration: {
|
6914
7126
|
...action.declaration,
|
6915
7127
|
...declaration
|
6916
|
-
}
|
7128
|
+
},
|
7129
|
+
annotation: action.annotation
|
6917
7130
|
},
|
6918
7131
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6919
7132
|
eventId
|
@@ -7020,7 +7233,12 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
7020
7233
|
type: "and",
|
7021
7234
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
7022
7235
|
},
|
7023
|
-
actions: [
|
7236
|
+
actions: [
|
7237
|
+
{
|
7238
|
+
type: "DEFAULT",
|
7239
|
+
conditionals: []
|
7240
|
+
}
|
7241
|
+
],
|
7024
7242
|
icon: "Draft"
|
7025
7243
|
}
|
7026
7244
|
]);
|
@@ -7036,9 +7254,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
7036
7254
|
if (isTemplateVariable(value)) {
|
7037
7255
|
return false;
|
7038
7256
|
}
|
7039
|
-
if (typeof value === "object" &&
|
7040
|
-
//@ts-ignore
|
7041
|
-
Object.values(value).some((val) => isTemplateVariable(val))) {
|
7257
|
+
if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
|
7042
7258
|
return false;
|
7043
7259
|
}
|
7044
7260
|
return true;
|
@@ -7060,7 +7276,7 @@ function isFieldConfigDefaultValue(value) {
|
|
7060
7276
|
}
|
7061
7277
|
|
7062
7278
|
// ../commons/src/events/scopes.ts
|
7063
|
-
var
|
7279
|
+
var import_lodash5 = require("lodash");
|
7064
7280
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
7065
7281
|
SCOPES.RECORD_DECLARE,
|
7066
7282
|
SCOPES.RECORD_READ,
|
@@ -7148,13 +7364,13 @@ var WRITE_ACTION_SCOPES = [
|
|
7148
7364
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
7149
7365
|
];
|
7150
7366
|
function hasAnyOfScopes(a, b) {
|
7151
|
-
return (0,
|
7367
|
+
return (0, import_lodash5.intersection)(a, b).length > 0;
|
7152
7368
|
}
|
7153
7369
|
|
7154
7370
|
// ../commons/src/events/serializers/user/deserializer.ts
|
7155
|
-
var
|
7371
|
+
var import_zod36 = require("zod");
|
7156
7372
|
var UserWithPrimaryOffice = User.extend({
|
7157
|
-
primaryOfficeId:
|
7373
|
+
primaryOfficeId: import_zod36.z.string()
|
7158
7374
|
});
|
7159
7375
|
function userDeserializer(serializedUserField, user2) {
|
7160
7376
|
if (typeof serializedUserField === "string") {
|
@@ -7250,14 +7466,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7250
7466
|
ActionType.REJECT_CORRECTION,
|
7251
7467
|
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7252
7468
|
],
|
7253
|
-
[EventStatus.enum.CERTIFIED]: [
|
7254
|
-
ActionType.READ,
|
7255
|
-
ActionType.PRINT_CERTIFICATE,
|
7256
|
-
ActionType.REQUEST_CORRECTION,
|
7257
|
-
ActionType.APPROVE_CORRECTION,
|
7258
|
-
ActionType.REJECT_CORRECTION,
|
7259
|
-
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7260
|
-
],
|
7261
7469
|
[EventStatus.enum.ARCHIVED]: [
|
7262
7470
|
ActionType.READ,
|
7263
7471
|
ActionType.ASSIGN,
|
@@ -7265,9 +7473,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7265
7473
|
]
|
7266
7474
|
};
|
7267
7475
|
var getAvailableActionsForEvent = (event2) => {
|
7268
|
-
|
7269
|
-
|
7270
|
-
|
7271
|
-
|
7272
|
-
|
7476
|
+
if (event2.flags.includes(InherentFlags.REJECTED)) {
|
7477
|
+
return [
|
7478
|
+
ActionType.READ,
|
7479
|
+
event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
|
7480
|
+
ActionType.ARCHIVE
|
7481
|
+
];
|
7482
|
+
}
|
7483
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7273
7484
|
};
|