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