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