@opencrvs/toolkit 1.8.1-rc.742a497 → 1.8.1-rc.77e91ea
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 +3 -3
- package/dist/commons/events/ActionConfig.d.ts +1920 -276
- package/dist/commons/events/Draft.d.ts +8 -8
- package/dist/commons/events/EventConfig.d.ts +586 -94
- package/dist/commons/events/FieldConfig.d.ts +810 -28
- package/dist/commons/events/FieldType.d.ts +5 -0
- package/dist/commons/events/FormConfig.d.ts +924 -132
- package/dist/commons/events/PageConfig.d.ts +260 -36
- package/dist/commons/events/defineConfig.d.ts +54 -18
- package/dist/commons/events/test.utils.d.ts +2 -1
- package/dist/commons/events/utils.d.ts +111 -141
- package/dist/events/index.js +887 -818
- package/package.json +1 -1
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,
|
@@ -201,7 +203,7 @@ __export(events_exports, {
|
|
201
203
|
and: () => and,
|
202
204
|
annotationActions: () => annotationActions,
|
203
205
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
204
|
-
|
206
|
+
applyDraftToEventIndex: () => applyDraftToEventIndex,
|
205
207
|
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
206
208
|
areConditionsMet: () => areConditionsMet,
|
207
209
|
compositeFieldTypes: () => compositeFieldTypes,
|
@@ -209,6 +211,7 @@ __export(events_exports, {
|
|
209
211
|
createFieldConditionals: () => createFieldConditionals,
|
210
212
|
createPrng: () => createPrng,
|
211
213
|
createValidationSchema: () => createValidationSchema,
|
214
|
+
dangerouslyGetCurrentEventStateWithDrafts: () => dangerouslyGetCurrentEventStateWithDrafts,
|
212
215
|
deepDropNulls: () => deepDropNulls,
|
213
216
|
deepMerge: () => deepMerge,
|
214
217
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -230,7 +233,7 @@ __export(events_exports, {
|
|
230
233
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
231
234
|
field: () => field,
|
232
235
|
fieldTypes: () => fieldTypes,
|
233
|
-
|
236
|
+
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
234
237
|
findAllFields: () => findAllFields,
|
235
238
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
236
239
|
findRecordActionPages: () => findRecordActionPages,
|
@@ -258,7 +261,6 @@ __export(events_exports, {
|
|
258
261
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
259
262
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
260
263
|
getCurrentEventState: () => getCurrentEventState,
|
261
|
-
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
262
264
|
getDeclaration: () => getDeclaration,
|
263
265
|
getDeclarationFieldById: () => getDeclarationFieldById,
|
264
266
|
getDeclarationFields: () => getDeclarationFields,
|
@@ -318,6 +320,7 @@ __export(events_exports, {
|
|
318
320
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
319
321
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
320
322
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
323
|
+
mergeDrafts: () => mergeDrafts,
|
321
324
|
never: () => never,
|
322
325
|
not: () => not,
|
323
326
|
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
@@ -341,7 +344,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
341
344
|
var BIRTH_EVENT = "v2-birth";
|
342
345
|
|
343
346
|
// ../commons/src/events/ActionConfig.ts
|
344
|
-
var
|
347
|
+
var import_zod11 = require("zod");
|
345
348
|
|
346
349
|
// ../commons/src/events/Conditional.ts
|
347
350
|
var import_zod = require("zod");
|
@@ -511,9 +514,10 @@ function isMetaAction(actionType) {
|
|
511
514
|
}
|
512
515
|
|
513
516
|
// ../commons/src/events/FieldConfig.ts
|
514
|
-
var
|
517
|
+
var import_zod8 = require("zod");
|
515
518
|
|
516
519
|
// ../commons/src/events/FieldType.ts
|
520
|
+
var import_zod4 = require("zod");
|
517
521
|
var FieldType = {
|
518
522
|
NAME: "NAME",
|
519
523
|
PHONE: "PHONE",
|
@@ -546,6 +550,11 @@ var FieldType = {
|
|
546
550
|
SIGNATURE: "SIGNATURE",
|
547
551
|
DATA: "DATA"
|
548
552
|
};
|
553
|
+
var FileFieldType = import_zod4.z.enum([
|
554
|
+
FieldType.FILE,
|
555
|
+
FieldType.FILE_WITH_OPTIONS,
|
556
|
+
FieldType.SIGNATURE
|
557
|
+
]);
|
549
558
|
var fieldTypes = Object.values(FieldType);
|
550
559
|
var compositeFieldTypes = [
|
551
560
|
FieldType.DATE_RANGE,
|
@@ -555,24 +564,24 @@ var compositeFieldTypes = [
|
|
555
564
|
];
|
556
565
|
|
557
566
|
// ../commons/src/events/FieldValue.ts
|
558
|
-
var
|
567
|
+
var import_zod7 = require("zod");
|
559
568
|
|
560
569
|
// ../commons/src/documents.ts
|
561
|
-
var
|
570
|
+
var import_zod5 = require("zod");
|
562
571
|
var import_zod_openapi3 = require("zod-openapi");
|
563
|
-
(0, import_zod_openapi3.extendZodWithOpenApi)(
|
564
|
-
var FullDocumentUrl =
|
572
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
573
|
+
var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
|
565
574
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
566
575
|
);
|
567
|
-
var FullDocumentPath =
|
576
|
+
var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
568
577
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
569
578
|
);
|
570
|
-
var DocumentPath =
|
579
|
+
var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
|
571
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"
|
572
581
|
);
|
573
582
|
|
574
583
|
// ../commons/src/events/CompositeFieldValue.ts
|
575
|
-
var
|
584
|
+
var import_zod6 = require("zod");
|
576
585
|
var GeographicalArea = {
|
577
586
|
URBAN: "URBAN",
|
578
587
|
RURAL: "RURAL"
|
@@ -581,110 +590,110 @@ var AddressType = {
|
|
581
590
|
DOMESTIC: "DOMESTIC",
|
582
591
|
INTERNATIONAL: "INTERNATIONAL"
|
583
592
|
};
|
584
|
-
var FileFieldValue =
|
593
|
+
var FileFieldValue = import_zod6.z.object({
|
585
594
|
path: FullDocumentPath,
|
586
|
-
originalFilename:
|
587
|
-
type:
|
595
|
+
originalFilename: import_zod6.z.string(),
|
596
|
+
type: import_zod6.z.string()
|
588
597
|
});
|
589
|
-
var AdminStructure =
|
590
|
-
country:
|
591
|
-
addressType:
|
592
|
-
province:
|
593
|
-
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()
|
594
603
|
});
|
595
604
|
var UrbanAddressValue = AdminStructure.extend({
|
596
|
-
urbanOrRural:
|
597
|
-
town:
|
598
|
-
residentialArea:
|
599
|
-
street:
|
600
|
-
number:
|
601
|
-
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()
|
602
611
|
});
|
603
612
|
var RuralAddressValue = AdminStructure.extend({
|
604
|
-
urbanOrRural:
|
605
|
-
village:
|
613
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.RURAL),
|
614
|
+
village: import_zod6.z.string().optional()
|
606
615
|
});
|
607
616
|
var UrbanAddressUpdateValue = AdminStructure.extend({
|
608
|
-
urbanOrRural:
|
609
|
-
town:
|
610
|
-
residentialArea:
|
611
|
-
street:
|
612
|
-
number:
|
613
|
-
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()
|
614
623
|
});
|
615
|
-
var NameFieldValue =
|
616
|
-
firstname:
|
617
|
-
surname:
|
618
|
-
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()
|
619
628
|
});
|
620
|
-
var NameFieldUpdateValue =
|
621
|
-
firstname:
|
622
|
-
surname:
|
623
|
-
middlename:
|
624
|
-
}).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());
|
625
634
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
626
|
-
urbanOrRural:
|
627
|
-
village:
|
635
|
+
urbanOrRural: import_zod6.z.literal(GeographicalArea.RURAL),
|
636
|
+
village: import_zod6.z.string().nullish()
|
628
637
|
});
|
629
|
-
var GenericAddressValue =
|
630
|
-
country:
|
631
|
-
addressType:
|
632
|
-
state:
|
633
|
-
district2:
|
634
|
-
cityOrTown:
|
635
|
-
addressLine1:
|
636
|
-
addressLine2:
|
637
|
-
addressLine3:
|
638
|
-
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()
|
639
648
|
});
|
640
|
-
var AddressFieldValue =
|
641
|
-
var GenericAddressUpdateValue =
|
642
|
-
country:
|
643
|
-
addressType:
|
644
|
-
state:
|
645
|
-
district2:
|
646
|
-
cityOrTown:
|
647
|
-
addressLine1:
|
648
|
-
addressLine2:
|
649
|
-
addressLine3:
|
650
|
-
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()
|
651
660
|
});
|
652
|
-
var AddressFieldUpdateValue =
|
661
|
+
var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("urbanOrRural", [
|
653
662
|
UrbanAddressUpdateValue,
|
654
663
|
RuralAddressUpdateValue
|
655
664
|
]).or(GenericAddressUpdateValue);
|
656
|
-
var FileFieldValueWithOption =
|
665
|
+
var FileFieldValueWithOption = import_zod6.z.object({
|
657
666
|
path: FullDocumentPath,
|
658
|
-
originalFilename:
|
659
|
-
type:
|
660
|
-
option:
|
667
|
+
originalFilename: import_zod6.z.string(),
|
668
|
+
type: import_zod6.z.string(),
|
669
|
+
option: import_zod6.z.string()
|
661
670
|
});
|
662
|
-
var FileFieldWithOptionValue =
|
671
|
+
var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
|
663
672
|
|
664
673
|
// ../commons/src/events/FieldValue.ts
|
665
|
-
var TextValue =
|
674
|
+
var TextValue = import_zod7.z.string();
|
666
675
|
var NonEmptyTextValue = TextValue.min(1);
|
667
|
-
var DateValue =
|
668
|
-
var TimeValue =
|
669
|
-
var DatetimeValue =
|
670
|
-
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([
|
671
680
|
"last7Days",
|
672
681
|
"last30Days",
|
673
682
|
"last90Days",
|
674
683
|
"last365Days"
|
675
684
|
]);
|
676
|
-
var DateRangeFieldValue =
|
685
|
+
var DateRangeFieldValue = import_zod7.z.object({
|
677
686
|
start: DateValue,
|
678
687
|
end: DateValue
|
679
688
|
}).or(DateValue).describe(
|
680
689
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
681
690
|
);
|
682
|
-
var EmailValue =
|
683
|
-
var CheckboxFieldValue =
|
684
|
-
var NumberFieldValue =
|
685
|
-
var DataFieldValue =
|
686
|
-
var SignatureFieldValue =
|
687
|
-
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([
|
688
697
|
TextValue,
|
689
698
|
DateValue,
|
690
699
|
TimeValue,
|
@@ -701,7 +710,7 @@ var FieldValue = import_zod6.z.union([
|
|
701
710
|
NameFieldValue,
|
702
711
|
NameFieldUpdateValue
|
703
712
|
]);
|
704
|
-
var FieldUpdateValue =
|
713
|
+
var FieldUpdateValue = import_zod7.z.union([
|
705
714
|
TextValue,
|
706
715
|
DateValue,
|
707
716
|
TimeValue,
|
@@ -720,67 +729,67 @@ var FieldUpdateValue = import_zod6.z.union([
|
|
720
729
|
|
721
730
|
// ../commons/src/events/FieldConfig.ts
|
722
731
|
var import_zod_openapi4 = require("zod-openapi");
|
723
|
-
(0, import_zod_openapi4.extendZodWithOpenApi)(
|
724
|
-
var FieldId =
|
725
|
-
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({
|
726
735
|
$$field: FieldId
|
727
736
|
}).describe("Reference to a field by its ID");
|
728
|
-
var ValidationConfig =
|
737
|
+
var ValidationConfig = import_zod8.z.object({
|
729
738
|
validator: Conditional,
|
730
739
|
message: TranslationConfig
|
731
740
|
});
|
732
|
-
var BaseField =
|
741
|
+
var BaseField = import_zod8.z.object({
|
733
742
|
id: FieldId,
|
734
743
|
label: TranslationConfig,
|
735
744
|
parent: FieldReference.optional().describe(
|
736
745
|
"Reference to a parent field. If a field has a parent, it will be reset when the parent field is changed."
|
737
746
|
),
|
738
|
-
required:
|
739
|
-
conditionals:
|
740
|
-
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(),
|
741
750
|
placeholder: TranslationConfig.optional(),
|
742
|
-
validation:
|
751
|
+
validation: import_zod8.z.array(ValidationConfig).default([]).optional(),
|
743
752
|
helperText: TranslationConfig.optional(),
|
744
|
-
hideLabel:
|
745
|
-
uncorrectable:
|
753
|
+
hideLabel: import_zod8.z.boolean().default(false).optional(),
|
754
|
+
uncorrectable: import_zod8.z.boolean().default(false).optional().describe(
|
746
755
|
"Indicates if the field can be changed during a record correction."
|
747
756
|
)
|
748
757
|
});
|
749
758
|
var Divider = BaseField.extend({
|
750
|
-
type:
|
759
|
+
type: import_zod8.z.literal(FieldType.DIVIDER)
|
751
760
|
});
|
752
761
|
var TextField = BaseField.extend({
|
753
|
-
type:
|
762
|
+
type: import_zod8.z.literal(FieldType.TEXT),
|
754
763
|
defaultValue: NonEmptyTextValue.optional(),
|
755
|
-
configuration:
|
756
|
-
maxLength:
|
757
|
-
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(),
|
758
767
|
prefix: TranslationConfig.optional(),
|
759
768
|
postfix: TranslationConfig.optional()
|
760
769
|
}).default({ type: "text" }).optional()
|
761
770
|
}).describe("Text input");
|
762
771
|
var NumberField = BaseField.extend({
|
763
|
-
type:
|
772
|
+
type: import_zod8.z.literal(FieldType.NUMBER),
|
764
773
|
defaultValue: NumberFieldValue.optional(),
|
765
|
-
configuration:
|
766
|
-
min:
|
767
|
-
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"),
|
768
777
|
prefix: TranslationConfig.optional(),
|
769
778
|
postfix: TranslationConfig.optional()
|
770
779
|
}).optional()
|
771
780
|
}).describe("Number input");
|
772
781
|
var TextAreaField = BaseField.extend({
|
773
|
-
type:
|
782
|
+
type: import_zod8.z.literal(FieldType.TEXTAREA),
|
774
783
|
defaultValue: NonEmptyTextValue.optional(),
|
775
|
-
configuration:
|
776
|
-
maxLength:
|
777
|
-
rows:
|
778
|
-
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"),
|
779
788
|
prefix: TranslationConfig.optional(),
|
780
789
|
postfix: TranslationConfig.optional()
|
781
790
|
}).default({ rows: 4 }).optional()
|
782
791
|
}).describe("Multiline text input");
|
783
|
-
var ImageMimeType =
|
792
|
+
var ImageMimeType = import_zod8.z.enum([
|
784
793
|
"image/png",
|
785
794
|
"image/jpg",
|
786
795
|
"image/jpeg",
|
@@ -789,53 +798,53 @@ var ImageMimeType = import_zod7.z.enum([
|
|
789
798
|
var MimeType = ImageMimeType;
|
790
799
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
791
800
|
var SignatureField = BaseField.extend({
|
792
|
-
type:
|
801
|
+
type: import_zod8.z.literal(FieldType.SIGNATURE),
|
793
802
|
signaturePromptLabel: TranslationConfig.describe(
|
794
803
|
"Title of the signature modal"
|
795
804
|
),
|
796
805
|
defaultValue: SignatureFieldValue.optional(),
|
797
|
-
configuration:
|
798
|
-
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),
|
799
808
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
800
809
|
}).default({
|
801
810
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
802
811
|
})
|
803
812
|
}).describe("Signature input field");
|
804
813
|
var EmailField = BaseField.extend({
|
805
|
-
type:
|
806
|
-
configuration:
|
807
|
-
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")
|
808
817
|
}).default({ maxLength: 10 }).optional(),
|
809
818
|
defaultValue: NonEmptyTextValue.optional()
|
810
819
|
});
|
811
820
|
var DateField = BaseField.extend({
|
812
|
-
type:
|
821
|
+
type: import_zod8.z.literal(FieldType.DATE),
|
813
822
|
defaultValue: DateValue.optional(),
|
814
|
-
configuration:
|
823
|
+
configuration: import_zod8.z.object({
|
815
824
|
notice: TranslationConfig.describe(
|
816
825
|
"Text to display above the date input"
|
817
826
|
).optional()
|
818
827
|
}).optional()
|
819
828
|
}).describe("A single date input (yyyy-MM-dd)");
|
820
829
|
var TimeField = BaseField.extend({
|
821
|
-
type:
|
830
|
+
type: import_zod8.z.literal(FieldType.TIME),
|
822
831
|
defaultValue: TimeValue.optional(),
|
823
|
-
configuration:
|
832
|
+
configuration: import_zod8.z.object({
|
824
833
|
notice: TranslationConfig.describe(
|
825
834
|
"Text to display above the time input"
|
826
835
|
).optional()
|
827
836
|
}).optional()
|
828
837
|
}).describe("A single date input (HH-mm)");
|
829
838
|
var DateRangeField = BaseField.extend({
|
830
|
-
type:
|
839
|
+
type: import_zod8.z.literal(FieldType.DATE_RANGE),
|
831
840
|
defaultValue: DateRangeFieldValue.optional(),
|
832
|
-
configuration:
|
841
|
+
configuration: import_zod8.z.object({
|
833
842
|
notice: TranslationConfig.describe(
|
834
843
|
"Text to display above the date input"
|
835
844
|
).optional()
|
836
845
|
}).optional()
|
837
846
|
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
838
|
-
var HtmlFontVariant =
|
847
|
+
var HtmlFontVariant = import_zod8.z.enum([
|
839
848
|
"reg12",
|
840
849
|
"reg14",
|
841
850
|
"reg16",
|
@@ -845,31 +854,31 @@ var HtmlFontVariant = import_zod7.z.enum([
|
|
845
854
|
"h2",
|
846
855
|
"h1"
|
847
856
|
]);
|
848
|
-
var ParagraphConfiguration =
|
849
|
-
styles:
|
857
|
+
var ParagraphConfiguration = import_zod8.z.object({
|
858
|
+
styles: import_zod8.z.object({
|
850
859
|
fontVariant: HtmlFontVariant.optional().describe(
|
851
860
|
"Font variant to use for the paragraph text"
|
852
861
|
),
|
853
|
-
hint:
|
862
|
+
hint: import_zod8.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
|
854
863
|
}).optional()
|
855
864
|
}).default({});
|
856
865
|
var Paragraph = BaseField.extend({
|
857
|
-
type:
|
866
|
+
type: import_zod8.z.literal(FieldType.PARAGRAPH),
|
858
867
|
defaultValue: NonEmptyTextValue.optional(),
|
859
868
|
configuration: ParagraphConfiguration
|
860
869
|
}).describe("A read-only HTML <p> paragraph");
|
861
870
|
var PageHeader = BaseField.extend({
|
862
|
-
type:
|
871
|
+
type: import_zod8.z.literal(FieldType.PAGE_HEADER),
|
863
872
|
defaultValue: NonEmptyTextValue.optional()
|
864
873
|
}).describe("A read-only header component for form pages");
|
865
874
|
var File = BaseField.extend({
|
866
|
-
type:
|
875
|
+
type: import_zod8.z.literal(FieldType.FILE),
|
867
876
|
defaultValue: FileFieldValue.optional(),
|
868
|
-
configuration:
|
869
|
-
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),
|
870
879
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
871
|
-
style:
|
872
|
-
width:
|
880
|
+
style: import_zod8.z.object({
|
881
|
+
width: import_zod8.z.enum(["full", "auto"]).optional().describe(
|
873
882
|
"Whether the file upload button should take the full width of the container or not"
|
874
883
|
)
|
875
884
|
}).optional(),
|
@@ -878,65 +887,65 @@ var File = BaseField.extend({
|
|
878
887
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
879
888
|
})
|
880
889
|
}).describe("File upload");
|
881
|
-
var SelectOption =
|
882
|
-
value:
|
890
|
+
var SelectOption = import_zod8.z.object({
|
891
|
+
value: import_zod8.z.string().describe("The value of the option"),
|
883
892
|
label: TranslationConfig.describe("The label of the option")
|
884
893
|
});
|
885
894
|
var RadioGroup = BaseField.extend({
|
886
|
-
type:
|
895
|
+
type: import_zod8.z.literal(FieldType.RADIO_GROUP),
|
887
896
|
defaultValue: TextValue.optional(),
|
888
|
-
options:
|
889
|
-
configuration:
|
890
|
-
styles:
|
891
|
-
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()
|
892
901
|
}).optional()
|
893
902
|
}).optional()
|
894
903
|
}).describe("Grouped radio options");
|
895
904
|
var BulletList = BaseField.extend({
|
896
|
-
type:
|
905
|
+
type: import_zod8.z.literal(FieldType.BULLET_LIST),
|
897
906
|
defaultValue: TextValue.optional(),
|
898
|
-
items:
|
899
|
-
configuration:
|
900
|
-
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({
|
901
910
|
fontVariant: HtmlFontVariant.optional()
|
902
911
|
}).optional()
|
903
912
|
}).default({})
|
904
913
|
}).describe("A list of bullet points");
|
905
914
|
var Select = BaseField.extend({
|
906
|
-
type:
|
915
|
+
type: import_zod8.z.literal(FieldType.SELECT),
|
907
916
|
defaultValue: TextValue.optional(),
|
908
|
-
options:
|
917
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options")
|
909
918
|
}).describe("Select input");
|
910
|
-
var SelectDateRangeOption =
|
919
|
+
var SelectDateRangeOption = import_zod8.z.object({
|
911
920
|
value: SelectDateRangeValue.describe("The value of the option"),
|
912
921
|
label: TranslationConfig.describe("The label of the option")
|
913
922
|
});
|
914
923
|
var SelectDateRangeField = BaseField.extend({
|
915
|
-
type:
|
924
|
+
type: import_zod8.z.literal(FieldType.SELECT_DATE_RANGE),
|
916
925
|
defaultValue: SelectDateRangeValue.optional(),
|
917
|
-
options:
|
926
|
+
options: import_zod8.z.array(SelectDateRangeOption).describe("A list of options")
|
918
927
|
}).describe("Select input with date range options");
|
919
|
-
var NameConfig =
|
920
|
-
firstname:
|
921
|
-
middlename:
|
922
|
-
surname:
|
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()
|
923
932
|
});
|
924
933
|
var NameField = BaseField.extend({
|
925
|
-
type:
|
926
|
-
defaultValue:
|
934
|
+
type: import_zod8.z.literal(FieldType.NAME),
|
935
|
+
defaultValue: import_zod8.z.object({
|
927
936
|
firstname: NonEmptyTextValue.optional(),
|
928
937
|
middlename: NonEmptyTextValue.optional(),
|
929
938
|
surname: NonEmptyTextValue.optional()
|
930
939
|
}).optional(),
|
931
|
-
configuration:
|
940
|
+
configuration: import_zod8.z.object({
|
932
941
|
name: NameConfig.default({
|
933
942
|
firstname: { required: true },
|
934
943
|
surname: { required: true }
|
935
944
|
}).optional(),
|
936
|
-
|
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"),
|
937
947
|
prefix: TranslationConfig.optional(),
|
938
|
-
postfix: TranslationConfig.optional()
|
939
|
-
searchMode: import_zod7.z.boolean().optional()
|
948
|
+
postfix: TranslationConfig.optional()
|
940
949
|
}).default({
|
941
950
|
name: {
|
942
951
|
firstname: { required: true },
|
@@ -946,86 +955,108 @@ var NameField = BaseField.extend({
|
|
946
955
|
}).describe("Name input field");
|
947
956
|
var PhoneField = BaseField.extend({
|
948
957
|
defaultValue: NonEmptyTextValue.optional(),
|
949
|
-
type:
|
958
|
+
type: import_zod8.z.literal(FieldType.PHONE)
|
950
959
|
}).describe("Phone input field");
|
951
960
|
var IdField = BaseField.extend({
|
952
961
|
defaultValue: NonEmptyTextValue.optional(),
|
953
|
-
type:
|
962
|
+
type: import_zod8.z.literal(FieldType.ID)
|
954
963
|
}).describe("ID input field");
|
955
964
|
var Checkbox = BaseField.extend({
|
956
|
-
type:
|
965
|
+
type: import_zod8.z.literal(FieldType.CHECKBOX),
|
957
966
|
defaultValue: CheckboxFieldValue.optional()
|
958
967
|
}).describe("Boolean checkbox field");
|
959
968
|
var Country = BaseField.extend({
|
960
|
-
type:
|
969
|
+
type: import_zod8.z.literal(FieldType.COUNTRY),
|
961
970
|
defaultValue: NonEmptyTextValue.optional()
|
962
971
|
}).describe("Country select field");
|
963
|
-
var AdministrativeAreas =
|
972
|
+
var AdministrativeAreas = import_zod8.z.enum([
|
964
973
|
"ADMIN_STRUCTURE",
|
965
974
|
"HEALTH_FACILITY",
|
966
975
|
"CRVS_OFFICE"
|
967
976
|
]);
|
968
|
-
var AdministrativeAreaConfiguration =
|
969
|
-
partOf:
|
970
|
-
$declaration:
|
977
|
+
var AdministrativeAreaConfiguration = import_zod8.z.object({
|
978
|
+
partOf: import_zod8.z.object({
|
979
|
+
$declaration: import_zod8.z.string()
|
971
980
|
}).optional().describe("Parent location"),
|
972
981
|
type: AdministrativeAreas
|
973
982
|
}).describe("Administrative area options");
|
974
983
|
var AdministrativeArea = BaseField.extend({
|
975
|
-
type:
|
984
|
+
type: import_zod8.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
976
985
|
defaultValue: NonEmptyTextValue.optional(),
|
977
986
|
configuration: AdministrativeAreaConfiguration
|
978
987
|
}).describe("Administrative area input field e.g. facility, office");
|
979
988
|
var Location = BaseField.extend({
|
980
|
-
type:
|
989
|
+
type: import_zod8.z.literal(FieldType.LOCATION),
|
981
990
|
defaultValue: NonEmptyTextValue.optional(),
|
982
|
-
configuration:
|
983
|
-
searchableResource:
|
991
|
+
configuration: import_zod8.z.object({
|
992
|
+
searchableResource: import_zod8.z.array(import_zod8.z.enum(["locations", "facilities", "offices"])).optional()
|
984
993
|
}).optional()
|
985
994
|
}).describe("Input field for a location");
|
986
995
|
var FileUploadWithOptions = BaseField.extend({
|
987
|
-
type:
|
988
|
-
options:
|
996
|
+
type: import_zod8.z.literal(FieldType.FILE_WITH_OPTIONS),
|
997
|
+
options: import_zod8.z.array(SelectOption).describe("A list of options"),
|
989
998
|
defaultValue: FileFieldWithOptionValue.optional(),
|
990
|
-
configuration:
|
991
|
-
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),
|
992
1001
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
993
1002
|
}).default({
|
994
1003
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
995
1004
|
})
|
996
1005
|
});
|
997
1006
|
var Facility = BaseField.extend({
|
998
|
-
type:
|
1007
|
+
type: import_zod8.z.literal(FieldType.FACILITY),
|
999
1008
|
defaultValue: NonEmptyTextValue.optional()
|
1000
1009
|
}).describe("Input field for a facility");
|
1001
1010
|
var Office = BaseField.extend({
|
1002
|
-
type:
|
1011
|
+
type: import_zod8.z.literal(FieldType.OFFICE),
|
1003
1012
|
defaultValue: NonEmptyTextValue.optional()
|
1004
1013
|
}).describe("Input field for an office");
|
1005
1014
|
var Address = BaseField.extend({
|
1006
|
-
type:
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
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()
|
1011
1042
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
1012
|
-
var DataEntry =
|
1013
|
-
|
1043
|
+
var DataEntry = import_zod8.z.union([
|
1044
|
+
import_zod8.z.object({
|
1014
1045
|
label: TranslationConfig,
|
1015
|
-
value: TranslationConfig.or(
|
1046
|
+
value: TranslationConfig.or(import_zod8.z.string())
|
1016
1047
|
}),
|
1017
|
-
|
1018
|
-
fieldId:
|
1048
|
+
import_zod8.z.object({
|
1049
|
+
fieldId: import_zod8.z.string()
|
1019
1050
|
})
|
1020
1051
|
]);
|
1021
1052
|
var DataField = BaseField.extend({
|
1022
|
-
type:
|
1023
|
-
configuration:
|
1053
|
+
type: import_zod8.z.literal(FieldType.DATA),
|
1054
|
+
configuration: import_zod8.z.object({
|
1024
1055
|
subtitle: TranslationConfig.optional(),
|
1025
|
-
data:
|
1056
|
+
data: import_zod8.z.array(DataEntry)
|
1026
1057
|
})
|
1027
1058
|
}).describe("Data field for displaying read-only data");
|
1028
|
-
var FieldConfig =
|
1059
|
+
var FieldConfig = import_zod8.z.discriminatedUnion("type", [
|
1029
1060
|
Address,
|
1030
1061
|
TextField,
|
1031
1062
|
NumberField,
|
@@ -1058,19 +1089,24 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1058
1089
|
description: "Form field configuration",
|
1059
1090
|
ref: "FieldConfig"
|
1060
1091
|
});
|
1092
|
+
var AnyFileField = import_zod8.z.discriminatedUnion("type", [
|
1093
|
+
SignatureField,
|
1094
|
+
File,
|
1095
|
+
FileUploadWithOptions
|
1096
|
+
]);
|
1061
1097
|
|
1062
1098
|
// ../commons/src/events/FormConfig.ts
|
1063
|
-
var
|
1099
|
+
var import_zod10 = require("zod");
|
1064
1100
|
|
1065
1101
|
// ../commons/src/events/PageConfig.ts
|
1066
|
-
var
|
1102
|
+
var import_zod9 = require("zod");
|
1067
1103
|
var import_zod_openapi5 = require("zod-openapi");
|
1068
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(
|
1069
|
-
var PageTypes =
|
1070
|
-
var PageConfigBase =
|
1071
|
-
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"),
|
1072
1108
|
title: TranslationConfig.describe("Header title of the page"),
|
1073
|
-
fields:
|
1109
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
1074
1110
|
conditional: Conditional.optional().describe(
|
1075
1111
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
1076
1112
|
)
|
@@ -1079,13 +1115,13 @@ var PageConfigBase = import_zod8.z.object({
|
|
1079
1115
|
ref: "FormPageConfig"
|
1080
1116
|
});
|
1081
1117
|
var FormPageConfig = PageConfigBase.extend({
|
1082
|
-
type:
|
1118
|
+
type: import_zod9.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
1083
1119
|
});
|
1084
|
-
var VerificationActionConfig =
|
1085
|
-
verify:
|
1086
|
-
cancel:
|
1120
|
+
var VerificationActionConfig = import_zod9.z.object({
|
1121
|
+
verify: import_zod9.z.object({ label: TranslationConfig }),
|
1122
|
+
cancel: import_zod9.z.object({
|
1087
1123
|
label: TranslationConfig,
|
1088
|
-
confirmation:
|
1124
|
+
confirmation: import_zod9.z.object({
|
1089
1125
|
title: TranslationConfig,
|
1090
1126
|
body: TranslationConfig
|
1091
1127
|
})
|
@@ -1095,110 +1131,110 @@ var VerificationActionConfig = import_zod8.z.object({
|
|
1095
1131
|
ref: "VerificationActionConfig"
|
1096
1132
|
});
|
1097
1133
|
var VerificationPageConfig = FormPageConfig.extend({
|
1098
|
-
type:
|
1134
|
+
type: import_zod9.z.literal(PageTypes.enum.VERIFICATION),
|
1099
1135
|
actions: VerificationActionConfig
|
1100
1136
|
});
|
1101
|
-
var PageConfig =
|
1137
|
+
var PageConfig = import_zod9.z.discriminatedUnion("type", [
|
1102
1138
|
FormPageConfig,
|
1103
1139
|
VerificationPageConfig
|
1104
1140
|
]);
|
1105
1141
|
|
1106
1142
|
// ../commons/src/events/FormConfig.ts
|
1107
|
-
var DeclarationFormConfig =
|
1143
|
+
var DeclarationFormConfig = import_zod10.z.object({
|
1108
1144
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1109
|
-
pages:
|
1145
|
+
pages: import_zod10.z.array(FormPageConfig)
|
1110
1146
|
}).describe("Configuration for a declaration form");
|
1111
|
-
var ActionFormConfig =
|
1147
|
+
var ActionFormConfig = import_zod10.z.object({
|
1112
1148
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1113
|
-
pages:
|
1149
|
+
pages: import_zod10.z.array(PageConfig)
|
1114
1150
|
});
|
1115
|
-
var FormConfig =
|
1151
|
+
var FormConfig = import_zod10.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1116
1152
|
|
1117
1153
|
// ../commons/src/events/ActionConfig.ts
|
1118
1154
|
var import_zod_openapi6 = require("zod-openapi");
|
1119
|
-
(0, import_zod_openapi6.extendZodWithOpenApi)(
|
1120
|
-
var ActionConditional2 =
|
1155
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod11.z);
|
1156
|
+
var ActionConditional2 = import_zod11.z.discriminatedUnion("type", [
|
1121
1157
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1122
1158
|
ShowConditional,
|
1123
1159
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1124
1160
|
EnableConditional
|
1125
1161
|
]);
|
1126
|
-
var DeclarationReviewConfig =
|
1162
|
+
var DeclarationReviewConfig = import_zod11.z.object({
|
1127
1163
|
title: TranslationConfig.describe("Title of the review page"),
|
1128
|
-
fields:
|
1164
|
+
fields: import_zod11.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1129
1165
|
}).describe("Configuration for **declaration** review page.");
|
1130
|
-
var ActionConfigBase =
|
1166
|
+
var ActionConfigBase = import_zod11.z.object({
|
1131
1167
|
label: TranslationConfig,
|
1132
|
-
conditionals:
|
1133
|
-
draft:
|
1168
|
+
conditionals: import_zod11.z.array(ActionConditional2).optional().default([]),
|
1169
|
+
draft: import_zod11.z.boolean().optional()
|
1134
1170
|
});
|
1135
1171
|
var ReadActionConfig = ActionConfigBase.merge(
|
1136
|
-
|
1137
|
-
type:
|
1172
|
+
import_zod11.z.object({
|
1173
|
+
type: import_zod11.z.literal(ActionType.READ),
|
1138
1174
|
review: DeclarationReviewConfig
|
1139
1175
|
})
|
1140
1176
|
);
|
1141
1177
|
var DeclareConfig = ActionConfigBase.merge(
|
1142
|
-
|
1143
|
-
type:
|
1178
|
+
import_zod11.z.object({
|
1179
|
+
type: import_zod11.z.literal(ActionType.DECLARE),
|
1144
1180
|
review: DeclarationReviewConfig
|
1145
1181
|
})
|
1146
1182
|
);
|
1147
1183
|
var ValidateConfig = ActionConfigBase.merge(
|
1148
|
-
|
1149
|
-
type:
|
1184
|
+
import_zod11.z.object({
|
1185
|
+
type: import_zod11.z.literal(ActionType.VALIDATE),
|
1150
1186
|
review: DeclarationReviewConfig
|
1151
1187
|
})
|
1152
1188
|
);
|
1153
1189
|
var RegisterConfig = ActionConfigBase.merge(
|
1154
|
-
|
1155
|
-
type:
|
1190
|
+
import_zod11.z.object({
|
1191
|
+
type: import_zod11.z.literal(ActionType.REGISTER),
|
1156
1192
|
review: DeclarationReviewConfig
|
1157
1193
|
})
|
1158
1194
|
);
|
1159
1195
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1160
|
-
|
1161
|
-
type:
|
1196
|
+
import_zod11.z.object({
|
1197
|
+
type: import_zod11.z.literal(ActionType.REJECT)
|
1162
1198
|
})
|
1163
1199
|
);
|
1164
1200
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1165
|
-
|
1166
|
-
type:
|
1201
|
+
import_zod11.z.object({
|
1202
|
+
type: import_zod11.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1167
1203
|
})
|
1168
1204
|
);
|
1169
1205
|
var ArchiveConfig = ActionConfigBase.merge(
|
1170
|
-
|
1171
|
-
type:
|
1206
|
+
import_zod11.z.object({
|
1207
|
+
type: import_zod11.z.literal(ActionType.ARCHIVE)
|
1172
1208
|
})
|
1173
1209
|
);
|
1174
1210
|
var DeleteConfig = ActionConfigBase.merge(
|
1175
|
-
|
1176
|
-
type:
|
1211
|
+
import_zod11.z.object({
|
1212
|
+
type: import_zod11.z.literal(ActionType.DELETE)
|
1177
1213
|
})
|
1178
1214
|
);
|
1179
1215
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1180
|
-
|
1181
|
-
type:
|
1216
|
+
import_zod11.z.object({
|
1217
|
+
type: import_zod11.z.literal(ActionType.PRINT_CERTIFICATE),
|
1182
1218
|
printForm: ActionFormConfig
|
1183
1219
|
})
|
1184
1220
|
);
|
1185
1221
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1186
|
-
|
1187
|
-
type:
|
1222
|
+
import_zod11.z.object({
|
1223
|
+
type: import_zod11.z.literal(ActionType.REQUEST_CORRECTION),
|
1188
1224
|
correctionForm: ActionFormConfig
|
1189
1225
|
})
|
1190
1226
|
);
|
1191
1227
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1192
|
-
|
1193
|
-
type:
|
1228
|
+
import_zod11.z.object({
|
1229
|
+
type: import_zod11.z.literal(ActionType.REJECT_CORRECTION)
|
1194
1230
|
})
|
1195
1231
|
);
|
1196
1232
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1197
|
-
|
1198
|
-
type:
|
1233
|
+
import_zod11.z.object({
|
1234
|
+
type: import_zod11.z.literal(ActionType.APPROVE_CORRECTION)
|
1199
1235
|
})
|
1200
1236
|
);
|
1201
|
-
var ActionConfig =
|
1237
|
+
var ActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1202
1238
|
/*
|
1203
1239
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1204
1240
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1218,109 +1254,109 @@ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
|
|
1218
1254
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1219
1255
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1220
1256
|
]).openapi({ ref: "ActionConfig" });
|
1221
|
-
var DeclarationActionConfig =
|
1257
|
+
var DeclarationActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1222
1258
|
DeclareConfig,
|
1223
1259
|
ValidateConfig,
|
1224
1260
|
RegisterConfig
|
1225
1261
|
]);
|
1226
1262
|
|
1227
1263
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1228
|
-
var
|
1229
|
-
var FontFamily =
|
1230
|
-
normal:
|
1231
|
-
bold:
|
1232
|
-
italics:
|
1233
|
-
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()
|
1234
1270
|
});
|
1235
|
-
var CertificateConfig =
|
1236
|
-
id:
|
1237
|
-
event:
|
1271
|
+
var CertificateConfig = import_zod12.z.object({
|
1272
|
+
id: import_zod12.z.string(),
|
1273
|
+
event: import_zod12.z.string(),
|
1238
1274
|
label: TranslationConfig,
|
1239
|
-
isDefault:
|
1240
|
-
fee:
|
1241
|
-
onTime:
|
1242
|
-
late:
|
1243
|
-
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()
|
1244
1280
|
}),
|
1245
|
-
svgUrl:
|
1246
|
-
fonts:
|
1247
|
-
conditionals:
|
1281
|
+
svgUrl: import_zod12.z.string(),
|
1282
|
+
fonts: import_zod12.z.record(FontFamily).optional(),
|
1283
|
+
conditionals: import_zod12.z.array(ShowConditional).optional()
|
1248
1284
|
});
|
1249
1285
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1250
|
-
hash:
|
1251
|
-
svg:
|
1286
|
+
hash: import_zod12.z.string().optional(),
|
1287
|
+
svg: import_zod12.z.string()
|
1252
1288
|
});
|
1253
1289
|
|
1254
1290
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1255
|
-
var
|
1256
|
-
var LanguageConfig =
|
1257
|
-
lang:
|
1291
|
+
var import_zod13 = require("zod");
|
1292
|
+
var LanguageConfig = import_zod13.z.object({
|
1293
|
+
lang: import_zod13.z.string(),
|
1258
1294
|
/**
|
1259
1295
|
* client.csv contents
|
1260
1296
|
*/
|
1261
|
-
messages:
|
1297
|
+
messages: import_zod13.z.record(import_zod13.z.string())
|
1262
1298
|
});
|
1263
1299
|
|
1264
1300
|
// ../commons/src/events/EventConfig.ts
|
1265
|
-
var
|
1301
|
+
var import_zod22 = require("zod");
|
1266
1302
|
|
1267
1303
|
// ../commons/src/events/DeduplicationConfig.ts
|
1268
|
-
var
|
1304
|
+
var import_zod14 = require("zod");
|
1269
1305
|
var import_zod_openapi7 = require("zod-openapi");
|
1270
|
-
(0, import_zod_openapi7.extendZodWithOpenApi)(
|
1271
|
-
var FieldReference2 =
|
1272
|
-
var Matcher =
|
1273
|
-
fieldId:
|
1274
|
-
options:
|
1275
|
-
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()
|
1276
1312
|
}).optional().default({})
|
1277
1313
|
});
|
1278
1314
|
var FuzzyMatcher = Matcher.extend({
|
1279
|
-
type:
|
1280
|
-
options:
|
1315
|
+
type: import_zod14.z.literal("fuzzy"),
|
1316
|
+
options: import_zod14.z.object({
|
1281
1317
|
/**
|
1282
1318
|
* Names of length 3 or less characters = 0 edits allowed
|
1283
1319
|
* Names of length 4 - 6 characters = 1 edit allowed
|
1284
1320
|
* Names of length >7 characters = 2 edits allowed
|
1285
1321
|
*/
|
1286
|
-
fuzziness:
|
1287
|
-
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)
|
1288
1324
|
}).optional().default({})
|
1289
1325
|
});
|
1290
1326
|
var StrictMatcher = Matcher.extend({
|
1291
|
-
type:
|
1292
|
-
options:
|
1293
|
-
boost:
|
1327
|
+
type: import_zod14.z.literal("strict"),
|
1328
|
+
options: import_zod14.z.object({
|
1329
|
+
boost: import_zod14.z.number().optional().default(1)
|
1294
1330
|
}).optional().default({})
|
1295
1331
|
});
|
1296
1332
|
var DateRangeMatcher = Matcher.extend({
|
1297
|
-
type:
|
1298
|
-
options:
|
1299
|
-
days:
|
1333
|
+
type: import_zod14.z.literal("dateRange"),
|
1334
|
+
options: import_zod14.z.object({
|
1335
|
+
days: import_zod14.z.number(),
|
1300
1336
|
origin: FieldReference2,
|
1301
|
-
boost:
|
1337
|
+
boost: import_zod14.z.number().optional().default(1)
|
1302
1338
|
})
|
1303
1339
|
});
|
1304
1340
|
var DateDistanceMatcher = Matcher.extend({
|
1305
|
-
type:
|
1306
|
-
options:
|
1307
|
-
days:
|
1341
|
+
type: import_zod14.z.literal("dateDistance"),
|
1342
|
+
options: import_zod14.z.object({
|
1343
|
+
days: import_zod14.z.number(),
|
1308
1344
|
origin: FieldReference2,
|
1309
|
-
boost:
|
1345
|
+
boost: import_zod14.z.number().optional().default(1)
|
1310
1346
|
})
|
1311
1347
|
});
|
1312
|
-
var And =
|
1313
|
-
type:
|
1348
|
+
var And = import_zod14.z.object({
|
1349
|
+
type: import_zod14.z.literal("and"),
|
1314
1350
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1315
|
-
clauses:
|
1351
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1316
1352
|
});
|
1317
|
-
var Or =
|
1318
|
-
type:
|
1353
|
+
var Or = import_zod14.z.object({
|
1354
|
+
type: import_zod14.z.literal("or"),
|
1319
1355
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1320
|
-
clauses:
|
1356
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1321
1357
|
});
|
1322
|
-
var Clause =
|
1323
|
-
() =>
|
1358
|
+
var Clause = import_zod14.z.lazy(
|
1359
|
+
() => import_zod14.z.discriminatedUnion("type", [
|
1324
1360
|
And,
|
1325
1361
|
Or,
|
1326
1362
|
FuzzyMatcher,
|
@@ -1331,43 +1367,43 @@ var Clause = import_zod13.z.lazy(
|
|
1331
1367
|
).openapi({
|
1332
1368
|
ref: "Clause"
|
1333
1369
|
});
|
1334
|
-
var DeduplicationConfig =
|
1335
|
-
id:
|
1370
|
+
var DeduplicationConfig = import_zod14.z.object({
|
1371
|
+
id: import_zod14.z.string(),
|
1336
1372
|
label: TranslationConfig,
|
1337
1373
|
query: Clause
|
1338
1374
|
});
|
1339
1375
|
|
1340
1376
|
// ../commons/src/events/SummaryConfig.ts
|
1341
|
-
var
|
1342
|
-
var BaseField2 =
|
1377
|
+
var import_zod15 = require("zod");
|
1378
|
+
var BaseField2 = import_zod15.z.object({
|
1343
1379
|
emptyValueMessage: TranslationConfig.optional(),
|
1344
|
-
conditionals:
|
1380
|
+
conditionals: import_zod15.z.array(ShowConditional).default([]).optional()
|
1345
1381
|
});
|
1346
1382
|
var ReferenceField = BaseField2.extend({
|
1347
|
-
fieldId:
|
1383
|
+
fieldId: import_zod15.z.string(),
|
1348
1384
|
label: TranslationConfig.optional().describe(
|
1349
1385
|
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1350
1386
|
)
|
1351
1387
|
}).describe("Field directly referencing event data with field id");
|
1352
1388
|
var Field = BaseField2.extend({
|
1353
|
-
id:
|
1389
|
+
id: import_zod15.z.string().describe("Id of summary field"),
|
1354
1390
|
value: TranslationConfig.describe(
|
1355
1391
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1356
1392
|
),
|
1357
1393
|
label: TranslationConfig
|
1358
1394
|
}).describe("Custom configured field");
|
1359
|
-
var SummaryConfig =
|
1360
|
-
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.")
|
1361
1397
|
}).describe("Configuration for summary in event.");
|
1362
1398
|
|
1363
1399
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1364
|
-
var
|
1365
|
-
var MatchType =
|
1366
|
-
var BaseField3 =
|
1367
|
-
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({
|
1368
1404
|
type: MatchType.describe("Determines the type of field")
|
1369
1405
|
}),
|
1370
|
-
options:
|
1406
|
+
options: import_zod16.z.array(SelectOption).optional(),
|
1371
1407
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1372
1408
|
`
|
1373
1409
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
@@ -1388,7 +1424,7 @@ var BaseField3 = import_zod15.z.object({
|
|
1388
1424
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1389
1425
|
`
|
1390
1426
|
),
|
1391
|
-
conditionals:
|
1427
|
+
conditionals: import_zod16.z.array(FieldConditional).default([]).optional().describe(
|
1392
1428
|
`
|
1393
1429
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1394
1430
|
|
@@ -1402,30 +1438,30 @@ var BaseField3 = import_zod15.z.object({
|
|
1402
1438
|
are always rendered in the advanced search form.
|
1403
1439
|
`
|
1404
1440
|
),
|
1405
|
-
validations:
|
1441
|
+
validations: import_zod16.z.array(ValidationConfig).default([]).optional().describe(
|
1406
1442
|
`In advanced search, we sometimes need to override the default field validations.`
|
1407
1443
|
)
|
1408
1444
|
});
|
1409
|
-
var SearchQueryParams =
|
1410
|
-
eventType:
|
1445
|
+
var SearchQueryParams = import_zod16.z.object({
|
1446
|
+
eventType: import_zod16.z.string().optional().describe(
|
1411
1447
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1412
1448
|
)
|
1413
1449
|
}).catchall(FieldValue);
|
1414
1450
|
var FieldConfigSchema = BaseField3.extend({
|
1415
|
-
fieldId:
|
1416
|
-
fieldType:
|
1417
|
-
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(
|
1418
1454
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1419
1455
|
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1420
1456
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1421
1457
|
),
|
1422
|
-
excludeInSearchQuery:
|
1458
|
+
excludeInSearchQuery: import_zod16.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1423
1459
|
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1424
1460
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1425
1461
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1426
1462
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1427
1463
|
});
|
1428
|
-
var EventFieldIdInput =
|
1464
|
+
var EventFieldIdInput = import_zod16.z.enum([
|
1429
1465
|
"trackingId",
|
1430
1466
|
"status",
|
1431
1467
|
"legalStatuses.REGISTERED.acceptedAt",
|
@@ -1433,7 +1469,7 @@ var EventFieldIdInput = import_zod15.z.enum([
|
|
1433
1469
|
"updatedAt"
|
1434
1470
|
]);
|
1435
1471
|
var METADATA_FIELD_PREFIX = "event.";
|
1436
|
-
var EventFieldId =
|
1472
|
+
var EventFieldId = import_zod16.z.enum([
|
1437
1473
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
1438
1474
|
`${METADATA_FIELD_PREFIX}status`,
|
1439
1475
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
@@ -1442,28 +1478,28 @@ var EventFieldId = import_zod15.z.enum([
|
|
1442
1478
|
]);
|
1443
1479
|
var EventFieldConfigSchema = BaseField3.extend({
|
1444
1480
|
fieldId: EventFieldId,
|
1445
|
-
fieldType:
|
1481
|
+
fieldType: import_zod16.z.literal("event")
|
1446
1482
|
});
|
1447
|
-
var SearchField =
|
1483
|
+
var SearchField = import_zod16.z.discriminatedUnion("fieldType", [
|
1448
1484
|
FieldConfigSchema,
|
1449
1485
|
EventFieldConfigSchema
|
1450
1486
|
]);
|
1451
|
-
var AdvancedSearchConfig =
|
1487
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
1452
1488
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1453
|
-
fields:
|
1489
|
+
fields: import_zod16.z.array(SearchField).describe("Advanced search fields.")
|
1454
1490
|
});
|
1455
1491
|
|
1456
1492
|
// ../commons/src/events/utils.ts
|
1457
1493
|
var import_lodash = require("lodash");
|
1458
1494
|
|
1459
1495
|
// ../commons/src/events/ActionDocument.ts
|
1460
|
-
var
|
1496
|
+
var import_zod20 = require("zod");
|
1461
1497
|
var import_zod_openapi8 = require("zod-openapi");
|
1462
1498
|
|
1463
1499
|
// ../commons/src/uuid.ts
|
1464
1500
|
var import_uuid = require("uuid");
|
1465
|
-
var
|
1466
|
-
var UUID =
|
1501
|
+
var import_zod17 = require("zod");
|
1502
|
+
var UUID = import_zod17.z.string().uuid().brand("UUID");
|
1467
1503
|
function getUUID() {
|
1468
1504
|
return (0, import_uuid.v4)();
|
1469
1505
|
}
|
@@ -1473,10 +1509,10 @@ var CreatedAtLocation = UUID.nullish();
|
|
1473
1509
|
|
1474
1510
|
// ../commons/src/authentication.ts
|
1475
1511
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1476
|
-
var
|
1512
|
+
var import_zod19 = require("zod");
|
1477
1513
|
|
1478
1514
|
// ../commons/src/scopes.ts
|
1479
|
-
var
|
1515
|
+
var import_zod18 = require("zod");
|
1480
1516
|
var SCOPES = {
|
1481
1517
|
// TODO v1.8 legacy scopes
|
1482
1518
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -1589,108 +1625,108 @@ var SCOPES = {
|
|
1589
1625
|
// data seeding
|
1590
1626
|
USER_DATA_SEEDING: "user.data-seeding"
|
1591
1627
|
};
|
1592
|
-
var LegacyScopes =
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
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)
|
1604
1640
|
]);
|
1605
|
-
var IntegrationScopes =
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
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)
|
1610
1646
|
]);
|
1611
|
-
var DeclareScopes =
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
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)
|
1622
1658
|
]);
|
1623
|
-
var UnassignScope =
|
1624
|
-
var ValidateScopes =
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
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)
|
1631
1667
|
]);
|
1632
|
-
var RegisterScope =
|
1633
|
-
var CertifyScopes =
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
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)
|
1642
1678
|
]);
|
1643
|
-
var CorrectionScopes =
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
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)
|
1652
1688
|
]);
|
1653
|
-
var SearchScopes =
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
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)
|
1660
1696
|
]);
|
1661
|
-
var AuditScopes =
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
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)
|
1666
1702
|
]);
|
1667
|
-
var ProfileScopes =
|
1668
|
-
|
1669
|
-
|
1703
|
+
var ProfileScopes = import_zod18.z.union([
|
1704
|
+
import_zod18.z.literal(SCOPES.PROFILE_UPDATE),
|
1705
|
+
import_zod18.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1670
1706
|
]);
|
1671
|
-
var PerformanceScopes =
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
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)
|
1675
1711
|
]);
|
1676
|
-
var OrganisationScopes =
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
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)
|
1680
1716
|
]);
|
1681
|
-
var UserScopes =
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
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)
|
1690
1726
|
]);
|
1691
|
-
var ConfigScope =
|
1692
|
-
var DataSeedingScope =
|
1693
|
-
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([
|
1694
1730
|
LegacyScopes,
|
1695
1731
|
IntegrationScopes,
|
1696
1732
|
UnassignScope,
|
@@ -1709,39 +1745,39 @@ var LiteralScopes = import_zod17.z.union([
|
|
1709
1745
|
DataSeedingScope
|
1710
1746
|
]);
|
1711
1747
|
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1712
|
-
var rawConfigurableScope =
|
1713
|
-
var CreateUserScope =
|
1714
|
-
type:
|
1715
|
-
options:
|
1716
|
-
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())
|
1717
1753
|
})
|
1718
1754
|
});
|
1719
|
-
var EditUserScope =
|
1720
|
-
type:
|
1721
|
-
options:
|
1722
|
-
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())
|
1723
1759
|
})
|
1724
1760
|
});
|
1725
|
-
var WorkqueueScope =
|
1726
|
-
type:
|
1727
|
-
options:
|
1728
|
-
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())
|
1729
1765
|
})
|
1730
1766
|
});
|
1731
|
-
var NotifyRecordScope =
|
1732
|
-
type:
|
1733
|
-
options:
|
1734
|
-
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())
|
1735
1771
|
})
|
1736
1772
|
});
|
1737
|
-
var SearchScope =
|
1738
|
-
type:
|
1739
|
-
options:
|
1740
|
-
event:
|
1741
|
-
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)
|
1742
1778
|
})
|
1743
1779
|
});
|
1744
|
-
var ConfigurableRawScopes =
|
1780
|
+
var ConfigurableRawScopes = import_zod18.z.discriminatedUnion("type", [
|
1745
1781
|
SearchScope,
|
1746
1782
|
CreateUserScope,
|
1747
1783
|
EditUserScope,
|
@@ -1749,7 +1785,7 @@ var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
|
|
1749
1785
|
NotifyRecordScope
|
1750
1786
|
]);
|
1751
1787
|
var scopes = Object.values(SCOPES);
|
1752
|
-
var ActionScopes =
|
1788
|
+
var ActionScopes = import_zod18.z.union([
|
1753
1789
|
DeclareScopes,
|
1754
1790
|
ValidateScopes,
|
1755
1791
|
RegisterScope,
|
@@ -1900,30 +1936,30 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
1900
1936
|
]
|
1901
1937
|
}
|
1902
1938
|
];
|
1903
|
-
var TokenUserType =
|
1904
|
-
var TokenWithBearer =
|
1939
|
+
var TokenUserType = import_zod19.z.enum(["user", "system"]);
|
1940
|
+
var TokenWithBearer = import_zod19.z.string().regex(/^Bearer\s/);
|
1905
1941
|
|
1906
1942
|
// ../commons/src/events/ActionDocument.ts
|
1907
|
-
(0, import_zod_openapi8.extendZodWithOpenApi)(
|
1908
|
-
var ActionUpdate =
|
1909
|
-
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);
|
1910
1946
|
var ActionStatus = {
|
1911
1947
|
Requested: "Requested",
|
1912
1948
|
Accepted: "Accepted",
|
1913
1949
|
Rejected: "Rejected"
|
1914
1950
|
};
|
1915
|
-
var ActionBase =
|
1951
|
+
var ActionBase = import_zod20.z.object({
|
1916
1952
|
id: UUID,
|
1917
|
-
transactionId:
|
1953
|
+
transactionId: import_zod20.z.string(),
|
1918
1954
|
createdByUserType: TokenUserType,
|
1919
|
-
createdAt:
|
1920
|
-
createdBy:
|
1921
|
-
createdByRole:
|
1922
|
-
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"),
|
1923
1959
|
createdAtLocation: CreatedAtLocation,
|
1924
1960
|
declaration: ActionUpdate,
|
1925
1961
|
annotation: ActionUpdate.optional().nullable(),
|
1926
|
-
status:
|
1962
|
+
status: import_zod20.z.enum([
|
1927
1963
|
ActionStatus.Requested,
|
1928
1964
|
ActionStatus.Accepted,
|
1929
1965
|
ActionStatus.Rejected
|
@@ -1937,102 +1973,102 @@ var ActionBase = import_zod19.z.object({
|
|
1937
1973
|
// See PrintCertificateAction
|
1938
1974
|
});
|
1939
1975
|
var AssignedAction = ActionBase.merge(
|
1940
|
-
|
1941
|
-
type:
|
1942
|
-
assignedTo:
|
1976
|
+
import_zod20.z.object({
|
1977
|
+
type: import_zod20.z.literal(ActionType.ASSIGN),
|
1978
|
+
assignedTo: import_zod20.z.string()
|
1943
1979
|
// TODO move into 'content' property
|
1944
1980
|
})
|
1945
1981
|
);
|
1946
1982
|
var UnassignedAction = ActionBase.merge(
|
1947
|
-
|
1948
|
-
type:
|
1983
|
+
import_zod20.z.object({
|
1984
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN)
|
1949
1985
|
})
|
1950
1986
|
);
|
1951
1987
|
var RegisterAction = ActionBase.merge(
|
1952
|
-
|
1953
|
-
type:
|
1954
|
-
registrationNumber:
|
1988
|
+
import_zod20.z.object({
|
1989
|
+
type: import_zod20.z.literal(ActionType.REGISTER),
|
1990
|
+
registrationNumber: import_zod20.z.string().optional()
|
1955
1991
|
// TODO move into 'content' property
|
1956
1992
|
})
|
1957
1993
|
);
|
1958
1994
|
var DeclareAction = ActionBase.merge(
|
1959
|
-
|
1960
|
-
type:
|
1995
|
+
import_zod20.z.object({
|
1996
|
+
type: import_zod20.z.literal(ActionType.DECLARE)
|
1961
1997
|
})
|
1962
1998
|
);
|
1963
1999
|
var ValidateAction = ActionBase.merge(
|
1964
|
-
|
1965
|
-
type:
|
2000
|
+
import_zod20.z.object({
|
2001
|
+
type: import_zod20.z.literal(ActionType.VALIDATE)
|
1966
2002
|
})
|
1967
2003
|
);
|
1968
|
-
var RejectionReason =
|
1969
|
-
message:
|
1970
|
-
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")
|
1971
2007
|
});
|
1972
2008
|
var RejectAction = ActionBase.merge(
|
1973
|
-
|
1974
|
-
type:
|
2009
|
+
import_zod20.z.object({
|
2010
|
+
type: import_zod20.z.literal(ActionType.REJECT),
|
1975
2011
|
reason: RejectionReason
|
1976
2012
|
// TODO move into 'content' property
|
1977
2013
|
})
|
1978
2014
|
);
|
1979
2015
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1980
|
-
|
1981
|
-
type:
|
2016
|
+
import_zod20.z.object({
|
2017
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1982
2018
|
})
|
1983
2019
|
);
|
1984
2020
|
var ArchiveAction = ActionBase.merge(
|
1985
|
-
|
1986
|
-
type:
|
2021
|
+
import_zod20.z.object({
|
2022
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE),
|
1987
2023
|
reason: RejectionReason
|
1988
2024
|
// TODO move into 'content' property
|
1989
2025
|
})
|
1990
2026
|
);
|
1991
2027
|
var CreatedAction = ActionBase.merge(
|
1992
|
-
|
1993
|
-
type:
|
2028
|
+
import_zod20.z.object({
|
2029
|
+
type: import_zod20.z.literal(ActionType.CREATE)
|
1994
2030
|
})
|
1995
2031
|
);
|
1996
2032
|
var NotifiedAction = ActionBase.merge(
|
1997
|
-
|
1998
|
-
type:
|
2033
|
+
import_zod20.z.object({
|
2034
|
+
type: import_zod20.z.literal(ActionType.NOTIFY)
|
1999
2035
|
})
|
2000
2036
|
);
|
2001
|
-
var PrintContent =
|
2002
|
-
templateId:
|
2037
|
+
var PrintContent = import_zod20.z.object({
|
2038
|
+
templateId: import_zod20.z.string().optional()
|
2003
2039
|
});
|
2004
2040
|
var PrintCertificateAction = ActionBase.merge(
|
2005
|
-
|
2006
|
-
type:
|
2041
|
+
import_zod20.z.object({
|
2042
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE),
|
2007
2043
|
content: PrintContent.optional().nullable()
|
2008
2044
|
})
|
2009
2045
|
);
|
2010
2046
|
var RequestedCorrectionAction = ActionBase.merge(
|
2011
|
-
|
2012
|
-
type:
|
2047
|
+
import_zod20.z.object({
|
2048
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION)
|
2013
2049
|
})
|
2014
2050
|
);
|
2015
2051
|
var ApprovedCorrectionAction = ActionBase.merge(
|
2016
|
-
|
2017
|
-
type:
|
2018
|
-
requestId:
|
2052
|
+
import_zod20.z.object({
|
2053
|
+
type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION),
|
2054
|
+
requestId: import_zod20.z.string()
|
2019
2055
|
// TODO move into 'content' property
|
2020
2056
|
})
|
2021
2057
|
);
|
2022
2058
|
var RejectedCorrectionAction = ActionBase.merge(
|
2023
|
-
|
2024
|
-
type:
|
2025
|
-
requestId:
|
2059
|
+
import_zod20.z.object({
|
2060
|
+
type: import_zod20.z.literal(ActionType.REJECT_CORRECTION),
|
2061
|
+
requestId: import_zod20.z.string(),
|
2026
2062
|
// TODO move into 'content' property
|
2027
2063
|
reason: RejectionReason
|
2028
2064
|
})
|
2029
2065
|
);
|
2030
2066
|
var ReadAction = ActionBase.merge(
|
2031
|
-
|
2032
|
-
type:
|
2067
|
+
import_zod20.z.object({
|
2068
|
+
type: import_zod20.z.literal(ActionType.READ)
|
2033
2069
|
})
|
2034
2070
|
);
|
2035
|
-
var ActionDocument =
|
2071
|
+
var ActionDocument = import_zod20.z.discriminatedUnion("type", [
|
2036
2072
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
2037
2073
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
2038
2074
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -2055,20 +2091,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
2055
2091
|
declaration: true,
|
2056
2092
|
annotation: true
|
2057
2093
|
}).merge(
|
2058
|
-
|
2059
|
-
type:
|
2060
|
-
status:
|
2094
|
+
import_zod20.z.object({
|
2095
|
+
type: import_zod20.z.enum(ConfirmableActions),
|
2096
|
+
status: import_zod20.z.literal(ActionStatus.Rejected)
|
2061
2097
|
})
|
2062
2098
|
);
|
2063
|
-
var Action =
|
2064
|
-
var ResolvedUser =
|
2065
|
-
id:
|
2066
|
-
role:
|
2067
|
-
name:
|
2068
|
-
|
2069
|
-
use:
|
2070
|
-
given:
|
2071
|
-
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()
|
2072
2108
|
})
|
2073
2109
|
)
|
2074
2110
|
});
|
@@ -2079,7 +2115,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
2079
2115
|
var import_date_fns = require("date-fns");
|
2080
2116
|
|
2081
2117
|
// ../commons/src/events/FieldTypeMapping.ts
|
2082
|
-
var
|
2118
|
+
var import_zod21 = require("zod");
|
2083
2119
|
function mapFieldTypeToZod(type, required) {
|
2084
2120
|
let schema;
|
2085
2121
|
switch (type) {
|
@@ -2145,7 +2181,7 @@ function createValidationSchema(config) {
|
|
2145
2181
|
for (const field2 of config) {
|
2146
2182
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2147
2183
|
}
|
2148
|
-
return
|
2184
|
+
return import_zod21.z.object(shape);
|
2149
2185
|
}
|
2150
2186
|
function mapFieldTypeToEmptyValue(field2) {
|
2151
2187
|
switch (field2.type) {
|
@@ -2653,10 +2689,16 @@ function omitHiddenPaginatedFields(formConfig, declaration) {
|
|
2653
2689
|
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
2654
2690
|
return omitHiddenFields(visiblePagesFormFields, declaration);
|
2655
2691
|
}
|
2656
|
-
function
|
2657
|
-
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
|
+
);
|
2658
2698
|
const lastAction = actions[actions.length - 1];
|
2659
|
-
|
2699
|
+
const isDraftActive = draft.createdAt >= lastAction.createdAt;
|
2700
|
+
const isDraftForEvent = event2.id === draft.eventId;
|
2701
|
+
return isDraftActive && isDraftForEvent ? draft : void 0;
|
2660
2702
|
}
|
2661
2703
|
function createEmptyDraft(eventId, draftId, actionType) {
|
2662
2704
|
return {
|
@@ -2789,12 +2831,35 @@ function timePeriodToDateRange(value) {
|
|
2789
2831
|
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2790
2832
|
};
|
2791
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
|
+
}
|
2792
2857
|
|
2793
2858
|
// ../commons/src/events/EventConfig.ts
|
2794
2859
|
var import_zod_openapi9 = require("zod-openapi");
|
2795
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
2796
|
-
var EventConfig =
|
2797
|
-
id:
|
2860
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2861
|
+
var EventConfig = import_zod22.z.object({
|
2862
|
+
id: import_zod22.z.string().describe(
|
2798
2863
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2799
2864
|
),
|
2800
2865
|
dateOfEvent: FieldReference.optional(),
|
@@ -2804,10 +2869,10 @@ var EventConfig = import_zod21.z.object({
|
|
2804
2869
|
),
|
2805
2870
|
summary: SummaryConfig,
|
2806
2871
|
label: TranslationConfig,
|
2807
|
-
actions:
|
2872
|
+
actions: import_zod22.z.array(ActionConfig),
|
2808
2873
|
declaration: DeclarationFormConfig,
|
2809
|
-
deduplication:
|
2810
|
-
advancedSearch:
|
2874
|
+
deduplication: import_zod22.z.array(DeduplicationConfig).optional().default([]),
|
2875
|
+
advancedSearch: import_zod22.z.array(AdvancedSearchConfig).optional().default([])
|
2811
2876
|
}).superRefine((event2, ctx) => {
|
2812
2877
|
const allFields = findAllFields(event2);
|
2813
2878
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2891,12 +2956,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2891
2956
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2892
2957
|
|
2893
2958
|
// ../commons/src/events/WorkqueueConfig.ts
|
2894
|
-
var
|
2959
|
+
var import_zod29 = require("zod");
|
2895
2960
|
|
2896
2961
|
// ../commons/src/events/serializers/user/serializer.ts
|
2897
|
-
var
|
2898
|
-
var SerializedUserField =
|
2899
|
-
$userField:
|
2962
|
+
var import_zod23 = require("zod");
|
2963
|
+
var SerializedUserField = import_zod23.z.object({
|
2964
|
+
$userField: import_zod23.z.enum([
|
2900
2965
|
"id",
|
2901
2966
|
"name",
|
2902
2967
|
"role",
|
@@ -3385,11 +3450,11 @@ var event = Object.assign(eventFn, {
|
|
3385
3450
|
});
|
3386
3451
|
|
3387
3452
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3388
|
-
var
|
3453
|
+
var import_zod25 = require("zod");
|
3389
3454
|
|
3390
3455
|
// ../commons/src/events/EventMetadata.ts
|
3391
|
-
var
|
3392
|
-
var EventStatus =
|
3456
|
+
var import_zod24 = require("zod");
|
3457
|
+
var EventStatus = import_zod24.z.enum([
|
3393
3458
|
"CREATED",
|
3394
3459
|
"NOTIFIED",
|
3395
3460
|
"DECLARED",
|
@@ -3403,7 +3468,7 @@ var InherentFlags = {
|
|
3403
3468
|
REJECTED: "rejected",
|
3404
3469
|
CORRECTION_REQUESTED: "correction-requested"
|
3405
3470
|
};
|
3406
|
-
var ActionFlag =
|
3471
|
+
var ActionFlag = import_zod24.z.string().regex(
|
3407
3472
|
new RegExp(
|
3408
3473
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3409
3474
|
ActionStatus
|
@@ -3411,56 +3476,56 @@ var ActionFlag = import_zod23.z.string().regex(
|
|
3411
3476
|
),
|
3412
3477
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3413
3478
|
);
|
3414
|
-
var Flag = ActionFlag.or(
|
3415
|
-
var ZodDate =
|
3416
|
-
var ActionCreationMetadata =
|
3417
|
-
createdAt:
|
3418
|
-
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."),
|
3419
3484
|
createdAtLocation: CreatedAtLocation.describe(
|
3420
3485
|
"Location of the user who created the action request."
|
3421
3486
|
),
|
3422
|
-
createdByUserType:
|
3423
|
-
acceptedAt:
|
3424
|
-
createdByRole:
|
3425
|
-
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.")
|
3426
3491
|
});
|
3427
3492
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3428
|
-
registrationNumber:
|
3493
|
+
registrationNumber: import_zod24.z.string().describe(
|
3429
3494
|
"Registration number of the event. Always present for accepted registrations."
|
3430
3495
|
)
|
3431
3496
|
});
|
3432
|
-
var LegalStatuses =
|
3497
|
+
var LegalStatuses = import_zod24.z.object({
|
3433
3498
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3434
3499
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3435
3500
|
});
|
3436
|
-
var EventMetadata =
|
3501
|
+
var EventMetadata = import_zod24.z.object({
|
3437
3502
|
id: UUID,
|
3438
|
-
type:
|
3503
|
+
type: import_zod24.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3439
3504
|
status: EventStatus,
|
3440
3505
|
legalStatuses: LegalStatuses.describe(
|
3441
3506
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3442
3507
|
),
|
3443
|
-
createdAt:
|
3508
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3444
3509
|
dateOfEvent: ZodDate.nullish(),
|
3445
|
-
createdBy:
|
3446
|
-
createdByUserType:
|
3447
|
-
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."),
|
3448
3513
|
createdAtLocation: CreatedAtLocation.describe(
|
3449
3514
|
"Location of the user who created the event."
|
3450
3515
|
),
|
3451
|
-
createdBySignature:
|
3516
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the event."),
|
3452
3517
|
updatedAtLocation: UUID.nullish().describe(
|
3453
3518
|
"Location of the user who last changed the status."
|
3454
3519
|
),
|
3455
|
-
updatedAt:
|
3520
|
+
updatedAt: import_zod24.z.string().datetime().describe(
|
3456
3521
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3457
3522
|
),
|
3458
|
-
assignedTo:
|
3459
|
-
updatedBy:
|
3460
|
-
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(
|
3461
3526
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3462
3527
|
),
|
3463
|
-
flags:
|
3528
|
+
flags: import_zod24.z.array(Flag)
|
3464
3529
|
});
|
3465
3530
|
var EventMetadataKeysArray = [
|
3466
3531
|
"id",
|
@@ -3480,7 +3545,7 @@ var EventMetadataKeysArray = [
|
|
3480
3545
|
"legalStatuses",
|
3481
3546
|
"flags"
|
3482
3547
|
];
|
3483
|
-
var EventMetadataKeys =
|
3548
|
+
var EventMetadataKeys = import_zod24.z.enum(EventMetadataKeysArray);
|
3484
3549
|
var eventMetadataLabelMap = {
|
3485
3550
|
"event.assignedTo": {
|
3486
3551
|
id: "event.assignedTo.label",
|
@@ -3565,11 +3630,11 @@ var WorkqueueColumnKeysArray = [
|
|
3565
3630
|
"title",
|
3566
3631
|
"outbox"
|
3567
3632
|
];
|
3568
|
-
var WorkqueueColumnKeys =
|
3569
|
-
var WorkqueueColumnValue =
|
3633
|
+
var WorkqueueColumnKeys = import_zod25.z.enum(WorkqueueColumnKeysArray);
|
3634
|
+
var WorkqueueColumnValue = import_zod25.z.object({
|
3570
3635
|
$event: WorkqueueColumnKeys
|
3571
3636
|
});
|
3572
|
-
var WorkqueueColumn =
|
3637
|
+
var WorkqueueColumn = import_zod25.z.object({
|
3573
3638
|
label: TranslationConfig,
|
3574
3639
|
value: WorkqueueColumnValue
|
3575
3640
|
});
|
@@ -3580,120 +3645,120 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3580
3645
|
}
|
3581
3646
|
|
3582
3647
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3583
|
-
var
|
3648
|
+
var import_zod27 = require("zod");
|
3584
3649
|
|
3585
3650
|
// ../commons/src/events/EventIndex.ts
|
3586
|
-
var
|
3651
|
+
var import_zod26 = require("zod");
|
3587
3652
|
var import_zod_openapi10 = require("zod-openapi");
|
3588
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3653
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3589
3654
|
var EventIndex = EventMetadata.extend({
|
3590
3655
|
declaration: EventState
|
3591
3656
|
}).openapi({
|
3592
3657
|
ref: "EventIndex"
|
3593
3658
|
});
|
3594
|
-
var EventSearchIndex =
|
3595
|
-
|
3596
|
-
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()
|
3597
3662
|
// Ensures "type" (event-id) exists and is a string
|
3598
3663
|
})
|
3599
3664
|
).openapi({
|
3600
3665
|
ref: "EventSearchIndex"
|
3601
3666
|
});
|
3602
|
-
var Fuzzy =
|
3667
|
+
var Fuzzy = import_zod26.z.object({ type: import_zod26.z.literal("fuzzy"), term: import_zod26.z.string() }).openapi({
|
3603
3668
|
ref: "Fuzzy"
|
3604
3669
|
});
|
3605
|
-
var Exact =
|
3670
|
+
var Exact = import_zod26.z.object({ type: import_zod26.z.literal("exact"), term: import_zod26.z.string() }).openapi({
|
3606
3671
|
ref: "Exact"
|
3607
3672
|
});
|
3608
|
-
var ExactStatus =
|
3609
|
-
type:
|
3673
|
+
var ExactStatus = import_zod26.z.object({
|
3674
|
+
type: import_zod26.z.literal("exact"),
|
3610
3675
|
term: EventStatus
|
3611
3676
|
}).openapi({
|
3612
3677
|
ref: "ExactStatus"
|
3613
3678
|
});
|
3614
|
-
var ExactUserType =
|
3615
|
-
type:
|
3679
|
+
var ExactUserType = import_zod26.z.object({
|
3680
|
+
type: import_zod26.z.literal("exact"),
|
3616
3681
|
term: TokenUserType
|
3617
3682
|
}).openapi({
|
3618
3683
|
ref: "ExactUserType"
|
3619
3684
|
});
|
3620
|
-
var AnyOf =
|
3621
|
-
type:
|
3622
|
-
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())
|
3623
3688
|
}).openapi({
|
3624
3689
|
ref: "AnyOf"
|
3625
3690
|
});
|
3626
|
-
var AnyOfStatus =
|
3627
|
-
type:
|
3628
|
-
terms:
|
3691
|
+
var AnyOfStatus = import_zod26.z.object({
|
3692
|
+
type: import_zod26.z.literal("anyOf"),
|
3693
|
+
terms: import_zod26.z.array(EventStatus)
|
3629
3694
|
}).openapi({
|
3630
3695
|
ref: "AnyOfStatus"
|
3631
3696
|
});
|
3632
|
-
var Range =
|
3633
|
-
type:
|
3634
|
-
gte:
|
3635
|
-
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()
|
3636
3701
|
}).openapi({
|
3637
3702
|
ref: "Range"
|
3638
3703
|
});
|
3639
|
-
var ContainsFlags =
|
3640
|
-
anyOf:
|
3641
|
-
noneOf:
|
3704
|
+
var ContainsFlags = import_zod26.z.object({
|
3705
|
+
anyOf: import_zod26.z.array(Flag).optional(),
|
3706
|
+
noneOf: import_zod26.z.array(Flag).optional()
|
3642
3707
|
}).openapi({
|
3643
3708
|
ref: "ContainsFlags"
|
3644
3709
|
});
|
3645
|
-
var Within =
|
3710
|
+
var Within = import_zod26.z.object({ type: import_zod26.z.literal("within"), location: import_zod26.z.string() }).openapi({
|
3646
3711
|
ref: "Within"
|
3647
3712
|
});
|
3648
|
-
var RangeDate =
|
3649
|
-
type:
|
3650
|
-
gte:
|
3651
|
-
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())
|
3652
3717
|
}).openapi({ ref: "RangeDate" });
|
3653
3718
|
var ExactDate = Exact.extend({
|
3654
|
-
term:
|
3719
|
+
term: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3655
3720
|
}).openapi({
|
3656
3721
|
ref: "ExactDate"
|
3657
3722
|
});
|
3658
|
-
var TimePeriod =
|
3659
|
-
type:
|
3723
|
+
var TimePeriod = import_zod26.z.object({
|
3724
|
+
type: import_zod26.z.literal("timePeriod"),
|
3660
3725
|
term: SelectDateRangeValue
|
3661
3726
|
}).openapi({
|
3662
3727
|
ref: "TimePeriod"
|
3663
3728
|
});
|
3664
|
-
var DateCondition =
|
3729
|
+
var DateCondition = import_zod26.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3665
3730
|
ref: "DateCondition"
|
3666
3731
|
});
|
3667
|
-
var QueryInput =
|
3668
|
-
() =>
|
3669
|
-
|
3670
|
-
|
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)
|
3671
3736
|
])
|
3672
3737
|
).openapi({
|
3673
3738
|
ref: "QueryInput"
|
3674
3739
|
});
|
3675
|
-
var QueryExpression =
|
3676
|
-
id:
|
3677
|
-
eventType:
|
3678
|
-
status:
|
3679
|
-
createdAt:
|
3680
|
-
updatedAt:
|
3681
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
3682
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
3683
|
-
|
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])
|
3684
3749
|
),
|
3685
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3686
|
-
|
3750
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3751
|
+
import_zod26.z.union([Within, Exact])
|
3687
3752
|
),
|
3688
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3689
|
-
createdAtLocation:
|
3690
|
-
updatedAtLocation:
|
3691
|
-
assignedTo:
|
3692
|
-
createdByUserType:
|
3693
|
-
createdBy:
|
3694
|
-
updatedBy:
|
3695
|
-
trackingId:
|
3696
|
-
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),
|
3697
3762
|
// @todo: The type for this comes out as "any"
|
3698
3763
|
data: QueryInput
|
3699
3764
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
@@ -3701,9 +3766,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3701
3766
|
}).openapi({
|
3702
3767
|
ref: "QueryExpression"
|
3703
3768
|
});
|
3704
|
-
var QueryType =
|
3705
|
-
type:
|
3706
|
-
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(
|
3707
3772
|
(val) => {
|
3708
3773
|
if (typeof val === "string") {
|
3709
3774
|
return [JSON.parse(val)];
|
@@ -3713,7 +3778,7 @@ var QueryType = import_zod25.z.object({
|
|
3713
3778
|
}
|
3714
3779
|
return val;
|
3715
3780
|
},
|
3716
|
-
|
3781
|
+
import_zod26.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3717
3782
|
default: [
|
3718
3783
|
{
|
3719
3784
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3740,56 +3805,56 @@ var SearchScopeAccessLevels = {
|
|
3740
3805
|
};
|
3741
3806
|
|
3742
3807
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3743
|
-
var SerializableExact =
|
3744
|
-
type:
|
3745
|
-
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])
|
3746
3811
|
});
|
3747
|
-
var SerializableWithin =
|
3748
|
-
type:
|
3749
|
-
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])
|
3750
3815
|
});
|
3751
|
-
var SerializedQueryExpression =
|
3752
|
-
eventType:
|
3753
|
-
status:
|
3754
|
-
createdAt:
|
3755
|
-
updatedAt:
|
3756
|
-
"legalStatuses.REGISTERED.createdAt":
|
3757
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3758
|
-
|
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])
|
3759
3824
|
),
|
3760
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3761
|
-
createdAtLocation:
|
3762
|
-
|
3825
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod27.z.optional(Exact),
|
3826
|
+
createdAtLocation: import_zod27.z.optional(
|
3827
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3763
3828
|
),
|
3764
|
-
updatedAtLocation:
|
3765
|
-
|
3829
|
+
updatedAtLocation: import_zod27.z.optional(
|
3830
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3766
3831
|
),
|
3767
|
-
assignedTo:
|
3768
|
-
createdBy:
|
3832
|
+
assignedTo: import_zod27.z.optional(SerializableExact),
|
3833
|
+
createdBy: import_zod27.z.optional(SerializableExact),
|
3769
3834
|
createdByUserType: ExactUserType,
|
3770
|
-
updatedBy:
|
3771
|
-
trackingId:
|
3772
|
-
flags:
|
3835
|
+
updatedBy: import_zod27.z.optional(SerializableExact),
|
3836
|
+
trackingId: import_zod27.z.optional(Exact),
|
3837
|
+
flags: import_zod27.z.optional(ContainsFlags),
|
3773
3838
|
data: QueryInput
|
3774
3839
|
}).partial();
|
3775
|
-
var Or2 =
|
3776
|
-
type:
|
3777
|
-
clauses:
|
3840
|
+
var Or2 = import_zod27.z.object({
|
3841
|
+
type: import_zod27.z.literal("or"),
|
3842
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3778
3843
|
});
|
3779
|
-
var And2 =
|
3780
|
-
type:
|
3781
|
-
clauses:
|
3844
|
+
var And2 = import_zod27.z.object({
|
3845
|
+
type: import_zod27.z.literal("and"),
|
3846
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3782
3847
|
});
|
3783
|
-
var CountryConfigQueryType =
|
3784
|
-
var CountryConfigQueryInputType =
|
3848
|
+
var CountryConfigQueryType = import_zod27.z.discriminatedUnion("type", [And2, Or2]);
|
3849
|
+
var CountryConfigQueryInputType = import_zod27.z.union([
|
3785
3850
|
SerializedQueryExpression,
|
3786
3851
|
And2,
|
3787
3852
|
Or2
|
3788
3853
|
]);
|
3789
3854
|
|
3790
3855
|
// ../commons/src/icons.ts
|
3791
|
-
var
|
3792
|
-
var AvailableIcons =
|
3856
|
+
var import_zod28 = require("zod");
|
3857
|
+
var AvailableIcons = import_zod28.z.enum([
|
3793
3858
|
"Archived",
|
3794
3859
|
"Assigned",
|
3795
3860
|
"Certified",
|
@@ -3910,23 +3975,23 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3910
3975
|
value: event.field("updatedAt")
|
3911
3976
|
}
|
3912
3977
|
]);
|
3913
|
-
var WorkqueueActionsWithDefault =
|
3978
|
+
var WorkqueueActionsWithDefault = import_zod29.z.enum([
|
3914
3979
|
...workqueueActions.options,
|
3915
3980
|
"DEFAULT"
|
3916
3981
|
]);
|
3917
|
-
var WorkqueueConfig =
|
3918
|
-
slug:
|
3982
|
+
var WorkqueueConfig = import_zod29.z.object({
|
3983
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3919
3984
|
name: TranslationConfig.describe(
|
3920
3985
|
"Title of the workflow (both in navigation and on the page)"
|
3921
3986
|
),
|
3922
3987
|
query: CountryConfigQueryType,
|
3923
|
-
actions:
|
3924
|
-
|
3988
|
+
actions: import_zod29.z.array(
|
3989
|
+
import_zod29.z.object({
|
3925
3990
|
type: WorkqueueActionsWithDefault,
|
3926
|
-
conditionals:
|
3991
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3927
3992
|
})
|
3928
3993
|
),
|
3929
|
-
columns:
|
3994
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3930
3995
|
icon: AvailableIcons,
|
3931
3996
|
emptyMessage: TranslationConfig.optional()
|
3932
3997
|
}).describe("Configuration for workqueue.");
|
@@ -3934,19 +3999,19 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
3934
3999
|
query: true,
|
3935
4000
|
columns: true
|
3936
4001
|
});
|
3937
|
-
var WorkqueueConfigInput =
|
3938
|
-
slug:
|
4002
|
+
var WorkqueueConfigInput = import_zod29.z.object({
|
4003
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3939
4004
|
name: TranslationConfig.describe(
|
3940
4005
|
"Title of the workflow (both in navigation and on the page)"
|
3941
4006
|
),
|
3942
4007
|
query: CountryConfigQueryInputType,
|
3943
|
-
actions:
|
3944
|
-
|
4008
|
+
actions: import_zod29.z.array(
|
4009
|
+
import_zod29.z.object({
|
3945
4010
|
type: WorkqueueActionsWithDefault,
|
3946
|
-
conditionals:
|
4011
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3947
4012
|
})
|
3948
4013
|
),
|
3949
|
-
columns:
|
4014
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3950
4015
|
icon: AvailableIcons,
|
3951
4016
|
emptyMessage: TranslationConfig.optional()
|
3952
4017
|
});
|
@@ -3958,10 +4023,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3958
4023
|
function defineWorkqueues(workqueues) {
|
3959
4024
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3960
4025
|
}
|
3961
|
-
var WorkqueueCountInput =
|
3962
|
-
|
4026
|
+
var WorkqueueCountInput = import_zod29.z.array(
|
4027
|
+
import_zod29.z.object({ slug: import_zod29.z.string(), query: QueryType })
|
3963
4028
|
);
|
3964
|
-
var WorkqueueCountOutput =
|
4029
|
+
var WorkqueueCountOutput = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.number());
|
3965
4030
|
|
3966
4031
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3967
4032
|
var defaultWorkqueueColumns = [
|
@@ -3984,42 +4049,42 @@ var defaultWorkqueueColumns = [
|
|
3984
4049
|
];
|
3985
4050
|
|
3986
4051
|
// ../commons/src/events/Draft.ts
|
3987
|
-
var
|
4052
|
+
var import_zod31 = require("zod");
|
3988
4053
|
|
3989
4054
|
// ../commons/src/events/ActionInput.ts
|
3990
|
-
var
|
4055
|
+
var import_zod30 = require("zod");
|
3991
4056
|
var import_zod_openapi11 = require("zod-openapi");
|
3992
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
3993
|
-
var BaseActionInput =
|
4057
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod30.z);
|
4058
|
+
var BaseActionInput = import_zod30.z.object({
|
3994
4059
|
eventId: UUID,
|
3995
|
-
transactionId:
|
4060
|
+
transactionId: import_zod30.z.string(),
|
3996
4061
|
declaration: ActionUpdate.default({}),
|
3997
4062
|
annotation: ActionUpdate.optional(),
|
3998
4063
|
originalActionId: UUID.optional(),
|
3999
4064
|
// should not be part of base action.
|
4000
|
-
keepAssignment:
|
4065
|
+
keepAssignment: import_zod30.z.boolean().optional()
|
4001
4066
|
});
|
4002
4067
|
var CreateActionInput = BaseActionInput.merge(
|
4003
|
-
|
4004
|
-
type:
|
4068
|
+
import_zod30.z.object({
|
4069
|
+
type: import_zod30.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
4005
4070
|
createdAtLocation: CreatedAtLocation
|
4006
4071
|
})
|
4007
4072
|
);
|
4008
4073
|
var RegisterActionInput = BaseActionInput.merge(
|
4009
|
-
|
4010
|
-
type:
|
4011
|
-
registrationNumber:
|
4074
|
+
import_zod30.z.object({
|
4075
|
+
type: import_zod30.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
4076
|
+
registrationNumber: import_zod30.z.string().optional()
|
4012
4077
|
})
|
4013
4078
|
).strict();
|
4014
4079
|
var ValidateActionInput = BaseActionInput.merge(
|
4015
|
-
|
4016
|
-
type:
|
4017
|
-
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())
|
4018
4083
|
})
|
4019
4084
|
);
|
4020
4085
|
var NotifyActionInput = BaseActionInput.merge(
|
4021
|
-
|
4022
|
-
type:
|
4086
|
+
import_zod30.z.object({
|
4087
|
+
type: import_zod30.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
4023
4088
|
})
|
4024
4089
|
).openapi({
|
4025
4090
|
default: {
|
@@ -4031,70 +4096,70 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
4031
4096
|
}
|
4032
4097
|
});
|
4033
4098
|
var DeclareActionInput = BaseActionInput.merge(
|
4034
|
-
|
4035
|
-
type:
|
4099
|
+
import_zod30.z.object({
|
4100
|
+
type: import_zod30.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
4036
4101
|
})
|
4037
4102
|
);
|
4038
4103
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
4039
|
-
|
4040
|
-
type:
|
4104
|
+
import_zod30.z.object({
|
4105
|
+
type: import_zod30.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
4041
4106
|
content: PrintContent.optional()
|
4042
4107
|
})
|
4043
4108
|
);
|
4044
4109
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
4045
|
-
|
4046
|
-
type:
|
4110
|
+
import_zod30.z.object({
|
4111
|
+
type: import_zod30.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
4047
4112
|
reason: RejectionReason
|
4048
4113
|
})
|
4049
4114
|
);
|
4050
4115
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
4051
|
-
|
4052
|
-
type:
|
4116
|
+
import_zod30.z.object({
|
4117
|
+
type: import_zod30.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
4053
4118
|
})
|
4054
4119
|
);
|
4055
4120
|
var ArchiveActionInput = BaseActionInput.merge(
|
4056
|
-
|
4057
|
-
type:
|
4121
|
+
import_zod30.z.object({
|
4122
|
+
type: import_zod30.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
4058
4123
|
reason: RejectionReason
|
4059
4124
|
})
|
4060
4125
|
);
|
4061
4126
|
var AssignActionInput = BaseActionInput.merge(
|
4062
|
-
|
4063
|
-
type:
|
4064
|
-
assignedTo:
|
4127
|
+
import_zod30.z.object({
|
4128
|
+
type: import_zod30.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
4129
|
+
assignedTo: import_zod30.z.string()
|
4065
4130
|
})
|
4066
4131
|
);
|
4067
4132
|
var UnassignActionInput = BaseActionInput.merge(
|
4068
|
-
|
4069
|
-
type:
|
4070
|
-
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)
|
4071
4136
|
})
|
4072
4137
|
);
|
4073
4138
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
4074
|
-
|
4075
|
-
type:
|
4139
|
+
import_zod30.z.object({
|
4140
|
+
type: import_zod30.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
4076
4141
|
})
|
4077
4142
|
);
|
4078
4143
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
4079
|
-
|
4080
|
-
requestId:
|
4081
|
-
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),
|
4082
4147
|
reason: RejectionReason
|
4083
4148
|
})
|
4084
4149
|
);
|
4085
4150
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
4086
|
-
|
4087
|
-
requestId:
|
4088
|
-
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)
|
4089
4154
|
})
|
4090
4155
|
);
|
4091
4156
|
var ReadActionInput = BaseActionInput.merge(
|
4092
|
-
|
4093
|
-
type:
|
4157
|
+
import_zod30.z.object({
|
4158
|
+
type: import_zod30.z.literal(ActionType.READ).default(ActionType.READ)
|
4094
4159
|
})
|
4095
4160
|
);
|
4096
|
-
var DeleteActionInput =
|
4097
|
-
var ActionInput =
|
4161
|
+
var DeleteActionInput = import_zod30.z.object({ eventId: UUID });
|
4162
|
+
var ActionInput = import_zod30.z.discriminatedUnion("type", [
|
4098
4163
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
4099
4164
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
4100
4165
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -4123,18 +4188,18 @@ var ActionInput = import_zod29.z.discriminatedUnion("type", [
|
|
4123
4188
|
});
|
4124
4189
|
|
4125
4190
|
// ../commons/src/events/Draft.ts
|
4126
|
-
var Draft =
|
4191
|
+
var Draft = import_zod31.z.object({
|
4127
4192
|
id: UUID,
|
4128
4193
|
eventId: UUID,
|
4129
|
-
transactionId:
|
4130
|
-
createdAt:
|
4194
|
+
transactionId: import_zod31.z.string(),
|
4195
|
+
createdAt: import_zod31.z.string().datetime(),
|
4131
4196
|
action: ActionBase.extend({
|
4132
|
-
type: ActionTypes
|
4197
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
|
4133
4198
|
}).omit({ id: true })
|
4134
4199
|
});
|
4135
4200
|
var DraftInput = BaseActionInput.extend({
|
4136
|
-
type: ActionTypes,
|
4137
|
-
status:
|
4201
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
|
4202
|
+
status: import_zod31.z.enum([
|
4138
4203
|
ActionStatus.Requested,
|
4139
4204
|
ActionStatus.Accepted,
|
4140
4205
|
ActionStatus.Rejected
|
@@ -4142,26 +4207,29 @@ var DraftInput = BaseActionInput.extend({
|
|
4142
4207
|
});
|
4143
4208
|
|
4144
4209
|
// ../commons/src/events/EventInput.ts
|
4145
|
-
var
|
4210
|
+
var import_zod32 = require("zod");
|
4146
4211
|
var import_uuid8 = require("uuid");
|
4147
|
-
var EventInput =
|
4148
|
-
transactionId:
|
4149
|
-
type:
|
4212
|
+
var EventInput = import_zod32.z.object({
|
4213
|
+
transactionId: import_zod32.z.string(),
|
4214
|
+
type: import_zod32.z.string()
|
4150
4215
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
4151
4216
|
|
4152
4217
|
// ../commons/src/events/EventDocument.ts
|
4153
|
-
var
|
4218
|
+
var import_zod33 = require("zod");
|
4154
4219
|
var import_zod_openapi12 = require("zod-openapi");
|
4155
|
-
(0, import_zod_openapi12.extendZodWithOpenApi)(
|
4156
|
-
var EventDocument =
|
4220
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod33.z);
|
4221
|
+
var EventDocument = import_zod33.z.object({
|
4157
4222
|
id: UUID,
|
4158
|
-
type:
|
4159
|
-
createdAt:
|
4160
|
-
updatedAt:
|
4161
|
-
actions:
|
4162
|
-
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()
|
4163
4228
|
}).openapi({ ref: "EventDocument" });
|
4164
4229
|
|
4230
|
+
// ../commons/src/events/state/index.ts
|
4231
|
+
var import_lodash3 = require("lodash");
|
4232
|
+
|
4165
4233
|
// ../commons/src/events/state/utils.ts
|
4166
4234
|
var import_lodash2 = require("lodash");
|
4167
4235
|
function getActionRequests(actionType, actions) {
|
@@ -4451,30 +4519,36 @@ function getCurrentEventState(event2, config) {
|
|
4451
4519
|
flags: getFlagsFromActions(event2.actions)
|
4452
4520
|
});
|
4453
4521
|
}
|
4454
|
-
function
|
4522
|
+
function dangerouslyGetCurrentEventStateWithDrafts({
|
4455
4523
|
event: event2,
|
4456
|
-
|
4524
|
+
draft,
|
4457
4525
|
configuration
|
4458
4526
|
}) {
|
4459
4527
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
4460
|
-
const
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
|
4465
|
-
|
4466
|
-
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
4473
|
-
|
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 = {
|
4474
4548
|
...event2,
|
4475
|
-
actions:
|
4549
|
+
actions: actionsWithDraft
|
4476
4550
|
};
|
4477
|
-
return getCurrentEventState(
|
4551
|
+
return getCurrentEventState(eventWithDraft, configuration);
|
4478
4552
|
}
|
4479
4553
|
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4480
4554
|
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
@@ -4488,18 +4562,13 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
4488
4562
|
declaration: updatedDeclaration
|
4489
4563
|
};
|
4490
4564
|
}
|
4491
|
-
function
|
4492
|
-
const indexedAt = eventIndex.updatedAt;
|
4493
|
-
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
4494
|
-
if (activeDrafts.length === 0) {
|
4495
|
-
return eventIndex;
|
4496
|
-
}
|
4565
|
+
function applyDraftToEventIndex(eventIndex, draft, eventConfiguration) {
|
4497
4566
|
return applyDeclarationToEventIndex(
|
4498
4567
|
{
|
4499
4568
|
...eventIndex,
|
4500
|
-
updatedAt:
|
4569
|
+
updatedAt: draft.createdAt
|
4501
4570
|
},
|
4502
|
-
|
4571
|
+
draft.action.declaration,
|
4503
4572
|
eventConfiguration
|
4504
4573
|
);
|
4505
4574
|
}
|
@@ -4513,18 +4582,17 @@ function getAnnotationFromDrafts(drafts) {
|
|
4513
4582
|
function getActionAnnotation({
|
4514
4583
|
event: event2,
|
4515
4584
|
actionType,
|
4516
|
-
|
4585
|
+
draft
|
4517
4586
|
}) {
|
4518
4587
|
const activeActions = getAcceptedActions(event2);
|
4519
|
-
const action = activeActions.
|
4520
|
-
|
4588
|
+
const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
|
4589
|
+
const matchingDraft = draft?.action.type === actionType ? draft : void 0;
|
4590
|
+
const sortedActions = (0, import_lodash3.orderBy)(
|
4591
|
+
[action, matchingDraft?.action].filter((a) => a !== void 0),
|
4592
|
+
"createdAt",
|
4593
|
+
"asc"
|
4521
4594
|
);
|
4522
|
-
const
|
4523
|
-
const sorted = [
|
4524
|
-
...action ? [action] : [],
|
4525
|
-
...eventDrafts.map((draft) => draft.action)
|
4526
|
-
].sort();
|
4527
|
-
const annotation = sorted.reduce((ann, sortedAction) => {
|
4595
|
+
const annotation = sortedActions.reduce((ann, sortedAction) => {
|
4528
4596
|
return deepMerge(ann, sortedAction.annotation ?? {});
|
4529
4597
|
}, {});
|
4530
4598
|
return deepDropNulls(annotation);
|
@@ -4542,23 +4610,23 @@ function generateTransactionId() {
|
|
4542
4610
|
}
|
4543
4611
|
|
4544
4612
|
// ../commons/src/events/User.ts
|
4545
|
-
var
|
4546
|
-
var User =
|
4547
|
-
id:
|
4548
|
-
name:
|
4549
|
-
|
4550
|
-
use:
|
4551
|
-
given:
|
4552
|
-
family:
|
4613
|
+
var import_zod34 = require("zod");
|
4614
|
+
var User = import_zod34.z.object({
|
4615
|
+
id: import_zod34.z.string(),
|
4616
|
+
name: import_zod34.z.array(
|
4617
|
+
import_zod34.z.object({
|
4618
|
+
use: import_zod34.z.string(),
|
4619
|
+
given: import_zod34.z.array(import_zod34.z.string()),
|
4620
|
+
family: import_zod34.z.string()
|
4553
4621
|
})
|
4554
4622
|
),
|
4555
|
-
role:
|
4623
|
+
role: import_zod34.z.string(),
|
4556
4624
|
avatar: FullDocumentPath.optional(),
|
4557
4625
|
signature: FullDocumentPath.optional()
|
4558
4626
|
});
|
4559
4627
|
|
4560
4628
|
// ../commons/src/events/test.utils.ts
|
4561
|
-
var
|
4629
|
+
var import_lodash4 = require("lodash");
|
4562
4630
|
var import_date_fns4 = require("date-fns");
|
4563
4631
|
|
4564
4632
|
// ../commons/src/field-config/field-configuration.ts
|
@@ -5741,44 +5809,41 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5741
5809
|
},
|
5742
5810
|
{
|
5743
5811
|
id: "identity-check",
|
5744
|
-
type: PageTypes.enum.
|
5812
|
+
type: PageTypes.enum.VERIFICATION,
|
5745
5813
|
title: {
|
5746
|
-
id: "event.
|
5747
|
-
defaultMessage: "Verify
|
5814
|
+
id: "v2.event.birth.action.correction.form.section.requester.identity.verify.title",
|
5815
|
+
defaultMessage: "Verify ID",
|
5748
5816
|
description: "This is the title of the section"
|
5749
5817
|
},
|
5750
|
-
fields: [
|
5751
|
-
|
5752
|
-
|
5753
|
-
type: "PAGE_HEADER",
|
5818
|
+
fields: [],
|
5819
|
+
actions: {
|
5820
|
+
verify: {
|
5754
5821
|
label: {
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5822
|
+
defaultMessage: "Verified",
|
5823
|
+
description: "This is the label for the verification button",
|
5824
|
+
id: "v2.event.birth.action.correction.form.verify"
|
5758
5825
|
}
|
5759
5826
|
},
|
5760
|
-
{
|
5761
|
-
id: "correction.identity-check.verified",
|
5762
|
-
type: "RADIO_GROUP",
|
5827
|
+
cancel: {
|
5763
5828
|
label: {
|
5764
|
-
|
5765
|
-
|
5766
|
-
|
5829
|
+
defaultMessage: "Identity does not match",
|
5830
|
+
description: "This is the label for the verification cancellation button",
|
5831
|
+
id: "v2.event.birth.action.correction.form.cancel"
|
5767
5832
|
},
|
5768
|
-
|
5769
|
-
|
5770
|
-
|
5771
|
-
|
5772
|
-
|
5773
|
-
|
5774
|
-
|
5775
|
-
|
5776
|
-
|
5777
|
-
|
5833
|
+
confirmation: {
|
5834
|
+
title: {
|
5835
|
+
defaultMessage: "Correct without proof of ID?",
|
5836
|
+
description: "This is the title for the verification cancellation modal",
|
5837
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.title"
|
5838
|
+
},
|
5839
|
+
body: {
|
5840
|
+
defaultMessage: "Please be aware that if you proceed, you will be responsible for making a change to this record without the necessary proof of identification",
|
5841
|
+
description: "This is the body for the verification cancellation modal",
|
5842
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.body"
|
5778
5843
|
}
|
5779
|
-
|
5844
|
+
}
|
5780
5845
|
}
|
5781
|
-
|
5846
|
+
}
|
5782
5847
|
},
|
5783
5848
|
{
|
5784
5849
|
id: "correction-request.supporting-documents",
|
@@ -6560,9 +6625,9 @@ var v2BirthEvent = defineConfig({
|
|
6560
6625
|
});
|
6561
6626
|
|
6562
6627
|
// ../commons/src/events/test.utils.ts
|
6563
|
-
var
|
6628
|
+
var import_zod35 = require("zod");
|
6564
6629
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6565
|
-
var TestUserRole =
|
6630
|
+
var TestUserRole = import_zod35.z.enum([
|
6566
6631
|
"FIELD_AGENT",
|
6567
6632
|
"LOCAL_REGISTRAR",
|
6568
6633
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6727,7 +6792,7 @@ function eventPayloadGenerator(rng) {
|
|
6727
6792
|
eventId,
|
6728
6793
|
actionType,
|
6729
6794
|
annotation
|
6730
|
-
}, input = {}) => (0,
|
6795
|
+
}, input = {}) => (0, import_lodash4.merge)(
|
6731
6796
|
{
|
6732
6797
|
id: getUUID(),
|
6733
6798
|
eventId,
|
@@ -6752,6 +6817,7 @@ function eventPayloadGenerator(rng) {
|
|
6752
6817
|
annotation: {
|
6753
6818
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
6754
6819
|
"correction.request.reason": "Child's name was incorrect",
|
6820
|
+
"identity-check": true,
|
6755
6821
|
...annotation
|
6756
6822
|
},
|
6757
6823
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -6786,13 +6852,13 @@ function eventPayloadGenerator(rng) {
|
|
6786
6852
|
notify: (eventId, input = {}) => {
|
6787
6853
|
let declaration = input.declaration;
|
6788
6854
|
if (!declaration) {
|
6789
|
-
const partialDeclaration = (0,
|
6855
|
+
const partialDeclaration = (0, import_lodash4.omitBy)(
|
6790
6856
|
generateActionDeclarationInput(
|
6791
6857
|
tennisClubMembershipEvent,
|
6792
6858
|
ActionType.DECLARE,
|
6793
6859
|
rng
|
6794
6860
|
),
|
6795
|
-
|
6861
|
+
import_lodash4.isString
|
6796
6862
|
);
|
6797
6863
|
declaration = partialDeclaration;
|
6798
6864
|
}
|
@@ -6839,7 +6905,6 @@ function eventPayloadGenerator(rng) {
|
|
6839
6905
|
type: ActionType.ARCHIVE,
|
6840
6906
|
transactionId: input.transactionId ?? getUUID(),
|
6841
6907
|
declaration: {},
|
6842
|
-
// @TODO: Check whether generator is needed?
|
6843
6908
|
annotation: {},
|
6844
6909
|
duplicates: [],
|
6845
6910
|
eventId,
|
@@ -6895,7 +6960,7 @@ function eventPayloadGenerator(rng) {
|
|
6895
6960
|
request: (eventId, input = {}) => ({
|
6896
6961
|
type: ActionType.REQUEST_CORRECTION,
|
6897
6962
|
transactionId: input.transactionId ?? getUUID(),
|
6898
|
-
declaration: input.declaration ?? (0,
|
6963
|
+
declaration: input.declaration ?? (0, import_lodash4.omit)(
|
6899
6964
|
generateActionDeclarationInput(
|
6900
6965
|
tennisClubMembershipEvent,
|
6901
6966
|
ActionType.REQUEST_CORRECTION,
|
@@ -7053,7 +7118,8 @@ function generateEventDraftDocument({
|
|
7053
7118
|
declaration: {
|
7054
7119
|
...action.declaration,
|
7055
7120
|
...declaration
|
7056
|
-
}
|
7121
|
+
},
|
7122
|
+
annotation: action.annotation
|
7057
7123
|
},
|
7058
7124
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
7059
7125
|
eventId
|
@@ -7160,7 +7226,12 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
7160
7226
|
type: "and",
|
7161
7227
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
7162
7228
|
},
|
7163
|
-
actions: [
|
7229
|
+
actions: [
|
7230
|
+
{
|
7231
|
+
type: "DEFAULT",
|
7232
|
+
conditionals: []
|
7233
|
+
}
|
7234
|
+
],
|
7164
7235
|
icon: "Draft"
|
7165
7236
|
}
|
7166
7237
|
]);
|
@@ -7176,9 +7247,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
7176
7247
|
if (isTemplateVariable(value)) {
|
7177
7248
|
return false;
|
7178
7249
|
}
|
7179
|
-
if (typeof value === "object" &&
|
7180
|
-
//@ts-ignore
|
7181
|
-
Object.values(value).some((val) => isTemplateVariable(val))) {
|
7250
|
+
if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
|
7182
7251
|
return false;
|
7183
7252
|
}
|
7184
7253
|
return true;
|
@@ -7200,7 +7269,7 @@ function isFieldConfigDefaultValue(value) {
|
|
7200
7269
|
}
|
7201
7270
|
|
7202
7271
|
// ../commons/src/events/scopes.ts
|
7203
|
-
var
|
7272
|
+
var import_lodash5 = require("lodash");
|
7204
7273
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
7205
7274
|
SCOPES.RECORD_DECLARE,
|
7206
7275
|
SCOPES.RECORD_READ,
|
@@ -7288,13 +7357,13 @@ var WRITE_ACTION_SCOPES = [
|
|
7288
7357
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
7289
7358
|
];
|
7290
7359
|
function hasAnyOfScopes(a, b) {
|
7291
|
-
return (0,
|
7360
|
+
return (0, import_lodash5.intersection)(a, b).length > 0;
|
7292
7361
|
}
|
7293
7362
|
|
7294
7363
|
// ../commons/src/events/serializers/user/deserializer.ts
|
7295
|
-
var
|
7364
|
+
var import_zod36 = require("zod");
|
7296
7365
|
var UserWithPrimaryOffice = User.extend({
|
7297
|
-
primaryOfficeId:
|
7366
|
+
primaryOfficeId: import_zod36.z.string()
|
7298
7367
|
});
|
7299
7368
|
function userDeserializer(serializedUserField, user2) {
|
7300
7369
|
if (typeof serializedUserField === "string") {
|