@opencrvs/toolkit 1.8.1-rc.008155b → 1.8.1-rc.032a7f2
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 +387 -387
- 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 +18 -18
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/Draft.d.ts +56 -56
- package/dist/commons/events/EventConfig.d.ts +1250 -231
- package/dist/commons/events/EventDocument.d.ts +432 -432
- package/dist/commons/events/EventIndex.d.ts +10 -10
- package/dist/commons/events/FieldConfig.d.ts +1063 -63
- 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/defineConfig.d.ts +180 -45
- package/dist/commons/events/event.d.ts +55 -1
- package/dist/commons/events/test.utils.d.ts +14 -13
- package/dist/commons/events/utils.d.ts +339 -193
- package/dist/conditionals/index.js +1 -0
- package/dist/events/index.js +1029 -810
- 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
@@ -52,6 +52,7 @@ __export(events_exports, {
|
|
52
52
|
AddressType: () => AddressType,
|
53
53
|
AdministrativeAreas: () => AdministrativeAreas,
|
54
54
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
55
|
+
AnyFileField: () => AnyFileField,
|
55
56
|
AnyOf: () => AnyOf,
|
56
57
|
AnyOfStatus: () => AnyOfStatus,
|
57
58
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
@@ -117,6 +118,7 @@ __export(events_exports, {
|
|
117
118
|
FieldType: () => FieldType,
|
118
119
|
FieldUpdateValue: () => FieldUpdateValue,
|
119
120
|
FieldValue: () => FieldValue,
|
121
|
+
FileFieldType: () => FileFieldType,
|
120
122
|
FileFieldValue: () => FileFieldValue,
|
121
123
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
122
124
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
@@ -134,6 +136,7 @@ __export(events_exports, {
|
|
134
136
|
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
135
137
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
136
138
|
MimeType: () => MimeType,
|
139
|
+
NameConfig: () => NameConfig,
|
137
140
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
138
141
|
NameFieldValue: () => NameFieldValue,
|
139
142
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
@@ -171,6 +174,7 @@ __export(events_exports, {
|
|
171
174
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
172
175
|
TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
|
173
176
|
TestUserRole: () => TestUserRole,
|
177
|
+
TextField: () => TextField,
|
174
178
|
TextValue: () => TextValue,
|
175
179
|
TimeValue: () => TimeValue,
|
176
180
|
TranslationConfig: () => TranslationConfig,
|
@@ -199,13 +203,15 @@ __export(events_exports, {
|
|
199
203
|
and: () => and,
|
200
204
|
annotationActions: () => annotationActions,
|
201
205
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
202
|
-
|
206
|
+
applyDraftToEventIndex: () => applyDraftToEventIndex,
|
207
|
+
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
203
208
|
areConditionsMet: () => areConditionsMet,
|
204
209
|
compositeFieldTypes: () => compositeFieldTypes,
|
205
210
|
createEmptyDraft: () => createEmptyDraft,
|
206
211
|
createFieldConditionals: () => createFieldConditionals,
|
207
212
|
createPrng: () => createPrng,
|
208
213
|
createValidationSchema: () => createValidationSchema,
|
214
|
+
dangerouslyGetCurrentEventStateWithDrafts: () => dangerouslyGetCurrentEventStateWithDrafts,
|
209
215
|
deepDropNulls: () => deepDropNulls,
|
210
216
|
deepMerge: () => deepMerge,
|
211
217
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -227,7 +233,7 @@ __export(events_exports, {
|
|
227
233
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
228
234
|
field: () => field,
|
229
235
|
fieldTypes: () => fieldTypes,
|
230
|
-
|
236
|
+
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
231
237
|
findAllFields: () => findAllFields,
|
232
238
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
233
239
|
findRecordActionPages: () => findRecordActionPages,
|
@@ -255,7 +261,6 @@ __export(events_exports, {
|
|
255
261
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
256
262
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
257
263
|
getCurrentEventState: () => getCurrentEventState,
|
258
|
-
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
259
264
|
getDeclaration: () => getDeclaration,
|
260
265
|
getDeclarationFieldById: () => getDeclarationFieldById,
|
261
266
|
getDeclarationFields: () => getDeclarationFields,
|
@@ -315,6 +320,7 @@ __export(events_exports, {
|
|
315
320
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
316
321
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
317
322
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
323
|
+
mergeDrafts: () => mergeDrafts,
|
318
324
|
never: () => never,
|
319
325
|
not: () => not,
|
320
326
|
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
@@ -323,6 +329,7 @@ __export(events_exports, {
|
|
323
329
|
or: () => or,
|
324
330
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
325
331
|
runFieldValidations: () => runFieldValidations,
|
332
|
+
runStructuralValidations: () => runStructuralValidations,
|
326
333
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
327
334
|
user: () => user,
|
328
335
|
validate: () => validate,
|
@@ -337,7 +344,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
337
344
|
var BIRTH_EVENT = "v2-birth";
|
338
345
|
|
339
346
|
// ../commons/src/events/ActionConfig.ts
|
340
|
-
var
|
347
|
+
var import_zod11 = require("zod");
|
341
348
|
|
342
349
|
// ../commons/src/events/Conditional.ts
|
343
350
|
var import_zod = require("zod");
|
@@ -507,9 +514,10 @@ function isMetaAction(actionType) {
|
|
507
514
|
}
|
508
515
|
|
509
516
|
// ../commons/src/events/FieldConfig.ts
|
510
|
-
var
|
517
|
+
var import_zod8 = require("zod");
|
511
518
|
|
512
519
|
// ../commons/src/events/FieldType.ts
|
520
|
+
var import_zod4 = require("zod");
|
513
521
|
var FieldType = {
|
514
522
|
NAME: "NAME",
|
515
523
|
PHONE: "PHONE",
|
@@ -542,6 +550,11 @@ var FieldType = {
|
|
542
550
|
SIGNATURE: "SIGNATURE",
|
543
551
|
DATA: "DATA"
|
544
552
|
};
|
553
|
+
var FileFieldType = import_zod4.z.enum([
|
554
|
+
FieldType.FILE,
|
555
|
+
FieldType.FILE_WITH_OPTIONS,
|
556
|
+
FieldType.SIGNATURE
|
557
|
+
]);
|
545
558
|
var fieldTypes = Object.values(FieldType);
|
546
559
|
var compositeFieldTypes = [
|
547
560
|
FieldType.DATE_RANGE,
|
@@ -551,24 +564,24 @@ var compositeFieldTypes = [
|
|
551
564
|
];
|
552
565
|
|
553
566
|
// ../commons/src/events/FieldValue.ts
|
554
|
-
var
|
567
|
+
var import_zod7 = require("zod");
|
555
568
|
|
556
569
|
// ../commons/src/documents.ts
|
557
|
-
var
|
570
|
+
var import_zod5 = require("zod");
|
558
571
|
var import_zod_openapi3 = require("zod-openapi");
|
559
|
-
(0, import_zod_openapi3.extendZodWithOpenApi)(
|
560
|
-
var FullDocumentUrl =
|
572
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
573
|
+
var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
|
561
574
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
562
575
|
);
|
563
|
-
var FullDocumentPath =
|
576
|
+
var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
564
577
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
565
578
|
);
|
566
|
-
var DocumentPath =
|
579
|
+
var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
|
567
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"
|
568
581
|
);
|
569
582
|
|
570
583
|
// ../commons/src/events/CompositeFieldValue.ts
|
571
|
-
var
|
584
|
+
var import_zod6 = require("zod");
|
572
585
|
var GeographicalArea = {
|
573
586
|
URBAN: "URBAN",
|
574
587
|
RURAL: "RURAL"
|
@@ -577,110 +590,110 @@ var AddressType = {
|
|
577
590
|
DOMESTIC: "DOMESTIC",
|
578
591
|
INTERNATIONAL: "INTERNATIONAL"
|
579
592
|
};
|
580
|
-
var FileFieldValue =
|
593
|
+
var FileFieldValue = import_zod6.z.object({
|
581
594
|
path: FullDocumentPath,
|
582
|
-
originalFilename:
|
583
|
-
type:
|
595
|
+
originalFilename: import_zod6.z.string(),
|
596
|
+
type: import_zod6.z.string()
|
584
597
|
});
|
585
|
-
var AdminStructure =
|
586
|
-
country:
|
587
|
-
addressType:
|
588
|
-
province:
|
589
|
-
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()
|
590
603
|
});
|
591
604
|
var UrbanAddressValue = AdminStructure.extend({
|
592
|
-
urbanOrRural:
|
593
|
-
town:
|
594
|
-
residentialArea:
|
595
|
-
street:
|
596
|
-
number:
|
597
|
-
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()
|
598
611
|
});
|
599
612
|
var RuralAddressValue = AdminStructure.extend({
|
600
|
-
urbanOrRural:
|
601
|
-
village:
|
613
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.RURAL),
|
614
|
+
village: import_zod6.z.string().optional()
|
602
615
|
});
|
603
616
|
var UrbanAddressUpdateValue = AdminStructure.extend({
|
604
|
-
urbanOrRural:
|
605
|
-
town:
|
606
|
-
residentialArea:
|
607
|
-
street:
|
608
|
-
number:
|
609
|
-
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()
|
610
623
|
});
|
611
|
-
var NameFieldValue =
|
612
|
-
firstname:
|
613
|
-
surname:
|
614
|
-
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()
|
615
628
|
});
|
616
|
-
var NameFieldUpdateValue =
|
617
|
-
firstname:
|
618
|
-
surname:
|
619
|
-
middlename:
|
620
|
-
}).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());
|
621
634
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
622
|
-
urbanOrRural:
|
623
|
-
village:
|
635
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.RURAL),
|
636
|
+
village: import_zod6.z.string().nullish()
|
624
637
|
});
|
625
|
-
var GenericAddressValue =
|
626
|
-
country:
|
627
|
-
addressType:
|
628
|
-
state:
|
629
|
-
district2:
|
630
|
-
cityOrTown:
|
631
|
-
addressLine1:
|
632
|
-
addressLine2:
|
633
|
-
addressLine3:
|
634
|
-
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()
|
635
648
|
});
|
636
|
-
var AddressFieldValue =
|
637
|
-
var GenericAddressUpdateValue =
|
638
|
-
country:
|
639
|
-
addressType:
|
640
|
-
state:
|
641
|
-
district2:
|
642
|
-
cityOrTown:
|
643
|
-
addressLine1:
|
644
|
-
addressLine2:
|
645
|
-
addressLine3:
|
646
|
-
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()
|
647
660
|
});
|
648
|
-
var AddressFieldUpdateValue =
|
661
|
+
var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("urbanOrRural", [
|
649
662
|
UrbanAddressUpdateValue,
|
650
663
|
RuralAddressUpdateValue
|
651
664
|
]).or(GenericAddressUpdateValue);
|
652
|
-
var FileFieldValueWithOption =
|
665
|
+
var FileFieldValueWithOption = import_zod6.z.object({
|
653
666
|
path: FullDocumentPath,
|
654
|
-
originalFilename:
|
655
|
-
type:
|
656
|
-
option:
|
667
|
+
originalFilename: import_zod6.z.string(),
|
668
|
+
type: import_zod6.z.string(),
|
669
|
+
option: import_zod6.z.string()
|
657
670
|
});
|
658
|
-
var FileFieldWithOptionValue =
|
671
|
+
var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
|
659
672
|
|
660
673
|
// ../commons/src/events/FieldValue.ts
|
661
|
-
var TextValue =
|
674
|
+
var TextValue = import_zod7.z.string();
|
662
675
|
var NonEmptyTextValue = TextValue.min(1);
|
663
|
-
var DateValue =
|
664
|
-
var TimeValue =
|
665
|
-
var DatetimeValue =
|
666
|
-
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([
|
667
680
|
"last7Days",
|
668
681
|
"last30Days",
|
669
682
|
"last90Days",
|
670
683
|
"last365Days"
|
671
684
|
]);
|
672
|
-
var DateRangeFieldValue =
|
685
|
+
var DateRangeFieldValue = import_zod7.z.object({
|
673
686
|
start: DateValue,
|
674
687
|
end: DateValue
|
675
688
|
}).or(DateValue).describe(
|
676
689
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
677
690
|
);
|
678
|
-
var EmailValue =
|
679
|
-
var CheckboxFieldValue =
|
680
|
-
var NumberFieldValue =
|
681
|
-
var DataFieldValue =
|
682
|
-
var SignatureFieldValue =
|
683
|
-
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([
|
684
697
|
TextValue,
|
685
698
|
DateValue,
|
686
699
|
TimeValue,
|
@@ -697,7 +710,7 @@ var FieldValue = import_zod6.z.union([
|
|
697
710
|
NameFieldValue,
|
698
711
|
NameFieldUpdateValue
|
699
712
|
]);
|
700
|
-
var FieldUpdateValue =
|
713
|
+
var FieldUpdateValue = import_zod7.z.union([
|
701
714
|
TextValue,
|
702
715
|
DateValue,
|
703
716
|
TimeValue,
|
@@ -716,67 +729,67 @@ var FieldUpdateValue = import_zod6.z.union([
|
|
716
729
|
|
717
730
|
// ../commons/src/events/FieldConfig.ts
|
718
731
|
var import_zod_openapi4 = require("zod-openapi");
|
719
|
-
(0, import_zod_openapi4.extendZodWithOpenApi)(
|
720
|
-
var FieldId =
|
721
|
-
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({
|
722
735
|
$$field: FieldId
|
723
736
|
}).describe("Reference to a field by its ID");
|
724
|
-
var ValidationConfig =
|
737
|
+
var ValidationConfig = import_zod8.z.object({
|
725
738
|
validator: Conditional,
|
726
739
|
message: TranslationConfig
|
727
740
|
});
|
728
|
-
var BaseField =
|
741
|
+
var BaseField = import_zod8.z.object({
|
729
742
|
id: FieldId,
|
730
743
|
label: TranslationConfig,
|
731
744
|
parent: FieldReference.optional().describe(
|
732
745
|
"Reference to a parent field. If a field has a parent, it will be reset when the parent field is changed."
|
733
746
|
),
|
734
|
-
required:
|
735
|
-
conditionals:
|
736
|
-
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(),
|
737
750
|
placeholder: TranslationConfig.optional(),
|
738
|
-
validation:
|
751
|
+
validation: import_zod8.z.array(ValidationConfig).default([]).optional(),
|
739
752
|
helperText: TranslationConfig.optional(),
|
740
|
-
hideLabel:
|
741
|
-
uncorrectable:
|
753
|
+
hideLabel: import_zod8.z.boolean().default(false).optional(),
|
754
|
+
uncorrectable: import_zod8.z.boolean().default(false).optional().describe(
|
742
755
|
"Indicates if the field can be changed during a record correction."
|
743
756
|
)
|
744
757
|
});
|
745
758
|
var Divider = BaseField.extend({
|
746
|
-
type:
|
759
|
+
type: import_zod8.z.literal(FieldType.DIVIDER)
|
747
760
|
});
|
748
761
|
var TextField = BaseField.extend({
|
749
|
-
type:
|
762
|
+
type: import_zod8.z.literal(FieldType.TEXT),
|
750
763
|
defaultValue: NonEmptyTextValue.optional(),
|
751
|
-
configuration:
|
752
|
-
maxLength:
|
753
|
-
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(),
|
754
767
|
prefix: TranslationConfig.optional(),
|
755
768
|
postfix: TranslationConfig.optional()
|
756
769
|
}).default({ type: "text" }).optional()
|
757
770
|
}).describe("Text input");
|
758
771
|
var NumberField = BaseField.extend({
|
759
|
-
type:
|
772
|
+
type: import_zod8.z.literal(FieldType.NUMBER),
|
760
773
|
defaultValue: NumberFieldValue.optional(),
|
761
|
-
configuration:
|
762
|
-
min:
|
763
|
-
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"),
|
764
777
|
prefix: TranslationConfig.optional(),
|
765
778
|
postfix: TranslationConfig.optional()
|
766
779
|
}).optional()
|
767
780
|
}).describe("Number input");
|
768
781
|
var TextAreaField = BaseField.extend({
|
769
|
-
type:
|
782
|
+
type: import_zod8.z.literal(FieldType.TEXTAREA),
|
770
783
|
defaultValue: NonEmptyTextValue.optional(),
|
771
|
-
configuration:
|
772
|
-
maxLength:
|
773
|
-
rows:
|
774
|
-
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"),
|
775
788
|
prefix: TranslationConfig.optional(),
|
776
789
|
postfix: TranslationConfig.optional()
|
777
790
|
}).default({ rows: 4 }).optional()
|
778
791
|
}).describe("Multiline text input");
|
779
|
-
var ImageMimeType =
|
792
|
+
var ImageMimeType = import_zod8.z.enum([
|
780
793
|
"image/png",
|
781
794
|
"image/jpg",
|
782
795
|
"image/jpeg",
|
@@ -785,53 +798,53 @@ var ImageMimeType = import_zod7.z.enum([
|
|
785
798
|
var MimeType = ImageMimeType;
|
786
799
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
787
800
|
var SignatureField = BaseField.extend({
|
788
|
-
type:
|
801
|
+
type: import_zod8.z.literal(FieldType.SIGNATURE),
|
789
802
|
signaturePromptLabel: TranslationConfig.describe(
|
790
803
|
"Title of the signature modal"
|
791
804
|
),
|
792
805
|
defaultValue: SignatureFieldValue.optional(),
|
793
|
-
configuration:
|
794
|
-
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),
|
795
808
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
796
809
|
}).default({
|
797
810
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
798
811
|
})
|
799
812
|
}).describe("Signature input field");
|
800
813
|
var EmailField = BaseField.extend({
|
801
|
-
type:
|
802
|
-
configuration:
|
803
|
-
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")
|
804
817
|
}).default({ maxLength: 10 }).optional(),
|
805
818
|
defaultValue: NonEmptyTextValue.optional()
|
806
819
|
});
|
807
820
|
var DateField = BaseField.extend({
|
808
|
-
type:
|
821
|
+
type: import_zod8.z.literal(FieldType.DATE),
|
809
822
|
defaultValue: DateValue.optional(),
|
810
|
-
configuration:
|
823
|
+
configuration: import_zod8.z.object({
|
811
824
|
notice: TranslationConfig.describe(
|
812
825
|
"Text to display above the date input"
|
813
826
|
).optional()
|
814
827
|
}).optional()
|
815
828
|
}).describe("A single date input (yyyy-MM-dd)");
|
816
829
|
var TimeField = BaseField.extend({
|
817
|
-
type:
|
830
|
+
type: import_zod8.z.literal(FieldType.TIME),
|
818
831
|
defaultValue: TimeValue.optional(),
|
819
|
-
configuration:
|
832
|
+
configuration: import_zod8.z.object({
|
820
833
|
notice: TranslationConfig.describe(
|
821
834
|
"Text to display above the time input"
|
822
835
|
).optional()
|
823
836
|
}).optional()
|
824
837
|
}).describe("A single date input (HH-mm)");
|
825
838
|
var DateRangeField = BaseField.extend({
|
826
|
-
type:
|
839
|
+
type: import_zod8.z.literal(FieldType.DATE_RANGE),
|
827
840
|
defaultValue: DateRangeFieldValue.optional(),
|
828
|
-
configuration:
|
841
|
+
configuration: import_zod8.z.object({
|
829
842
|
notice: TranslationConfig.describe(
|
830
843
|
"Text to display above the date input"
|
831
844
|
).optional()
|
832
845
|
}).optional()
|
833
846
|
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
834
|
-
var HtmlFontVariant =
|
847
|
+
var HtmlFontVariant = import_zod8.z.enum([
|
835
848
|
"reg12",
|
836
849
|
"reg14",
|
837
850
|
"reg16",
|
@@ -841,31 +854,31 @@ var HtmlFontVariant = import_zod7.z.enum([
|
|
841
854
|
"h2",
|
842
855
|
"h1"
|
843
856
|
]);
|
844
|
-
var ParagraphConfiguration =
|
845
|
-
styles:
|
857
|
+
var ParagraphConfiguration = import_zod8.z.object({
|
858
|
+
styles: import_zod8.z.object({
|
846
859
|
fontVariant: HtmlFontVariant.optional().describe(
|
847
860
|
"Font variant to use for the paragraph text"
|
848
861
|
),
|
849
|
-
hint:
|
862
|
+
hint: import_zod8.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
|
850
863
|
}).optional()
|
851
864
|
}).default({});
|
852
865
|
var Paragraph = BaseField.extend({
|
853
|
-
type:
|
866
|
+
type: import_zod8.z.literal(FieldType.PARAGRAPH),
|
854
867
|
defaultValue: NonEmptyTextValue.optional(),
|
855
868
|
configuration: ParagraphConfiguration
|
856
869
|
}).describe("A read-only HTML <p> paragraph");
|
857
870
|
var PageHeader = BaseField.extend({
|
858
|
-
type:
|
871
|
+
type: import_zod8.z.literal(FieldType.PAGE_HEADER),
|
859
872
|
defaultValue: NonEmptyTextValue.optional()
|
860
873
|
}).describe("A read-only header component for form pages");
|
861
874
|
var File = BaseField.extend({
|
862
|
-
type:
|
875
|
+
type: import_zod8.z.literal(FieldType.FILE),
|
863
876
|
defaultValue: FileFieldValue.optional(),
|
864
|
-
configuration:
|
865
|
-
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),
|
866
879
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
867
|
-
style:
|
868
|
-
width:
|
880
|
+
style: import_zod8.z.object({
|
881
|
+
width: import_zod8.z.enum(["full", "auto"]).optional().describe(
|
869
882
|
"Whether the file upload button should take the full width of the container or not"
|
870
883
|
)
|
871
884
|
}).optional(),
|
@@ -874,140 +887,176 @@ var File = BaseField.extend({
|
|
874
887
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
875
888
|
})
|
876
889
|
}).describe("File upload");
|
877
|
-
var SelectOption =
|
878
|
-
value:
|
890
|
+
var SelectOption = import_zod8.z.object({
|
891
|
+
value: import_zod8.z.string().describe("The value of the option"),
|
879
892
|
label: TranslationConfig.describe("The label of the option")
|
880
893
|
});
|
881
894
|
var RadioGroup = BaseField.extend({
|
882
|
-
type:
|
895
|
+
type: import_zod8.z.literal(FieldType.RADIO_GROUP),
|
883
896
|
defaultValue: TextValue.optional(),
|
884
|
-
options:
|
885
|
-
configuration:
|
886
|
-
styles:
|
887
|
-
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()
|
888
901
|
}).optional()
|
889
902
|
}).optional()
|
890
903
|
}).describe("Grouped radio options");
|
891
904
|
var BulletList = BaseField.extend({
|
892
|
-
type:
|
905
|
+
type: import_zod8.z.literal(FieldType.BULLET_LIST),
|
893
906
|
defaultValue: TextValue.optional(),
|
894
|
-
items:
|
895
|
-
configuration:
|
896
|
-
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({
|
897
910
|
fontVariant: HtmlFontVariant.optional()
|
898
911
|
}).optional()
|
899
912
|
}).default({})
|
900
913
|
}).describe("A list of bullet points");
|
901
914
|
var Select = BaseField.extend({
|
902
|
-
type:
|
915
|
+
type: import_zod8.z.literal(FieldType.SELECT),
|
903
916
|
defaultValue: TextValue.optional(),
|
904
|
-
options:
|
917
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options")
|
905
918
|
}).describe("Select input");
|
906
|
-
var SelectDateRangeOption =
|
919
|
+
var SelectDateRangeOption = import_zod8.z.object({
|
907
920
|
value: SelectDateRangeValue.describe("The value of the option"),
|
908
921
|
label: TranslationConfig.describe("The label of the option")
|
909
922
|
});
|
910
923
|
var SelectDateRangeField = BaseField.extend({
|
911
|
-
type:
|
924
|
+
type: import_zod8.z.literal(FieldType.SELECT_DATE_RANGE),
|
912
925
|
defaultValue: SelectDateRangeValue.optional(),
|
913
|
-
options:
|
926
|
+
options: import_zod8.z.array(SelectDateRangeOption).describe("A list of options")
|
914
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
|
+
});
|
915
933
|
var NameField = BaseField.extend({
|
916
|
-
type:
|
917
|
-
defaultValue:
|
918
|
-
firstname: NonEmptyTextValue,
|
919
|
-
|
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()
|
920
939
|
}).optional(),
|
921
|
-
configuration:
|
922
|
-
|
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"),
|
923
947
|
prefix: TranslationConfig.optional(),
|
924
|
-
postfix: TranslationConfig.optional()
|
925
|
-
|
926
|
-
|
948
|
+
postfix: TranslationConfig.optional()
|
949
|
+
}).default({
|
950
|
+
name: {
|
951
|
+
firstname: { required: true },
|
952
|
+
surname: { required: true }
|
953
|
+
}
|
927
954
|
}).optional()
|
928
955
|
}).describe("Name input field");
|
929
956
|
var PhoneField = BaseField.extend({
|
930
957
|
defaultValue: NonEmptyTextValue.optional(),
|
931
|
-
type:
|
958
|
+
type: import_zod8.z.literal(FieldType.PHONE)
|
932
959
|
}).describe("Phone input field");
|
933
960
|
var IdField = BaseField.extend({
|
934
961
|
defaultValue: NonEmptyTextValue.optional(),
|
935
|
-
type:
|
962
|
+
type: import_zod8.z.literal(FieldType.ID)
|
936
963
|
}).describe("ID input field");
|
937
964
|
var Checkbox = BaseField.extend({
|
938
|
-
type:
|
965
|
+
type: import_zod8.z.literal(FieldType.CHECKBOX),
|
939
966
|
defaultValue: CheckboxFieldValue.optional()
|
940
967
|
}).describe("Boolean checkbox field");
|
941
968
|
var Country = BaseField.extend({
|
942
|
-
type:
|
969
|
+
type: import_zod8.z.literal(FieldType.COUNTRY),
|
943
970
|
defaultValue: NonEmptyTextValue.optional()
|
944
971
|
}).describe("Country select field");
|
945
|
-
var AdministrativeAreas =
|
972
|
+
var AdministrativeAreas = import_zod8.z.enum([
|
946
973
|
"ADMIN_STRUCTURE",
|
947
974
|
"HEALTH_FACILITY",
|
948
975
|
"CRVS_OFFICE"
|
949
976
|
]);
|
950
|
-
var AdministrativeAreaConfiguration =
|
951
|
-
partOf:
|
952
|
-
$declaration:
|
977
|
+
var AdministrativeAreaConfiguration = import_zod8.z.object({
|
978
|
+
partOf: import_zod8.z.object({
|
979
|
+
$declaration: import_zod8.z.string()
|
953
980
|
}).optional().describe("Parent location"),
|
954
981
|
type: AdministrativeAreas
|
955
982
|
}).describe("Administrative area options");
|
956
983
|
var AdministrativeArea = BaseField.extend({
|
957
|
-
type:
|
984
|
+
type: import_zod8.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
958
985
|
defaultValue: NonEmptyTextValue.optional(),
|
959
986
|
configuration: AdministrativeAreaConfiguration
|
960
987
|
}).describe("Administrative area input field e.g. facility, office");
|
961
988
|
var Location = BaseField.extend({
|
962
|
-
type:
|
989
|
+
type: import_zod8.z.literal(FieldType.LOCATION),
|
963
990
|
defaultValue: NonEmptyTextValue.optional(),
|
964
|
-
configuration:
|
965
|
-
searchableResource:
|
991
|
+
configuration: import_zod8.z.object({
|
992
|
+
searchableResource: import_zod8.z.array(import_zod8.z.enum(["locations", "facilities", "offices"])).optional()
|
966
993
|
}).optional()
|
967
994
|
}).describe("Input field for a location");
|
968
995
|
var FileUploadWithOptions = BaseField.extend({
|
969
|
-
type:
|
970
|
-
options:
|
996
|
+
type: import_zod8.z.literal(FieldType.FILE_WITH_OPTIONS),
|
997
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options"),
|
971
998
|
defaultValue: FileFieldWithOptionValue.optional(),
|
972
|
-
configuration:
|
973
|
-
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),
|
974
1001
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
975
1002
|
}).default({
|
976
1003
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
977
1004
|
})
|
978
1005
|
});
|
979
1006
|
var Facility = BaseField.extend({
|
980
|
-
type:
|
1007
|
+
type: import_zod8.z.literal(FieldType.FACILITY),
|
981
1008
|
defaultValue: NonEmptyTextValue.optional()
|
982
1009
|
}).describe("Input field for a facility");
|
983
1010
|
var Office = BaseField.extend({
|
984
|
-
type:
|
1011
|
+
type: import_zod8.z.literal(FieldType.OFFICE),
|
985
1012
|
defaultValue: NonEmptyTextValue.optional()
|
986
1013
|
}).describe("Input field for an office");
|
987
1014
|
var Address = BaseField.extend({
|
988
|
-
type:
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
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()
|
993
1042
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
994
|
-
var DataEntry =
|
995
|
-
|
1043
|
+
var DataEntry = import_zod8.z.union([
|
1044
|
+
import_zod8.z.object({
|
996
1045
|
label: TranslationConfig,
|
997
|
-
value: TranslationConfig.or(
|
1046
|
+
value: TranslationConfig.or(import_zod8.z.string())
|
998
1047
|
}),
|
999
|
-
|
1000
|
-
fieldId:
|
1048
|
+
import_zod8.z.object({
|
1049
|
+
fieldId: import_zod8.z.string()
|
1001
1050
|
})
|
1002
1051
|
]);
|
1003
1052
|
var DataField = BaseField.extend({
|
1004
|
-
type:
|
1005
|
-
configuration:
|
1053
|
+
type: import_zod8.z.literal(FieldType.DATA),
|
1054
|
+
configuration: import_zod8.z.object({
|
1006
1055
|
subtitle: TranslationConfig.optional(),
|
1007
|
-
data:
|
1056
|
+
data: import_zod8.z.array(DataEntry)
|
1008
1057
|
})
|
1009
1058
|
}).describe("Data field for displaying read-only data");
|
1010
|
-
var FieldConfig =
|
1059
|
+
var FieldConfig = import_zod8.z.discriminatedUnion("type", [
|
1011
1060
|
Address,
|
1012
1061
|
TextField,
|
1013
1062
|
NumberField,
|
@@ -1040,19 +1089,24 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1040
1089
|
description: "Form field configuration",
|
1041
1090
|
ref: "FieldConfig"
|
1042
1091
|
});
|
1092
|
+
var AnyFileField = import_zod8.z.discriminatedUnion("type", [
|
1093
|
+
SignatureField,
|
1094
|
+
File,
|
1095
|
+
FileUploadWithOptions
|
1096
|
+
]);
|
1043
1097
|
|
1044
1098
|
// ../commons/src/events/FormConfig.ts
|
1045
|
-
var
|
1099
|
+
var import_zod10 = require("zod");
|
1046
1100
|
|
1047
1101
|
// ../commons/src/events/PageConfig.ts
|
1048
|
-
var
|
1102
|
+
var import_zod9 = require("zod");
|
1049
1103
|
var import_zod_openapi5 = require("zod-openapi");
|
1050
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(
|
1051
|
-
var PageTypes =
|
1052
|
-
var PageConfigBase =
|
1053
|
-
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"),
|
1054
1108
|
title: TranslationConfig.describe("Header title of the page"),
|
1055
|
-
fields:
|
1109
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
1056
1110
|
conditional: Conditional.optional().describe(
|
1057
1111
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
1058
1112
|
)
|
@@ -1061,13 +1115,13 @@ var PageConfigBase = import_zod8.z.object({
|
|
1061
1115
|
ref: "FormPageConfig"
|
1062
1116
|
});
|
1063
1117
|
var FormPageConfig = PageConfigBase.extend({
|
1064
|
-
type:
|
1118
|
+
type: import_zod9.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
1065
1119
|
});
|
1066
|
-
var VerificationActionConfig =
|
1067
|
-
verify:
|
1068
|
-
cancel:
|
1120
|
+
var VerificationActionConfig = import_zod9.z.object({
|
1121
|
+
verify: import_zod9.z.object({ label: TranslationConfig }),
|
1122
|
+
cancel: import_zod9.z.object({
|
1069
1123
|
label: TranslationConfig,
|
1070
|
-
confirmation:
|
1124
|
+
confirmation: import_zod9.z.object({
|
1071
1125
|
title: TranslationConfig,
|
1072
1126
|
body: TranslationConfig
|
1073
1127
|
})
|
@@ -1077,110 +1131,110 @@ var VerificationActionConfig = import_zod8.z.object({
|
|
1077
1131
|
ref: "VerificationActionConfig"
|
1078
1132
|
});
|
1079
1133
|
var VerificationPageConfig = FormPageConfig.extend({
|
1080
|
-
type:
|
1134
|
+
type: import_zod9.z.literal(PageTypes.enum.VERIFICATION),
|
1081
1135
|
actions: VerificationActionConfig
|
1082
1136
|
});
|
1083
|
-
var PageConfig =
|
1137
|
+
var PageConfig = import_zod9.z.discriminatedUnion("type", [
|
1084
1138
|
FormPageConfig,
|
1085
1139
|
VerificationPageConfig
|
1086
1140
|
]);
|
1087
1141
|
|
1088
1142
|
// ../commons/src/events/FormConfig.ts
|
1089
|
-
var DeclarationFormConfig =
|
1143
|
+
var DeclarationFormConfig = import_zod10.z.object({
|
1090
1144
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1091
|
-
pages:
|
1145
|
+
pages: import_zod10.z.array(FormPageConfig)
|
1092
1146
|
}).describe("Configuration for a declaration form");
|
1093
|
-
var ActionFormConfig =
|
1147
|
+
var ActionFormConfig = import_zod10.z.object({
|
1094
1148
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1095
|
-
pages:
|
1149
|
+
pages: import_zod10.z.array(PageConfig)
|
1096
1150
|
});
|
1097
|
-
var FormConfig =
|
1151
|
+
var FormConfig = import_zod10.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1098
1152
|
|
1099
1153
|
// ../commons/src/events/ActionConfig.ts
|
1100
1154
|
var import_zod_openapi6 = require("zod-openapi");
|
1101
|
-
(0, import_zod_openapi6.extendZodWithOpenApi)(
|
1102
|
-
var ActionConditional2 =
|
1155
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod11.z);
|
1156
|
+
var ActionConditional2 = import_zod11.z.discriminatedUnion("type", [
|
1103
1157
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1104
1158
|
ShowConditional,
|
1105
1159
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1106
1160
|
EnableConditional
|
1107
1161
|
]);
|
1108
|
-
var DeclarationReviewConfig =
|
1162
|
+
var DeclarationReviewConfig = import_zod11.z.object({
|
1109
1163
|
title: TranslationConfig.describe("Title of the review page"),
|
1110
|
-
fields:
|
1164
|
+
fields: import_zod11.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1111
1165
|
}).describe("Configuration for **declaration** review page.");
|
1112
|
-
var ActionConfigBase =
|
1166
|
+
var ActionConfigBase = import_zod11.z.object({
|
1113
1167
|
label: TranslationConfig,
|
1114
|
-
conditionals:
|
1115
|
-
draft:
|
1168
|
+
conditionals: import_zod11.z.array(ActionConditional2).optional().default([]),
|
1169
|
+
draft: import_zod11.z.boolean().optional()
|
1116
1170
|
});
|
1117
1171
|
var ReadActionConfig = ActionConfigBase.merge(
|
1118
|
-
|
1119
|
-
type:
|
1172
|
+
import_zod11.z.object({
|
1173
|
+
type: import_zod11.z.literal(ActionType.READ),
|
1120
1174
|
review: DeclarationReviewConfig
|
1121
1175
|
})
|
1122
1176
|
);
|
1123
1177
|
var DeclareConfig = ActionConfigBase.merge(
|
1124
|
-
|
1125
|
-
type:
|
1178
|
+
import_zod11.z.object({
|
1179
|
+
type: import_zod11.z.literal(ActionType.DECLARE),
|
1126
1180
|
review: DeclarationReviewConfig
|
1127
1181
|
})
|
1128
1182
|
);
|
1129
1183
|
var ValidateConfig = ActionConfigBase.merge(
|
1130
|
-
|
1131
|
-
type:
|
1184
|
+
import_zod11.z.object({
|
1185
|
+
type: import_zod11.z.literal(ActionType.VALIDATE),
|
1132
1186
|
review: DeclarationReviewConfig
|
1133
1187
|
})
|
1134
1188
|
);
|
1135
1189
|
var RegisterConfig = ActionConfigBase.merge(
|
1136
|
-
|
1137
|
-
type:
|
1190
|
+
import_zod11.z.object({
|
1191
|
+
type: import_zod11.z.literal(ActionType.REGISTER),
|
1138
1192
|
review: DeclarationReviewConfig
|
1139
1193
|
})
|
1140
1194
|
);
|
1141
1195
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1142
|
-
|
1143
|
-
type:
|
1196
|
+
import_zod11.z.object({
|
1197
|
+
type: import_zod11.z.literal(ActionType.REJECT)
|
1144
1198
|
})
|
1145
1199
|
);
|
1146
1200
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1147
|
-
|
1148
|
-
type:
|
1201
|
+
import_zod11.z.object({
|
1202
|
+
type: import_zod11.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1149
1203
|
})
|
1150
1204
|
);
|
1151
1205
|
var ArchiveConfig = ActionConfigBase.merge(
|
1152
|
-
|
1153
|
-
type:
|
1206
|
+
import_zod11.z.object({
|
1207
|
+
type: import_zod11.z.literal(ActionType.ARCHIVE)
|
1154
1208
|
})
|
1155
1209
|
);
|
1156
1210
|
var DeleteConfig = ActionConfigBase.merge(
|
1157
|
-
|
1158
|
-
type:
|
1211
|
+
import_zod11.z.object({
|
1212
|
+
type: import_zod11.z.literal(ActionType.DELETE)
|
1159
1213
|
})
|
1160
1214
|
);
|
1161
1215
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1162
|
-
|
1163
|
-
type:
|
1216
|
+
import_zod11.z.object({
|
1217
|
+
type: import_zod11.z.literal(ActionType.PRINT_CERTIFICATE),
|
1164
1218
|
printForm: ActionFormConfig
|
1165
1219
|
})
|
1166
1220
|
);
|
1167
1221
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1168
|
-
|
1169
|
-
type:
|
1222
|
+
import_zod11.z.object({
|
1223
|
+
type: import_zod11.z.literal(ActionType.REQUEST_CORRECTION),
|
1170
1224
|
correctionForm: ActionFormConfig
|
1171
1225
|
})
|
1172
1226
|
);
|
1173
1227
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1174
|
-
|
1175
|
-
type:
|
1228
|
+
import_zod11.z.object({
|
1229
|
+
type: import_zod11.z.literal(ActionType.REJECT_CORRECTION)
|
1176
1230
|
})
|
1177
1231
|
);
|
1178
1232
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1179
|
-
|
1180
|
-
type:
|
1233
|
+
import_zod11.z.object({
|
1234
|
+
type: import_zod11.z.literal(ActionType.APPROVE_CORRECTION)
|
1181
1235
|
})
|
1182
1236
|
);
|
1183
|
-
var ActionConfig =
|
1237
|
+
var ActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1184
1238
|
/*
|
1185
1239
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1186
1240
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1200,108 +1254,109 @@ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
|
|
1200
1254
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1201
1255
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1202
1256
|
]).openapi({ ref: "ActionConfig" });
|
1203
|
-
var DeclarationActionConfig =
|
1257
|
+
var DeclarationActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1204
1258
|
DeclareConfig,
|
1205
1259
|
ValidateConfig,
|
1206
1260
|
RegisterConfig
|
1207
1261
|
]);
|
1208
1262
|
|
1209
1263
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1210
|
-
var
|
1211
|
-
var FontFamily =
|
1212
|
-
normal:
|
1213
|
-
bold:
|
1214
|
-
italics:
|
1215
|
-
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()
|
1216
1270
|
});
|
1217
|
-
var CertificateConfig =
|
1218
|
-
id:
|
1219
|
-
event:
|
1271
|
+
var CertificateConfig = import_zod12.z.object({
|
1272
|
+
id: import_zod12.z.string(),
|
1273
|
+
event: import_zod12.z.string(),
|
1220
1274
|
label: TranslationConfig,
|
1221
|
-
isDefault:
|
1222
|
-
fee:
|
1223
|
-
onTime:
|
1224
|
-
late:
|
1225
|
-
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()
|
1226
1280
|
}),
|
1227
|
-
svgUrl:
|
1228
|
-
fonts:
|
1281
|
+
svgUrl: import_zod12.z.string(),
|
1282
|
+
fonts: import_zod12.z.record(FontFamily).optional(),
|
1283
|
+
conditionals: import_zod12.z.array(ShowConditional).optional()
|
1229
1284
|
});
|
1230
1285
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1231
|
-
hash:
|
1232
|
-
svg:
|
1286
|
+
hash: import_zod12.z.string().optional(),
|
1287
|
+
svg: import_zod12.z.string()
|
1233
1288
|
});
|
1234
1289
|
|
1235
1290
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1236
|
-
var
|
1237
|
-
var LanguageConfig =
|
1238
|
-
lang:
|
1291
|
+
var import_zod13 = require("zod");
|
1292
|
+
var LanguageConfig = import_zod13.z.object({
|
1293
|
+
lang: import_zod13.z.string(),
|
1239
1294
|
/**
|
1240
1295
|
* client.csv contents
|
1241
1296
|
*/
|
1242
|
-
messages:
|
1297
|
+
messages: import_zod13.z.record(import_zod13.z.string())
|
1243
1298
|
});
|
1244
1299
|
|
1245
1300
|
// ../commons/src/events/EventConfig.ts
|
1246
|
-
var
|
1301
|
+
var import_zod22 = require("zod");
|
1247
1302
|
|
1248
1303
|
// ../commons/src/events/DeduplicationConfig.ts
|
1249
|
-
var
|
1304
|
+
var import_zod14 = require("zod");
|
1250
1305
|
var import_zod_openapi7 = require("zod-openapi");
|
1251
|
-
(0, import_zod_openapi7.extendZodWithOpenApi)(
|
1252
|
-
var FieldReference2 =
|
1253
|
-
var Matcher =
|
1254
|
-
fieldId:
|
1255
|
-
options:
|
1256
|
-
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()
|
1257
1312
|
}).optional().default({})
|
1258
1313
|
});
|
1259
1314
|
var FuzzyMatcher = Matcher.extend({
|
1260
|
-
type:
|
1261
|
-
options:
|
1315
|
+
type: import_zod14.z.literal("fuzzy"),
|
1316
|
+
options: import_zod14.z.object({
|
1262
1317
|
/**
|
1263
1318
|
* Names of length 3 or less characters = 0 edits allowed
|
1264
1319
|
* Names of length 4 - 6 characters = 1 edit allowed
|
1265
1320
|
* Names of length >7 characters = 2 edits allowed
|
1266
1321
|
*/
|
1267
|
-
fuzziness:
|
1268
|
-
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)
|
1269
1324
|
}).optional().default({})
|
1270
1325
|
});
|
1271
1326
|
var StrictMatcher = Matcher.extend({
|
1272
|
-
type:
|
1273
|
-
options:
|
1274
|
-
boost:
|
1327
|
+
type: import_zod14.z.literal("strict"),
|
1328
|
+
options: import_zod14.z.object({
|
1329
|
+
boost: import_zod14.z.number().optional().default(1)
|
1275
1330
|
}).optional().default({})
|
1276
1331
|
});
|
1277
1332
|
var DateRangeMatcher = Matcher.extend({
|
1278
|
-
type:
|
1279
|
-
options:
|
1280
|
-
days:
|
1333
|
+
type: import_zod14.z.literal("dateRange"),
|
1334
|
+
options: import_zod14.z.object({
|
1335
|
+
days: import_zod14.z.number(),
|
1281
1336
|
origin: FieldReference2,
|
1282
|
-
boost:
|
1337
|
+
boost: import_zod14.z.number().optional().default(1)
|
1283
1338
|
})
|
1284
1339
|
});
|
1285
1340
|
var DateDistanceMatcher = Matcher.extend({
|
1286
|
-
type:
|
1287
|
-
options:
|
1288
|
-
days:
|
1341
|
+
type: import_zod14.z.literal("dateDistance"),
|
1342
|
+
options: import_zod14.z.object({
|
1343
|
+
days: import_zod14.z.number(),
|
1289
1344
|
origin: FieldReference2,
|
1290
|
-
boost:
|
1345
|
+
boost: import_zod14.z.number().optional().default(1)
|
1291
1346
|
})
|
1292
1347
|
});
|
1293
|
-
var And =
|
1294
|
-
type:
|
1348
|
+
var And = import_zod14.z.object({
|
1349
|
+
type: import_zod14.z.literal("and"),
|
1295
1350
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1296
|
-
clauses:
|
1351
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1297
1352
|
});
|
1298
|
-
var Or =
|
1299
|
-
type:
|
1353
|
+
var Or = import_zod14.z.object({
|
1354
|
+
type: import_zod14.z.literal("or"),
|
1300
1355
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1301
|
-
clauses:
|
1356
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1302
1357
|
});
|
1303
|
-
var Clause =
|
1304
|
-
() =>
|
1358
|
+
var Clause = import_zod14.z.lazy(
|
1359
|
+
() => import_zod14.z.discriminatedUnion("type", [
|
1305
1360
|
And,
|
1306
1361
|
Or,
|
1307
1362
|
FuzzyMatcher,
|
@@ -1312,43 +1367,43 @@ var Clause = import_zod13.z.lazy(
|
|
1312
1367
|
).openapi({
|
1313
1368
|
ref: "Clause"
|
1314
1369
|
});
|
1315
|
-
var DeduplicationConfig =
|
1316
|
-
id:
|
1370
|
+
var DeduplicationConfig = import_zod14.z.object({
|
1371
|
+
id: import_zod14.z.string(),
|
1317
1372
|
label: TranslationConfig,
|
1318
1373
|
query: Clause
|
1319
1374
|
});
|
1320
1375
|
|
1321
1376
|
// ../commons/src/events/SummaryConfig.ts
|
1322
|
-
var
|
1323
|
-
var BaseField2 =
|
1377
|
+
var import_zod15 = require("zod");
|
1378
|
+
var BaseField2 = import_zod15.z.object({
|
1324
1379
|
emptyValueMessage: TranslationConfig.optional(),
|
1325
|
-
conditionals:
|
1380
|
+
conditionals: import_zod15.z.array(ShowConditional).default([]).optional()
|
1326
1381
|
});
|
1327
1382
|
var ReferenceField = BaseField2.extend({
|
1328
|
-
fieldId:
|
1383
|
+
fieldId: import_zod15.z.string(),
|
1329
1384
|
label: TranslationConfig.optional().describe(
|
1330
1385
|
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1331
1386
|
)
|
1332
1387
|
}).describe("Field directly referencing event data with field id");
|
1333
1388
|
var Field = BaseField2.extend({
|
1334
|
-
id:
|
1389
|
+
id: import_zod15.z.string().describe("Id of summary field"),
|
1335
1390
|
value: TranslationConfig.describe(
|
1336
1391
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1337
1392
|
),
|
1338
1393
|
label: TranslationConfig
|
1339
1394
|
}).describe("Custom configured field");
|
1340
|
-
var SummaryConfig =
|
1341
|
-
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.")
|
1342
1397
|
}).describe("Configuration for summary in event.");
|
1343
1398
|
|
1344
1399
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1345
|
-
var
|
1346
|
-
var MatchType =
|
1347
|
-
var BaseField3 =
|
1348
|
-
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({
|
1349
1404
|
type: MatchType.describe("Determines the type of field")
|
1350
1405
|
}),
|
1351
|
-
options:
|
1406
|
+
options: import_zod16.z.array(SelectOption).optional(),
|
1352
1407
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1353
1408
|
`
|
1354
1409
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
@@ -1369,7 +1424,7 @@ var BaseField3 = import_zod15.z.object({
|
|
1369
1424
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1370
1425
|
`
|
1371
1426
|
),
|
1372
|
-
conditionals:
|
1427
|
+
conditionals: import_zod16.z.array(FieldConditional).default([]).optional().describe(
|
1373
1428
|
`
|
1374
1429
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1375
1430
|
|
@@ -1383,30 +1438,30 @@ var BaseField3 = import_zod15.z.object({
|
|
1383
1438
|
are always rendered in the advanced search form.
|
1384
1439
|
`
|
1385
1440
|
),
|
1386
|
-
validations:
|
1441
|
+
validations: import_zod16.z.array(ValidationConfig).default([]).optional().describe(
|
1387
1442
|
`In advanced search, we sometimes need to override the default field validations.`
|
1388
1443
|
)
|
1389
1444
|
});
|
1390
|
-
var SearchQueryParams =
|
1391
|
-
eventType:
|
1445
|
+
var SearchQueryParams = import_zod16.z.object({
|
1446
|
+
eventType: import_zod16.z.string().optional().describe(
|
1392
1447
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1393
1448
|
)
|
1394
1449
|
}).catchall(FieldValue);
|
1395
1450
|
var FieldConfigSchema = BaseField3.extend({
|
1396
|
-
fieldId:
|
1397
|
-
fieldType:
|
1398
|
-
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(
|
1399
1454
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1400
1455
|
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1401
1456
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1402
1457
|
),
|
1403
|
-
excludeInSearchQuery:
|
1458
|
+
excludeInSearchQuery: import_zod16.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1404
1459
|
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1405
1460
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1406
1461
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1407
1462
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1408
1463
|
});
|
1409
|
-
var EventFieldIdInput =
|
1464
|
+
var EventFieldIdInput = import_zod16.z.enum([
|
1410
1465
|
"trackingId",
|
1411
1466
|
"status",
|
1412
1467
|
"legalStatuses.REGISTERED.acceptedAt",
|
@@ -1414,7 +1469,7 @@ var EventFieldIdInput = import_zod15.z.enum([
|
|
1414
1469
|
"updatedAt"
|
1415
1470
|
]);
|
1416
1471
|
var METADATA_FIELD_PREFIX = "event.";
|
1417
|
-
var EventFieldId =
|
1472
|
+
var EventFieldId = import_zod16.z.enum([
|
1418
1473
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
1419
1474
|
`${METADATA_FIELD_PREFIX}status`,
|
1420
1475
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
@@ -1423,28 +1478,28 @@ var EventFieldId = import_zod15.z.enum([
|
|
1423
1478
|
]);
|
1424
1479
|
var EventFieldConfigSchema = BaseField3.extend({
|
1425
1480
|
fieldId: EventFieldId,
|
1426
|
-
fieldType:
|
1481
|
+
fieldType: import_zod16.z.literal("event")
|
1427
1482
|
});
|
1428
|
-
var SearchField =
|
1483
|
+
var SearchField = import_zod16.z.discriminatedUnion("fieldType", [
|
1429
1484
|
FieldConfigSchema,
|
1430
1485
|
EventFieldConfigSchema
|
1431
1486
|
]);
|
1432
|
-
var AdvancedSearchConfig =
|
1487
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
1433
1488
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1434
|
-
fields:
|
1489
|
+
fields: import_zod16.z.array(SearchField).describe("Advanced search fields.")
|
1435
1490
|
});
|
1436
1491
|
|
1437
1492
|
// ../commons/src/events/utils.ts
|
1438
1493
|
var import_lodash = require("lodash");
|
1439
1494
|
|
1440
1495
|
// ../commons/src/events/ActionDocument.ts
|
1441
|
-
var
|
1496
|
+
var import_zod20 = require("zod");
|
1442
1497
|
var import_zod_openapi8 = require("zod-openapi");
|
1443
1498
|
|
1444
1499
|
// ../commons/src/uuid.ts
|
1445
1500
|
var import_uuid = require("uuid");
|
1446
|
-
var
|
1447
|
-
var UUID =
|
1501
|
+
var import_zod17 = require("zod");
|
1502
|
+
var UUID = import_zod17.z.string().uuid().brand("UUID");
|
1448
1503
|
function getUUID() {
|
1449
1504
|
return (0, import_uuid.v4)();
|
1450
1505
|
}
|
@@ -1454,10 +1509,10 @@ var CreatedAtLocation = UUID.nullish();
|
|
1454
1509
|
|
1455
1510
|
// ../commons/src/authentication.ts
|
1456
1511
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1457
|
-
var
|
1512
|
+
var import_zod19 = require("zod");
|
1458
1513
|
|
1459
1514
|
// ../commons/src/scopes.ts
|
1460
|
-
var
|
1515
|
+
var import_zod18 = require("zod");
|
1461
1516
|
var SCOPES = {
|
1462
1517
|
// TODO v1.8 legacy scopes
|
1463
1518
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -1570,108 +1625,108 @@ var SCOPES = {
|
|
1570
1625
|
// data seeding
|
1571
1626
|
USER_DATA_SEEDING: "user.data-seeding"
|
1572
1627
|
};
|
1573
|
-
var LegacyScopes =
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
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)
|
1585
1640
|
]);
|
1586
|
-
var IntegrationScopes =
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
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)
|
1591
1646
|
]);
|
1592
|
-
var DeclareScopes =
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
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)
|
1603
1658
|
]);
|
1604
|
-
var UnassignScope =
|
1605
|
-
var ValidateScopes =
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
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)
|
1612
1667
|
]);
|
1613
|
-
var RegisterScope =
|
1614
|
-
var CertifyScopes =
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
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)
|
1623
1678
|
]);
|
1624
|
-
var CorrectionScopes =
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
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)
|
1633
1688
|
]);
|
1634
|
-
var SearchScopes =
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
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)
|
1641
1696
|
]);
|
1642
|
-
var AuditScopes =
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
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)
|
1647
1702
|
]);
|
1648
|
-
var ProfileScopes =
|
1649
|
-
|
1650
|
-
|
1703
|
+
var ProfileScopes = import_zod18.z.union([
|
1704
|
+
import_zod18.z.literal(SCOPES.PROFILE_UPDATE),
|
1705
|
+
import_zod18.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1651
1706
|
]);
|
1652
|
-
var PerformanceScopes =
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
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)
|
1656
1711
|
]);
|
1657
|
-
var OrganisationScopes =
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
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)
|
1661
1716
|
]);
|
1662
|
-
var UserScopes =
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
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)
|
1671
1726
|
]);
|
1672
|
-
var ConfigScope =
|
1673
|
-
var DataSeedingScope =
|
1674
|
-
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([
|
1675
1730
|
LegacyScopes,
|
1676
1731
|
IntegrationScopes,
|
1677
1732
|
UnassignScope,
|
@@ -1690,39 +1745,39 @@ var LiteralScopes = import_zod17.z.union([
|
|
1690
1745
|
DataSeedingScope
|
1691
1746
|
]);
|
1692
1747
|
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1693
|
-
var rawConfigurableScope =
|
1694
|
-
var CreateUserScope =
|
1695
|
-
type:
|
1696
|
-
options:
|
1697
|
-
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())
|
1698
1753
|
})
|
1699
1754
|
});
|
1700
|
-
var EditUserScope =
|
1701
|
-
type:
|
1702
|
-
options:
|
1703
|
-
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())
|
1704
1759
|
})
|
1705
1760
|
});
|
1706
|
-
var WorkqueueScope =
|
1707
|
-
type:
|
1708
|
-
options:
|
1709
|
-
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())
|
1710
1765
|
})
|
1711
1766
|
});
|
1712
|
-
var NotifyRecordScope =
|
1713
|
-
type:
|
1714
|
-
options:
|
1715
|
-
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())
|
1716
1771
|
})
|
1717
1772
|
});
|
1718
|
-
var SearchScope =
|
1719
|
-
type:
|
1720
|
-
options:
|
1721
|
-
event:
|
1722
|
-
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)
|
1723
1778
|
})
|
1724
1779
|
});
|
1725
|
-
var ConfigurableRawScopes =
|
1780
|
+
var ConfigurableRawScopes = import_zod18.z.discriminatedUnion("type", [
|
1726
1781
|
SearchScope,
|
1727
1782
|
CreateUserScope,
|
1728
1783
|
EditUserScope,
|
@@ -1730,7 +1785,7 @@ var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
|
|
1730
1785
|
NotifyRecordScope
|
1731
1786
|
]);
|
1732
1787
|
var scopes = Object.values(SCOPES);
|
1733
|
-
var ActionScopes =
|
1788
|
+
var ActionScopes = import_zod18.z.union([
|
1734
1789
|
DeclareScopes,
|
1735
1790
|
ValidateScopes,
|
1736
1791
|
RegisterScope,
|
@@ -1881,30 +1936,30 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
1881
1936
|
]
|
1882
1937
|
}
|
1883
1938
|
];
|
1884
|
-
var TokenUserType =
|
1885
|
-
var TokenWithBearer =
|
1939
|
+
var TokenUserType = import_zod19.z.enum(["user", "system"]);
|
1940
|
+
var TokenWithBearer = import_zod19.z.string().regex(/^Bearer\s/);
|
1886
1941
|
|
1887
1942
|
// ../commons/src/events/ActionDocument.ts
|
1888
|
-
(0, import_zod_openapi8.extendZodWithOpenApi)(
|
1889
|
-
var ActionUpdate =
|
1890
|
-
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);
|
1891
1946
|
var ActionStatus = {
|
1892
1947
|
Requested: "Requested",
|
1893
1948
|
Accepted: "Accepted",
|
1894
1949
|
Rejected: "Rejected"
|
1895
1950
|
};
|
1896
|
-
var ActionBase =
|
1951
|
+
var ActionBase = import_zod20.z.object({
|
1897
1952
|
id: UUID,
|
1898
|
-
transactionId:
|
1953
|
+
transactionId: import_zod20.z.string(),
|
1899
1954
|
createdByUserType: TokenUserType,
|
1900
|
-
createdAt:
|
1901
|
-
createdBy:
|
1902
|
-
createdByRole:
|
1903
|
-
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"),
|
1904
1959
|
createdAtLocation: CreatedAtLocation,
|
1905
1960
|
declaration: ActionUpdate,
|
1906
1961
|
annotation: ActionUpdate.optional().nullable(),
|
1907
|
-
status:
|
1962
|
+
status: import_zod20.z.enum([
|
1908
1963
|
ActionStatus.Requested,
|
1909
1964
|
ActionStatus.Accepted,
|
1910
1965
|
ActionStatus.Rejected
|
@@ -1918,102 +1973,102 @@ var ActionBase = import_zod19.z.object({
|
|
1918
1973
|
// See PrintCertificateAction
|
1919
1974
|
});
|
1920
1975
|
var AssignedAction = ActionBase.merge(
|
1921
|
-
|
1922
|
-
type:
|
1923
|
-
assignedTo:
|
1976
|
+
import_zod20.z.object({
|
1977
|
+
type: import_zod20.z.literal(ActionType.ASSIGN),
|
1978
|
+
assignedTo: import_zod20.z.string()
|
1924
1979
|
// TODO move into 'content' property
|
1925
1980
|
})
|
1926
1981
|
);
|
1927
1982
|
var UnassignedAction = ActionBase.merge(
|
1928
|
-
|
1929
|
-
type:
|
1983
|
+
import_zod20.z.object({
|
1984
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN)
|
1930
1985
|
})
|
1931
1986
|
);
|
1932
1987
|
var RegisterAction = ActionBase.merge(
|
1933
|
-
|
1934
|
-
type:
|
1935
|
-
registrationNumber:
|
1988
|
+
import_zod20.z.object({
|
1989
|
+
type: import_zod20.z.literal(ActionType.REGISTER),
|
1990
|
+
registrationNumber: import_zod20.z.string().optional()
|
1936
1991
|
// TODO move into 'content' property
|
1937
1992
|
})
|
1938
1993
|
);
|
1939
1994
|
var DeclareAction = ActionBase.merge(
|
1940
|
-
|
1941
|
-
type:
|
1995
|
+
import_zod20.z.object({
|
1996
|
+
type: import_zod20.z.literal(ActionType.DECLARE)
|
1942
1997
|
})
|
1943
1998
|
);
|
1944
1999
|
var ValidateAction = ActionBase.merge(
|
1945
|
-
|
1946
|
-
type:
|
2000
|
+
import_zod20.z.object({
|
2001
|
+
type: import_zod20.z.literal(ActionType.VALIDATE)
|
1947
2002
|
})
|
1948
2003
|
);
|
1949
|
-
var RejectionReason =
|
1950
|
-
message:
|
1951
|
-
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")
|
1952
2007
|
});
|
1953
2008
|
var RejectAction = ActionBase.merge(
|
1954
|
-
|
1955
|
-
type:
|
2009
|
+
import_zod20.z.object({
|
2010
|
+
type: import_zod20.z.literal(ActionType.REJECT),
|
1956
2011
|
reason: RejectionReason
|
1957
2012
|
// TODO move into 'content' property
|
1958
2013
|
})
|
1959
2014
|
);
|
1960
2015
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1961
|
-
|
1962
|
-
type:
|
2016
|
+
import_zod20.z.object({
|
2017
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1963
2018
|
})
|
1964
2019
|
);
|
1965
2020
|
var ArchiveAction = ActionBase.merge(
|
1966
|
-
|
1967
|
-
type:
|
2021
|
+
import_zod20.z.object({
|
2022
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE),
|
1968
2023
|
reason: RejectionReason
|
1969
2024
|
// TODO move into 'content' property
|
1970
2025
|
})
|
1971
2026
|
);
|
1972
2027
|
var CreatedAction = ActionBase.merge(
|
1973
|
-
|
1974
|
-
type:
|
2028
|
+
import_zod20.z.object({
|
2029
|
+
type: import_zod20.z.literal(ActionType.CREATE)
|
1975
2030
|
})
|
1976
2031
|
);
|
1977
2032
|
var NotifiedAction = ActionBase.merge(
|
1978
|
-
|
1979
|
-
type:
|
2033
|
+
import_zod20.z.object({
|
2034
|
+
type: import_zod20.z.literal(ActionType.NOTIFY)
|
1980
2035
|
})
|
1981
2036
|
);
|
1982
|
-
var PrintContent =
|
1983
|
-
templateId:
|
2037
|
+
var PrintContent = import_zod20.z.object({
|
2038
|
+
templateId: import_zod20.z.string().optional()
|
1984
2039
|
});
|
1985
2040
|
var PrintCertificateAction = ActionBase.merge(
|
1986
|
-
|
1987
|
-
type:
|
2041
|
+
import_zod20.z.object({
|
2042
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE),
|
1988
2043
|
content: PrintContent.optional().nullable()
|
1989
2044
|
})
|
1990
2045
|
);
|
1991
2046
|
var RequestedCorrectionAction = ActionBase.merge(
|
1992
|
-
|
1993
|
-
type:
|
2047
|
+
import_zod20.z.object({
|
2048
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION)
|
1994
2049
|
})
|
1995
2050
|
);
|
1996
2051
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1997
|
-
|
1998
|
-
type:
|
1999
|
-
requestId:
|
2052
|
+
import_zod20.z.object({
|
2053
|
+
type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION),
|
2054
|
+
requestId: import_zod20.z.string()
|
2000
2055
|
// TODO move into 'content' property
|
2001
2056
|
})
|
2002
2057
|
);
|
2003
2058
|
var RejectedCorrectionAction = ActionBase.merge(
|
2004
|
-
|
2005
|
-
type:
|
2006
|
-
requestId:
|
2059
|
+
import_zod20.z.object({
|
2060
|
+
type: import_zod20.z.literal(ActionType.REJECT_CORRECTION),
|
2061
|
+
requestId: import_zod20.z.string(),
|
2007
2062
|
// TODO move into 'content' property
|
2008
2063
|
reason: RejectionReason
|
2009
2064
|
})
|
2010
2065
|
);
|
2011
2066
|
var ReadAction = ActionBase.merge(
|
2012
|
-
|
2013
|
-
type:
|
2067
|
+
import_zod20.z.object({
|
2068
|
+
type: import_zod20.z.literal(ActionType.READ)
|
2014
2069
|
})
|
2015
2070
|
);
|
2016
|
-
var ActionDocument =
|
2071
|
+
var ActionDocument = import_zod20.z.discriminatedUnion("type", [
|
2017
2072
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
2018
2073
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
2019
2074
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -2036,31 +2091,31 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
2036
2091
|
declaration: true,
|
2037
2092
|
annotation: true
|
2038
2093
|
}).merge(
|
2039
|
-
|
2040
|
-
type:
|
2041
|
-
status:
|
2094
|
+
import_zod20.z.object({
|
2095
|
+
type: import_zod20.z.enum(ConfirmableActions),
|
2096
|
+
status: import_zod20.z.literal(ActionStatus.Rejected)
|
2042
2097
|
})
|
2043
2098
|
);
|
2044
|
-
var Action =
|
2045
|
-
var ResolvedUser =
|
2046
|
-
id:
|
2047
|
-
role:
|
2048
|
-
name:
|
2049
|
-
|
2050
|
-
use:
|
2051
|
-
given:
|
2052
|
-
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()
|
2053
2108
|
})
|
2054
2109
|
)
|
2055
2110
|
});
|
2056
2111
|
|
2057
2112
|
// ../commons/src/conditionals/validate.ts
|
2058
|
-
var
|
2113
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
2059
2114
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
2060
2115
|
var import_date_fns = require("date-fns");
|
2061
2116
|
|
2062
2117
|
// ../commons/src/events/FieldTypeMapping.ts
|
2063
|
-
var
|
2118
|
+
var import_zod21 = require("zod");
|
2064
2119
|
function mapFieldTypeToZod(type, required) {
|
2065
2120
|
let schema;
|
2066
2121
|
switch (type) {
|
@@ -2126,7 +2181,7 @@ function createValidationSchema(config) {
|
|
2126
2181
|
for (const field2 of config) {
|
2127
2182
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2128
2183
|
}
|
2129
|
-
return
|
2184
|
+
return import_zod21.z.object(shape);
|
2130
2185
|
}
|
2131
2186
|
function mapFieldTypeToEmptyValue(field2) {
|
2132
2187
|
switch (field2.type) {
|
@@ -2269,9 +2324,11 @@ var isNonInteractiveFieldType = (field2) => {
|
|
2269
2324
|
};
|
2270
2325
|
|
2271
2326
|
// ../commons/src/conditionals/validate.ts
|
2272
|
-
var ajv = new
|
2327
|
+
var ajv = new import__.default({
|
2273
2328
|
$data: true,
|
2274
|
-
allowUnionTypes: true
|
2329
|
+
allowUnionTypes: true,
|
2330
|
+
strict: false
|
2331
|
+
// Allow minContains and other newer features
|
2275
2332
|
});
|
2276
2333
|
(0, import_ajv_formats.default)(ajv);
|
2277
2334
|
ajv.addKeyword({
|
@@ -2444,6 +2501,23 @@ function validateFieldInput({
|
|
2444
2501
|
const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
|
2445
2502
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
2446
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
|
+
}
|
2447
2521
|
function runFieldValidations({
|
2448
2522
|
field: field2,
|
2449
2523
|
values
|
@@ -2509,6 +2583,11 @@ function getValidatorsForField(fieldId, validations) {
|
|
2509
2583
|
};
|
2510
2584
|
}).filter((x) => x !== null);
|
2511
2585
|
}
|
2586
|
+
function areCertificateConditionsMet(conditions, values) {
|
2587
|
+
return conditions.every((condition) => {
|
2588
|
+
return ajv.validate(condition.conditional, values);
|
2589
|
+
});
|
2590
|
+
}
|
2512
2591
|
|
2513
2592
|
// ../commons/src/utils.ts
|
2514
2593
|
function getOrThrow(x, message) {
|
@@ -2610,10 +2689,16 @@ function omitHiddenPaginatedFields(formConfig, declaration) {
|
|
2610
2689
|
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
2611
2690
|
return omitHiddenFields(visiblePagesFormFields, declaration);
|
2612
2691
|
}
|
2613
|
-
function
|
2614
|
-
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
|
+
);
|
2615
2698
|
const lastAction = actions[actions.length - 1];
|
2616
|
-
|
2699
|
+
const isDraftActive = draft.createdAt >= lastAction.createdAt;
|
2700
|
+
const isDraftForEvent = event2.id === draft.eventId;
|
2701
|
+
return isDraftActive && isDraftForEvent ? draft : void 0;
|
2617
2702
|
}
|
2618
2703
|
function createEmptyDraft(eventId, draftId, actionType) {
|
2619
2704
|
return {
|
@@ -2746,12 +2831,35 @@ function timePeriodToDateRange(value) {
|
|
2746
2831
|
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2747
2832
|
};
|
2748
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
|
+
}
|
2749
2857
|
|
2750
2858
|
// ../commons/src/events/EventConfig.ts
|
2751
2859
|
var import_zod_openapi9 = require("zod-openapi");
|
2752
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
2753
|
-
var EventConfig =
|
2754
|
-
id:
|
2860
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2861
|
+
var EventConfig = import_zod22.z.object({
|
2862
|
+
id: import_zod22.z.string().describe(
|
2755
2863
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2756
2864
|
),
|
2757
2865
|
dateOfEvent: FieldReference.optional(),
|
@@ -2761,10 +2869,10 @@ var EventConfig = import_zod21.z.object({
|
|
2761
2869
|
),
|
2762
2870
|
summary: SummaryConfig,
|
2763
2871
|
label: TranslationConfig,
|
2764
|
-
actions:
|
2872
|
+
actions: import_zod22.z.array(ActionConfig),
|
2765
2873
|
declaration: DeclarationFormConfig,
|
2766
|
-
deduplication:
|
2767
|
-
advancedSearch:
|
2874
|
+
deduplication: import_zod22.z.array(DeduplicationConfig).optional().default([]),
|
2875
|
+
advancedSearch: import_zod22.z.array(AdvancedSearchConfig).optional().default([])
|
2768
2876
|
}).superRefine((event2, ctx) => {
|
2769
2877
|
const allFields = findAllFields(event2);
|
2770
2878
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2848,12 +2956,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2848
2956
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2849
2957
|
|
2850
2958
|
// ../commons/src/events/WorkqueueConfig.ts
|
2851
|
-
var
|
2959
|
+
var import_zod29 = require("zod");
|
2852
2960
|
|
2853
2961
|
// ../commons/src/events/serializers/user/serializer.ts
|
2854
|
-
var
|
2855
|
-
var SerializedUserField =
|
2856
|
-
$userField:
|
2962
|
+
var import_zod23 = require("zod");
|
2963
|
+
var SerializedUserField = import_zod23.z.object({
|
2964
|
+
$userField: import_zod23.z.enum([
|
2857
2965
|
"id",
|
2858
2966
|
"name",
|
2859
2967
|
"role",
|
@@ -3105,6 +3213,7 @@ function createFieldConditionals(fieldId) {
|
|
3105
3213
|
properties: {
|
3106
3214
|
[fieldId]: {
|
3107
3215
|
type: "string",
|
3216
|
+
minLength: 1,
|
3108
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'.-]*)*$",
|
3109
3218
|
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
3110
3219
|
}
|
@@ -3232,32 +3341,107 @@ function eventFn(fieldId) {
|
|
3232
3341
|
var event = Object.assign(eventFn, {
|
3233
3342
|
/**
|
3234
3343
|
* Checks if the event contains a specific action type.
|
3344
|
+
* Can be used directly as a conditional or chained with additional methods.
|
3235
3345
|
* @param action - The action type to check for.
|
3236
3346
|
*/
|
3237
|
-
hasAction: (action) =>
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
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({
|
3241
3388
|
type: "object",
|
3242
3389
|
properties: {
|
3243
|
-
|
3244
|
-
type: "
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
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"]
|
3254
3404
|
}
|
3255
3405
|
},
|
3256
|
-
required: ["
|
3257
|
-
}
|
3258
|
-
}
|
3259
|
-
|
3260
|
-
|
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
|
+
},
|
3261
3445
|
field(field2) {
|
3262
3446
|
return {
|
3263
3447
|
$event: field2
|
@@ -3266,11 +3450,11 @@ var event = Object.assign(eventFn, {
|
|
3266
3450
|
});
|
3267
3451
|
|
3268
3452
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3269
|
-
var
|
3453
|
+
var import_zod25 = require("zod");
|
3270
3454
|
|
3271
3455
|
// ../commons/src/events/EventMetadata.ts
|
3272
|
-
var
|
3273
|
-
var EventStatus =
|
3456
|
+
var import_zod24 = require("zod");
|
3457
|
+
var EventStatus = import_zod24.z.enum([
|
3274
3458
|
"CREATED",
|
3275
3459
|
"NOTIFIED",
|
3276
3460
|
"DECLARED",
|
@@ -3284,7 +3468,7 @@ var InherentFlags = {
|
|
3284
3468
|
REJECTED: "rejected",
|
3285
3469
|
CORRECTION_REQUESTED: "correction-requested"
|
3286
3470
|
};
|
3287
|
-
var ActionFlag =
|
3471
|
+
var ActionFlag = import_zod24.z.string().regex(
|
3288
3472
|
new RegExp(
|
3289
3473
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3290
3474
|
ActionStatus
|
@@ -3292,56 +3476,56 @@ var ActionFlag = import_zod23.z.string().regex(
|
|
3292
3476
|
),
|
3293
3477
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3294
3478
|
);
|
3295
|
-
var Flag = ActionFlag.or(
|
3296
|
-
var ZodDate =
|
3297
|
-
var ActionCreationMetadata =
|
3298
|
-
createdAt:
|
3299
|
-
createdBy:
|
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."),
|
3300
3484
|
createdAtLocation: CreatedAtLocation.describe(
|
3301
3485
|
"Location of the user who created the action request."
|
3302
3486
|
),
|
3303
|
-
createdByUserType:
|
3304
|
-
acceptedAt:
|
3305
|
-
createdByRole:
|
3306
|
-
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.")
|
3307
3491
|
});
|
3308
3492
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3309
|
-
registrationNumber:
|
3493
|
+
registrationNumber: import_zod24.z.string().describe(
|
3310
3494
|
"Registration number of the event. Always present for accepted registrations."
|
3311
3495
|
)
|
3312
3496
|
});
|
3313
|
-
var LegalStatuses =
|
3497
|
+
var LegalStatuses = import_zod24.z.object({
|
3314
3498
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3315
3499
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3316
3500
|
});
|
3317
|
-
var EventMetadata =
|
3501
|
+
var EventMetadata = import_zod24.z.object({
|
3318
3502
|
id: UUID,
|
3319
|
-
type:
|
3503
|
+
type: import_zod24.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3320
3504
|
status: EventStatus,
|
3321
3505
|
legalStatuses: LegalStatuses.describe(
|
3322
3506
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3323
3507
|
),
|
3324
|
-
createdAt:
|
3508
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3325
3509
|
dateOfEvent: ZodDate.nullish(),
|
3326
|
-
createdBy:
|
3327
|
-
createdByUserType:
|
3328
|
-
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."),
|
3329
3513
|
createdAtLocation: CreatedAtLocation.describe(
|
3330
3514
|
"Location of the user who created the event."
|
3331
3515
|
),
|
3332
|
-
createdBySignature:
|
3516
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the event."),
|
3333
3517
|
updatedAtLocation: UUID.nullish().describe(
|
3334
3518
|
"Location of the user who last changed the status."
|
3335
3519
|
),
|
3336
|
-
updatedAt:
|
3520
|
+
updatedAt: import_zod24.z.string().datetime().describe(
|
3337
3521
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3338
3522
|
),
|
3339
|
-
assignedTo:
|
3340
|
-
updatedBy:
|
3341
|
-
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(
|
3342
3526
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3343
3527
|
),
|
3344
|
-
flags:
|
3528
|
+
flags: import_zod24.z.array(Flag)
|
3345
3529
|
});
|
3346
3530
|
var EventMetadataKeysArray = [
|
3347
3531
|
"id",
|
@@ -3361,7 +3545,7 @@ var EventMetadataKeysArray = [
|
|
3361
3545
|
"legalStatuses",
|
3362
3546
|
"flags"
|
3363
3547
|
];
|
3364
|
-
var EventMetadataKeys =
|
3548
|
+
var EventMetadataKeys = import_zod24.z.enum(EventMetadataKeysArray);
|
3365
3549
|
var eventMetadataLabelMap = {
|
3366
3550
|
"event.assignedTo": {
|
3367
3551
|
id: "event.assignedTo.label",
|
@@ -3446,11 +3630,11 @@ var WorkqueueColumnKeysArray = [
|
|
3446
3630
|
"title",
|
3447
3631
|
"outbox"
|
3448
3632
|
];
|
3449
|
-
var WorkqueueColumnKeys =
|
3450
|
-
var WorkqueueColumnValue =
|
3633
|
+
var WorkqueueColumnKeys = import_zod25.z.enum(WorkqueueColumnKeysArray);
|
3634
|
+
var WorkqueueColumnValue = import_zod25.z.object({
|
3451
3635
|
$event: WorkqueueColumnKeys
|
3452
3636
|
});
|
3453
|
-
var WorkqueueColumn =
|
3637
|
+
var WorkqueueColumn = import_zod25.z.object({
|
3454
3638
|
label: TranslationConfig,
|
3455
3639
|
value: WorkqueueColumnValue
|
3456
3640
|
});
|
@@ -3461,120 +3645,120 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3461
3645
|
}
|
3462
3646
|
|
3463
3647
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3464
|
-
var
|
3648
|
+
var import_zod27 = require("zod");
|
3465
3649
|
|
3466
3650
|
// ../commons/src/events/EventIndex.ts
|
3467
|
-
var
|
3651
|
+
var import_zod26 = require("zod");
|
3468
3652
|
var import_zod_openapi10 = require("zod-openapi");
|
3469
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3653
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3470
3654
|
var EventIndex = EventMetadata.extend({
|
3471
3655
|
declaration: EventState
|
3472
3656
|
}).openapi({
|
3473
3657
|
ref: "EventIndex"
|
3474
3658
|
});
|
3475
|
-
var EventSearchIndex =
|
3476
|
-
|
3477
|
-
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()
|
3478
3662
|
// Ensures "type" (event-id) exists and is a string
|
3479
3663
|
})
|
3480
3664
|
).openapi({
|
3481
3665
|
ref: "EventSearchIndex"
|
3482
3666
|
});
|
3483
|
-
var Fuzzy =
|
3667
|
+
var Fuzzy = import_zod26.z.object({ type: import_zod26.z.literal("fuzzy"), term: import_zod26.z.string() }).openapi({
|
3484
3668
|
ref: "Fuzzy"
|
3485
3669
|
});
|
3486
|
-
var Exact =
|
3670
|
+
var Exact = import_zod26.z.object({ type: import_zod26.z.literal("exact"), term: import_zod26.z.string() }).openapi({
|
3487
3671
|
ref: "Exact"
|
3488
3672
|
});
|
3489
|
-
var ExactStatus =
|
3490
|
-
type:
|
3673
|
+
var ExactStatus = import_zod26.z.object({
|
3674
|
+
type: import_zod26.z.literal("exact"),
|
3491
3675
|
term: EventStatus
|
3492
3676
|
}).openapi({
|
3493
3677
|
ref: "ExactStatus"
|
3494
3678
|
});
|
3495
|
-
var ExactUserType =
|
3496
|
-
type:
|
3679
|
+
var ExactUserType = import_zod26.z.object({
|
3680
|
+
type: import_zod26.z.literal("exact"),
|
3497
3681
|
term: TokenUserType
|
3498
3682
|
}).openapi({
|
3499
3683
|
ref: "ExactUserType"
|
3500
3684
|
});
|
3501
|
-
var AnyOf =
|
3502
|
-
type:
|
3503
|
-
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())
|
3504
3688
|
}).openapi({
|
3505
3689
|
ref: "AnyOf"
|
3506
3690
|
});
|
3507
|
-
var AnyOfStatus =
|
3508
|
-
type:
|
3509
|
-
terms:
|
3691
|
+
var AnyOfStatus = import_zod26.z.object({
|
3692
|
+
type: import_zod26.z.literal("anyOf"),
|
3693
|
+
terms: import_zod26.z.array(EventStatus)
|
3510
3694
|
}).openapi({
|
3511
3695
|
ref: "AnyOfStatus"
|
3512
3696
|
});
|
3513
|
-
var Range =
|
3514
|
-
type:
|
3515
|
-
gte:
|
3516
|
-
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()
|
3517
3701
|
}).openapi({
|
3518
3702
|
ref: "Range"
|
3519
3703
|
});
|
3520
|
-
var ContainsFlags =
|
3521
|
-
anyOf:
|
3522
|
-
noneOf:
|
3704
|
+
var ContainsFlags = import_zod26.z.object({
|
3705
|
+
anyOf: import_zod26.z.array(Flag).optional(),
|
3706
|
+
noneOf: import_zod26.z.array(Flag).optional()
|
3523
3707
|
}).openapi({
|
3524
3708
|
ref: "ContainsFlags"
|
3525
3709
|
});
|
3526
|
-
var Within =
|
3710
|
+
var Within = import_zod26.z.object({ type: import_zod26.z.literal("within"), location: import_zod26.z.string() }).openapi({
|
3527
3711
|
ref: "Within"
|
3528
3712
|
});
|
3529
|
-
var RangeDate =
|
3530
|
-
type:
|
3531
|
-
gte:
|
3532
|
-
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())
|
3533
3717
|
}).openapi({ ref: "RangeDate" });
|
3534
3718
|
var ExactDate = Exact.extend({
|
3535
|
-
term:
|
3719
|
+
term: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3536
3720
|
}).openapi({
|
3537
3721
|
ref: "ExactDate"
|
3538
3722
|
});
|
3539
|
-
var TimePeriod =
|
3540
|
-
type:
|
3723
|
+
var TimePeriod = import_zod26.z.object({
|
3724
|
+
type: import_zod26.z.literal("timePeriod"),
|
3541
3725
|
term: SelectDateRangeValue
|
3542
3726
|
}).openapi({
|
3543
3727
|
ref: "TimePeriod"
|
3544
3728
|
});
|
3545
|
-
var DateCondition =
|
3729
|
+
var DateCondition = import_zod26.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3546
3730
|
ref: "DateCondition"
|
3547
3731
|
});
|
3548
|
-
var QueryInput =
|
3549
|
-
() =>
|
3550
|
-
|
3551
|
-
|
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)
|
3552
3736
|
])
|
3553
3737
|
).openapi({
|
3554
3738
|
ref: "QueryInput"
|
3555
3739
|
});
|
3556
|
-
var QueryExpression =
|
3557
|
-
id:
|
3558
|
-
eventType:
|
3559
|
-
status:
|
3560
|
-
createdAt:
|
3561
|
-
updatedAt:
|
3562
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
3563
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
3564
|
-
|
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])
|
3565
3749
|
),
|
3566
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3567
|
-
|
3750
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3751
|
+
import_zod26.z.union([Within, Exact])
|
3568
3752
|
),
|
3569
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3570
|
-
createdAtLocation:
|
3571
|
-
updatedAtLocation:
|
3572
|
-
assignedTo:
|
3573
|
-
createdByUserType:
|
3574
|
-
createdBy:
|
3575
|
-
updatedBy:
|
3576
|
-
trackingId:
|
3577
|
-
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),
|
3578
3762
|
// @todo: The type for this comes out as "any"
|
3579
3763
|
data: QueryInput
|
3580
3764
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
@@ -3582,9 +3766,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3582
3766
|
}).openapi({
|
3583
3767
|
ref: "QueryExpression"
|
3584
3768
|
});
|
3585
|
-
var QueryType =
|
3586
|
-
type:
|
3587
|
-
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(
|
3588
3772
|
(val) => {
|
3589
3773
|
if (typeof val === "string") {
|
3590
3774
|
return [JSON.parse(val)];
|
@@ -3594,7 +3778,7 @@ var QueryType = import_zod25.z.object({
|
|
3594
3778
|
}
|
3595
3779
|
return val;
|
3596
3780
|
},
|
3597
|
-
|
3781
|
+
import_zod26.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3598
3782
|
default: [
|
3599
3783
|
{
|
3600
3784
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3621,56 +3805,56 @@ var SearchScopeAccessLevels = {
|
|
3621
3805
|
};
|
3622
3806
|
|
3623
3807
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3624
|
-
var SerializableExact =
|
3625
|
-
type:
|
3626
|
-
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])
|
3627
3811
|
});
|
3628
|
-
var SerializableWithin =
|
3629
|
-
type:
|
3630
|
-
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])
|
3631
3815
|
});
|
3632
|
-
var SerializedQueryExpression =
|
3633
|
-
eventType:
|
3634
|
-
status:
|
3635
|
-
createdAt:
|
3636
|
-
updatedAt:
|
3637
|
-
"legalStatuses.REGISTERED.createdAt":
|
3638
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3639
|
-
|
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])
|
3640
3824
|
),
|
3641
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3642
|
-
createdAtLocation:
|
3643
|
-
|
3825
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod27.z.optional(Exact),
|
3826
|
+
createdAtLocation: import_zod27.z.optional(
|
3827
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3644
3828
|
),
|
3645
|
-
updatedAtLocation:
|
3646
|
-
|
3829
|
+
updatedAtLocation: import_zod27.z.optional(
|
3830
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3647
3831
|
),
|
3648
|
-
assignedTo:
|
3649
|
-
createdBy:
|
3832
|
+
assignedTo: import_zod27.z.optional(SerializableExact),
|
3833
|
+
createdBy: import_zod27.z.optional(SerializableExact),
|
3650
3834
|
createdByUserType: ExactUserType,
|
3651
|
-
updatedBy:
|
3652
|
-
trackingId:
|
3653
|
-
flags:
|
3835
|
+
updatedBy: import_zod27.z.optional(SerializableExact),
|
3836
|
+
trackingId: import_zod27.z.optional(Exact),
|
3837
|
+
flags: import_zod27.z.optional(ContainsFlags),
|
3654
3838
|
data: QueryInput
|
3655
3839
|
}).partial();
|
3656
|
-
var Or2 =
|
3657
|
-
type:
|
3658
|
-
clauses:
|
3840
|
+
var Or2 = import_zod27.z.object({
|
3841
|
+
type: import_zod27.z.literal("or"),
|
3842
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3659
3843
|
});
|
3660
|
-
var And2 =
|
3661
|
-
type:
|
3662
|
-
clauses:
|
3844
|
+
var And2 = import_zod27.z.object({
|
3845
|
+
type: import_zod27.z.literal("and"),
|
3846
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3663
3847
|
});
|
3664
|
-
var CountryConfigQueryType =
|
3665
|
-
var CountryConfigQueryInputType =
|
3848
|
+
var CountryConfigQueryType = import_zod27.z.discriminatedUnion("type", [And2, Or2]);
|
3849
|
+
var CountryConfigQueryInputType = import_zod27.z.union([
|
3666
3850
|
SerializedQueryExpression,
|
3667
3851
|
And2,
|
3668
3852
|
Or2
|
3669
3853
|
]);
|
3670
3854
|
|
3671
3855
|
// ../commons/src/icons.ts
|
3672
|
-
var
|
3673
|
-
var AvailableIcons =
|
3856
|
+
var import_zod28 = require("zod");
|
3857
|
+
var AvailableIcons = import_zod28.z.enum([
|
3674
3858
|
"Archived",
|
3675
3859
|
"Assigned",
|
3676
3860
|
"Certified",
|
@@ -3791,23 +3975,23 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3791
3975
|
value: event.field("updatedAt")
|
3792
3976
|
}
|
3793
3977
|
]);
|
3794
|
-
var WorkqueueActionsWithDefault =
|
3978
|
+
var WorkqueueActionsWithDefault = import_zod29.z.enum([
|
3795
3979
|
...workqueueActions.options,
|
3796
3980
|
"DEFAULT"
|
3797
3981
|
]);
|
3798
|
-
var WorkqueueConfig =
|
3799
|
-
slug:
|
3982
|
+
var WorkqueueConfig = import_zod29.z.object({
|
3983
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3800
3984
|
name: TranslationConfig.describe(
|
3801
3985
|
"Title of the workflow (both in navigation and on the page)"
|
3802
3986
|
),
|
3803
3987
|
query: CountryConfigQueryType,
|
3804
|
-
actions:
|
3805
|
-
|
3988
|
+
actions: import_zod29.z.array(
|
3989
|
+
import_zod29.z.object({
|
3806
3990
|
type: WorkqueueActionsWithDefault,
|
3807
|
-
conditionals:
|
3991
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3808
3992
|
})
|
3809
3993
|
),
|
3810
|
-
columns:
|
3994
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3811
3995
|
icon: AvailableIcons,
|
3812
3996
|
emptyMessage: TranslationConfig.optional()
|
3813
3997
|
}).describe("Configuration for workqueue.");
|
@@ -3815,19 +3999,19 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
3815
3999
|
query: true,
|
3816
4000
|
columns: true
|
3817
4001
|
});
|
3818
|
-
var WorkqueueConfigInput =
|
3819
|
-
slug:
|
4002
|
+
var WorkqueueConfigInput = import_zod29.z.object({
|
4003
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3820
4004
|
name: TranslationConfig.describe(
|
3821
4005
|
"Title of the workflow (both in navigation and on the page)"
|
3822
4006
|
),
|
3823
4007
|
query: CountryConfigQueryInputType,
|
3824
|
-
actions:
|
3825
|
-
|
4008
|
+
actions: import_zod29.z.array(
|
4009
|
+
import_zod29.z.object({
|
3826
4010
|
type: WorkqueueActionsWithDefault,
|
3827
|
-
conditionals:
|
4011
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3828
4012
|
})
|
3829
4013
|
),
|
3830
|
-
columns:
|
4014
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3831
4015
|
icon: AvailableIcons,
|
3832
4016
|
emptyMessage: TranslationConfig.optional()
|
3833
4017
|
});
|
@@ -3839,10 +4023,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3839
4023
|
function defineWorkqueues(workqueues) {
|
3840
4024
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3841
4025
|
}
|
3842
|
-
var WorkqueueCountInput =
|
3843
|
-
|
4026
|
+
var WorkqueueCountInput = import_zod29.z.array(
|
4027
|
+
import_zod29.z.object({ slug: import_zod29.z.string(), query: QueryType })
|
3844
4028
|
);
|
3845
|
-
var WorkqueueCountOutput =
|
4029
|
+
var WorkqueueCountOutput = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.number());
|
3846
4030
|
|
3847
4031
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3848
4032
|
var defaultWorkqueueColumns = [
|
@@ -3865,42 +4049,42 @@ var defaultWorkqueueColumns = [
|
|
3865
4049
|
];
|
3866
4050
|
|
3867
4051
|
// ../commons/src/events/Draft.ts
|
3868
|
-
var
|
4052
|
+
var import_zod31 = require("zod");
|
3869
4053
|
|
3870
4054
|
// ../commons/src/events/ActionInput.ts
|
3871
|
-
var
|
4055
|
+
var import_zod30 = require("zod");
|
3872
4056
|
var import_zod_openapi11 = require("zod-openapi");
|
3873
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
3874
|
-
var BaseActionInput =
|
4057
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod30.z);
|
4058
|
+
var BaseActionInput = import_zod30.z.object({
|
3875
4059
|
eventId: UUID,
|
3876
|
-
transactionId:
|
4060
|
+
transactionId: import_zod30.z.string(),
|
3877
4061
|
declaration: ActionUpdate.default({}),
|
3878
4062
|
annotation: ActionUpdate.optional(),
|
3879
4063
|
originalActionId: UUID.optional(),
|
3880
4064
|
// should not be part of base action.
|
3881
|
-
keepAssignment:
|
4065
|
+
keepAssignment: import_zod30.z.boolean().optional()
|
3882
4066
|
});
|
3883
4067
|
var CreateActionInput = BaseActionInput.merge(
|
3884
|
-
|
3885
|
-
type:
|
4068
|
+
import_zod30.z.object({
|
4069
|
+
type: import_zod30.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3886
4070
|
createdAtLocation: CreatedAtLocation
|
3887
4071
|
})
|
3888
4072
|
);
|
3889
4073
|
var RegisterActionInput = BaseActionInput.merge(
|
3890
|
-
|
3891
|
-
type:
|
3892
|
-
registrationNumber:
|
4074
|
+
import_zod30.z.object({
|
4075
|
+
type: import_zod30.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
4076
|
+
registrationNumber: import_zod30.z.string().optional()
|
3893
4077
|
})
|
3894
4078
|
).strict();
|
3895
4079
|
var ValidateActionInput = BaseActionInput.merge(
|
3896
|
-
|
3897
|
-
type:
|
3898
|
-
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())
|
3899
4083
|
})
|
3900
4084
|
);
|
3901
4085
|
var NotifyActionInput = BaseActionInput.merge(
|
3902
|
-
|
3903
|
-
type:
|
4086
|
+
import_zod30.z.object({
|
4087
|
+
type: import_zod30.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3904
4088
|
})
|
3905
4089
|
).openapi({
|
3906
4090
|
default: {
|
@@ -3912,70 +4096,70 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3912
4096
|
}
|
3913
4097
|
});
|
3914
4098
|
var DeclareActionInput = BaseActionInput.merge(
|
3915
|
-
|
3916
|
-
type:
|
4099
|
+
import_zod30.z.object({
|
4100
|
+
type: import_zod30.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3917
4101
|
})
|
3918
4102
|
);
|
3919
4103
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3920
|
-
|
3921
|
-
type:
|
4104
|
+
import_zod30.z.object({
|
4105
|
+
type: import_zod30.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
3922
4106
|
content: PrintContent.optional()
|
3923
4107
|
})
|
3924
4108
|
);
|
3925
4109
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3926
|
-
|
3927
|
-
type:
|
4110
|
+
import_zod30.z.object({
|
4111
|
+
type: import_zod30.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3928
4112
|
reason: RejectionReason
|
3929
4113
|
})
|
3930
4114
|
);
|
3931
4115
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3932
|
-
|
3933
|
-
type:
|
4116
|
+
import_zod30.z.object({
|
4117
|
+
type: import_zod30.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3934
4118
|
})
|
3935
4119
|
);
|
3936
4120
|
var ArchiveActionInput = BaseActionInput.merge(
|
3937
|
-
|
3938
|
-
type:
|
4121
|
+
import_zod30.z.object({
|
4122
|
+
type: import_zod30.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3939
4123
|
reason: RejectionReason
|
3940
4124
|
})
|
3941
4125
|
);
|
3942
4126
|
var AssignActionInput = BaseActionInput.merge(
|
3943
|
-
|
3944
|
-
type:
|
3945
|
-
assignedTo:
|
4127
|
+
import_zod30.z.object({
|
4128
|
+
type: import_zod30.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
4129
|
+
assignedTo: import_zod30.z.string()
|
3946
4130
|
})
|
3947
4131
|
);
|
3948
4132
|
var UnassignActionInput = BaseActionInput.merge(
|
3949
|
-
|
3950
|
-
type:
|
3951
|
-
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)
|
3952
4136
|
})
|
3953
4137
|
);
|
3954
4138
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3955
|
-
|
3956
|
-
type:
|
4139
|
+
import_zod30.z.object({
|
4140
|
+
type: import_zod30.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3957
4141
|
})
|
3958
4142
|
);
|
3959
4143
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3960
|
-
|
3961
|
-
requestId:
|
3962
|
-
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),
|
3963
4147
|
reason: RejectionReason
|
3964
4148
|
})
|
3965
4149
|
);
|
3966
4150
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3967
|
-
|
3968
|
-
requestId:
|
3969
|
-
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)
|
3970
4154
|
})
|
3971
4155
|
);
|
3972
4156
|
var ReadActionInput = BaseActionInput.merge(
|
3973
|
-
|
3974
|
-
type:
|
4157
|
+
import_zod30.z.object({
|
4158
|
+
type: import_zod30.z.literal(ActionType.READ).default(ActionType.READ)
|
3975
4159
|
})
|
3976
4160
|
);
|
3977
|
-
var DeleteActionInput =
|
3978
|
-
var ActionInput =
|
4161
|
+
var DeleteActionInput = import_zod30.z.object({ eventId: UUID });
|
4162
|
+
var ActionInput = import_zod30.z.discriminatedUnion("type", [
|
3979
4163
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3980
4164
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3981
4165
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -4004,18 +4188,18 @@ var ActionInput = import_zod29.z.discriminatedUnion("type", [
|
|
4004
4188
|
});
|
4005
4189
|
|
4006
4190
|
// ../commons/src/events/Draft.ts
|
4007
|
-
var Draft =
|
4191
|
+
var Draft = import_zod31.z.object({
|
4008
4192
|
id: UUID,
|
4009
4193
|
eventId: UUID,
|
4010
|
-
transactionId:
|
4011
|
-
createdAt:
|
4194
|
+
transactionId: import_zod31.z.string(),
|
4195
|
+
createdAt: import_zod31.z.string().datetime(),
|
4012
4196
|
action: ActionBase.extend({
|
4013
|
-
type: ActionTypes
|
4197
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
|
4014
4198
|
}).omit({ id: true })
|
4015
4199
|
});
|
4016
4200
|
var DraftInput = BaseActionInput.extend({
|
4017
|
-
type: ActionTypes,
|
4018
|
-
status:
|
4201
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
|
4202
|
+
status: import_zod31.z.enum([
|
4019
4203
|
ActionStatus.Requested,
|
4020
4204
|
ActionStatus.Accepted,
|
4021
4205
|
ActionStatus.Rejected
|
@@ -4023,26 +4207,29 @@ var DraftInput = BaseActionInput.extend({
|
|
4023
4207
|
});
|
4024
4208
|
|
4025
4209
|
// ../commons/src/events/EventInput.ts
|
4026
|
-
var
|
4210
|
+
var import_zod32 = require("zod");
|
4027
4211
|
var import_uuid8 = require("uuid");
|
4028
|
-
var EventInput =
|
4029
|
-
transactionId:
|
4030
|
-
type:
|
4212
|
+
var EventInput = import_zod32.z.object({
|
4213
|
+
transactionId: import_zod32.z.string(),
|
4214
|
+
type: import_zod32.z.string()
|
4031
4215
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
4032
4216
|
|
4033
4217
|
// ../commons/src/events/EventDocument.ts
|
4034
|
-
var
|
4218
|
+
var import_zod33 = require("zod");
|
4035
4219
|
var import_zod_openapi12 = require("zod-openapi");
|
4036
|
-
(0, import_zod_openapi12.extendZodWithOpenApi)(
|
4037
|
-
var EventDocument =
|
4220
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod33.z);
|
4221
|
+
var EventDocument = import_zod33.z.object({
|
4038
4222
|
id: UUID,
|
4039
|
-
type:
|
4040
|
-
createdAt:
|
4041
|
-
updatedAt:
|
4042
|
-
actions:
|
4043
|
-
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()
|
4044
4228
|
}).openapi({ ref: "EventDocument" });
|
4045
4229
|
|
4230
|
+
// ../commons/src/events/state/index.ts
|
4231
|
+
var import_lodash3 = require("lodash");
|
4232
|
+
|
4046
4233
|
// ../commons/src/events/state/utils.ts
|
4047
4234
|
var import_lodash2 = require("lodash");
|
4048
4235
|
function getActionRequests(actionType, actions) {
|
@@ -4332,30 +4519,36 @@ function getCurrentEventState(event2, config) {
|
|
4332
4519
|
flags: getFlagsFromActions(event2.actions)
|
4333
4520
|
});
|
4334
4521
|
}
|
4335
|
-
function
|
4522
|
+
function dangerouslyGetCurrentEventStateWithDrafts({
|
4336
4523
|
event: event2,
|
4337
|
-
|
4524
|
+
draft,
|
4338
4525
|
configuration
|
4339
4526
|
}) {
|
4340
4527
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
4341
|
-
const
|
4342
|
-
|
4343
|
-
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4351
|
-
|
4352
|
-
|
4353
|
-
|
4354
|
-
|
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 = {
|
4355
4548
|
...event2,
|
4356
|
-
actions:
|
4549
|
+
actions: actionsWithDraft
|
4357
4550
|
};
|
4358
|
-
return getCurrentEventState(
|
4551
|
+
return getCurrentEventState(eventWithDraft, configuration);
|
4359
4552
|
}
|
4360
4553
|
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4361
4554
|
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
@@ -4369,18 +4562,18 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
4369
4562
|
declaration: updatedDeclaration
|
4370
4563
|
};
|
4371
4564
|
}
|
4372
|
-
function
|
4565
|
+
function applyDraftToEventIndex(eventIndex, draft, eventConfiguration) {
|
4373
4566
|
const indexedAt = eventIndex.updatedAt;
|
4374
|
-
const
|
4375
|
-
if (
|
4567
|
+
const activeDraft = draft && draft.createdAt >= indexedAt ? draft : void 0;
|
4568
|
+
if (!activeDraft) {
|
4376
4569
|
return eventIndex;
|
4377
4570
|
}
|
4378
4571
|
return applyDeclarationToEventIndex(
|
4379
4572
|
{
|
4380
4573
|
...eventIndex,
|
4381
|
-
updatedAt:
|
4574
|
+
updatedAt: activeDraft.createdAt
|
4382
4575
|
},
|
4383
|
-
|
4576
|
+
activeDraft.action.declaration,
|
4384
4577
|
eventConfiguration
|
4385
4578
|
);
|
4386
4579
|
}
|
@@ -4394,18 +4587,17 @@ function getAnnotationFromDrafts(drafts) {
|
|
4394
4587
|
function getActionAnnotation({
|
4395
4588
|
event: event2,
|
4396
4589
|
actionType,
|
4397
|
-
|
4590
|
+
draft
|
4398
4591
|
}) {
|
4399
4592
|
const activeActions = getAcceptedActions(event2);
|
4400
|
-
const action = activeActions.
|
4401
|
-
|
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"
|
4402
4599
|
);
|
4403
|
-
const
|
4404
|
-
const sorted = [
|
4405
|
-
...action ? [action] : [],
|
4406
|
-
...eventDrafts.map((draft) => draft.action)
|
4407
|
-
].sort();
|
4408
|
-
const annotation = sorted.reduce((ann, sortedAction) => {
|
4600
|
+
const annotation = sortedActions.reduce((ann, sortedAction) => {
|
4409
4601
|
return deepMerge(ann, sortedAction.annotation ?? {});
|
4410
4602
|
}, {});
|
4411
4603
|
return deepDropNulls(annotation);
|
@@ -4423,23 +4615,23 @@ function generateTransactionId() {
|
|
4423
4615
|
}
|
4424
4616
|
|
4425
4617
|
// ../commons/src/events/User.ts
|
4426
|
-
var
|
4427
|
-
var User =
|
4428
|
-
id:
|
4429
|
-
name:
|
4430
|
-
|
4431
|
-
use:
|
4432
|
-
given:
|
4433
|
-
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()
|
4434
4626
|
})
|
4435
4627
|
),
|
4436
|
-
role:
|
4628
|
+
role: import_zod34.z.string(),
|
4437
4629
|
avatar: FullDocumentPath.optional(),
|
4438
4630
|
signature: FullDocumentPath.optional()
|
4439
4631
|
});
|
4440
4632
|
|
4441
4633
|
// ../commons/src/events/test.utils.ts
|
4442
|
-
var
|
4634
|
+
var import_lodash4 = require("lodash");
|
4443
4635
|
var import_date_fns4 = require("date-fns");
|
4444
4636
|
|
4445
4637
|
// ../commons/src/field-config/field-configuration.ts
|
@@ -5174,7 +5366,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5174
5366
|
defaultMessage: "Applicant's name",
|
5175
5367
|
description: "This is the label for the field",
|
5176
5368
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
5177
|
-
}
|
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
|
+
]
|
5178
5390
|
},
|
5179
5391
|
{
|
5180
5392
|
id: "applicant.email",
|
@@ -6421,9 +6633,9 @@ var v2BirthEvent = defineConfig({
|
|
6421
6633
|
});
|
6422
6634
|
|
6423
6635
|
// ../commons/src/events/test.utils.ts
|
6424
|
-
var
|
6636
|
+
var import_zod35 = require("zod");
|
6425
6637
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6426
|
-
var TestUserRole =
|
6638
|
+
var TestUserRole = import_zod35.z.enum([
|
6427
6639
|
"FIELD_AGENT",
|
6428
6640
|
"LOCAL_REGISTRAR",
|
6429
6641
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6588,7 +6800,7 @@ function eventPayloadGenerator(rng) {
|
|
6588
6800
|
eventId,
|
6589
6801
|
actionType,
|
6590
6802
|
annotation
|
6591
|
-
}, input = {}) => (0,
|
6803
|
+
}, input = {}) => (0, import_lodash4.merge)(
|
6592
6804
|
{
|
6593
6805
|
id: getUUID(),
|
6594
6806
|
eventId,
|
@@ -6647,13 +6859,13 @@ function eventPayloadGenerator(rng) {
|
|
6647
6859
|
notify: (eventId, input = {}) => {
|
6648
6860
|
let declaration = input.declaration;
|
6649
6861
|
if (!declaration) {
|
6650
|
-
const partialDeclaration = (0,
|
6862
|
+
const partialDeclaration = (0, import_lodash4.omitBy)(
|
6651
6863
|
generateActionDeclarationInput(
|
6652
6864
|
tennisClubMembershipEvent,
|
6653
6865
|
ActionType.DECLARE,
|
6654
6866
|
rng
|
6655
6867
|
),
|
6656
|
-
|
6868
|
+
import_lodash4.isString
|
6657
6869
|
);
|
6658
6870
|
declaration = partialDeclaration;
|
6659
6871
|
}
|
@@ -6700,7 +6912,6 @@ function eventPayloadGenerator(rng) {
|
|
6700
6912
|
type: ActionType.ARCHIVE,
|
6701
6913
|
transactionId: input.transactionId ?? getUUID(),
|
6702
6914
|
declaration: {},
|
6703
|
-
// @TODO: Check whether generator is needed?
|
6704
6915
|
annotation: {},
|
6705
6916
|
duplicates: [],
|
6706
6917
|
eventId,
|
@@ -6756,7 +6967,7 @@ function eventPayloadGenerator(rng) {
|
|
6756
6967
|
request: (eventId, input = {}) => ({
|
6757
6968
|
type: ActionType.REQUEST_CORRECTION,
|
6758
6969
|
transactionId: input.transactionId ?? getUUID(),
|
6759
|
-
declaration: input.declaration ?? (0,
|
6970
|
+
declaration: input.declaration ?? (0, import_lodash4.omit)(
|
6760
6971
|
generateActionDeclarationInput(
|
6761
6972
|
tennisClubMembershipEvent,
|
6762
6973
|
ActionType.REQUEST_CORRECTION,
|
@@ -6847,7 +7058,11 @@ function generateActionDocument({
|
|
6847
7058
|
case ActionType.NOTIFY:
|
6848
7059
|
return { ...actionBase, type: action };
|
6849
7060
|
case ActionType.PRINT_CERTIFICATE:
|
6850
|
-
return {
|
7061
|
+
return {
|
7062
|
+
...actionBase,
|
7063
|
+
type: action,
|
7064
|
+
content: defaults.content
|
7065
|
+
};
|
6851
7066
|
case ActionType.REQUEST_CORRECTION:
|
6852
7067
|
return { ...actionBase, type: action };
|
6853
7068
|
case ActionType.APPROVE_CORRECTION:
|
@@ -6910,7 +7125,8 @@ function generateEventDraftDocument({
|
|
6910
7125
|
declaration: {
|
6911
7126
|
...action.declaration,
|
6912
7127
|
...declaration
|
6913
|
-
}
|
7128
|
+
},
|
7129
|
+
annotation: action.annotation
|
6914
7130
|
},
|
6915
7131
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6916
7132
|
eventId
|
@@ -7017,7 +7233,12 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
7017
7233
|
type: "and",
|
7018
7234
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
7019
7235
|
},
|
7020
|
-
actions: [
|
7236
|
+
actions: [
|
7237
|
+
{
|
7238
|
+
type: "DEFAULT",
|
7239
|
+
conditionals: []
|
7240
|
+
}
|
7241
|
+
],
|
7021
7242
|
icon: "Draft"
|
7022
7243
|
}
|
7023
7244
|
]);
|
@@ -7033,9 +7254,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
7033
7254
|
if (isTemplateVariable(value)) {
|
7034
7255
|
return false;
|
7035
7256
|
}
|
7036
|
-
if (typeof value === "object" &&
|
7037
|
-
//@ts-ignore
|
7038
|
-
Object.values(value).some((val) => isTemplateVariable(val))) {
|
7257
|
+
if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
|
7039
7258
|
return false;
|
7040
7259
|
}
|
7041
7260
|
return true;
|
@@ -7057,7 +7276,7 @@ function isFieldConfigDefaultValue(value) {
|
|
7057
7276
|
}
|
7058
7277
|
|
7059
7278
|
// ../commons/src/events/scopes.ts
|
7060
|
-
var
|
7279
|
+
var import_lodash5 = require("lodash");
|
7061
7280
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
7062
7281
|
SCOPES.RECORD_DECLARE,
|
7063
7282
|
SCOPES.RECORD_READ,
|
@@ -7145,13 +7364,13 @@ var WRITE_ACTION_SCOPES = [
|
|
7145
7364
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
7146
7365
|
];
|
7147
7366
|
function hasAnyOfScopes(a, b) {
|
7148
|
-
return (0,
|
7367
|
+
return (0, import_lodash5.intersection)(a, b).length > 0;
|
7149
7368
|
}
|
7150
7369
|
|
7151
7370
|
// ../commons/src/events/serializers/user/deserializer.ts
|
7152
|
-
var
|
7371
|
+
var import_zod36 = require("zod");
|
7153
7372
|
var UserWithPrimaryOffice = User.extend({
|
7154
|
-
primaryOfficeId:
|
7373
|
+
primaryOfficeId: import_zod36.z.string()
|
7155
7374
|
});
|
7156
7375
|
function userDeserializer(serializedUserField, user2) {
|
7157
7376
|
if (typeof serializedUserField === "string") {
|