@opencrvs/toolkit 1.8.1-rc.032a7f2 → 1.8.1-rc.06c1a33
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 +1350 -4
- package/dist/commons/events/ActionConfig.d.ts +15480 -7338
- package/dist/commons/events/ActionDocument.d.ts +3036 -1
- package/dist/commons/events/ActionInput.d.ts +2460 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +93 -3
- package/dist/commons/events/CompositeFieldValue.d.ts +60 -0
- package/dist/commons/events/Draft.d.ts +200 -8
- package/dist/commons/events/EventConfig.d.ts +8815 -5048
- package/dist/commons/events/EventDocument.d.ts +1704 -0
- package/dist/commons/events/EventIndex.d.ts +47 -1
- package/dist/commons/events/FieldConfig.d.ts +1108 -1128
- package/dist/commons/events/FieldType.d.ts +3 -6
- package/dist/commons/events/FieldTypeMapping.d.ts +85 -3
- package/dist/commons/events/FieldValue.d.ts +62 -3
- package/dist/commons/events/FormConfig.d.ts +7497 -3687
- package/dist/commons/events/PageConfig.d.ts +1382 -460
- package/dist/commons/events/WorkqueueConfig.d.ts +8 -8
- package/dist/commons/events/defineConfig.d.ts +737 -62
- package/dist/commons/events/test.utils.d.ts +43 -2
- package/dist/commons/events/utils.d.ts +1474 -143
- package/dist/events/index.js +882 -896
- 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,
|
@@ -62,6 +61,7 @@ __export(events_exports, {
|
|
62
61
|
BIRTH_EVENT: () => BIRTH_EVENT,
|
63
62
|
BaseActionInput: () => BaseActionInput,
|
64
63
|
BearerTokenByUserType: () => BearerTokenByUserType,
|
64
|
+
ButtonFieldValue: () => ButtonFieldValue,
|
65
65
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
66
66
|
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
67
67
|
CertificateConfig: () => CertificateConfig,
|
@@ -118,7 +118,6 @@ __export(events_exports, {
|
|
118
118
|
FieldType: () => FieldType,
|
119
119
|
FieldUpdateValue: () => FieldUpdateValue,
|
120
120
|
FieldValue: () => FieldValue,
|
121
|
-
FileFieldType: () => FileFieldType,
|
122
121
|
FileFieldValue: () => FileFieldValue,
|
123
122
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
124
123
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
@@ -129,6 +128,8 @@ __export(events_exports, {
|
|
129
128
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
130
129
|
GenericAddressValue: () => GenericAddressValue,
|
131
130
|
GeographicalArea: () => GeographicalArea,
|
131
|
+
HttpFieldUpdateValue: () => HttpFieldUpdateValue,
|
132
|
+
HttpFieldValue: () => HttpFieldValue,
|
132
133
|
ImageMimeType: () => ImageMimeType,
|
133
134
|
InherentFlags: () => InherentFlags,
|
134
135
|
LanguageConfig: () => LanguageConfig,
|
@@ -203,7 +204,7 @@ __export(events_exports, {
|
|
203
204
|
and: () => and,
|
204
205
|
annotationActions: () => annotationActions,
|
205
206
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
206
|
-
|
207
|
+
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
207
208
|
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
208
209
|
areConditionsMet: () => areConditionsMet,
|
209
210
|
compositeFieldTypes: () => compositeFieldTypes,
|
@@ -211,7 +212,6 @@ __export(events_exports, {
|
|
211
212
|
createFieldConditionals: () => createFieldConditionals,
|
212
213
|
createPrng: () => createPrng,
|
213
214
|
createValidationSchema: () => createValidationSchema,
|
214
|
-
dangerouslyGetCurrentEventStateWithDrafts: () => dangerouslyGetCurrentEventStateWithDrafts,
|
215
215
|
deepDropNulls: () => deepDropNulls,
|
216
216
|
deepMerge: () => deepMerge,
|
217
217
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -233,7 +233,7 @@ __export(events_exports, {
|
|
233
233
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
234
234
|
field: () => field,
|
235
235
|
fieldTypes: () => fieldTypes,
|
236
|
-
|
236
|
+
findActiveDrafts: () => findActiveDrafts,
|
237
237
|
findAllFields: () => findAllFields,
|
238
238
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
239
239
|
findRecordActionPages: () => findRecordActionPages,
|
@@ -261,6 +261,7 @@ __export(events_exports, {
|
|
261
261
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
262
262
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
263
263
|
getCurrentEventState: () => getCurrentEventState,
|
264
|
+
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
264
265
|
getDeclaration: () => getDeclaration,
|
265
266
|
getDeclarationFieldById: () => getDeclarationFieldById,
|
266
267
|
getDeclarationFields: () => getDeclarationFields,
|
@@ -277,6 +278,7 @@ __export(events_exports, {
|
|
277
278
|
isAddressFieldType: () => isAddressFieldType,
|
278
279
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
279
280
|
isBulletListFieldType: () => isBulletListFieldType,
|
281
|
+
isButtonFieldType: () => isButtonFieldType,
|
280
282
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
281
283
|
isConditionMet: () => isConditionMet,
|
282
284
|
isCountryFieldType: () => isCountryFieldType,
|
@@ -294,6 +296,7 @@ __export(events_exports, {
|
|
294
296
|
isFieldVisible: () => isFieldVisible,
|
295
297
|
isFileFieldType: () => isFileFieldType,
|
296
298
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
299
|
+
isHttpFieldType: () => isHttpFieldType,
|
297
300
|
isIdFieldType: () => isIdFieldType,
|
298
301
|
isLocationFieldType: () => isLocationFieldType,
|
299
302
|
isMetaAction: () => isMetaAction,
|
@@ -320,7 +323,6 @@ __export(events_exports, {
|
|
320
323
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
321
324
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
322
325
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
323
|
-
mergeDrafts: () => mergeDrafts,
|
324
326
|
never: () => never,
|
325
327
|
not: () => not,
|
326
328
|
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
@@ -344,7 +346,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
344
346
|
var BIRTH_EVENT = "v2-birth";
|
345
347
|
|
346
348
|
// ../commons/src/events/ActionConfig.ts
|
347
|
-
var
|
349
|
+
var import_zod10 = require("zod");
|
348
350
|
|
349
351
|
// ../commons/src/events/Conditional.ts
|
350
352
|
var import_zod = require("zod");
|
@@ -514,10 +516,9 @@ function isMetaAction(actionType) {
|
|
514
516
|
}
|
515
517
|
|
516
518
|
// ../commons/src/events/FieldConfig.ts
|
517
|
-
var
|
519
|
+
var import_zod7 = require("zod");
|
518
520
|
|
519
521
|
// ../commons/src/events/FieldType.ts
|
520
|
-
var import_zod4 = require("zod");
|
521
522
|
var FieldType = {
|
522
523
|
NAME: "NAME",
|
523
524
|
PHONE: "PHONE",
|
@@ -548,13 +549,10 @@ var FieldType = {
|
|
548
549
|
FACILITY: "FACILITY",
|
549
550
|
OFFICE: "OFFICE",
|
550
551
|
SIGNATURE: "SIGNATURE",
|
551
|
-
DATA: "DATA"
|
552
|
+
DATA: "DATA",
|
553
|
+
BUTTON: "BUTTON",
|
554
|
+
HTTP: "HTTP"
|
552
555
|
};
|
553
|
-
var FileFieldType = import_zod4.z.enum([
|
554
|
-
FieldType.FILE,
|
555
|
-
FieldType.FILE_WITH_OPTIONS,
|
556
|
-
FieldType.SIGNATURE
|
557
|
-
]);
|
558
556
|
var fieldTypes = Object.values(FieldType);
|
559
557
|
var compositeFieldTypes = [
|
560
558
|
FieldType.DATE_RANGE,
|
@@ -564,24 +562,24 @@ var compositeFieldTypes = [
|
|
564
562
|
];
|
565
563
|
|
566
564
|
// ../commons/src/events/FieldValue.ts
|
567
|
-
var
|
565
|
+
var import_zod6 = require("zod");
|
568
566
|
|
569
567
|
// ../commons/src/documents.ts
|
570
|
-
var
|
568
|
+
var import_zod4 = require("zod");
|
571
569
|
var import_zod_openapi3 = require("zod-openapi");
|
572
|
-
(0, import_zod_openapi3.extendZodWithOpenApi)(
|
573
|
-
var FullDocumentUrl =
|
570
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
|
571
|
+
var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
|
574
572
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
575
573
|
);
|
576
|
-
var FullDocumentPath =
|
574
|
+
var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
577
575
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
578
576
|
);
|
579
|
-
var DocumentPath =
|
577
|
+
var DocumentPath = import_zod4.z.string().brand("DocumentPath").describe(
|
580
578
|
"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
579
|
);
|
582
580
|
|
583
581
|
// ../commons/src/events/CompositeFieldValue.ts
|
584
|
-
var
|
582
|
+
var import_zod5 = require("zod");
|
585
583
|
var GeographicalArea = {
|
586
584
|
URBAN: "URBAN",
|
587
585
|
RURAL: "RURAL"
|
@@ -590,110 +588,122 @@ var AddressType = {
|
|
590
588
|
DOMESTIC: "DOMESTIC",
|
591
589
|
INTERNATIONAL: "INTERNATIONAL"
|
592
590
|
};
|
593
|
-
var FileFieldValue =
|
591
|
+
var FileFieldValue = import_zod5.z.object({
|
594
592
|
path: FullDocumentPath,
|
595
|
-
originalFilename:
|
596
|
-
type:
|
593
|
+
originalFilename: import_zod5.z.string(),
|
594
|
+
type: import_zod5.z.string()
|
597
595
|
});
|
598
|
-
var AdminStructure =
|
599
|
-
country:
|
600
|
-
addressType:
|
601
|
-
province:
|
602
|
-
district:
|
596
|
+
var AdminStructure = import_zod5.z.object({
|
597
|
+
country: import_zod5.z.string(),
|
598
|
+
addressType: import_zod5.z.literal(AddressType.DOMESTIC),
|
599
|
+
province: import_zod5.z.string(),
|
600
|
+
district: import_zod5.z.string()
|
603
601
|
});
|
604
602
|
var UrbanAddressValue = AdminStructure.extend({
|
605
|
-
urbanOrRural:
|
606
|
-
town:
|
607
|
-
residentialArea:
|
608
|
-
street:
|
609
|
-
number:
|
610
|
-
zipCode:
|
603
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
|
604
|
+
town: import_zod5.z.string().optional(),
|
605
|
+
residentialArea: import_zod5.z.string().optional(),
|
606
|
+
street: import_zod5.z.string().optional(),
|
607
|
+
number: import_zod5.z.string().optional(),
|
608
|
+
zipCode: import_zod5.z.string().optional()
|
611
609
|
});
|
612
610
|
var RuralAddressValue = AdminStructure.extend({
|
613
|
-
urbanOrRural:
|
614
|
-
village:
|
611
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
|
612
|
+
village: import_zod5.z.string().optional()
|
615
613
|
});
|
616
614
|
var UrbanAddressUpdateValue = AdminStructure.extend({
|
617
|
-
urbanOrRural:
|
618
|
-
town:
|
619
|
-
residentialArea:
|
620
|
-
street:
|
621
|
-
number:
|
622
|
-
zipCode:
|
615
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
|
616
|
+
town: import_zod5.z.string().nullish(),
|
617
|
+
residentialArea: import_zod5.z.string().nullish(),
|
618
|
+
street: import_zod5.z.string().nullish(),
|
619
|
+
number: import_zod5.z.string().nullish(),
|
620
|
+
zipCode: import_zod5.z.string().nullish()
|
623
621
|
});
|
624
|
-
var NameFieldValue =
|
625
|
-
firstname:
|
626
|
-
surname:
|
627
|
-
middlename:
|
622
|
+
var NameFieldValue = import_zod5.z.object({
|
623
|
+
firstname: import_zod5.z.string(),
|
624
|
+
surname: import_zod5.z.string(),
|
625
|
+
middlename: import_zod5.z.string().optional()
|
628
626
|
});
|
629
|
-
var NameFieldUpdateValue =
|
630
|
-
firstname:
|
631
|
-
surname:
|
632
|
-
middlename:
|
633
|
-
}).or(
|
627
|
+
var NameFieldUpdateValue = import_zod5.z.object({
|
628
|
+
firstname: import_zod5.z.string(),
|
629
|
+
surname: import_zod5.z.string(),
|
630
|
+
middlename: import_zod5.z.string().nullish()
|
631
|
+
}).or(import_zod5.z.null()).or(import_zod5.z.undefined());
|
634
632
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
635
|
-
urbanOrRural:
|
636
|
-
village:
|
633
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
|
634
|
+
village: import_zod5.z.string().nullish()
|
637
635
|
});
|
638
|
-
var GenericAddressValue =
|
639
|
-
country:
|
640
|
-
addressType:
|
641
|
-
state:
|
642
|
-
district2:
|
643
|
-
cityOrTown:
|
644
|
-
addressLine1:
|
645
|
-
addressLine2:
|
646
|
-
addressLine3:
|
647
|
-
postcodeOrZip:
|
636
|
+
var GenericAddressValue = import_zod5.z.object({
|
637
|
+
country: import_zod5.z.string(),
|
638
|
+
addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
|
639
|
+
state: import_zod5.z.string(),
|
640
|
+
district2: import_zod5.z.string(),
|
641
|
+
cityOrTown: import_zod5.z.string().optional(),
|
642
|
+
addressLine1: import_zod5.z.string().optional(),
|
643
|
+
addressLine2: import_zod5.z.string().optional(),
|
644
|
+
addressLine3: import_zod5.z.string().optional(),
|
645
|
+
postcodeOrZip: import_zod5.z.string().optional()
|
648
646
|
});
|
649
|
-
var AddressFieldValue =
|
650
|
-
var GenericAddressUpdateValue =
|
651
|
-
country:
|
652
|
-
addressType:
|
653
|
-
state:
|
654
|
-
district2:
|
655
|
-
cityOrTown:
|
656
|
-
addressLine1:
|
657
|
-
addressLine2:
|
658
|
-
addressLine3:
|
659
|
-
postcodeOrZip:
|
647
|
+
var AddressFieldValue = import_zod5.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
648
|
+
var GenericAddressUpdateValue = import_zod5.z.object({
|
649
|
+
country: import_zod5.z.string(),
|
650
|
+
addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
|
651
|
+
state: import_zod5.z.string(),
|
652
|
+
district2: import_zod5.z.string(),
|
653
|
+
cityOrTown: import_zod5.z.string().nullish(),
|
654
|
+
addressLine1: import_zod5.z.string().nullish(),
|
655
|
+
addressLine2: import_zod5.z.string().nullish(),
|
656
|
+
addressLine3: import_zod5.z.string().nullish(),
|
657
|
+
postcodeOrZip: import_zod5.z.string().nullish()
|
660
658
|
});
|
661
|
-
var AddressFieldUpdateValue =
|
659
|
+
var AddressFieldUpdateValue = import_zod5.z.discriminatedUnion("urbanOrRural", [
|
662
660
|
UrbanAddressUpdateValue,
|
663
661
|
RuralAddressUpdateValue
|
664
662
|
]).or(GenericAddressUpdateValue);
|
665
|
-
var FileFieldValueWithOption =
|
663
|
+
var FileFieldValueWithOption = import_zod5.z.object({
|
666
664
|
path: FullDocumentPath,
|
667
|
-
originalFilename:
|
668
|
-
type:
|
669
|
-
option:
|
665
|
+
originalFilename: import_zod5.z.string(),
|
666
|
+
type: import_zod5.z.string(),
|
667
|
+
option: import_zod5.z.string()
|
668
|
+
});
|
669
|
+
var FileFieldWithOptionValue = import_zod5.z.array(FileFieldValueWithOption);
|
670
|
+
var HttpFieldValue = import_zod5.z.object({
|
671
|
+
loading: import_zod5.z.boolean(),
|
672
|
+
error: import_zod5.z.object({ statusCode: import_zod5.z.number().nullable(), message: import_zod5.z.string() }).nullable(),
|
673
|
+
data: import_zod5.z.any(),
|
674
|
+
trackingValue: import_zod5.z.string().optional().describe("If the tracking value changes, the field will be re-fetched")
|
670
675
|
});
|
671
|
-
var
|
676
|
+
var HttpFieldUpdateValue = import_zod5.z.object({
|
677
|
+
loading: import_zod5.z.boolean().nullish(),
|
678
|
+
error: import_zod5.z.object({ statusCode: import_zod5.z.number().nullable(), message: import_zod5.z.string() }).nullish(),
|
679
|
+
data: import_zod5.z.any().nullish()
|
680
|
+
}).or(import_zod5.z.null()).or(import_zod5.z.undefined());
|
672
681
|
|
673
682
|
// ../commons/src/events/FieldValue.ts
|
674
|
-
var TextValue =
|
683
|
+
var TextValue = import_zod6.z.string();
|
675
684
|
var NonEmptyTextValue = TextValue.min(1);
|
676
|
-
var DateValue =
|
677
|
-
var TimeValue =
|
678
|
-
var DatetimeValue =
|
679
|
-
var SelectDateRangeValue =
|
685
|
+
var DateValue = import_zod6.z.string().date().describe("Date in the format YYYY-MM-DD");
|
686
|
+
var TimeValue = import_zod6.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
687
|
+
var DatetimeValue = import_zod6.z.string().datetime();
|
688
|
+
var SelectDateRangeValue = import_zod6.z.enum([
|
680
689
|
"last7Days",
|
681
690
|
"last30Days",
|
682
691
|
"last90Days",
|
683
692
|
"last365Days"
|
684
693
|
]);
|
685
|
-
var DateRangeFieldValue =
|
694
|
+
var DateRangeFieldValue = import_zod6.z.object({
|
686
695
|
start: DateValue,
|
687
696
|
end: DateValue
|
688
697
|
}).or(DateValue).describe(
|
689
698
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
690
699
|
);
|
691
|
-
var EmailValue =
|
692
|
-
var CheckboxFieldValue =
|
693
|
-
var NumberFieldValue =
|
694
|
-
var DataFieldValue =
|
695
|
-
var SignatureFieldValue =
|
696
|
-
var
|
700
|
+
var EmailValue = import_zod6.z.string().email();
|
701
|
+
var CheckboxFieldValue = import_zod6.z.boolean();
|
702
|
+
var NumberFieldValue = import_zod6.z.number();
|
703
|
+
var DataFieldValue = import_zod6.z.undefined();
|
704
|
+
var SignatureFieldValue = import_zod6.z.string();
|
705
|
+
var ButtonFieldValue = import_zod6.z.number();
|
706
|
+
var FieldValue = import_zod6.z.union([
|
697
707
|
TextValue,
|
698
708
|
DateValue,
|
699
709
|
TimeValue,
|
@@ -708,9 +718,11 @@ var FieldValue = import_zod7.z.union([
|
|
708
718
|
DataFieldValue,
|
709
719
|
GenericAddressValue,
|
710
720
|
NameFieldValue,
|
711
|
-
NameFieldUpdateValue
|
721
|
+
NameFieldUpdateValue,
|
722
|
+
ButtonFieldValue,
|
723
|
+
HttpFieldValue
|
712
724
|
]);
|
713
|
-
var FieldUpdateValue =
|
725
|
+
var FieldUpdateValue = import_zod6.z.union([
|
714
726
|
TextValue,
|
715
727
|
DateValue,
|
716
728
|
TimeValue,
|
@@ -724,72 +736,73 @@ var FieldUpdateValue = import_zod7.z.union([
|
|
724
736
|
RuralAddressUpdateValue,
|
725
737
|
DataFieldValue,
|
726
738
|
GenericAddressUpdateValue,
|
727
|
-
NameFieldUpdateValue
|
739
|
+
NameFieldUpdateValue,
|
740
|
+
HttpFieldUpdateValue
|
728
741
|
]);
|
729
742
|
|
730
743
|
// ../commons/src/events/FieldConfig.ts
|
731
744
|
var import_zod_openapi4 = require("zod-openapi");
|
732
|
-
(0, import_zod_openapi4.extendZodWithOpenApi)(
|
733
|
-
var FieldId =
|
734
|
-
var FieldReference =
|
745
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod7.z);
|
746
|
+
var FieldId = import_zod7.z.string().describe("Unique identifier for the field");
|
747
|
+
var FieldReference = import_zod7.z.object({
|
735
748
|
$$field: FieldId
|
736
749
|
}).describe("Reference to a field by its ID");
|
737
|
-
var ValidationConfig =
|
750
|
+
var ValidationConfig = import_zod7.z.object({
|
738
751
|
validator: Conditional,
|
739
752
|
message: TranslationConfig
|
740
753
|
});
|
741
|
-
var BaseField =
|
754
|
+
var BaseField = import_zod7.z.object({
|
742
755
|
id: FieldId,
|
743
756
|
label: TranslationConfig,
|
744
757
|
parent: FieldReference.optional().describe(
|
745
758
|
"Reference to a parent field. If a field has a parent, it will be reset when the parent field is changed."
|
746
759
|
),
|
747
|
-
required:
|
748
|
-
conditionals:
|
749
|
-
secured:
|
760
|
+
required: import_zod7.z.boolean().default(false).optional(),
|
761
|
+
conditionals: import_zod7.z.array(FieldConditional).default([]).optional(),
|
762
|
+
secured: import_zod7.z.boolean().default(false).optional(),
|
750
763
|
placeholder: TranslationConfig.optional(),
|
751
|
-
validation:
|
764
|
+
validation: import_zod7.z.array(ValidationConfig).default([]).optional(),
|
752
765
|
helperText: TranslationConfig.optional(),
|
753
|
-
hideLabel:
|
754
|
-
uncorrectable:
|
766
|
+
hideLabel: import_zod7.z.boolean().default(false).optional(),
|
767
|
+
uncorrectable: import_zod7.z.boolean().default(false).optional().describe(
|
755
768
|
"Indicates if the field can be changed during a record correction."
|
756
769
|
)
|
757
770
|
});
|
758
771
|
var Divider = BaseField.extend({
|
759
|
-
type:
|
772
|
+
type: import_zod7.z.literal(FieldType.DIVIDER)
|
760
773
|
});
|
761
774
|
var TextField = BaseField.extend({
|
762
|
-
type:
|
775
|
+
type: import_zod7.z.literal(FieldType.TEXT),
|
763
776
|
defaultValue: NonEmptyTextValue.optional(),
|
764
|
-
configuration:
|
765
|
-
maxLength:
|
766
|
-
type:
|
777
|
+
configuration: import_zod7.z.object({
|
778
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
779
|
+
type: import_zod7.z.enum(["text", "password"]).optional(),
|
767
780
|
prefix: TranslationConfig.optional(),
|
768
781
|
postfix: TranslationConfig.optional()
|
769
782
|
}).default({ type: "text" }).optional()
|
770
783
|
}).describe("Text input");
|
771
784
|
var NumberField = BaseField.extend({
|
772
|
-
type:
|
785
|
+
type: import_zod7.z.literal(FieldType.NUMBER),
|
773
786
|
defaultValue: NumberFieldValue.optional(),
|
774
|
-
configuration:
|
775
|
-
min:
|
776
|
-
max:
|
787
|
+
configuration: import_zod7.z.object({
|
788
|
+
min: import_zod7.z.number().optional().describe("Minimum value"),
|
789
|
+
max: import_zod7.z.number().optional().describe("Maximum value"),
|
777
790
|
prefix: TranslationConfig.optional(),
|
778
791
|
postfix: TranslationConfig.optional()
|
779
792
|
}).optional()
|
780
793
|
}).describe("Number input");
|
781
794
|
var TextAreaField = BaseField.extend({
|
782
|
-
type:
|
795
|
+
type: import_zod7.z.literal(FieldType.TEXTAREA),
|
783
796
|
defaultValue: NonEmptyTextValue.optional(),
|
784
|
-
configuration:
|
785
|
-
maxLength:
|
786
|
-
rows:
|
787
|
-
cols:
|
797
|
+
configuration: import_zod7.z.object({
|
798
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
799
|
+
rows: import_zod7.z.number().optional().describe("Number of visible text lines"),
|
800
|
+
cols: import_zod7.z.number().optional().describe("Number of visible columns"),
|
788
801
|
prefix: TranslationConfig.optional(),
|
789
802
|
postfix: TranslationConfig.optional()
|
790
803
|
}).default({ rows: 4 }).optional()
|
791
804
|
}).describe("Multiline text input");
|
792
|
-
var ImageMimeType =
|
805
|
+
var ImageMimeType = import_zod7.z.enum([
|
793
806
|
"image/png",
|
794
807
|
"image/jpg",
|
795
808
|
"image/jpeg",
|
@@ -798,53 +811,53 @@ var ImageMimeType = import_zod8.z.enum([
|
|
798
811
|
var MimeType = ImageMimeType;
|
799
812
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
800
813
|
var SignatureField = BaseField.extend({
|
801
|
-
type:
|
814
|
+
type: import_zod7.z.literal(FieldType.SIGNATURE),
|
802
815
|
signaturePromptLabel: TranslationConfig.describe(
|
803
816
|
"Title of the signature modal"
|
804
817
|
),
|
805
818
|
defaultValue: SignatureFieldValue.optional(),
|
806
|
-
configuration:
|
807
|
-
maxFileSize:
|
819
|
+
configuration: import_zod7.z.object({
|
820
|
+
maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
808
821
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
809
822
|
}).default({
|
810
823
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
811
824
|
})
|
812
825
|
}).describe("Signature input field");
|
813
826
|
var EmailField = BaseField.extend({
|
814
|
-
type:
|
815
|
-
configuration:
|
816
|
-
maxLength:
|
827
|
+
type: import_zod7.z.literal(FieldType.EMAIL),
|
828
|
+
configuration: import_zod7.z.object({
|
829
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text")
|
817
830
|
}).default({ maxLength: 10 }).optional(),
|
818
831
|
defaultValue: NonEmptyTextValue.optional()
|
819
832
|
});
|
820
833
|
var DateField = BaseField.extend({
|
821
|
-
type:
|
834
|
+
type: import_zod7.z.literal(FieldType.DATE),
|
822
835
|
defaultValue: DateValue.optional(),
|
823
|
-
configuration:
|
836
|
+
configuration: import_zod7.z.object({
|
824
837
|
notice: TranslationConfig.describe(
|
825
838
|
"Text to display above the date input"
|
826
839
|
).optional()
|
827
840
|
}).optional()
|
828
841
|
}).describe("A single date input (yyyy-MM-dd)");
|
829
842
|
var TimeField = BaseField.extend({
|
830
|
-
type:
|
843
|
+
type: import_zod7.z.literal(FieldType.TIME),
|
831
844
|
defaultValue: TimeValue.optional(),
|
832
|
-
configuration:
|
845
|
+
configuration: import_zod7.z.object({
|
833
846
|
notice: TranslationConfig.describe(
|
834
847
|
"Text to display above the time input"
|
835
848
|
).optional()
|
836
849
|
}).optional()
|
837
850
|
}).describe("A single date input (HH-mm)");
|
838
851
|
var DateRangeField = BaseField.extend({
|
839
|
-
type:
|
852
|
+
type: import_zod7.z.literal(FieldType.DATE_RANGE),
|
840
853
|
defaultValue: DateRangeFieldValue.optional(),
|
841
|
-
configuration:
|
854
|
+
configuration: import_zod7.z.object({
|
842
855
|
notice: TranslationConfig.describe(
|
843
856
|
"Text to display above the date input"
|
844
857
|
).optional()
|
845
858
|
}).optional()
|
846
859
|
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
847
|
-
var HtmlFontVariant =
|
860
|
+
var HtmlFontVariant = import_zod7.z.enum([
|
848
861
|
"reg12",
|
849
862
|
"reg14",
|
850
863
|
"reg16",
|
@@ -854,31 +867,31 @@ var HtmlFontVariant = import_zod8.z.enum([
|
|
854
867
|
"h2",
|
855
868
|
"h1"
|
856
869
|
]);
|
857
|
-
var ParagraphConfiguration =
|
858
|
-
styles:
|
870
|
+
var ParagraphConfiguration = import_zod7.z.object({
|
871
|
+
styles: import_zod7.z.object({
|
859
872
|
fontVariant: HtmlFontVariant.optional().describe(
|
860
873
|
"Font variant to use for the paragraph text"
|
861
874
|
),
|
862
|
-
hint:
|
875
|
+
hint: import_zod7.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
|
863
876
|
}).optional()
|
864
877
|
}).default({});
|
865
878
|
var Paragraph = BaseField.extend({
|
866
|
-
type:
|
879
|
+
type: import_zod7.z.literal(FieldType.PARAGRAPH),
|
867
880
|
defaultValue: NonEmptyTextValue.optional(),
|
868
881
|
configuration: ParagraphConfiguration
|
869
882
|
}).describe("A read-only HTML <p> paragraph");
|
870
883
|
var PageHeader = BaseField.extend({
|
871
|
-
type:
|
884
|
+
type: import_zod7.z.literal(FieldType.PAGE_HEADER),
|
872
885
|
defaultValue: NonEmptyTextValue.optional()
|
873
886
|
}).describe("A read-only header component for form pages");
|
874
887
|
var File = BaseField.extend({
|
875
|
-
type:
|
888
|
+
type: import_zod7.z.literal(FieldType.FILE),
|
876
889
|
defaultValue: FileFieldValue.optional(),
|
877
|
-
configuration:
|
878
|
-
maxFileSize:
|
890
|
+
configuration: import_zod7.z.object({
|
891
|
+
maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
879
892
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
880
|
-
style:
|
881
|
-
width:
|
893
|
+
style: import_zod7.z.object({
|
894
|
+
width: import_zod7.z.enum(["full", "auto"]).optional().describe(
|
882
895
|
"Whether the file upload button should take the full width of the container or not"
|
883
896
|
)
|
884
897
|
}).optional(),
|
@@ -887,65 +900,65 @@ var File = BaseField.extend({
|
|
887
900
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
888
901
|
})
|
889
902
|
}).describe("File upload");
|
890
|
-
var SelectOption =
|
891
|
-
value:
|
903
|
+
var SelectOption = import_zod7.z.object({
|
904
|
+
value: import_zod7.z.string().describe("The value of the option"),
|
892
905
|
label: TranslationConfig.describe("The label of the option")
|
893
906
|
});
|
894
907
|
var RadioGroup = BaseField.extend({
|
895
|
-
type:
|
908
|
+
type: import_zod7.z.literal(FieldType.RADIO_GROUP),
|
896
909
|
defaultValue: TextValue.optional(),
|
897
|
-
options:
|
898
|
-
configuration:
|
899
|
-
styles:
|
900
|
-
size:
|
910
|
+
options: import_zod7.z.array(SelectOption).describe("A list of options"),
|
911
|
+
configuration: import_zod7.z.object({
|
912
|
+
styles: import_zod7.z.object({
|
913
|
+
size: import_zod7.z.enum(["NORMAL", "LARGE"]).optional()
|
901
914
|
}).optional()
|
902
915
|
}).optional()
|
903
916
|
}).describe("Grouped radio options");
|
904
917
|
var BulletList = BaseField.extend({
|
905
|
-
type:
|
918
|
+
type: import_zod7.z.literal(FieldType.BULLET_LIST),
|
906
919
|
defaultValue: TextValue.optional(),
|
907
|
-
items:
|
908
|
-
configuration:
|
909
|
-
styles:
|
920
|
+
items: import_zod7.z.array(TranslationConfig).describe("A list of items"),
|
921
|
+
configuration: import_zod7.z.object({
|
922
|
+
styles: import_zod7.z.object({
|
910
923
|
fontVariant: HtmlFontVariant.optional()
|
911
924
|
}).optional()
|
912
925
|
}).default({})
|
913
926
|
}).describe("A list of bullet points");
|
914
927
|
var Select = BaseField.extend({
|
915
|
-
type:
|
928
|
+
type: import_zod7.z.literal(FieldType.SELECT),
|
916
929
|
defaultValue: TextValue.optional(),
|
917
|
-
options:
|
930
|
+
options: import_zod7.z.array(SelectOption).describe("A list of options")
|
918
931
|
}).describe("Select input");
|
919
|
-
var SelectDateRangeOption =
|
932
|
+
var SelectDateRangeOption = import_zod7.z.object({
|
920
933
|
value: SelectDateRangeValue.describe("The value of the option"),
|
921
934
|
label: TranslationConfig.describe("The label of the option")
|
922
935
|
});
|
923
936
|
var SelectDateRangeField = BaseField.extend({
|
924
|
-
type:
|
937
|
+
type: import_zod7.z.literal(FieldType.SELECT_DATE_RANGE),
|
925
938
|
defaultValue: SelectDateRangeValue.optional(),
|
926
|
-
options:
|
939
|
+
options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
|
927
940
|
}).describe("Select input with date range options");
|
928
|
-
var NameConfig =
|
929
|
-
firstname:
|
930
|
-
middlename:
|
931
|
-
surname:
|
941
|
+
var NameConfig = import_zod7.z.object({
|
942
|
+
firstname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
|
943
|
+
middlename: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
|
944
|
+
surname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional()
|
932
945
|
});
|
933
946
|
var NameField = BaseField.extend({
|
934
|
-
type:
|
935
|
-
defaultValue:
|
947
|
+
type: import_zod7.z.literal(FieldType.NAME),
|
948
|
+
defaultValue: import_zod7.z.object({
|
936
949
|
firstname: NonEmptyTextValue.optional(),
|
937
950
|
middlename: NonEmptyTextValue.optional(),
|
938
951
|
surname: NonEmptyTextValue.optional()
|
939
952
|
}).optional(),
|
940
|
-
configuration:
|
953
|
+
configuration: import_zod7.z.object({
|
941
954
|
name: NameConfig.default({
|
942
955
|
firstname: { required: true },
|
943
956
|
surname: { required: true }
|
944
957
|
}).optional(),
|
945
|
-
|
946
|
-
maxLength: import_zod8.z.number().optional().describe("Maximum length of the text"),
|
958
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
947
959
|
prefix: TranslationConfig.optional(),
|
948
|
-
postfix: TranslationConfig.optional()
|
960
|
+
postfix: TranslationConfig.optional(),
|
961
|
+
searchMode: import_zod7.z.boolean().optional()
|
949
962
|
}).default({
|
950
963
|
name: {
|
951
964
|
firstname: { required: true },
|
@@ -955,108 +968,109 @@ var NameField = BaseField.extend({
|
|
955
968
|
}).describe("Name input field");
|
956
969
|
var PhoneField = BaseField.extend({
|
957
970
|
defaultValue: NonEmptyTextValue.optional(),
|
958
|
-
type:
|
971
|
+
type: import_zod7.z.literal(FieldType.PHONE)
|
959
972
|
}).describe("Phone input field");
|
960
973
|
var IdField = BaseField.extend({
|
961
974
|
defaultValue: NonEmptyTextValue.optional(),
|
962
|
-
type:
|
975
|
+
type: import_zod7.z.literal(FieldType.ID)
|
963
976
|
}).describe("ID input field");
|
964
977
|
var Checkbox = BaseField.extend({
|
965
|
-
type:
|
978
|
+
type: import_zod7.z.literal(FieldType.CHECKBOX),
|
966
979
|
defaultValue: CheckboxFieldValue.optional()
|
967
980
|
}).describe("Boolean checkbox field");
|
968
981
|
var Country = BaseField.extend({
|
969
|
-
type:
|
982
|
+
type: import_zod7.z.literal(FieldType.COUNTRY),
|
970
983
|
defaultValue: NonEmptyTextValue.optional()
|
971
984
|
}).describe("Country select field");
|
972
|
-
var AdministrativeAreas =
|
985
|
+
var AdministrativeAreas = import_zod7.z.enum([
|
973
986
|
"ADMIN_STRUCTURE",
|
974
987
|
"HEALTH_FACILITY",
|
975
988
|
"CRVS_OFFICE"
|
976
989
|
]);
|
977
|
-
var AdministrativeAreaConfiguration =
|
978
|
-
partOf:
|
979
|
-
$declaration:
|
990
|
+
var AdministrativeAreaConfiguration = import_zod7.z.object({
|
991
|
+
partOf: import_zod7.z.object({
|
992
|
+
$declaration: import_zod7.z.string()
|
980
993
|
}).optional().describe("Parent location"),
|
981
994
|
type: AdministrativeAreas
|
982
995
|
}).describe("Administrative area options");
|
983
996
|
var AdministrativeArea = BaseField.extend({
|
984
|
-
type:
|
997
|
+
type: import_zod7.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
985
998
|
defaultValue: NonEmptyTextValue.optional(),
|
986
999
|
configuration: AdministrativeAreaConfiguration
|
987
1000
|
}).describe("Administrative area input field e.g. facility, office");
|
988
1001
|
var Location = BaseField.extend({
|
989
|
-
type:
|
1002
|
+
type: import_zod7.z.literal(FieldType.LOCATION),
|
990
1003
|
defaultValue: NonEmptyTextValue.optional(),
|
991
|
-
configuration:
|
992
|
-
searchableResource:
|
1004
|
+
configuration: import_zod7.z.object({
|
1005
|
+
searchableResource: import_zod7.z.array(import_zod7.z.enum(["locations", "facilities", "offices"])).optional()
|
993
1006
|
}).optional()
|
994
1007
|
}).describe("Input field for a location");
|
995
1008
|
var FileUploadWithOptions = BaseField.extend({
|
996
|
-
type:
|
997
|
-
options:
|
1009
|
+
type: import_zod7.z.literal(FieldType.FILE_WITH_OPTIONS),
|
1010
|
+
options: import_zod7.z.array(SelectOption).describe("A list of options"),
|
998
1011
|
defaultValue: FileFieldWithOptionValue.optional(),
|
999
|
-
configuration:
|
1000
|
-
maxFileSize:
|
1012
|
+
configuration: import_zod7.z.object({
|
1013
|
+
maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
1001
1014
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
1002
1015
|
}).default({
|
1003
1016
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
1004
1017
|
})
|
1005
1018
|
});
|
1006
1019
|
var Facility = BaseField.extend({
|
1007
|
-
type:
|
1020
|
+
type: import_zod7.z.literal(FieldType.FACILITY),
|
1008
1021
|
defaultValue: NonEmptyTextValue.optional()
|
1009
1022
|
}).describe("Input field for a facility");
|
1010
1023
|
var Office = BaseField.extend({
|
1011
|
-
type:
|
1024
|
+
type: import_zod7.z.literal(FieldType.OFFICE),
|
1012
1025
|
defaultValue: NonEmptyTextValue.optional()
|
1013
1026
|
}).describe("Input field for an office");
|
1014
1027
|
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()
|
1028
|
+
type: import_zod7.z.literal(FieldType.ADDRESS),
|
1029
|
+
defaultValue: AddressFieldValue.optional(),
|
1030
|
+
configuration: import_zod7.z.object({
|
1031
|
+
searchMode: import_zod7.z.boolean().optional()
|
1032
|
+
}).optional()
|
1042
1033
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
1043
|
-
var DataEntry =
|
1044
|
-
|
1034
|
+
var DataEntry = import_zod7.z.union([
|
1035
|
+
import_zod7.z.object({
|
1045
1036
|
label: TranslationConfig,
|
1046
|
-
value: TranslationConfig.or(
|
1037
|
+
value: TranslationConfig.or(import_zod7.z.string())
|
1047
1038
|
}),
|
1048
|
-
|
1049
|
-
fieldId:
|
1039
|
+
import_zod7.z.object({
|
1040
|
+
fieldId: import_zod7.z.string()
|
1050
1041
|
})
|
1051
1042
|
]);
|
1052
1043
|
var DataField = BaseField.extend({
|
1053
|
-
type:
|
1054
|
-
configuration:
|
1044
|
+
type: import_zod7.z.literal(FieldType.DATA),
|
1045
|
+
configuration: import_zod7.z.object({
|
1055
1046
|
subtitle: TranslationConfig.optional(),
|
1056
|
-
data:
|
1047
|
+
data: import_zod7.z.array(DataEntry)
|
1057
1048
|
})
|
1058
1049
|
}).describe("Data field for displaying read-only data");
|
1059
|
-
var
|
1050
|
+
var ButtonField = BaseField.extend({
|
1051
|
+
type: import_zod7.z.literal(FieldType.BUTTON),
|
1052
|
+
configuration: import_zod7.z.object({
|
1053
|
+
icon: import_zod7.z.string().optional().describe(
|
1054
|
+
"Icon for the button. You can find icons from OpenCRVS UI-Kit."
|
1055
|
+
),
|
1056
|
+
loading: import_zod7.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
1057
|
+
text: TranslationConfig.describe("Text to display on the button")
|
1058
|
+
})
|
1059
|
+
}).describe("Generic button without any built-in functionality");
|
1060
|
+
var HttpField = BaseField.extend({
|
1061
|
+
type: import_zod7.z.literal(FieldType.HTTP),
|
1062
|
+
defaultValue: HttpFieldValue.optional(),
|
1063
|
+
configuration: import_zod7.z.object({
|
1064
|
+
trigger: FieldReference,
|
1065
|
+
url: import_zod7.z.string().describe("URL to send the HTTP request to"),
|
1066
|
+
method: import_zod7.z.enum(["GET", "POST", "PUT", "DELETE"]),
|
1067
|
+
headers: import_zod7.z.record(import_zod7.z.string()).optional(),
|
1068
|
+
body: import_zod7.z.record(import_zod7.z.string()).optional(),
|
1069
|
+
params: import_zod7.z.record(import_zod7.z.string()).optional(),
|
1070
|
+
timeout: import_zod7.z.number().default(15e3).describe("Request timeout in milliseconds")
|
1071
|
+
})
|
1072
|
+
}).describe("HTTP request function triggered by a button click");
|
1073
|
+
var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
1060
1074
|
Address,
|
1061
1075
|
TextField,
|
1062
1076
|
NumberField,
|
@@ -1084,29 +1098,26 @@ var FieldConfig = import_zod8.z.discriminatedUnion("type", [
|
|
1084
1098
|
SignatureField,
|
1085
1099
|
EmailField,
|
1086
1100
|
FileUploadWithOptions,
|
1087
|
-
DataField
|
1101
|
+
DataField,
|
1102
|
+
ButtonField,
|
1103
|
+
HttpField
|
1088
1104
|
]).openapi({
|
1089
1105
|
description: "Form field configuration",
|
1090
1106
|
ref: "FieldConfig"
|
1091
1107
|
});
|
1092
|
-
var AnyFileField = import_zod8.z.discriminatedUnion("type", [
|
1093
|
-
SignatureField,
|
1094
|
-
File,
|
1095
|
-
FileUploadWithOptions
|
1096
|
-
]);
|
1097
1108
|
|
1098
1109
|
// ../commons/src/events/FormConfig.ts
|
1099
|
-
var
|
1110
|
+
var import_zod9 = require("zod");
|
1100
1111
|
|
1101
1112
|
// ../commons/src/events/PageConfig.ts
|
1102
|
-
var
|
1113
|
+
var import_zod8 = require("zod");
|
1103
1114
|
var import_zod_openapi5 = require("zod-openapi");
|
1104
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(
|
1105
|
-
var PageTypes =
|
1106
|
-
var PageConfigBase =
|
1107
|
-
id:
|
1115
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod8.z);
|
1116
|
+
var PageTypes = import_zod8.z.enum(["FORM", "VERIFICATION"]);
|
1117
|
+
var PageConfigBase = import_zod8.z.object({
|
1118
|
+
id: import_zod8.z.string().describe("Unique identifier for the page"),
|
1108
1119
|
title: TranslationConfig.describe("Header title of the page"),
|
1109
|
-
fields:
|
1120
|
+
fields: import_zod8.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
1110
1121
|
conditional: Conditional.optional().describe(
|
1111
1122
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
1112
1123
|
)
|
@@ -1115,13 +1126,13 @@ var PageConfigBase = import_zod9.z.object({
|
|
1115
1126
|
ref: "FormPageConfig"
|
1116
1127
|
});
|
1117
1128
|
var FormPageConfig = PageConfigBase.extend({
|
1118
|
-
type:
|
1129
|
+
type: import_zod8.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
1119
1130
|
});
|
1120
|
-
var VerificationActionConfig =
|
1121
|
-
verify:
|
1122
|
-
cancel:
|
1131
|
+
var VerificationActionConfig = import_zod8.z.object({
|
1132
|
+
verify: import_zod8.z.object({ label: TranslationConfig }),
|
1133
|
+
cancel: import_zod8.z.object({
|
1123
1134
|
label: TranslationConfig,
|
1124
|
-
confirmation:
|
1135
|
+
confirmation: import_zod8.z.object({
|
1125
1136
|
title: TranslationConfig,
|
1126
1137
|
body: TranslationConfig
|
1127
1138
|
})
|
@@ -1131,110 +1142,110 @@ var VerificationActionConfig = import_zod9.z.object({
|
|
1131
1142
|
ref: "VerificationActionConfig"
|
1132
1143
|
});
|
1133
1144
|
var VerificationPageConfig = FormPageConfig.extend({
|
1134
|
-
type:
|
1145
|
+
type: import_zod8.z.literal(PageTypes.enum.VERIFICATION),
|
1135
1146
|
actions: VerificationActionConfig
|
1136
1147
|
});
|
1137
|
-
var PageConfig =
|
1148
|
+
var PageConfig = import_zod8.z.discriminatedUnion("type", [
|
1138
1149
|
FormPageConfig,
|
1139
1150
|
VerificationPageConfig
|
1140
1151
|
]);
|
1141
1152
|
|
1142
1153
|
// ../commons/src/events/FormConfig.ts
|
1143
|
-
var DeclarationFormConfig =
|
1154
|
+
var DeclarationFormConfig = import_zod9.z.object({
|
1144
1155
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1145
|
-
pages:
|
1156
|
+
pages: import_zod9.z.array(FormPageConfig)
|
1146
1157
|
}).describe("Configuration for a declaration form");
|
1147
|
-
var ActionFormConfig =
|
1158
|
+
var ActionFormConfig = import_zod9.z.object({
|
1148
1159
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1149
|
-
pages:
|
1160
|
+
pages: import_zod9.z.array(PageConfig)
|
1150
1161
|
});
|
1151
|
-
var FormConfig =
|
1162
|
+
var FormConfig = import_zod9.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1152
1163
|
|
1153
1164
|
// ../commons/src/events/ActionConfig.ts
|
1154
1165
|
var import_zod_openapi6 = require("zod-openapi");
|
1155
|
-
(0, import_zod_openapi6.extendZodWithOpenApi)(
|
1156
|
-
var ActionConditional2 =
|
1166
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod10.z);
|
1167
|
+
var ActionConditional2 = import_zod10.z.discriminatedUnion("type", [
|
1157
1168
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1158
1169
|
ShowConditional,
|
1159
1170
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1160
1171
|
EnableConditional
|
1161
1172
|
]);
|
1162
|
-
var DeclarationReviewConfig =
|
1173
|
+
var DeclarationReviewConfig = import_zod10.z.object({
|
1163
1174
|
title: TranslationConfig.describe("Title of the review page"),
|
1164
|
-
fields:
|
1175
|
+
fields: import_zod10.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1165
1176
|
}).describe("Configuration for **declaration** review page.");
|
1166
|
-
var ActionConfigBase =
|
1177
|
+
var ActionConfigBase = import_zod10.z.object({
|
1167
1178
|
label: TranslationConfig,
|
1168
|
-
conditionals:
|
1169
|
-
draft:
|
1179
|
+
conditionals: import_zod10.z.array(ActionConditional2).optional().default([]),
|
1180
|
+
draft: import_zod10.z.boolean().optional()
|
1170
1181
|
});
|
1171
1182
|
var ReadActionConfig = ActionConfigBase.merge(
|
1172
|
-
|
1173
|
-
type:
|
1183
|
+
import_zod10.z.object({
|
1184
|
+
type: import_zod10.z.literal(ActionType.READ),
|
1174
1185
|
review: DeclarationReviewConfig
|
1175
1186
|
})
|
1176
1187
|
);
|
1177
1188
|
var DeclareConfig = ActionConfigBase.merge(
|
1178
|
-
|
1179
|
-
type:
|
1189
|
+
import_zod10.z.object({
|
1190
|
+
type: import_zod10.z.literal(ActionType.DECLARE),
|
1180
1191
|
review: DeclarationReviewConfig
|
1181
1192
|
})
|
1182
1193
|
);
|
1183
1194
|
var ValidateConfig = ActionConfigBase.merge(
|
1184
|
-
|
1185
|
-
type:
|
1195
|
+
import_zod10.z.object({
|
1196
|
+
type: import_zod10.z.literal(ActionType.VALIDATE),
|
1186
1197
|
review: DeclarationReviewConfig
|
1187
1198
|
})
|
1188
1199
|
);
|
1189
1200
|
var RegisterConfig = ActionConfigBase.merge(
|
1190
|
-
|
1191
|
-
type:
|
1201
|
+
import_zod10.z.object({
|
1202
|
+
type: import_zod10.z.literal(ActionType.REGISTER),
|
1192
1203
|
review: DeclarationReviewConfig
|
1193
1204
|
})
|
1194
1205
|
);
|
1195
1206
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1196
|
-
|
1197
|
-
type:
|
1207
|
+
import_zod10.z.object({
|
1208
|
+
type: import_zod10.z.literal(ActionType.REJECT)
|
1198
1209
|
})
|
1199
1210
|
);
|
1200
1211
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1201
|
-
|
1202
|
-
type:
|
1212
|
+
import_zod10.z.object({
|
1213
|
+
type: import_zod10.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1203
1214
|
})
|
1204
1215
|
);
|
1205
1216
|
var ArchiveConfig = ActionConfigBase.merge(
|
1206
|
-
|
1207
|
-
type:
|
1217
|
+
import_zod10.z.object({
|
1218
|
+
type: import_zod10.z.literal(ActionType.ARCHIVE)
|
1208
1219
|
})
|
1209
1220
|
);
|
1210
1221
|
var DeleteConfig = ActionConfigBase.merge(
|
1211
|
-
|
1212
|
-
type:
|
1222
|
+
import_zod10.z.object({
|
1223
|
+
type: import_zod10.z.literal(ActionType.DELETE)
|
1213
1224
|
})
|
1214
1225
|
);
|
1215
1226
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1216
|
-
|
1217
|
-
type:
|
1227
|
+
import_zod10.z.object({
|
1228
|
+
type: import_zod10.z.literal(ActionType.PRINT_CERTIFICATE),
|
1218
1229
|
printForm: ActionFormConfig
|
1219
1230
|
})
|
1220
1231
|
);
|
1221
1232
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1222
|
-
|
1223
|
-
type:
|
1233
|
+
import_zod10.z.object({
|
1234
|
+
type: import_zod10.z.literal(ActionType.REQUEST_CORRECTION),
|
1224
1235
|
correctionForm: ActionFormConfig
|
1225
1236
|
})
|
1226
1237
|
);
|
1227
1238
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1228
|
-
|
1229
|
-
type:
|
1239
|
+
import_zod10.z.object({
|
1240
|
+
type: import_zod10.z.literal(ActionType.REJECT_CORRECTION)
|
1230
1241
|
})
|
1231
1242
|
);
|
1232
1243
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1233
|
-
|
1234
|
-
type:
|
1244
|
+
import_zod10.z.object({
|
1245
|
+
type: import_zod10.z.literal(ActionType.APPROVE_CORRECTION)
|
1235
1246
|
})
|
1236
1247
|
);
|
1237
|
-
var ActionConfig =
|
1248
|
+
var ActionConfig = import_zod10.z.discriminatedUnion("type", [
|
1238
1249
|
/*
|
1239
1250
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1240
1251
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1254,109 +1265,109 @@ var ActionConfig = import_zod11.z.discriminatedUnion("type", [
|
|
1254
1265
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1255
1266
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1256
1267
|
]).openapi({ ref: "ActionConfig" });
|
1257
|
-
var DeclarationActionConfig =
|
1268
|
+
var DeclarationActionConfig = import_zod10.z.discriminatedUnion("type", [
|
1258
1269
|
DeclareConfig,
|
1259
1270
|
ValidateConfig,
|
1260
1271
|
RegisterConfig
|
1261
1272
|
]);
|
1262
1273
|
|
1263
1274
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1264
|
-
var
|
1265
|
-
var FontFamily =
|
1266
|
-
normal:
|
1267
|
-
bold:
|
1268
|
-
italics:
|
1269
|
-
bolditalics:
|
1275
|
+
var import_zod11 = require("zod");
|
1276
|
+
var FontFamily = import_zod11.z.object({
|
1277
|
+
normal: import_zod11.z.string(),
|
1278
|
+
bold: import_zod11.z.string(),
|
1279
|
+
italics: import_zod11.z.string(),
|
1280
|
+
bolditalics: import_zod11.z.string()
|
1270
1281
|
});
|
1271
|
-
var CertificateConfig =
|
1272
|
-
id:
|
1273
|
-
event:
|
1282
|
+
var CertificateConfig = import_zod11.z.object({
|
1283
|
+
id: import_zod11.z.string(),
|
1284
|
+
event: import_zod11.z.string(),
|
1274
1285
|
label: TranslationConfig,
|
1275
|
-
isDefault:
|
1276
|
-
fee:
|
1277
|
-
onTime:
|
1278
|
-
late:
|
1279
|
-
delayed:
|
1286
|
+
isDefault: import_zod11.z.boolean(),
|
1287
|
+
fee: import_zod11.z.object({
|
1288
|
+
onTime: import_zod11.z.number(),
|
1289
|
+
late: import_zod11.z.number(),
|
1290
|
+
delayed: import_zod11.z.number()
|
1280
1291
|
}),
|
1281
|
-
svgUrl:
|
1282
|
-
fonts:
|
1283
|
-
conditionals:
|
1292
|
+
svgUrl: import_zod11.z.string(),
|
1293
|
+
fonts: import_zod11.z.record(FontFamily).optional(),
|
1294
|
+
conditionals: import_zod11.z.array(ShowConditional).optional()
|
1284
1295
|
});
|
1285
1296
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1286
|
-
hash:
|
1287
|
-
svg:
|
1297
|
+
hash: import_zod11.z.string().optional(),
|
1298
|
+
svg: import_zod11.z.string()
|
1288
1299
|
});
|
1289
1300
|
|
1290
1301
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1291
|
-
var
|
1292
|
-
var LanguageConfig =
|
1293
|
-
lang:
|
1302
|
+
var import_zod12 = require("zod");
|
1303
|
+
var LanguageConfig = import_zod12.z.object({
|
1304
|
+
lang: import_zod12.z.string(),
|
1294
1305
|
/**
|
1295
1306
|
* client.csv contents
|
1296
1307
|
*/
|
1297
|
-
messages:
|
1308
|
+
messages: import_zod12.z.record(import_zod12.z.string())
|
1298
1309
|
});
|
1299
1310
|
|
1300
1311
|
// ../commons/src/events/EventConfig.ts
|
1301
|
-
var
|
1312
|
+
var import_zod21 = require("zod");
|
1302
1313
|
|
1303
1314
|
// ../commons/src/events/DeduplicationConfig.ts
|
1304
|
-
var
|
1315
|
+
var import_zod13 = require("zod");
|
1305
1316
|
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:
|
1317
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod13.z);
|
1318
|
+
var FieldReference2 = import_zod13.z.string();
|
1319
|
+
var Matcher = import_zod13.z.object({
|
1320
|
+
fieldId: import_zod13.z.string(),
|
1321
|
+
options: import_zod13.z.object({
|
1322
|
+
boost: import_zod13.z.number().optional()
|
1312
1323
|
}).optional().default({})
|
1313
1324
|
});
|
1314
1325
|
var FuzzyMatcher = Matcher.extend({
|
1315
|
-
type:
|
1316
|
-
options:
|
1326
|
+
type: import_zod13.z.literal("fuzzy"),
|
1327
|
+
options: import_zod13.z.object({
|
1317
1328
|
/**
|
1318
1329
|
* Names of length 3 or less characters = 0 edits allowed
|
1319
1330
|
* Names of length 4 - 6 characters = 1 edit allowed
|
1320
1331
|
* Names of length >7 characters = 2 edits allowed
|
1321
1332
|
*/
|
1322
|
-
fuzziness:
|
1323
|
-
boost:
|
1333
|
+
fuzziness: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]).optional().default("AUTO:4,7"),
|
1334
|
+
boost: import_zod13.z.number().optional().default(1)
|
1324
1335
|
}).optional().default({})
|
1325
1336
|
});
|
1326
1337
|
var StrictMatcher = Matcher.extend({
|
1327
|
-
type:
|
1328
|
-
options:
|
1329
|
-
boost:
|
1338
|
+
type: import_zod13.z.literal("strict"),
|
1339
|
+
options: import_zod13.z.object({
|
1340
|
+
boost: import_zod13.z.number().optional().default(1)
|
1330
1341
|
}).optional().default({})
|
1331
1342
|
});
|
1332
1343
|
var DateRangeMatcher = Matcher.extend({
|
1333
|
-
type:
|
1334
|
-
options:
|
1335
|
-
days:
|
1344
|
+
type: import_zod13.z.literal("dateRange"),
|
1345
|
+
options: import_zod13.z.object({
|
1346
|
+
days: import_zod13.z.number(),
|
1336
1347
|
origin: FieldReference2,
|
1337
|
-
boost:
|
1348
|
+
boost: import_zod13.z.number().optional().default(1)
|
1338
1349
|
})
|
1339
1350
|
});
|
1340
1351
|
var DateDistanceMatcher = Matcher.extend({
|
1341
|
-
type:
|
1342
|
-
options:
|
1343
|
-
days:
|
1352
|
+
type: import_zod13.z.literal("dateDistance"),
|
1353
|
+
options: import_zod13.z.object({
|
1354
|
+
days: import_zod13.z.number(),
|
1344
1355
|
origin: FieldReference2,
|
1345
|
-
boost:
|
1356
|
+
boost: import_zod13.z.number().optional().default(1)
|
1346
1357
|
})
|
1347
1358
|
});
|
1348
|
-
var And =
|
1349
|
-
type:
|
1359
|
+
var And = import_zod13.z.object({
|
1360
|
+
type: import_zod13.z.literal("and"),
|
1350
1361
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1351
|
-
clauses:
|
1362
|
+
clauses: import_zod13.z.lazy(() => Clause.array())
|
1352
1363
|
});
|
1353
|
-
var Or =
|
1354
|
-
type:
|
1364
|
+
var Or = import_zod13.z.object({
|
1365
|
+
type: import_zod13.z.literal("or"),
|
1355
1366
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1356
|
-
clauses:
|
1367
|
+
clauses: import_zod13.z.lazy(() => Clause.array())
|
1357
1368
|
});
|
1358
|
-
var Clause =
|
1359
|
-
() =>
|
1369
|
+
var Clause = import_zod13.z.lazy(
|
1370
|
+
() => import_zod13.z.discriminatedUnion("type", [
|
1360
1371
|
And,
|
1361
1372
|
Or,
|
1362
1373
|
FuzzyMatcher,
|
@@ -1367,43 +1378,43 @@ var Clause = import_zod14.z.lazy(
|
|
1367
1378
|
).openapi({
|
1368
1379
|
ref: "Clause"
|
1369
1380
|
});
|
1370
|
-
var DeduplicationConfig =
|
1371
|
-
id:
|
1381
|
+
var DeduplicationConfig = import_zod13.z.object({
|
1382
|
+
id: import_zod13.z.string(),
|
1372
1383
|
label: TranslationConfig,
|
1373
1384
|
query: Clause
|
1374
1385
|
});
|
1375
1386
|
|
1376
1387
|
// ../commons/src/events/SummaryConfig.ts
|
1377
|
-
var
|
1378
|
-
var BaseField2 =
|
1388
|
+
var import_zod14 = require("zod");
|
1389
|
+
var BaseField2 = import_zod14.z.object({
|
1379
1390
|
emptyValueMessage: TranslationConfig.optional(),
|
1380
|
-
conditionals:
|
1391
|
+
conditionals: import_zod14.z.array(ShowConditional).default([]).optional()
|
1381
1392
|
});
|
1382
1393
|
var ReferenceField = BaseField2.extend({
|
1383
|
-
fieldId:
|
1394
|
+
fieldId: import_zod14.z.string(),
|
1384
1395
|
label: TranslationConfig.optional().describe(
|
1385
1396
|
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1386
1397
|
)
|
1387
1398
|
}).describe("Field directly referencing event data with field id");
|
1388
1399
|
var Field = BaseField2.extend({
|
1389
|
-
id:
|
1400
|
+
id: import_zod14.z.string().describe("Id of summary field"),
|
1390
1401
|
value: TranslationConfig.describe(
|
1391
1402
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1392
1403
|
),
|
1393
1404
|
label: TranslationConfig
|
1394
1405
|
}).describe("Custom configured field");
|
1395
|
-
var SummaryConfig =
|
1396
|
-
fields:
|
1406
|
+
var SummaryConfig = import_zod14.z.object({
|
1407
|
+
fields: import_zod14.z.array(import_zod14.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
1397
1408
|
}).describe("Configuration for summary in event.");
|
1398
1409
|
|
1399
1410
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1400
|
-
var
|
1401
|
-
var MatchType =
|
1402
|
-
var BaseField3 =
|
1403
|
-
config:
|
1411
|
+
var import_zod15 = require("zod");
|
1412
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
|
1413
|
+
var BaseField3 = import_zod15.z.object({
|
1414
|
+
config: import_zod15.z.object({
|
1404
1415
|
type: MatchType.describe("Determines the type of field")
|
1405
1416
|
}),
|
1406
|
-
options:
|
1417
|
+
options: import_zod15.z.array(SelectOption).optional(),
|
1407
1418
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1408
1419
|
`
|
1409
1420
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
@@ -1424,7 +1435,7 @@ var BaseField3 = import_zod16.z.object({
|
|
1424
1435
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1425
1436
|
`
|
1426
1437
|
),
|
1427
|
-
conditionals:
|
1438
|
+
conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
|
1428
1439
|
`
|
1429
1440
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1430
1441
|
|
@@ -1438,30 +1449,30 @@ var BaseField3 = import_zod16.z.object({
|
|
1438
1449
|
are always rendered in the advanced search form.
|
1439
1450
|
`
|
1440
1451
|
),
|
1441
|
-
validations:
|
1452
|
+
validations: import_zod15.z.array(ValidationConfig).default([]).optional().describe(
|
1442
1453
|
`In advanced search, we sometimes need to override the default field validations.`
|
1443
1454
|
)
|
1444
1455
|
});
|
1445
|
-
var SearchQueryParams =
|
1446
|
-
eventType:
|
1456
|
+
var SearchQueryParams = import_zod15.z.object({
|
1457
|
+
eventType: import_zod15.z.string().optional().describe(
|
1447
1458
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1448
1459
|
)
|
1449
1460
|
}).catchall(FieldValue);
|
1450
1461
|
var FieldConfigSchema = BaseField3.extend({
|
1451
|
-
fieldId:
|
1452
|
-
fieldType:
|
1453
|
-
alternateFieldIds:
|
1462
|
+
fieldId: import_zod15.z.string(),
|
1463
|
+
fieldType: import_zod15.z.literal("field"),
|
1464
|
+
alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
1454
1465
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1455
1466
|
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1456
1467
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1457
1468
|
),
|
1458
|
-
excludeInSearchQuery:
|
1469
|
+
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1459
1470
|
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1460
1471
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1461
1472
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1462
1473
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1463
1474
|
});
|
1464
|
-
var EventFieldIdInput =
|
1475
|
+
var EventFieldIdInput = import_zod15.z.enum([
|
1465
1476
|
"trackingId",
|
1466
1477
|
"status",
|
1467
1478
|
"legalStatuses.REGISTERED.acceptedAt",
|
@@ -1469,7 +1480,7 @@ var EventFieldIdInput = import_zod16.z.enum([
|
|
1469
1480
|
"updatedAt"
|
1470
1481
|
]);
|
1471
1482
|
var METADATA_FIELD_PREFIX = "event.";
|
1472
|
-
var EventFieldId =
|
1483
|
+
var EventFieldId = import_zod15.z.enum([
|
1473
1484
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
1474
1485
|
`${METADATA_FIELD_PREFIX}status`,
|
1475
1486
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
@@ -1478,28 +1489,28 @@ var EventFieldId = import_zod16.z.enum([
|
|
1478
1489
|
]);
|
1479
1490
|
var EventFieldConfigSchema = BaseField3.extend({
|
1480
1491
|
fieldId: EventFieldId,
|
1481
|
-
fieldType:
|
1492
|
+
fieldType: import_zod15.z.literal("event")
|
1482
1493
|
});
|
1483
|
-
var SearchField =
|
1494
|
+
var SearchField = import_zod15.z.discriminatedUnion("fieldType", [
|
1484
1495
|
FieldConfigSchema,
|
1485
1496
|
EventFieldConfigSchema
|
1486
1497
|
]);
|
1487
|
-
var AdvancedSearchConfig =
|
1498
|
+
var AdvancedSearchConfig = import_zod15.z.object({
|
1488
1499
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1489
|
-
fields:
|
1500
|
+
fields: import_zod15.z.array(SearchField).describe("Advanced search fields.")
|
1490
1501
|
});
|
1491
1502
|
|
1492
1503
|
// ../commons/src/events/utils.ts
|
1493
1504
|
var import_lodash = require("lodash");
|
1494
1505
|
|
1495
1506
|
// ../commons/src/events/ActionDocument.ts
|
1496
|
-
var
|
1507
|
+
var import_zod19 = require("zod");
|
1497
1508
|
var import_zod_openapi8 = require("zod-openapi");
|
1498
1509
|
|
1499
1510
|
// ../commons/src/uuid.ts
|
1500
1511
|
var import_uuid = require("uuid");
|
1501
|
-
var
|
1502
|
-
var UUID =
|
1512
|
+
var import_zod16 = require("zod");
|
1513
|
+
var UUID = import_zod16.z.string().uuid().brand("UUID");
|
1503
1514
|
function getUUID() {
|
1504
1515
|
return (0, import_uuid.v4)();
|
1505
1516
|
}
|
@@ -1509,10 +1520,10 @@ var CreatedAtLocation = UUID.nullish();
|
|
1509
1520
|
|
1510
1521
|
// ../commons/src/authentication.ts
|
1511
1522
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1512
|
-
var
|
1523
|
+
var import_zod18 = require("zod");
|
1513
1524
|
|
1514
1525
|
// ../commons/src/scopes.ts
|
1515
|
-
var
|
1526
|
+
var import_zod17 = require("zod");
|
1516
1527
|
var SCOPES = {
|
1517
1528
|
// TODO v1.8 legacy scopes
|
1518
1529
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -1625,108 +1636,108 @@ var SCOPES = {
|
|
1625
1636
|
// data seeding
|
1626
1637
|
USER_DATA_SEEDING: "user.data-seeding"
|
1627
1638
|
};
|
1628
|
-
var LegacyScopes =
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1639
|
+
var LegacyScopes = import_zod17.z.union([
|
1640
|
+
import_zod17.z.literal(SCOPES.NATLSYSADMIN),
|
1641
|
+
import_zod17.z.literal(SCOPES.BYPASSRATELIMIT),
|
1642
|
+
import_zod17.z.literal(SCOPES.DECLARE),
|
1643
|
+
import_zod17.z.literal(SCOPES.REGISTER),
|
1644
|
+
import_zod17.z.literal(SCOPES.VALIDATE),
|
1645
|
+
import_zod17.z.literal(SCOPES.DEMO),
|
1646
|
+
import_zod17.z.literal(SCOPES.CERTIFY),
|
1647
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE),
|
1648
|
+
import_zod17.z.literal(SCOPES.SYSADMIN),
|
1649
|
+
import_zod17.z.literal(SCOPES.TEAMS),
|
1650
|
+
import_zod17.z.literal(SCOPES.CONFIG)
|
1640
1651
|
]);
|
1641
|
-
var IntegrationScopes =
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1652
|
+
var IntegrationScopes = import_zod17.z.union([
|
1653
|
+
import_zod17.z.literal(SCOPES.WEBHOOK),
|
1654
|
+
import_zod17.z.literal(SCOPES.NATIONALID),
|
1655
|
+
import_zod17.z.literal(SCOPES.NOTIFICATION_API),
|
1656
|
+
import_zod17.z.literal(SCOPES.RECORDSEARCH)
|
1646
1657
|
]);
|
1647
|
-
var DeclareScopes =
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
+
var DeclareScopes = import_zod17.z.union([
|
1659
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE),
|
1660
|
+
import_zod17.z.literal(SCOPES.RECORD_IMPORT),
|
1661
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
1662
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
1663
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
1664
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
1665
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
1666
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
1667
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
1668
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
1658
1669
|
]);
|
1659
|
-
var UnassignScope =
|
1660
|
-
var ValidateScopes =
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1670
|
+
var UnassignScope = import_zod17.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
1671
|
+
var ValidateScopes = import_zod17.z.union([
|
1672
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
1673
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
1674
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
1675
|
+
import_zod17.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
1676
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
1677
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
1667
1678
|
]);
|
1668
|
-
var RegisterScope =
|
1669
|
-
var CertifyScopes =
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1679
|
+
var RegisterScope = import_zod17.z.literal(SCOPES.RECORD_REGISTER);
|
1680
|
+
var CertifyScopes = import_zod17.z.union([
|
1681
|
+
import_zod17.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
1682
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
1683
|
+
import_zod17.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
1684
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
1685
|
+
import_zod17.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
1686
|
+
import_zod17.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
1687
|
+
import_zod17.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
1688
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
|
1678
1689
|
]);
|
1679
|
-
var CorrectionScopes =
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1690
|
+
var CorrectionScopes = import_zod17.z.union([
|
1691
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
1692
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
1693
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
1694
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
1695
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
1696
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
1697
|
+
import_zod17.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
1698
|
+
import_zod17.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
1688
1699
|
]);
|
1689
|
-
var SearchScopes =
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1700
|
+
var SearchScopes = import_zod17.z.union([
|
1701
|
+
import_zod17.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
1702
|
+
import_zod17.z.literal(SCOPES.SEARCH_BIRTH),
|
1703
|
+
import_zod17.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
1704
|
+
import_zod17.z.literal(SCOPES.SEARCH_DEATH),
|
1705
|
+
import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
1706
|
+
import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE)
|
1696
1707
|
]);
|
1697
|
-
var AuditScopes =
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1708
|
+
var AuditScopes = import_zod17.z.union([
|
1709
|
+
import_zod17.z.literal(SCOPES.RECORD_READ),
|
1710
|
+
import_zod17.z.literal(SCOPES.RECORD_READ_AUDIT),
|
1711
|
+
import_zod17.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
1712
|
+
import_zod17.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
|
1702
1713
|
]);
|
1703
|
-
var ProfileScopes =
|
1704
|
-
|
1705
|
-
|
1714
|
+
var ProfileScopes = import_zod17.z.union([
|
1715
|
+
import_zod17.z.literal(SCOPES.PROFILE_UPDATE),
|
1716
|
+
import_zod17.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1706
1717
|
]);
|
1707
|
-
var PerformanceScopes =
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1718
|
+
var PerformanceScopes = import_zod17.z.union([
|
1719
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE_READ),
|
1720
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
1721
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
1711
1722
|
]);
|
1712
|
-
var OrganisationScopes =
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1723
|
+
var OrganisationScopes = import_zod17.z.union([
|
1724
|
+
import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
1725
|
+
import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
1726
|
+
import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
1716
1727
|
]);
|
1717
|
-
var UserScopes =
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1728
|
+
var UserScopes = import_zod17.z.union([
|
1729
|
+
import_zod17.z.literal(SCOPES.USER_READ),
|
1730
|
+
import_zod17.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
1731
|
+
import_zod17.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
1732
|
+
import_zod17.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
1733
|
+
import_zod17.z.literal(SCOPES.USER_CREATE),
|
1734
|
+
import_zod17.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
1735
|
+
import_zod17.z.literal(SCOPES.USER_UPDATE),
|
1736
|
+
import_zod17.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
1726
1737
|
]);
|
1727
|
-
var ConfigScope =
|
1728
|
-
var DataSeedingScope =
|
1729
|
-
var LiteralScopes =
|
1738
|
+
var ConfigScope = import_zod17.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
1739
|
+
var DataSeedingScope = import_zod17.z.literal(SCOPES.USER_DATA_SEEDING);
|
1740
|
+
var LiteralScopes = import_zod17.z.union([
|
1730
1741
|
LegacyScopes,
|
1731
1742
|
IntegrationScopes,
|
1732
1743
|
UnassignScope,
|
@@ -1745,39 +1756,39 @@ var LiteralScopes = import_zod18.z.union([
|
|
1745
1756
|
DataSeedingScope
|
1746
1757
|
]);
|
1747
1758
|
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1748
|
-
var rawConfigurableScope =
|
1749
|
-
var CreateUserScope =
|
1750
|
-
type:
|
1751
|
-
options:
|
1752
|
-
role:
|
1759
|
+
var rawConfigurableScope = import_zod17.z.string().regex(rawConfigurableScopeRegex);
|
1760
|
+
var CreateUserScope = import_zod17.z.object({
|
1761
|
+
type: import_zod17.z.literal("user.create"),
|
1762
|
+
options: import_zod17.z.object({
|
1763
|
+
role: import_zod17.z.array(import_zod17.z.string())
|
1753
1764
|
})
|
1754
1765
|
});
|
1755
|
-
var EditUserScope =
|
1756
|
-
type:
|
1757
|
-
options:
|
1758
|
-
role:
|
1766
|
+
var EditUserScope = import_zod17.z.object({
|
1767
|
+
type: import_zod17.z.literal("user.edit"),
|
1768
|
+
options: import_zod17.z.object({
|
1769
|
+
role: import_zod17.z.array(import_zod17.z.string())
|
1759
1770
|
})
|
1760
1771
|
});
|
1761
|
-
var WorkqueueScope =
|
1762
|
-
type:
|
1763
|
-
options:
|
1764
|
-
id:
|
1772
|
+
var WorkqueueScope = import_zod17.z.object({
|
1773
|
+
type: import_zod17.z.literal("workqueue"),
|
1774
|
+
options: import_zod17.z.object({
|
1775
|
+
id: import_zod17.z.array(import_zod17.z.string())
|
1765
1776
|
})
|
1766
1777
|
});
|
1767
|
-
var NotifyRecordScope =
|
1768
|
-
type:
|
1769
|
-
options:
|
1770
|
-
event:
|
1778
|
+
var NotifyRecordScope = import_zod17.z.object({
|
1779
|
+
type: import_zod17.z.literal("record.notify"),
|
1780
|
+
options: import_zod17.z.object({
|
1781
|
+
event: import_zod17.z.array(import_zod17.z.string())
|
1771
1782
|
})
|
1772
1783
|
});
|
1773
|
-
var SearchScope =
|
1774
|
-
type:
|
1775
|
-
options:
|
1776
|
-
event:
|
1777
|
-
access:
|
1784
|
+
var SearchScope = import_zod17.z.object({
|
1785
|
+
type: import_zod17.z.literal("search"),
|
1786
|
+
options: import_zod17.z.object({
|
1787
|
+
event: import_zod17.z.array(import_zod17.z.string()).length(1),
|
1788
|
+
access: import_zod17.z.array(import_zod17.z.enum(["my-jurisdiction", "all"])).length(1)
|
1778
1789
|
})
|
1779
1790
|
});
|
1780
|
-
var ConfigurableRawScopes =
|
1791
|
+
var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
|
1781
1792
|
SearchScope,
|
1782
1793
|
CreateUserScope,
|
1783
1794
|
EditUserScope,
|
@@ -1785,7 +1796,7 @@ var ConfigurableRawScopes = import_zod18.z.discriminatedUnion("type", [
|
|
1785
1796
|
NotifyRecordScope
|
1786
1797
|
]);
|
1787
1798
|
var scopes = Object.values(SCOPES);
|
1788
|
-
var ActionScopes =
|
1799
|
+
var ActionScopes = import_zod17.z.union([
|
1789
1800
|
DeclareScopes,
|
1790
1801
|
ValidateScopes,
|
1791
1802
|
RegisterScope,
|
@@ -1936,30 +1947,30 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
1936
1947
|
]
|
1937
1948
|
}
|
1938
1949
|
];
|
1939
|
-
var TokenUserType =
|
1940
|
-
var TokenWithBearer =
|
1950
|
+
var TokenUserType = import_zod18.z.enum(["user", "system"]);
|
1951
|
+
var TokenWithBearer = import_zod18.z.string().regex(/^Bearer\s/);
|
1941
1952
|
|
1942
1953
|
// ../commons/src/events/ActionDocument.ts
|
1943
|
-
(0, import_zod_openapi8.extendZodWithOpenApi)(
|
1944
|
-
var ActionUpdate =
|
1945
|
-
var EventState =
|
1954
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod19.z);
|
1955
|
+
var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
|
1956
|
+
var EventState = import_zod19.z.record(import_zod19.z.string(), FieldValue);
|
1946
1957
|
var ActionStatus = {
|
1947
1958
|
Requested: "Requested",
|
1948
1959
|
Accepted: "Accepted",
|
1949
1960
|
Rejected: "Rejected"
|
1950
1961
|
};
|
1951
|
-
var ActionBase =
|
1962
|
+
var ActionBase = import_zod19.z.object({
|
1952
1963
|
id: UUID,
|
1953
|
-
transactionId:
|
1964
|
+
transactionId: import_zod19.z.string(),
|
1954
1965
|
createdByUserType: TokenUserType,
|
1955
|
-
createdAt:
|
1956
|
-
createdBy:
|
1957
|
-
createdByRole:
|
1958
|
-
createdBySignature:
|
1966
|
+
createdAt: import_zod19.z.string().datetime(),
|
1967
|
+
createdBy: import_zod19.z.string(),
|
1968
|
+
createdByRole: import_zod19.z.string(),
|
1969
|
+
createdBySignature: import_zod19.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1959
1970
|
createdAtLocation: CreatedAtLocation,
|
1960
1971
|
declaration: ActionUpdate,
|
1961
1972
|
annotation: ActionUpdate.optional().nullable(),
|
1962
|
-
status:
|
1973
|
+
status: import_zod19.z.enum([
|
1963
1974
|
ActionStatus.Requested,
|
1964
1975
|
ActionStatus.Accepted,
|
1965
1976
|
ActionStatus.Rejected
|
@@ -1973,102 +1984,102 @@ var ActionBase = import_zod20.z.object({
|
|
1973
1984
|
// See PrintCertificateAction
|
1974
1985
|
});
|
1975
1986
|
var AssignedAction = ActionBase.merge(
|
1976
|
-
|
1977
|
-
type:
|
1978
|
-
assignedTo:
|
1987
|
+
import_zod19.z.object({
|
1988
|
+
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1989
|
+
assignedTo: import_zod19.z.string()
|
1979
1990
|
// TODO move into 'content' property
|
1980
1991
|
})
|
1981
1992
|
);
|
1982
1993
|
var UnassignedAction = ActionBase.merge(
|
1983
|
-
|
1984
|
-
type:
|
1994
|
+
import_zod19.z.object({
|
1995
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN)
|
1985
1996
|
})
|
1986
1997
|
);
|
1987
1998
|
var RegisterAction = ActionBase.merge(
|
1988
|
-
|
1989
|
-
type:
|
1990
|
-
registrationNumber:
|
1999
|
+
import_zod19.z.object({
|
2000
|
+
type: import_zod19.z.literal(ActionType.REGISTER),
|
2001
|
+
registrationNumber: import_zod19.z.string().optional()
|
1991
2002
|
// TODO move into 'content' property
|
1992
2003
|
})
|
1993
2004
|
);
|
1994
2005
|
var DeclareAction = ActionBase.merge(
|
1995
|
-
|
1996
|
-
type:
|
2006
|
+
import_zod19.z.object({
|
2007
|
+
type: import_zod19.z.literal(ActionType.DECLARE)
|
1997
2008
|
})
|
1998
2009
|
);
|
1999
2010
|
var ValidateAction = ActionBase.merge(
|
2000
|
-
|
2001
|
-
type:
|
2011
|
+
import_zod19.z.object({
|
2012
|
+
type: import_zod19.z.literal(ActionType.VALIDATE)
|
2002
2013
|
})
|
2003
2014
|
);
|
2004
|
-
var RejectionReason =
|
2005
|
-
message:
|
2006
|
-
isDuplicate:
|
2015
|
+
var RejectionReason = import_zod19.z.object({
|
2016
|
+
message: import_zod19.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
2017
|
+
isDuplicate: import_zod19.z.boolean().optional().describe("If a declaration is duplicated")
|
2007
2018
|
});
|
2008
2019
|
var RejectAction = ActionBase.merge(
|
2009
|
-
|
2010
|
-
type:
|
2020
|
+
import_zod19.z.object({
|
2021
|
+
type: import_zod19.z.literal(ActionType.REJECT),
|
2011
2022
|
reason: RejectionReason
|
2012
2023
|
// TODO move into 'content' property
|
2013
2024
|
})
|
2014
2025
|
);
|
2015
2026
|
var MarkAsDuplicateAction = ActionBase.merge(
|
2016
|
-
|
2017
|
-
type:
|
2027
|
+
import_zod19.z.object({
|
2028
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
2018
2029
|
})
|
2019
2030
|
);
|
2020
2031
|
var ArchiveAction = ActionBase.merge(
|
2021
|
-
|
2022
|
-
type:
|
2032
|
+
import_zod19.z.object({
|
2033
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
2023
2034
|
reason: RejectionReason
|
2024
2035
|
// TODO move into 'content' property
|
2025
2036
|
})
|
2026
2037
|
);
|
2027
2038
|
var CreatedAction = ActionBase.merge(
|
2028
|
-
|
2029
|
-
type:
|
2039
|
+
import_zod19.z.object({
|
2040
|
+
type: import_zod19.z.literal(ActionType.CREATE)
|
2030
2041
|
})
|
2031
2042
|
);
|
2032
2043
|
var NotifiedAction = ActionBase.merge(
|
2033
|
-
|
2034
|
-
type:
|
2044
|
+
import_zod19.z.object({
|
2045
|
+
type: import_zod19.z.literal(ActionType.NOTIFY)
|
2035
2046
|
})
|
2036
2047
|
);
|
2037
|
-
var PrintContent =
|
2038
|
-
templateId:
|
2048
|
+
var PrintContent = import_zod19.z.object({
|
2049
|
+
templateId: import_zod19.z.string().optional()
|
2039
2050
|
});
|
2040
2051
|
var PrintCertificateAction = ActionBase.merge(
|
2041
|
-
|
2042
|
-
type:
|
2052
|
+
import_zod19.z.object({
|
2053
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
|
2043
2054
|
content: PrintContent.optional().nullable()
|
2044
2055
|
})
|
2045
2056
|
);
|
2046
2057
|
var RequestedCorrectionAction = ActionBase.merge(
|
2047
|
-
|
2048
|
-
type:
|
2058
|
+
import_zod19.z.object({
|
2059
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
|
2049
2060
|
})
|
2050
2061
|
);
|
2051
2062
|
var ApprovedCorrectionAction = ActionBase.merge(
|
2052
|
-
|
2053
|
-
type:
|
2054
|
-
requestId:
|
2063
|
+
import_zod19.z.object({
|
2064
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
2065
|
+
requestId: import_zod19.z.string()
|
2055
2066
|
// TODO move into 'content' property
|
2056
2067
|
})
|
2057
2068
|
);
|
2058
2069
|
var RejectedCorrectionAction = ActionBase.merge(
|
2059
|
-
|
2060
|
-
type:
|
2061
|
-
requestId:
|
2070
|
+
import_zod19.z.object({
|
2071
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
2072
|
+
requestId: import_zod19.z.string(),
|
2062
2073
|
// TODO move into 'content' property
|
2063
2074
|
reason: RejectionReason
|
2064
2075
|
})
|
2065
2076
|
);
|
2066
2077
|
var ReadAction = ActionBase.merge(
|
2067
|
-
|
2068
|
-
type:
|
2078
|
+
import_zod19.z.object({
|
2079
|
+
type: import_zod19.z.literal(ActionType.READ)
|
2069
2080
|
})
|
2070
2081
|
);
|
2071
|
-
var ActionDocument =
|
2082
|
+
var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
2072
2083
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
2073
2084
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
2074
2085
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -2091,20 +2102,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
2091
2102
|
declaration: true,
|
2092
2103
|
annotation: true
|
2093
2104
|
}).merge(
|
2094
|
-
|
2095
|
-
type:
|
2096
|
-
status:
|
2105
|
+
import_zod19.z.object({
|
2106
|
+
type: import_zod19.z.enum(ConfirmableActions),
|
2107
|
+
status: import_zod19.z.literal(ActionStatus.Rejected)
|
2097
2108
|
})
|
2098
2109
|
);
|
2099
|
-
var Action =
|
2100
|
-
var ResolvedUser =
|
2101
|
-
id:
|
2102
|
-
role:
|
2103
|
-
name:
|
2104
|
-
|
2105
|
-
use:
|
2106
|
-
given:
|
2107
|
-
family:
|
2110
|
+
var Action = import_zod19.z.union([ActionDocument, AsyncRejectActionDocument]);
|
2111
|
+
var ResolvedUser = import_zod19.z.object({
|
2112
|
+
id: import_zod19.z.string(),
|
2113
|
+
role: import_zod19.z.string(),
|
2114
|
+
name: import_zod19.z.array(
|
2115
|
+
import_zod19.z.object({
|
2116
|
+
use: import_zod19.z.string(),
|
2117
|
+
given: import_zod19.z.array(import_zod19.z.string()),
|
2118
|
+
family: import_zod19.z.string()
|
2108
2119
|
})
|
2109
2120
|
)
|
2110
2121
|
});
|
@@ -2115,7 +2126,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
2115
2126
|
var import_date_fns = require("date-fns");
|
2116
2127
|
|
2117
2128
|
// ../commons/src/events/FieldTypeMapping.ts
|
2118
|
-
var
|
2129
|
+
var import_zod20 = require("zod");
|
2119
2130
|
function mapFieldTypeToZod(type, required) {
|
2120
2131
|
let schema;
|
2121
2132
|
switch (type) {
|
@@ -2173,6 +2184,12 @@ function mapFieldTypeToZod(type, required) {
|
|
2173
2184
|
case FieldType.NAME:
|
2174
2185
|
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
2175
2186
|
break;
|
2187
|
+
case FieldType.BUTTON:
|
2188
|
+
schema = ButtonFieldValue;
|
2189
|
+
break;
|
2190
|
+
case FieldType.HTTP:
|
2191
|
+
schema = HttpFieldUpdateValue;
|
2192
|
+
break;
|
2176
2193
|
}
|
2177
2194
|
return required ? schema : schema.nullish();
|
2178
2195
|
}
|
@@ -2181,7 +2198,7 @@ function createValidationSchema(config) {
|
|
2181
2198
|
for (const field2 of config) {
|
2182
2199
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2183
2200
|
}
|
2184
|
-
return
|
2201
|
+
return import_zod20.z.object(shape);
|
2185
2202
|
}
|
2186
2203
|
function mapFieldTypeToEmptyValue(field2) {
|
2187
2204
|
switch (field2.type) {
|
@@ -2208,6 +2225,8 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2208
2225
|
case FieldType.DATA:
|
2209
2226
|
case FieldType.NAME:
|
2210
2227
|
case FieldType.PHONE:
|
2228
|
+
case FieldType.BUTTON:
|
2229
|
+
case FieldType.HTTP:
|
2211
2230
|
case FieldType.ID:
|
2212
2231
|
return null;
|
2213
2232
|
case FieldType.ADDRESS:
|
@@ -2319,8 +2338,14 @@ var isOfficeFieldType = (field2) => {
|
|
2319
2338
|
var isDataFieldType = (field2) => {
|
2320
2339
|
return field2.config.type === FieldType.DATA;
|
2321
2340
|
};
|
2341
|
+
var isButtonFieldType = (field2) => {
|
2342
|
+
return field2.config.type === FieldType.BUTTON;
|
2343
|
+
};
|
2344
|
+
var isHttpFieldType = (field2) => {
|
2345
|
+
return field2.config.type === FieldType.HTTP;
|
2346
|
+
};
|
2322
2347
|
var isNonInteractiveFieldType = (field2) => {
|
2323
|
-
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
2348
|
+
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA || field2.type === FieldType.HTTP;
|
2324
2349
|
};
|
2325
2350
|
|
2326
2351
|
// ../commons/src/conditionals/validate.ts
|
@@ -2689,16 +2714,10 @@ function omitHiddenPaginatedFields(formConfig, declaration) {
|
|
2689
2714
|
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
2690
2715
|
return omitHiddenFields(visiblePagesFormFields, declaration);
|
2691
2716
|
}
|
2692
|
-
function
|
2693
|
-
const actions = (
|
2694
|
-
event2.actions.filter(({ type }) => type !== ActionType.READ),
|
2695
|
-
["createdAt"],
|
2696
|
-
["asc"]
|
2697
|
-
);
|
2717
|
+
function findActiveDrafts(event2, drafts) {
|
2718
|
+
const actions = event2.actions.slice().filter(({ type }) => type !== ActionType.READ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2698
2719
|
const lastAction = actions[actions.length - 1];
|
2699
|
-
|
2700
|
-
const isDraftForEvent = event2.id === draft.eventId;
|
2701
|
-
return isDraftActive && isDraftForEvent ? draft : void 0;
|
2720
|
+
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
2702
2721
|
}
|
2703
2722
|
function createEmptyDraft(eventId, draftId, actionType) {
|
2704
2723
|
return {
|
@@ -2831,35 +2850,12 @@ function timePeriodToDateRange(value) {
|
|
2831
2850
|
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2832
2851
|
};
|
2833
2852
|
}
|
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
2853
|
|
2858
2854
|
// ../commons/src/events/EventConfig.ts
|
2859
2855
|
var import_zod_openapi9 = require("zod-openapi");
|
2860
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
2861
|
-
var EventConfig =
|
2862
|
-
id:
|
2856
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod21.z);
|
2857
|
+
var EventConfig = import_zod21.z.object({
|
2858
|
+
id: import_zod21.z.string().describe(
|
2863
2859
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2864
2860
|
),
|
2865
2861
|
dateOfEvent: FieldReference.optional(),
|
@@ -2869,10 +2865,10 @@ var EventConfig = import_zod22.z.object({
|
|
2869
2865
|
),
|
2870
2866
|
summary: SummaryConfig,
|
2871
2867
|
label: TranslationConfig,
|
2872
|
-
actions:
|
2868
|
+
actions: import_zod21.z.array(ActionConfig),
|
2873
2869
|
declaration: DeclarationFormConfig,
|
2874
|
-
deduplication:
|
2875
|
-
advancedSearch:
|
2870
|
+
deduplication: import_zod21.z.array(DeduplicationConfig).optional().default([]),
|
2871
|
+
advancedSearch: import_zod21.z.array(AdvancedSearchConfig).optional().default([])
|
2876
2872
|
}).superRefine((event2, ctx) => {
|
2877
2873
|
const allFields = findAllFields(event2);
|
2878
2874
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2956,12 +2952,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2956
2952
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2957
2953
|
|
2958
2954
|
// ../commons/src/events/WorkqueueConfig.ts
|
2959
|
-
var
|
2955
|
+
var import_zod28 = require("zod");
|
2960
2956
|
|
2961
2957
|
// ../commons/src/events/serializers/user/serializer.ts
|
2962
|
-
var
|
2963
|
-
var SerializedUserField =
|
2964
|
-
$userField:
|
2958
|
+
var import_zod22 = require("zod");
|
2959
|
+
var SerializedUserField = import_zod22.z.object({
|
2960
|
+
$userField: import_zod22.z.enum([
|
2965
2961
|
"id",
|
2966
2962
|
"name",
|
2967
2963
|
"role",
|
@@ -3450,11 +3446,11 @@ var event = Object.assign(eventFn, {
|
|
3450
3446
|
});
|
3451
3447
|
|
3452
3448
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3453
|
-
var
|
3449
|
+
var import_zod24 = require("zod");
|
3454
3450
|
|
3455
3451
|
// ../commons/src/events/EventMetadata.ts
|
3456
|
-
var
|
3457
|
-
var EventStatus =
|
3452
|
+
var import_zod23 = require("zod");
|
3453
|
+
var EventStatus = import_zod23.z.enum([
|
3458
3454
|
"CREATED",
|
3459
3455
|
"NOTIFIED",
|
3460
3456
|
"DECLARED",
|
@@ -3468,7 +3464,7 @@ var InherentFlags = {
|
|
3468
3464
|
REJECTED: "rejected",
|
3469
3465
|
CORRECTION_REQUESTED: "correction-requested"
|
3470
3466
|
};
|
3471
|
-
var ActionFlag =
|
3467
|
+
var ActionFlag = import_zod23.z.string().regex(
|
3472
3468
|
new RegExp(
|
3473
3469
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3474
3470
|
ActionStatus
|
@@ -3476,56 +3472,56 @@ var ActionFlag = import_zod24.z.string().regex(
|
|
3476
3472
|
),
|
3477
3473
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3478
3474
|
);
|
3479
|
-
var Flag = ActionFlag.or(
|
3480
|
-
var ZodDate =
|
3481
|
-
var ActionCreationMetadata =
|
3482
|
-
createdAt:
|
3483
|
-
createdBy:
|
3475
|
+
var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
|
3476
|
+
var ZodDate = import_zod23.z.string().date();
|
3477
|
+
var ActionCreationMetadata = import_zod23.z.object({
|
3478
|
+
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
|
3479
|
+
createdBy: import_zod23.z.string().describe("ID of the user who created the action request."),
|
3484
3480
|
createdAtLocation: CreatedAtLocation.describe(
|
3485
3481
|
"Location of the user who created the action request."
|
3486
3482
|
),
|
3487
|
-
createdByUserType:
|
3488
|
-
acceptedAt:
|
3489
|
-
createdByRole:
|
3490
|
-
createdBySignature:
|
3483
|
+
createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3484
|
+
acceptedAt: import_zod23.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
3485
|
+
createdByRole: import_zod23.z.string().describe("Role of the user at the time of action request creation."),
|
3486
|
+
createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the action request.")
|
3491
3487
|
});
|
3492
3488
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3493
|
-
registrationNumber:
|
3489
|
+
registrationNumber: import_zod23.z.string().describe(
|
3494
3490
|
"Registration number of the event. Always present for accepted registrations."
|
3495
3491
|
)
|
3496
3492
|
});
|
3497
|
-
var LegalStatuses =
|
3493
|
+
var LegalStatuses = import_zod23.z.object({
|
3498
3494
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3499
3495
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3500
3496
|
});
|
3501
|
-
var EventMetadata =
|
3497
|
+
var EventMetadata = import_zod23.z.object({
|
3502
3498
|
id: UUID,
|
3503
|
-
type:
|
3499
|
+
type: import_zod23.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3504
3500
|
status: EventStatus,
|
3505
3501
|
legalStatuses: LegalStatuses.describe(
|
3506
3502
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3507
3503
|
),
|
3508
|
-
createdAt:
|
3504
|
+
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3509
3505
|
dateOfEvent: ZodDate.nullish(),
|
3510
|
-
createdBy:
|
3511
|
-
createdByUserType:
|
3512
|
-
updatedByUserRole:
|
3506
|
+
createdBy: import_zod23.z.string().describe("ID of the user who created the event."),
|
3507
|
+
createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3508
|
+
updatedByUserRole: import_zod23.z.string().describe("Role of the user who last changed the status."),
|
3513
3509
|
createdAtLocation: CreatedAtLocation.describe(
|
3514
3510
|
"Location of the user who created the event."
|
3515
3511
|
),
|
3516
|
-
createdBySignature:
|
3512
|
+
createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the event."),
|
3517
3513
|
updatedAtLocation: UUID.nullish().describe(
|
3518
3514
|
"Location of the user who last changed the status."
|
3519
3515
|
),
|
3520
|
-
updatedAt:
|
3516
|
+
updatedAt: import_zod23.z.string().datetime().describe(
|
3521
3517
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3522
3518
|
),
|
3523
|
-
assignedTo:
|
3524
|
-
updatedBy:
|
3525
|
-
trackingId:
|
3519
|
+
assignedTo: import_zod23.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
3520
|
+
updatedBy: import_zod23.z.string().nullish().describe("ID of the user who last changed the status."),
|
3521
|
+
trackingId: import_zod23.z.string().describe(
|
3526
3522
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3527
3523
|
),
|
3528
|
-
flags:
|
3524
|
+
flags: import_zod23.z.array(Flag)
|
3529
3525
|
});
|
3530
3526
|
var EventMetadataKeysArray = [
|
3531
3527
|
"id",
|
@@ -3545,7 +3541,7 @@ var EventMetadataKeysArray = [
|
|
3545
3541
|
"legalStatuses",
|
3546
3542
|
"flags"
|
3547
3543
|
];
|
3548
|
-
var EventMetadataKeys =
|
3544
|
+
var EventMetadataKeys = import_zod23.z.enum(EventMetadataKeysArray);
|
3549
3545
|
var eventMetadataLabelMap = {
|
3550
3546
|
"event.assignedTo": {
|
3551
3547
|
id: "event.assignedTo.label",
|
@@ -3630,11 +3626,11 @@ var WorkqueueColumnKeysArray = [
|
|
3630
3626
|
"title",
|
3631
3627
|
"outbox"
|
3632
3628
|
];
|
3633
|
-
var WorkqueueColumnKeys =
|
3634
|
-
var WorkqueueColumnValue =
|
3629
|
+
var WorkqueueColumnKeys = import_zod24.z.enum(WorkqueueColumnKeysArray);
|
3630
|
+
var WorkqueueColumnValue = import_zod24.z.object({
|
3635
3631
|
$event: WorkqueueColumnKeys
|
3636
3632
|
});
|
3637
|
-
var WorkqueueColumn =
|
3633
|
+
var WorkqueueColumn = import_zod24.z.object({
|
3638
3634
|
label: TranslationConfig,
|
3639
3635
|
value: WorkqueueColumnValue
|
3640
3636
|
});
|
@@ -3645,120 +3641,120 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3645
3641
|
}
|
3646
3642
|
|
3647
3643
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3648
|
-
var
|
3644
|
+
var import_zod26 = require("zod");
|
3649
3645
|
|
3650
3646
|
// ../commons/src/events/EventIndex.ts
|
3651
|
-
var
|
3647
|
+
var import_zod25 = require("zod");
|
3652
3648
|
var import_zod_openapi10 = require("zod-openapi");
|
3653
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3649
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod25.z);
|
3654
3650
|
var EventIndex = EventMetadata.extend({
|
3655
3651
|
declaration: EventState
|
3656
3652
|
}).openapi({
|
3657
3653
|
ref: "EventIndex"
|
3658
3654
|
});
|
3659
|
-
var EventSearchIndex =
|
3660
|
-
|
3661
|
-
type:
|
3655
|
+
var EventSearchIndex = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.any()).and(
|
3656
|
+
import_zod25.z.object({
|
3657
|
+
type: import_zod25.z.string()
|
3662
3658
|
// Ensures "type" (event-id) exists and is a string
|
3663
3659
|
})
|
3664
3660
|
).openapi({
|
3665
3661
|
ref: "EventSearchIndex"
|
3666
3662
|
});
|
3667
|
-
var Fuzzy =
|
3663
|
+
var Fuzzy = import_zod25.z.object({ type: import_zod25.z.literal("fuzzy"), term: import_zod25.z.string() }).openapi({
|
3668
3664
|
ref: "Fuzzy"
|
3669
3665
|
});
|
3670
|
-
var Exact =
|
3666
|
+
var Exact = import_zod25.z.object({ type: import_zod25.z.literal("exact"), term: import_zod25.z.string() }).openapi({
|
3671
3667
|
ref: "Exact"
|
3672
3668
|
});
|
3673
|
-
var ExactStatus =
|
3674
|
-
type:
|
3669
|
+
var ExactStatus = import_zod25.z.object({
|
3670
|
+
type: import_zod25.z.literal("exact"),
|
3675
3671
|
term: EventStatus
|
3676
3672
|
}).openapi({
|
3677
3673
|
ref: "ExactStatus"
|
3678
3674
|
});
|
3679
|
-
var ExactUserType =
|
3680
|
-
type:
|
3675
|
+
var ExactUserType = import_zod25.z.object({
|
3676
|
+
type: import_zod25.z.literal("exact"),
|
3681
3677
|
term: TokenUserType
|
3682
3678
|
}).openapi({
|
3683
3679
|
ref: "ExactUserType"
|
3684
3680
|
});
|
3685
|
-
var AnyOf =
|
3686
|
-
type:
|
3687
|
-
terms:
|
3681
|
+
var AnyOf = import_zod25.z.object({
|
3682
|
+
type: import_zod25.z.literal("anyOf"),
|
3683
|
+
terms: import_zod25.z.array(import_zod25.z.string())
|
3688
3684
|
}).openapi({
|
3689
3685
|
ref: "AnyOf"
|
3690
3686
|
});
|
3691
|
-
var AnyOfStatus =
|
3692
|
-
type:
|
3693
|
-
terms:
|
3687
|
+
var AnyOfStatus = import_zod25.z.object({
|
3688
|
+
type: import_zod25.z.literal("anyOf"),
|
3689
|
+
terms: import_zod25.z.array(EventStatus)
|
3694
3690
|
}).openapi({
|
3695
3691
|
ref: "AnyOfStatus"
|
3696
3692
|
});
|
3697
|
-
var Range =
|
3698
|
-
type:
|
3699
|
-
gte:
|
3700
|
-
lte:
|
3693
|
+
var Range = import_zod25.z.object({
|
3694
|
+
type: import_zod25.z.literal("range"),
|
3695
|
+
gte: import_zod25.z.string(),
|
3696
|
+
lte: import_zod25.z.string()
|
3701
3697
|
}).openapi({
|
3702
3698
|
ref: "Range"
|
3703
3699
|
});
|
3704
|
-
var ContainsFlags =
|
3705
|
-
anyOf:
|
3706
|
-
noneOf:
|
3700
|
+
var ContainsFlags = import_zod25.z.object({
|
3701
|
+
anyOf: import_zod25.z.array(Flag).optional(),
|
3702
|
+
noneOf: import_zod25.z.array(Flag).optional()
|
3707
3703
|
}).openapi({
|
3708
3704
|
ref: "ContainsFlags"
|
3709
3705
|
});
|
3710
|
-
var Within =
|
3706
|
+
var Within = import_zod25.z.object({ type: import_zod25.z.literal("within"), location: import_zod25.z.string() }).openapi({
|
3711
3707
|
ref: "Within"
|
3712
3708
|
});
|
3713
|
-
var RangeDate =
|
3714
|
-
type:
|
3715
|
-
gte:
|
3716
|
-
lte:
|
3709
|
+
var RangeDate = import_zod25.z.object({
|
3710
|
+
type: import_zod25.z.literal("range"),
|
3711
|
+
gte: import_zod25.z.string().date().or(import_zod25.z.string().datetime()),
|
3712
|
+
lte: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
|
3717
3713
|
}).openapi({ ref: "RangeDate" });
|
3718
3714
|
var ExactDate = Exact.extend({
|
3719
|
-
term:
|
3715
|
+
term: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
|
3720
3716
|
}).openapi({
|
3721
3717
|
ref: "ExactDate"
|
3722
3718
|
});
|
3723
|
-
var TimePeriod =
|
3724
|
-
type:
|
3719
|
+
var TimePeriod = import_zod25.z.object({
|
3720
|
+
type: import_zod25.z.literal("timePeriod"),
|
3725
3721
|
term: SelectDateRangeValue
|
3726
3722
|
}).openapi({
|
3727
3723
|
ref: "TimePeriod"
|
3728
3724
|
});
|
3729
|
-
var DateCondition =
|
3725
|
+
var DateCondition = import_zod25.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3730
3726
|
ref: "DateCondition"
|
3731
3727
|
});
|
3732
|
-
var QueryInput =
|
3733
|
-
() =>
|
3734
|
-
|
3735
|
-
|
3728
|
+
var QueryInput = import_zod25.z.lazy(
|
3729
|
+
() => import_zod25.z.union([
|
3730
|
+
import_zod25.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
3731
|
+
import_zod25.z.record(import_zod25.z.string(), QueryInput)
|
3736
3732
|
])
|
3737
3733
|
).openapi({
|
3738
3734
|
ref: "QueryInput"
|
3739
3735
|
});
|
3740
|
-
var QueryExpression =
|
3741
|
-
id:
|
3742
|
-
eventType:
|
3743
|
-
status:
|
3744
|
-
createdAt:
|
3745
|
-
updatedAt:
|
3746
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
3747
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
3748
|
-
|
3736
|
+
var QueryExpression = import_zod25.z.object({
|
3737
|
+
id: import_zod25.z.optional(import_zod25.z.string()),
|
3738
|
+
eventType: import_zod25.z.string(),
|
3739
|
+
status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
|
3740
|
+
createdAt: import_zod25.z.optional(DateCondition),
|
3741
|
+
updatedAt: import_zod25.z.optional(DateCondition),
|
3742
|
+
"legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
|
3743
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
|
3744
|
+
import_zod25.z.union([Within, Exact])
|
3749
3745
|
),
|
3750
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3751
|
-
|
3746
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3747
|
+
import_zod25.z.union([Within, Exact])
|
3752
3748
|
),
|
3753
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3754
|
-
createdAtLocation:
|
3755
|
-
updatedAtLocation:
|
3756
|
-
assignedTo:
|
3757
|
-
createdByUserType:
|
3758
|
-
createdBy:
|
3759
|
-
updatedBy:
|
3760
|
-
trackingId:
|
3761
|
-
flags:
|
3749
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
|
3750
|
+
createdAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
|
3751
|
+
updatedAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
|
3752
|
+
assignedTo: import_zod25.z.optional(Exact),
|
3753
|
+
createdByUserType: import_zod25.z.optional(ExactUserType),
|
3754
|
+
createdBy: import_zod25.z.optional(Exact),
|
3755
|
+
updatedBy: import_zod25.z.optional(Exact),
|
3756
|
+
trackingId: import_zod25.z.optional(Exact),
|
3757
|
+
flags: import_zod25.z.optional(ContainsFlags),
|
3762
3758
|
// @todo: The type for this comes out as "any"
|
3763
3759
|
data: QueryInput
|
3764
3760
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
@@ -3766,9 +3762,9 @@ var QueryExpression = import_zod26.z.object({
|
|
3766
3762
|
}).openapi({
|
3767
3763
|
ref: "QueryExpression"
|
3768
3764
|
});
|
3769
|
-
var QueryType =
|
3770
|
-
type:
|
3771
|
-
clauses:
|
3765
|
+
var QueryType = import_zod25.z.object({
|
3766
|
+
type: import_zod25.z.literal("and").or(import_zod25.z.literal("or")).openapi({ default: "and" }),
|
3767
|
+
clauses: import_zod25.z.preprocess(
|
3772
3768
|
(val) => {
|
3773
3769
|
if (typeof val === "string") {
|
3774
3770
|
return [JSON.parse(val)];
|
@@ -3778,7 +3774,7 @@ var QueryType = import_zod26.z.object({
|
|
3778
3774
|
}
|
3779
3775
|
return val;
|
3780
3776
|
},
|
3781
|
-
|
3777
|
+
import_zod25.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3782
3778
|
default: [
|
3783
3779
|
{
|
3784
3780
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3805,56 +3801,56 @@ var SearchScopeAccessLevels = {
|
|
3805
3801
|
};
|
3806
3802
|
|
3807
3803
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3808
|
-
var SerializableExact =
|
3809
|
-
type:
|
3810
|
-
term:
|
3804
|
+
var SerializableExact = import_zod26.z.object({
|
3805
|
+
type: import_zod26.z.literal("exact"),
|
3806
|
+
term: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
|
3811
3807
|
});
|
3812
|
-
var SerializableWithin =
|
3813
|
-
type:
|
3814
|
-
location:
|
3808
|
+
var SerializableWithin = import_zod26.z.object({
|
3809
|
+
type: import_zod26.z.literal("within"),
|
3810
|
+
location: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
|
3815
3811
|
});
|
3816
|
-
var SerializedQueryExpression =
|
3817
|
-
eventType:
|
3818
|
-
status:
|
3819
|
-
createdAt:
|
3820
|
-
updatedAt:
|
3821
|
-
"legalStatuses.REGISTERED.createdAt":
|
3822
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3823
|
-
|
3812
|
+
var SerializedQueryExpression = import_zod26.z.object({
|
3813
|
+
eventType: import_zod26.z.string(),
|
3814
|
+
status: import_zod26.z.optional(import_zod26.z.union([AnyOfStatus, ExactStatus])),
|
3815
|
+
createdAt: import_zod26.z.optional(DateCondition),
|
3816
|
+
updatedAt: import_zod26.z.optional(DateCondition),
|
3817
|
+
"legalStatuses.REGISTERED.createdAt": import_zod26.z.optional(DateCondition),
|
3818
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3819
|
+
import_zod26.z.union([Within, Exact])
|
3824
3820
|
),
|
3825
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3826
|
-
createdAtLocation:
|
3827
|
-
|
3821
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod26.z.optional(Exact),
|
3822
|
+
createdAtLocation: import_zod26.z.optional(
|
3823
|
+
import_zod26.z.union([SerializableWithin, SerializableExact])
|
3828
3824
|
),
|
3829
|
-
updatedAtLocation:
|
3830
|
-
|
3825
|
+
updatedAtLocation: import_zod26.z.optional(
|
3826
|
+
import_zod26.z.union([SerializableWithin, SerializableExact])
|
3831
3827
|
),
|
3832
|
-
assignedTo:
|
3833
|
-
createdBy:
|
3828
|
+
assignedTo: import_zod26.z.optional(SerializableExact),
|
3829
|
+
createdBy: import_zod26.z.optional(SerializableExact),
|
3834
3830
|
createdByUserType: ExactUserType,
|
3835
|
-
updatedBy:
|
3836
|
-
trackingId:
|
3837
|
-
flags:
|
3831
|
+
updatedBy: import_zod26.z.optional(SerializableExact),
|
3832
|
+
trackingId: import_zod26.z.optional(Exact),
|
3833
|
+
flags: import_zod26.z.optional(ContainsFlags),
|
3838
3834
|
data: QueryInput
|
3839
3835
|
}).partial();
|
3840
|
-
var Or2 =
|
3841
|
-
type:
|
3842
|
-
clauses:
|
3836
|
+
var Or2 = import_zod26.z.object({
|
3837
|
+
type: import_zod26.z.literal("or"),
|
3838
|
+
clauses: import_zod26.z.array(SerializedQueryExpression)
|
3843
3839
|
});
|
3844
|
-
var And2 =
|
3845
|
-
type:
|
3846
|
-
clauses:
|
3840
|
+
var And2 = import_zod26.z.object({
|
3841
|
+
type: import_zod26.z.literal("and"),
|
3842
|
+
clauses: import_zod26.z.array(SerializedQueryExpression)
|
3847
3843
|
});
|
3848
|
-
var CountryConfigQueryType =
|
3849
|
-
var CountryConfigQueryInputType =
|
3844
|
+
var CountryConfigQueryType = import_zod26.z.discriminatedUnion("type", [And2, Or2]);
|
3845
|
+
var CountryConfigQueryInputType = import_zod26.z.union([
|
3850
3846
|
SerializedQueryExpression,
|
3851
3847
|
And2,
|
3852
3848
|
Or2
|
3853
3849
|
]);
|
3854
3850
|
|
3855
3851
|
// ../commons/src/icons.ts
|
3856
|
-
var
|
3857
|
-
var AvailableIcons =
|
3852
|
+
var import_zod27 = require("zod");
|
3853
|
+
var AvailableIcons = import_zod27.z.enum([
|
3858
3854
|
"Archived",
|
3859
3855
|
"Assigned",
|
3860
3856
|
"Certified",
|
@@ -3975,23 +3971,23 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3975
3971
|
value: event.field("updatedAt")
|
3976
3972
|
}
|
3977
3973
|
]);
|
3978
|
-
var WorkqueueActionsWithDefault =
|
3974
|
+
var WorkqueueActionsWithDefault = import_zod28.z.enum([
|
3979
3975
|
...workqueueActions.options,
|
3980
3976
|
"DEFAULT"
|
3981
3977
|
]);
|
3982
|
-
var WorkqueueConfig =
|
3983
|
-
slug:
|
3978
|
+
var WorkqueueConfig = import_zod28.z.object({
|
3979
|
+
slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
|
3984
3980
|
name: TranslationConfig.describe(
|
3985
3981
|
"Title of the workflow (both in navigation and on the page)"
|
3986
3982
|
),
|
3987
3983
|
query: CountryConfigQueryType,
|
3988
|
-
actions:
|
3989
|
-
|
3984
|
+
actions: import_zod28.z.array(
|
3985
|
+
import_zod28.z.object({
|
3990
3986
|
type: WorkqueueActionsWithDefault,
|
3991
|
-
conditionals:
|
3987
|
+
conditionals: import_zod28.z.array(Conditional).optional()
|
3992
3988
|
})
|
3993
3989
|
),
|
3994
|
-
columns:
|
3990
|
+
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3995
3991
|
icon: AvailableIcons,
|
3996
3992
|
emptyMessage: TranslationConfig.optional()
|
3997
3993
|
}).describe("Configuration for workqueue.");
|
@@ -3999,19 +3995,19 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
3999
3995
|
query: true,
|
4000
3996
|
columns: true
|
4001
3997
|
});
|
4002
|
-
var WorkqueueConfigInput =
|
4003
|
-
slug:
|
3998
|
+
var WorkqueueConfigInput = import_zod28.z.object({
|
3999
|
+
slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
|
4004
4000
|
name: TranslationConfig.describe(
|
4005
4001
|
"Title of the workflow (both in navigation and on the page)"
|
4006
4002
|
),
|
4007
4003
|
query: CountryConfigQueryInputType,
|
4008
|
-
actions:
|
4009
|
-
|
4004
|
+
actions: import_zod28.z.array(
|
4005
|
+
import_zod28.z.object({
|
4010
4006
|
type: WorkqueueActionsWithDefault,
|
4011
|
-
conditionals:
|
4007
|
+
conditionals: import_zod28.z.array(Conditional).optional()
|
4012
4008
|
})
|
4013
4009
|
),
|
4014
|
-
columns:
|
4010
|
+
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
4015
4011
|
icon: AvailableIcons,
|
4016
4012
|
emptyMessage: TranslationConfig.optional()
|
4017
4013
|
});
|
@@ -4023,10 +4019,10 @@ function defineWorkqueue(workqueueInput) {
|
|
4023
4019
|
function defineWorkqueues(workqueues) {
|
4024
4020
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
4025
4021
|
}
|
4026
|
-
var WorkqueueCountInput =
|
4027
|
-
|
4022
|
+
var WorkqueueCountInput = import_zod28.z.array(
|
4023
|
+
import_zod28.z.object({ slug: import_zod28.z.string(), query: QueryType })
|
4028
4024
|
);
|
4029
|
-
var WorkqueueCountOutput =
|
4025
|
+
var WorkqueueCountOutput = import_zod28.z.record(import_zod28.z.string(), import_zod28.z.number());
|
4030
4026
|
|
4031
4027
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
4032
4028
|
var defaultWorkqueueColumns = [
|
@@ -4049,42 +4045,42 @@ var defaultWorkqueueColumns = [
|
|
4049
4045
|
];
|
4050
4046
|
|
4051
4047
|
// ../commons/src/events/Draft.ts
|
4052
|
-
var
|
4048
|
+
var import_zod30 = require("zod");
|
4053
4049
|
|
4054
4050
|
// ../commons/src/events/ActionInput.ts
|
4055
|
-
var
|
4051
|
+
var import_zod29 = require("zod");
|
4056
4052
|
var import_zod_openapi11 = require("zod-openapi");
|
4057
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
4058
|
-
var BaseActionInput =
|
4053
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
4054
|
+
var BaseActionInput = import_zod29.z.object({
|
4059
4055
|
eventId: UUID,
|
4060
|
-
transactionId:
|
4056
|
+
transactionId: import_zod29.z.string(),
|
4061
4057
|
declaration: ActionUpdate.default({}),
|
4062
4058
|
annotation: ActionUpdate.optional(),
|
4063
4059
|
originalActionId: UUID.optional(),
|
4064
4060
|
// should not be part of base action.
|
4065
|
-
keepAssignment:
|
4061
|
+
keepAssignment: import_zod29.z.boolean().optional()
|
4066
4062
|
});
|
4067
4063
|
var CreateActionInput = BaseActionInput.merge(
|
4068
|
-
|
4069
|
-
type:
|
4064
|
+
import_zod29.z.object({
|
4065
|
+
type: import_zod29.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
4070
4066
|
createdAtLocation: CreatedAtLocation
|
4071
4067
|
})
|
4072
4068
|
);
|
4073
4069
|
var RegisterActionInput = BaseActionInput.merge(
|
4074
|
-
|
4075
|
-
type:
|
4076
|
-
registrationNumber:
|
4070
|
+
import_zod29.z.object({
|
4071
|
+
type: import_zod29.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
4072
|
+
registrationNumber: import_zod29.z.string().optional()
|
4077
4073
|
})
|
4078
4074
|
).strict();
|
4079
4075
|
var ValidateActionInput = BaseActionInput.merge(
|
4080
|
-
|
4081
|
-
type:
|
4082
|
-
duplicates:
|
4076
|
+
import_zod29.z.object({
|
4077
|
+
type: import_zod29.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
4078
|
+
duplicates: import_zod29.z.array(import_zod29.z.string())
|
4083
4079
|
})
|
4084
4080
|
);
|
4085
4081
|
var NotifyActionInput = BaseActionInput.merge(
|
4086
|
-
|
4087
|
-
type:
|
4082
|
+
import_zod29.z.object({
|
4083
|
+
type: import_zod29.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
4088
4084
|
})
|
4089
4085
|
).openapi({
|
4090
4086
|
default: {
|
@@ -4096,70 +4092,70 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
4096
4092
|
}
|
4097
4093
|
});
|
4098
4094
|
var DeclareActionInput = BaseActionInput.merge(
|
4099
|
-
|
4100
|
-
type:
|
4095
|
+
import_zod29.z.object({
|
4096
|
+
type: import_zod29.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
4101
4097
|
})
|
4102
4098
|
);
|
4103
4099
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
4104
|
-
|
4105
|
-
type:
|
4100
|
+
import_zod29.z.object({
|
4101
|
+
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
4106
4102
|
content: PrintContent.optional()
|
4107
4103
|
})
|
4108
4104
|
);
|
4109
4105
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
4110
|
-
|
4111
|
-
type:
|
4106
|
+
import_zod29.z.object({
|
4107
|
+
type: import_zod29.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
4112
4108
|
reason: RejectionReason
|
4113
4109
|
})
|
4114
4110
|
);
|
4115
4111
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
4116
|
-
|
4117
|
-
type:
|
4112
|
+
import_zod29.z.object({
|
4113
|
+
type: import_zod29.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
4118
4114
|
})
|
4119
4115
|
);
|
4120
4116
|
var ArchiveActionInput = BaseActionInput.merge(
|
4121
|
-
|
4122
|
-
type:
|
4117
|
+
import_zod29.z.object({
|
4118
|
+
type: import_zod29.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
4123
4119
|
reason: RejectionReason
|
4124
4120
|
})
|
4125
4121
|
);
|
4126
4122
|
var AssignActionInput = BaseActionInput.merge(
|
4127
|
-
|
4128
|
-
type:
|
4129
|
-
assignedTo:
|
4123
|
+
import_zod29.z.object({
|
4124
|
+
type: import_zod29.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
4125
|
+
assignedTo: import_zod29.z.string()
|
4130
4126
|
})
|
4131
4127
|
);
|
4132
4128
|
var UnassignActionInput = BaseActionInput.merge(
|
4133
|
-
|
4134
|
-
type:
|
4135
|
-
assignedTo:
|
4129
|
+
import_zod29.z.object({
|
4130
|
+
type: import_zod29.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
4131
|
+
assignedTo: import_zod29.z.literal(null).default(null)
|
4136
4132
|
})
|
4137
4133
|
);
|
4138
4134
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
4139
|
-
|
4140
|
-
type:
|
4135
|
+
import_zod29.z.object({
|
4136
|
+
type: import_zod29.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
4141
4137
|
})
|
4142
4138
|
);
|
4143
4139
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
4144
|
-
|
4145
|
-
requestId:
|
4146
|
-
type:
|
4140
|
+
import_zod29.z.object({
|
4141
|
+
requestId: import_zod29.z.string(),
|
4142
|
+
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
4147
4143
|
reason: RejectionReason
|
4148
4144
|
})
|
4149
4145
|
);
|
4150
4146
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
4151
|
-
|
4152
|
-
requestId:
|
4153
|
-
type:
|
4147
|
+
import_zod29.z.object({
|
4148
|
+
requestId: import_zod29.z.string(),
|
4149
|
+
type: import_zod29.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
4154
4150
|
})
|
4155
4151
|
);
|
4156
4152
|
var ReadActionInput = BaseActionInput.merge(
|
4157
|
-
|
4158
|
-
type:
|
4153
|
+
import_zod29.z.object({
|
4154
|
+
type: import_zod29.z.literal(ActionType.READ).default(ActionType.READ)
|
4159
4155
|
})
|
4160
4156
|
);
|
4161
|
-
var DeleteActionInput =
|
4162
|
-
var ActionInput =
|
4157
|
+
var DeleteActionInput = import_zod29.z.object({ eventId: UUID });
|
4158
|
+
var ActionInput = import_zod29.z.discriminatedUnion("type", [
|
4163
4159
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
4164
4160
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
4165
4161
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -4188,18 +4184,18 @@ var ActionInput = import_zod30.z.discriminatedUnion("type", [
|
|
4188
4184
|
});
|
4189
4185
|
|
4190
4186
|
// ../commons/src/events/Draft.ts
|
4191
|
-
var Draft =
|
4187
|
+
var Draft = import_zod30.z.object({
|
4192
4188
|
id: UUID,
|
4193
4189
|
eventId: UUID,
|
4194
|
-
transactionId:
|
4195
|
-
createdAt:
|
4190
|
+
transactionId: import_zod30.z.string(),
|
4191
|
+
createdAt: import_zod30.z.string().datetime(),
|
4196
4192
|
action: ActionBase.extend({
|
4197
|
-
type: ActionTypes
|
4193
|
+
type: ActionTypes
|
4198
4194
|
}).omit({ id: true })
|
4199
4195
|
});
|
4200
4196
|
var DraftInput = BaseActionInput.extend({
|
4201
|
-
type: ActionTypes
|
4202
|
-
status:
|
4197
|
+
type: ActionTypes,
|
4198
|
+
status: import_zod30.z.enum([
|
4203
4199
|
ActionStatus.Requested,
|
4204
4200
|
ActionStatus.Accepted,
|
4205
4201
|
ActionStatus.Rejected
|
@@ -4207,29 +4203,26 @@ var DraftInput = BaseActionInput.extend({
|
|
4207
4203
|
});
|
4208
4204
|
|
4209
4205
|
// ../commons/src/events/EventInput.ts
|
4210
|
-
var
|
4206
|
+
var import_zod31 = require("zod");
|
4211
4207
|
var import_uuid8 = require("uuid");
|
4212
|
-
var EventInput =
|
4213
|
-
transactionId:
|
4214
|
-
type:
|
4208
|
+
var EventInput = import_zod31.z.object({
|
4209
|
+
transactionId: import_zod31.z.string(),
|
4210
|
+
type: import_zod31.z.string()
|
4215
4211
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
4216
4212
|
|
4217
4213
|
// ../commons/src/events/EventDocument.ts
|
4218
|
-
var
|
4214
|
+
var import_zod32 = require("zod");
|
4219
4215
|
var import_zod_openapi12 = require("zod-openapi");
|
4220
|
-
(0, import_zod_openapi12.extendZodWithOpenApi)(
|
4221
|
-
var EventDocument =
|
4216
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod32.z);
|
4217
|
+
var EventDocument = import_zod32.z.object({
|
4222
4218
|
id: UUID,
|
4223
|
-
type:
|
4224
|
-
createdAt:
|
4225
|
-
updatedAt:
|
4226
|
-
actions:
|
4227
|
-
trackingId:
|
4219
|
+
type: import_zod32.z.string(),
|
4220
|
+
createdAt: import_zod32.z.string().datetime(),
|
4221
|
+
updatedAt: import_zod32.z.string().datetime(),
|
4222
|
+
actions: import_zod32.z.array(Action),
|
4223
|
+
trackingId: import_zod32.z.string()
|
4228
4224
|
}).openapi({ ref: "EventDocument" });
|
4229
4225
|
|
4230
|
-
// ../commons/src/events/state/index.ts
|
4231
|
-
var import_lodash3 = require("lodash");
|
4232
|
-
|
4233
4226
|
// ../commons/src/events/state/utils.ts
|
4234
4227
|
var import_lodash2 = require("lodash");
|
4235
4228
|
function getActionRequests(actionType, actions) {
|
@@ -4519,36 +4512,30 @@ function getCurrentEventState(event2, config) {
|
|
4519
4512
|
flags: getFlagsFromActions(event2.actions)
|
4520
4513
|
});
|
4521
4514
|
}
|
4522
|
-
function
|
4515
|
+
function getCurrentEventStateWithDrafts({
|
4523
4516
|
event: event2,
|
4524
|
-
|
4517
|
+
drafts,
|
4525
4518
|
configuration
|
4526
4519
|
}) {
|
4527
4520
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
4528
|
-
const
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
4537
|
-
|
4538
|
-
|
4539
|
-
|
4540
|
-
|
4541
|
-
|
4542
|
-
const actionsWithDraft = (0, import_lodash3.orderBy)(
|
4543
|
-
[...actions, ...draftActions],
|
4544
|
-
["createdAt"],
|
4545
|
-
"asc"
|
4546
|
-
);
|
4547
|
-
const eventWithDraft = {
|
4521
|
+
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
4522
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
4523
|
+
return [
|
4524
|
+
action,
|
4525
|
+
{
|
4526
|
+
...action,
|
4527
|
+
type: ActionType.APPROVE_CORRECTION
|
4528
|
+
}
|
4529
|
+
];
|
4530
|
+
}
|
4531
|
+
return [action];
|
4532
|
+
});
|
4533
|
+
const actionWithDrafts = [...actions, ...activeDrafts].sort();
|
4534
|
+
const withDrafts = {
|
4548
4535
|
...event2,
|
4549
|
-
actions:
|
4536
|
+
actions: actionWithDrafts
|
4550
4537
|
};
|
4551
|
-
return getCurrentEventState(
|
4538
|
+
return getCurrentEventState(withDrafts, configuration);
|
4552
4539
|
}
|
4553
4540
|
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4554
4541
|
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
@@ -4562,18 +4549,18 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
4562
4549
|
declaration: updatedDeclaration
|
4563
4550
|
};
|
4564
4551
|
}
|
4565
|
-
function
|
4552
|
+
function applyDraftsToEventIndex(eventIndex, drafts, eventConfiguration) {
|
4566
4553
|
const indexedAt = eventIndex.updatedAt;
|
4567
|
-
const
|
4568
|
-
if (
|
4554
|
+
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
4555
|
+
if (activeDrafts.length === 0) {
|
4569
4556
|
return eventIndex;
|
4570
4557
|
}
|
4571
4558
|
return applyDeclarationToEventIndex(
|
4572
4559
|
{
|
4573
4560
|
...eventIndex,
|
4574
|
-
updatedAt:
|
4561
|
+
updatedAt: activeDrafts[activeDrafts.length - 1].createdAt
|
4575
4562
|
},
|
4576
|
-
|
4563
|
+
activeDrafts[activeDrafts.length - 1].declaration,
|
4577
4564
|
eventConfiguration
|
4578
4565
|
);
|
4579
4566
|
}
|
@@ -4587,17 +4574,18 @@ function getAnnotationFromDrafts(drafts) {
|
|
4587
4574
|
function getActionAnnotation({
|
4588
4575
|
event: event2,
|
4589
4576
|
actionType,
|
4590
|
-
|
4577
|
+
drafts = []
|
4591
4578
|
}) {
|
4592
4579
|
const activeActions = getAcceptedActions(event2);
|
4593
|
-
const action =
|
4594
|
-
|
4595
|
-
const sortedActions = (0, import_lodash3.orderBy)(
|
4596
|
-
[action, matchingDraft?.action].filter((a) => a !== void 0),
|
4597
|
-
"createdAt",
|
4598
|
-
"asc"
|
4580
|
+
const action = activeActions.find(
|
4581
|
+
(activeAction) => actionType === activeAction.type
|
4599
4582
|
);
|
4600
|
-
const
|
4583
|
+
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
4584
|
+
const sorted = [
|
4585
|
+
...action ? [action] : [],
|
4586
|
+
...eventDrafts.map((draft) => draft.action)
|
4587
|
+
].sort();
|
4588
|
+
const annotation = sorted.reduce((ann, sortedAction) => {
|
4601
4589
|
return deepMerge(ann, sortedAction.annotation ?? {});
|
4602
4590
|
}, {});
|
4603
4591
|
return deepDropNulls(annotation);
|
@@ -4615,23 +4603,23 @@ function generateTransactionId() {
|
|
4615
4603
|
}
|
4616
4604
|
|
4617
4605
|
// ../commons/src/events/User.ts
|
4618
|
-
var
|
4619
|
-
var User =
|
4620
|
-
id:
|
4621
|
-
name:
|
4622
|
-
|
4623
|
-
use:
|
4624
|
-
given:
|
4625
|
-
family:
|
4606
|
+
var import_zod33 = require("zod");
|
4607
|
+
var User = import_zod33.z.object({
|
4608
|
+
id: import_zod33.z.string(),
|
4609
|
+
name: import_zod33.z.array(
|
4610
|
+
import_zod33.z.object({
|
4611
|
+
use: import_zod33.z.string(),
|
4612
|
+
given: import_zod33.z.array(import_zod33.z.string()),
|
4613
|
+
family: import_zod33.z.string()
|
4626
4614
|
})
|
4627
4615
|
),
|
4628
|
-
role:
|
4616
|
+
role: import_zod33.z.string(),
|
4629
4617
|
avatar: FullDocumentPath.optional(),
|
4630
4618
|
signature: FullDocumentPath.optional()
|
4631
4619
|
});
|
4632
4620
|
|
4633
4621
|
// ../commons/src/events/test.utils.ts
|
4634
|
-
var
|
4622
|
+
var import_lodash3 = require("lodash");
|
4635
4623
|
var import_date_fns4 = require("date-fns");
|
4636
4624
|
|
4637
4625
|
// ../commons/src/field-config/field-configuration.ts
|
@@ -5814,44 +5802,41 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5814
5802
|
},
|
5815
5803
|
{
|
5816
5804
|
id: "identity-check",
|
5817
|
-
type: PageTypes.enum.
|
5805
|
+
type: PageTypes.enum.VERIFICATION,
|
5818
5806
|
title: {
|
5819
|
-
id: "event.
|
5820
|
-
defaultMessage: "Verify
|
5807
|
+
id: "v2.event.birth.action.correction.form.section.requester.identity.verify.title",
|
5808
|
+
defaultMessage: "Verify ID",
|
5821
5809
|
description: "This is the title of the section"
|
5822
5810
|
},
|
5823
|
-
fields: [
|
5824
|
-
|
5825
|
-
|
5826
|
-
type: "PAGE_HEADER",
|
5811
|
+
fields: [],
|
5812
|
+
actions: {
|
5813
|
+
verify: {
|
5827
5814
|
label: {
|
5828
|
-
|
5829
|
-
|
5830
|
-
|
5815
|
+
defaultMessage: "Verified",
|
5816
|
+
description: "This is the label for the verification button",
|
5817
|
+
id: "v2.event.birth.action.correction.form.verify"
|
5831
5818
|
}
|
5832
5819
|
},
|
5833
|
-
{
|
5834
|
-
id: "correction.identity-check.verified",
|
5835
|
-
type: "RADIO_GROUP",
|
5820
|
+
cancel: {
|
5836
5821
|
label: {
|
5837
|
-
|
5838
|
-
|
5839
|
-
|
5822
|
+
defaultMessage: "Identity does not match",
|
5823
|
+
description: "This is the label for the verification cancellation button",
|
5824
|
+
id: "v2.event.birth.action.correction.form.cancel"
|
5840
5825
|
},
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
|
5850
|
-
|
5826
|
+
confirmation: {
|
5827
|
+
title: {
|
5828
|
+
defaultMessage: "Correct without proof of ID?",
|
5829
|
+
description: "This is the title for the verification cancellation modal",
|
5830
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.title"
|
5831
|
+
},
|
5832
|
+
body: {
|
5833
|
+
defaultMessage: "Please be aware that if you proceed, you will be responsible for making a change to this record without the necessary proof of identification",
|
5834
|
+
description: "This is the body for the verification cancellation modal",
|
5835
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.body"
|
5851
5836
|
}
|
5852
|
-
|
5837
|
+
}
|
5853
5838
|
}
|
5854
|
-
|
5839
|
+
}
|
5855
5840
|
},
|
5856
5841
|
{
|
5857
5842
|
id: "correction-request.supporting-documents",
|
@@ -6633,9 +6618,9 @@ var v2BirthEvent = defineConfig({
|
|
6633
6618
|
});
|
6634
6619
|
|
6635
6620
|
// ../commons/src/events/test.utils.ts
|
6636
|
-
var
|
6621
|
+
var import_zod34 = require("zod");
|
6637
6622
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6638
|
-
var TestUserRole =
|
6623
|
+
var TestUserRole = import_zod34.z.enum([
|
6639
6624
|
"FIELD_AGENT",
|
6640
6625
|
"LOCAL_REGISTRAR",
|
6641
6626
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6704,6 +6689,8 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6704
6689
|
return generateRandomName(rng);
|
6705
6690
|
case FieldType.NUMBER:
|
6706
6691
|
return 19;
|
6692
|
+
case FieldType.BUTTON:
|
6693
|
+
return 1;
|
6707
6694
|
case FieldType.EMAIL:
|
6708
6695
|
return "test@opencrvs.org";
|
6709
6696
|
case FieldType.ADDRESS:
|
@@ -6739,6 +6726,7 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6739
6726
|
};
|
6740
6727
|
case FieldType.FILE_WITH_OPTIONS:
|
6741
6728
|
case FieldType.DATA:
|
6729
|
+
case FieldType.HTTP:
|
6742
6730
|
return void 0;
|
6743
6731
|
}
|
6744
6732
|
}
|
@@ -6800,7 +6788,7 @@ function eventPayloadGenerator(rng) {
|
|
6800
6788
|
eventId,
|
6801
6789
|
actionType,
|
6802
6790
|
annotation
|
6803
|
-
}, input = {}) => (0,
|
6791
|
+
}, input = {}) => (0, import_lodash3.merge)(
|
6804
6792
|
{
|
6805
6793
|
id: getUUID(),
|
6806
6794
|
eventId,
|
@@ -6825,6 +6813,7 @@ function eventPayloadGenerator(rng) {
|
|
6825
6813
|
annotation: {
|
6826
6814
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
6827
6815
|
"correction.request.reason": "Child's name was incorrect",
|
6816
|
+
"identity-check": true,
|
6828
6817
|
...annotation
|
6829
6818
|
},
|
6830
6819
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -6859,13 +6848,13 @@ function eventPayloadGenerator(rng) {
|
|
6859
6848
|
notify: (eventId, input = {}) => {
|
6860
6849
|
let declaration = input.declaration;
|
6861
6850
|
if (!declaration) {
|
6862
|
-
const partialDeclaration = (0,
|
6851
|
+
const partialDeclaration = (0, import_lodash3.omitBy)(
|
6863
6852
|
generateActionDeclarationInput(
|
6864
6853
|
tennisClubMembershipEvent,
|
6865
6854
|
ActionType.DECLARE,
|
6866
6855
|
rng
|
6867
6856
|
),
|
6868
|
-
|
6857
|
+
import_lodash3.isString
|
6869
6858
|
);
|
6870
6859
|
declaration = partialDeclaration;
|
6871
6860
|
}
|
@@ -6912,6 +6901,7 @@ function eventPayloadGenerator(rng) {
|
|
6912
6901
|
type: ActionType.ARCHIVE,
|
6913
6902
|
transactionId: input.transactionId ?? getUUID(),
|
6914
6903
|
declaration: {},
|
6904
|
+
// @TODO: Check whether generator is needed?
|
6915
6905
|
annotation: {},
|
6916
6906
|
duplicates: [],
|
6917
6907
|
eventId,
|
@@ -6967,7 +6957,7 @@ function eventPayloadGenerator(rng) {
|
|
6967
6957
|
request: (eventId, input = {}) => ({
|
6968
6958
|
type: ActionType.REQUEST_CORRECTION,
|
6969
6959
|
transactionId: input.transactionId ?? getUUID(),
|
6970
|
-
declaration: input.declaration ?? (0,
|
6960
|
+
declaration: input.declaration ?? (0, import_lodash3.omit)(
|
6971
6961
|
generateActionDeclarationInput(
|
6972
6962
|
tennisClubMembershipEvent,
|
6973
6963
|
ActionType.REQUEST_CORRECTION,
|
@@ -7125,8 +7115,7 @@ function generateEventDraftDocument({
|
|
7125
7115
|
declaration: {
|
7126
7116
|
...action.declaration,
|
7127
7117
|
...declaration
|
7128
|
-
}
|
7129
|
-
annotation: action.annotation
|
7118
|
+
}
|
7130
7119
|
},
|
7131
7120
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
7132
7121
|
eventId
|
@@ -7233,12 +7222,7 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
7233
7222
|
type: "and",
|
7234
7223
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
7235
7224
|
},
|
7236
|
-
actions: [
|
7237
|
-
{
|
7238
|
-
type: "DEFAULT",
|
7239
|
-
conditionals: []
|
7240
|
-
}
|
7241
|
-
],
|
7225
|
+
actions: [],
|
7242
7226
|
icon: "Draft"
|
7243
7227
|
}
|
7244
7228
|
]);
|
@@ -7254,7 +7238,9 @@ function isFieldValueWithoutTemplates(value) {
|
|
7254
7238
|
if (isTemplateVariable(value)) {
|
7255
7239
|
return false;
|
7256
7240
|
}
|
7257
|
-
if (typeof value === "object" &&
|
7241
|
+
if (typeof value === "object" && // @todo remove ts-ignore
|
7242
|
+
//@ts-ignore
|
7243
|
+
Object.values(value).some((val) => isTemplateVariable(val))) {
|
7258
7244
|
return false;
|
7259
7245
|
}
|
7260
7246
|
return true;
|
@@ -7276,7 +7262,7 @@ function isFieldConfigDefaultValue(value) {
|
|
7276
7262
|
}
|
7277
7263
|
|
7278
7264
|
// ../commons/src/events/scopes.ts
|
7279
|
-
var
|
7265
|
+
var import_lodash4 = require("lodash");
|
7280
7266
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
7281
7267
|
SCOPES.RECORD_DECLARE,
|
7282
7268
|
SCOPES.RECORD_READ,
|
@@ -7364,13 +7350,13 @@ var WRITE_ACTION_SCOPES = [
|
|
7364
7350
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
7365
7351
|
];
|
7366
7352
|
function hasAnyOfScopes(a, b) {
|
7367
|
-
return (0,
|
7353
|
+
return (0, import_lodash4.intersection)(a, b).length > 0;
|
7368
7354
|
}
|
7369
7355
|
|
7370
7356
|
// ../commons/src/events/serializers/user/deserializer.ts
|
7371
|
-
var
|
7357
|
+
var import_zod35 = require("zod");
|
7372
7358
|
var UserWithPrimaryOffice = User.extend({
|
7373
|
-
primaryOfficeId:
|
7359
|
+
primaryOfficeId: import_zod35.z.string()
|
7374
7360
|
});
|
7375
7361
|
function userDeserializer(serializedUserField, user2) {
|
7376
7362
|
if (typeof serializedUserField === "string") {
|