@opencrvs/toolkit 1.8.1-rc.651c27c → 1.8.1-rc.69fdc3c
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 +436 -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 +1319 -747
- package/dist/commons/events/ActionInput.d.ts +662 -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 +477 -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 +19 -14
- package/dist/commons/events/utils.d.ts +343 -197
- package/dist/conditionals/index.js +3 -2
- package/dist/events/index.js +1101 -858
- 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,93 +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
|
2063
|
+
reason: RejectionReason
|
1984
2064
|
})
|
1985
2065
|
);
|
1986
2066
|
var ReadAction = ActionBase.merge(
|
1987
|
-
|
1988
|
-
type:
|
2067
|
+
import_zod20.z.object({
|
2068
|
+
type: import_zod20.z.literal(ActionType.READ)
|
1989
2069
|
})
|
1990
2070
|
);
|
1991
|
-
var ActionDocument =
|
2071
|
+
var ActionDocument = import_zod20.z.discriminatedUnion("type", [
|
1992
2072
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1993
2073
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1994
2074
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -2011,31 +2091,31 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
2011
2091
|
declaration: true,
|
2012
2092
|
annotation: true
|
2013
2093
|
}).merge(
|
2014
|
-
|
2015
|
-
type:
|
2016
|
-
status:
|
2094
|
+
import_zod20.z.object({
|
2095
|
+
type: import_zod20.z.enum(ConfirmableActions),
|
2096
|
+
status: import_zod20.z.literal(ActionStatus.Rejected)
|
2017
2097
|
})
|
2018
2098
|
);
|
2019
|
-
var Action =
|
2020
|
-
var ResolvedUser =
|
2021
|
-
id:
|
2022
|
-
role:
|
2023
|
-
name:
|
2024
|
-
|
2025
|
-
use:
|
2026
|
-
given:
|
2027
|
-
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()
|
2028
2108
|
})
|
2029
2109
|
)
|
2030
2110
|
});
|
2031
2111
|
|
2032
2112
|
// ../commons/src/conditionals/validate.ts
|
2033
|
-
var
|
2113
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
2034
2114
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
2035
2115
|
var import_date_fns = require("date-fns");
|
2036
2116
|
|
2037
2117
|
// ../commons/src/events/FieldTypeMapping.ts
|
2038
|
-
var
|
2118
|
+
var import_zod21 = require("zod");
|
2039
2119
|
function mapFieldTypeToZod(type, required) {
|
2040
2120
|
let schema;
|
2041
2121
|
switch (type) {
|
@@ -2101,7 +2181,7 @@ function createValidationSchema(config) {
|
|
2101
2181
|
for (const field2 of config) {
|
2102
2182
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2103
2183
|
}
|
2104
|
-
return
|
2184
|
+
return import_zod21.z.object(shape);
|
2105
2185
|
}
|
2106
2186
|
function mapFieldTypeToEmptyValue(field2) {
|
2107
2187
|
switch (field2.type) {
|
@@ -2244,9 +2324,11 @@ var isNonInteractiveFieldType = (field2) => {
|
|
2244
2324
|
};
|
2245
2325
|
|
2246
2326
|
// ../commons/src/conditionals/validate.ts
|
2247
|
-
var ajv = new
|
2327
|
+
var ajv = new import__.default({
|
2248
2328
|
$data: true,
|
2249
|
-
allowUnionTypes: true
|
2329
|
+
allowUnionTypes: true,
|
2330
|
+
strict: false
|
2331
|
+
// Allow minContains and other newer features
|
2250
2332
|
});
|
2251
2333
|
(0, import_ajv_formats.default)(ajv);
|
2252
2334
|
ajv.addKeyword({
|
@@ -2419,6 +2501,23 @@ function validateFieldInput({
|
|
2419
2501
|
const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
|
2420
2502
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
2421
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
|
+
}
|
2422
2521
|
function runFieldValidations({
|
2423
2522
|
field: field2,
|
2424
2523
|
values
|
@@ -2484,6 +2583,11 @@ function getValidatorsForField(fieldId, validations) {
|
|
2484
2583
|
};
|
2485
2584
|
}).filter((x) => x !== null);
|
2486
2585
|
}
|
2586
|
+
function areCertificateConditionsMet(conditions, values) {
|
2587
|
+
return conditions.every((condition) => {
|
2588
|
+
return ajv.validate(condition.conditional, values);
|
2589
|
+
});
|
2590
|
+
}
|
2487
2591
|
|
2488
2592
|
// ../commons/src/utils.ts
|
2489
2593
|
function getOrThrow(x, message) {
|
@@ -2585,10 +2689,16 @@ function omitHiddenPaginatedFields(formConfig, declaration) {
|
|
2585
2689
|
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
2586
2690
|
return omitHiddenFields(visiblePagesFormFields, declaration);
|
2587
2691
|
}
|
2588
|
-
function
|
2589
|
-
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
|
+
);
|
2590
2698
|
const lastAction = actions[actions.length - 1];
|
2591
|
-
|
2699
|
+
const isDraftActive = draft.createdAt >= lastAction.createdAt;
|
2700
|
+
const isDraftForEvent = event2.id === draft.eventId;
|
2701
|
+
return isDraftActive && isDraftForEvent ? draft : void 0;
|
2592
2702
|
}
|
2593
2703
|
function createEmptyDraft(eventId, draftId, actionType) {
|
2594
2704
|
return {
|
@@ -2704,16 +2814,16 @@ function timePeriodToDateRange(value) {
|
|
2704
2814
|
let startDate;
|
2705
2815
|
switch (value) {
|
2706
2816
|
case "last7Days":
|
2707
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2817
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
|
2708
2818
|
break;
|
2709
2819
|
case "last30Days":
|
2710
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2820
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
|
2711
2821
|
break;
|
2712
2822
|
case "last90Days":
|
2713
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2823
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
|
2714
2824
|
break;
|
2715
2825
|
case "last365Days":
|
2716
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2826
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
|
2717
2827
|
break;
|
2718
2828
|
}
|
2719
2829
|
return {
|
@@ -2721,12 +2831,35 @@ function timePeriodToDateRange(value) {
|
|
2721
2831
|
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2722
2832
|
};
|
2723
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
|
+
}
|
2724
2857
|
|
2725
2858
|
// ../commons/src/events/EventConfig.ts
|
2726
2859
|
var import_zod_openapi9 = require("zod-openapi");
|
2727
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
2728
|
-
var EventConfig =
|
2729
|
-
id:
|
2860
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2861
|
+
var EventConfig = import_zod22.z.object({
|
2862
|
+
id: import_zod22.z.string().describe(
|
2730
2863
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2731
2864
|
),
|
2732
2865
|
dateOfEvent: FieldReference.optional(),
|
@@ -2736,10 +2869,10 @@ var EventConfig = import_zod21.z.object({
|
|
2736
2869
|
),
|
2737
2870
|
summary: SummaryConfig,
|
2738
2871
|
label: TranslationConfig,
|
2739
|
-
actions:
|
2872
|
+
actions: import_zod22.z.array(ActionConfig),
|
2740
2873
|
declaration: DeclarationFormConfig,
|
2741
|
-
deduplication:
|
2742
|
-
advancedSearch:
|
2874
|
+
deduplication: import_zod22.z.array(DeduplicationConfig).optional().default([]),
|
2875
|
+
advancedSearch: import_zod22.z.array(AdvancedSearchConfig).optional().default([])
|
2743
2876
|
}).superRefine((event2, ctx) => {
|
2744
2877
|
const allFields = findAllFields(event2);
|
2745
2878
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2823,12 +2956,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2823
2956
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2824
2957
|
|
2825
2958
|
// ../commons/src/events/WorkqueueConfig.ts
|
2826
|
-
var
|
2959
|
+
var import_zod29 = require("zod");
|
2827
2960
|
|
2828
2961
|
// ../commons/src/events/serializers/user/serializer.ts
|
2829
|
-
var
|
2830
|
-
var SerializedUserField =
|
2831
|
-
$userField:
|
2962
|
+
var import_zod23 = require("zod");
|
2963
|
+
var SerializedUserField = import_zod23.z.object({
|
2964
|
+
$userField: import_zod23.z.enum([
|
2832
2965
|
"id",
|
2833
2966
|
"name",
|
2834
2967
|
"role",
|
@@ -3080,8 +3213,9 @@ function createFieldConditionals(fieldId) {
|
|
3080
3213
|
properties: {
|
3081
3214
|
[fieldId]: {
|
3082
3215
|
type: "string",
|
3083
|
-
|
3084
|
-
|
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."
|
3085
3219
|
}
|
3086
3220
|
}
|
3087
3221
|
}),
|
@@ -3174,6 +3308,19 @@ function createSearchConfig(baseField) {
|
|
3174
3308
|
fuzzy: () => ({
|
3175
3309
|
...baseField,
|
3176
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" }
|
3177
3324
|
})
|
3178
3325
|
};
|
3179
3326
|
}
|
@@ -3181,7 +3328,7 @@ function createSearchConfig(baseField) {
|
|
3181
3328
|
// ../commons/src/event-config/event-configuration.ts
|
3182
3329
|
function createEventFieldConfig(fieldId) {
|
3183
3330
|
const baseField = {
|
3184
|
-
fieldId
|
3331
|
+
fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
|
3185
3332
|
fieldType: "event"
|
3186
3333
|
};
|
3187
3334
|
return createSearchConfig(baseField);
|
@@ -3194,32 +3341,107 @@ function eventFn(fieldId) {
|
|
3194
3341
|
var event = Object.assign(eventFn, {
|
3195
3342
|
/**
|
3196
3343
|
* Checks if the event contains a specific action type.
|
3344
|
+
* Can be used directly as a conditional or chained with additional methods.
|
3197
3345
|
* @param action - The action type to check for.
|
3198
3346
|
*/
|
3199
|
-
hasAction: (action) =>
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
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({
|
3203
3388
|
type: "object",
|
3204
3389
|
properties: {
|
3205
|
-
|
3206
|
-
type: "
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
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"]
|
3216
3404
|
}
|
3217
3405
|
},
|
3218
|
-
required: ["
|
3219
|
-
}
|
3220
|
-
}
|
3221
|
-
|
3222
|
-
|
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
|
+
},
|
3223
3445
|
field(field2) {
|
3224
3446
|
return {
|
3225
3447
|
$event: field2
|
@@ -3228,83 +3450,82 @@ var event = Object.assign(eventFn, {
|
|
3228
3450
|
});
|
3229
3451
|
|
3230
3452
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3231
|
-
var
|
3453
|
+
var import_zod25 = require("zod");
|
3232
3454
|
|
3233
3455
|
// ../commons/src/events/EventMetadata.ts
|
3234
|
-
var
|
3235
|
-
var EventStatus =
|
3456
|
+
var import_zod24 = require("zod");
|
3457
|
+
var EventStatus = import_zod24.z.enum([
|
3236
3458
|
"CREATED",
|
3237
3459
|
"NOTIFIED",
|
3238
3460
|
"DECLARED",
|
3239
3461
|
"VALIDATED",
|
3240
3462
|
"REGISTERED",
|
3241
|
-
"CERTIFIED",
|
3242
3463
|
"ARCHIVED"
|
3243
3464
|
]);
|
3244
|
-
var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
|
3245
3465
|
var InherentFlags = {
|
3246
|
-
|
3466
|
+
PENDING_CERTIFICATION: "pending-certification",
|
3247
3467
|
INCOMPLETE: "incomplete",
|
3248
3468
|
REJECTED: "rejected",
|
3249
3469
|
CORRECTION_REQUESTED: "correction-requested"
|
3250
3470
|
};
|
3251
|
-
var
|
3471
|
+
var ActionFlag = import_zod24.z.string().regex(
|
3252
3472
|
new RegExp(
|
3253
3473
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3254
3474
|
ActionStatus
|
3255
3475
|
).join("|").toLowerCase()})$`
|
3256
3476
|
),
|
3257
3477
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3258
|
-
)
|
3259
|
-
var
|
3260
|
-
var
|
3261
|
-
|
3262
|
-
|
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."),
|
3263
3484
|
createdAtLocation: CreatedAtLocation.describe(
|
3264
3485
|
"Location of the user who created the action request."
|
3265
3486
|
),
|
3266
|
-
createdByUserType:
|
3267
|
-
acceptedAt:
|
3268
|
-
createdByRole:
|
3269
|
-
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.")
|
3270
3491
|
});
|
3271
3492
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3272
|
-
registrationNumber:
|
3493
|
+
registrationNumber: import_zod24.z.string().describe(
|
3273
3494
|
"Registration number of the event. Always present for accepted registrations."
|
3274
3495
|
)
|
3275
3496
|
});
|
3276
|
-
var LegalStatuses =
|
3497
|
+
var LegalStatuses = import_zod24.z.object({
|
3277
3498
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3278
3499
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3279
3500
|
});
|
3280
|
-
var EventMetadata =
|
3501
|
+
var EventMetadata = import_zod24.z.object({
|
3281
3502
|
id: UUID,
|
3282
|
-
type:
|
3503
|
+
type: import_zod24.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3283
3504
|
status: EventStatus,
|
3284
3505
|
legalStatuses: LegalStatuses.describe(
|
3285
3506
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3286
3507
|
),
|
3287
|
-
createdAt:
|
3508
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3288
3509
|
dateOfEvent: ZodDate.nullish(),
|
3289
|
-
createdBy:
|
3290
|
-
createdByUserType:
|
3291
|
-
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."),
|
3292
3513
|
createdAtLocation: CreatedAtLocation.describe(
|
3293
3514
|
"Location of the user who created the event."
|
3294
3515
|
),
|
3295
|
-
createdBySignature:
|
3516
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the event."),
|
3296
3517
|
updatedAtLocation: UUID.nullish().describe(
|
3297
3518
|
"Location of the user who last changed the status."
|
3298
3519
|
),
|
3299
|
-
updatedAt:
|
3520
|
+
updatedAt: import_zod24.z.string().datetime().describe(
|
3300
3521
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3301
3522
|
),
|
3302
|
-
assignedTo:
|
3303
|
-
updatedBy:
|
3304
|
-
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(
|
3305
3526
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3306
3527
|
),
|
3307
|
-
flags:
|
3528
|
+
flags: import_zod24.z.array(Flag)
|
3308
3529
|
});
|
3309
3530
|
var EventMetadataKeysArray = [
|
3310
3531
|
"id",
|
@@ -3324,7 +3545,7 @@ var EventMetadataKeysArray = [
|
|
3324
3545
|
"legalStatuses",
|
3325
3546
|
"flags"
|
3326
3547
|
];
|
3327
|
-
var EventMetadataKeys =
|
3548
|
+
var EventMetadataKeys = import_zod24.z.enum(EventMetadataKeysArray);
|
3328
3549
|
var eventMetadataLabelMap = {
|
3329
3550
|
"event.assignedTo": {
|
3330
3551
|
id: "event.assignedTo.label",
|
@@ -3409,11 +3630,11 @@ var WorkqueueColumnKeysArray = [
|
|
3409
3630
|
"title",
|
3410
3631
|
"outbox"
|
3411
3632
|
];
|
3412
|
-
var WorkqueueColumnKeys =
|
3413
|
-
var WorkqueueColumnValue =
|
3633
|
+
var WorkqueueColumnKeys = import_zod25.z.enum(WorkqueueColumnKeysArray);
|
3634
|
+
var WorkqueueColumnValue = import_zod25.z.object({
|
3414
3635
|
$event: WorkqueueColumnKeys
|
3415
3636
|
});
|
3416
|
-
var WorkqueueColumn =
|
3637
|
+
var WorkqueueColumn = import_zod25.z.object({
|
3417
3638
|
label: TranslationConfig,
|
3418
3639
|
value: WorkqueueColumnValue
|
3419
3640
|
});
|
@@ -3424,117 +3645,120 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3424
3645
|
}
|
3425
3646
|
|
3426
3647
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3427
|
-
var
|
3648
|
+
var import_zod27 = require("zod");
|
3428
3649
|
|
3429
3650
|
// ../commons/src/events/EventIndex.ts
|
3430
|
-
var
|
3651
|
+
var import_zod26 = require("zod");
|
3431
3652
|
var import_zod_openapi10 = require("zod-openapi");
|
3432
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3653
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3433
3654
|
var EventIndex = EventMetadata.extend({
|
3434
3655
|
declaration: EventState
|
3435
3656
|
}).openapi({
|
3436
3657
|
ref: "EventIndex"
|
3437
3658
|
});
|
3438
|
-
var EventSearchIndex =
|
3439
|
-
|
3440
|
-
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()
|
3441
3662
|
// Ensures "type" (event-id) exists and is a string
|
3442
3663
|
})
|
3443
3664
|
).openapi({
|
3444
3665
|
ref: "EventSearchIndex"
|
3445
3666
|
});
|
3446
|
-
var Fuzzy =
|
3667
|
+
var Fuzzy = import_zod26.z.object({ type: import_zod26.z.literal("fuzzy"), term: import_zod26.z.string() }).openapi({
|
3447
3668
|
ref: "Fuzzy"
|
3448
3669
|
});
|
3449
|
-
var Exact =
|
3670
|
+
var Exact = import_zod26.z.object({ type: import_zod26.z.literal("exact"), term: import_zod26.z.string() }).openapi({
|
3450
3671
|
ref: "Exact"
|
3451
3672
|
});
|
3452
|
-
var ExactStatus =
|
3453
|
-
type:
|
3673
|
+
var ExactStatus = import_zod26.z.object({
|
3674
|
+
type: import_zod26.z.literal("exact"),
|
3454
3675
|
term: EventStatus
|
3455
3676
|
}).openapi({
|
3456
3677
|
ref: "ExactStatus"
|
3457
3678
|
});
|
3458
|
-
var ExactUserType =
|
3459
|
-
type:
|
3679
|
+
var ExactUserType = import_zod26.z.object({
|
3680
|
+
type: import_zod26.z.literal("exact"),
|
3460
3681
|
term: TokenUserType
|
3461
3682
|
}).openapi({
|
3462
3683
|
ref: "ExactUserType"
|
3463
3684
|
});
|
3464
|
-
var AnyOf =
|
3465
|
-
type:
|
3466
|
-
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())
|
3467
3688
|
}).openapi({
|
3468
3689
|
ref: "AnyOf"
|
3469
3690
|
});
|
3470
|
-
var AnyOfStatus =
|
3471
|
-
type:
|
3472
|
-
terms:
|
3691
|
+
var AnyOfStatus = import_zod26.z.object({
|
3692
|
+
type: import_zod26.z.literal("anyOf"),
|
3693
|
+
terms: import_zod26.z.array(EventStatus)
|
3473
3694
|
}).openapi({
|
3474
3695
|
ref: "AnyOfStatus"
|
3475
3696
|
});
|
3476
|
-
var Range =
|
3477
|
-
type:
|
3478
|
-
gte:
|
3479
|
-
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()
|
3480
3701
|
}).openapi({
|
3481
3702
|
ref: "Range"
|
3482
3703
|
});
|
3483
|
-
var ContainsFlags =
|
3484
|
-
anyOf:
|
3485
|
-
noneOf:
|
3704
|
+
var ContainsFlags = import_zod26.z.object({
|
3705
|
+
anyOf: import_zod26.z.array(Flag).optional(),
|
3706
|
+
noneOf: import_zod26.z.array(Flag).optional()
|
3486
3707
|
}).openapi({
|
3487
3708
|
ref: "ContainsFlags"
|
3488
3709
|
});
|
3489
|
-
var Within =
|
3710
|
+
var Within = import_zod26.z.object({ type: import_zod26.z.literal("within"), location: import_zod26.z.string() }).openapi({
|
3490
3711
|
ref: "Within"
|
3491
3712
|
});
|
3492
|
-
var RangeDate =
|
3493
|
-
type:
|
3494
|
-
gte:
|
3495
|
-
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())
|
3496
3717
|
}).openapi({ ref: "RangeDate" });
|
3497
3718
|
var ExactDate = Exact.extend({
|
3498
|
-
term:
|
3719
|
+
term: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3499
3720
|
}).openapi({
|
3500
3721
|
ref: "ExactDate"
|
3501
3722
|
});
|
3502
|
-
var TimePeriod =
|
3503
|
-
type:
|
3723
|
+
var TimePeriod = import_zod26.z.object({
|
3724
|
+
type: import_zod26.z.literal("timePeriod"),
|
3504
3725
|
term: SelectDateRangeValue
|
3505
3726
|
}).openapi({
|
3506
3727
|
ref: "TimePeriod"
|
3507
3728
|
});
|
3508
|
-
var DateCondition =
|
3729
|
+
var DateCondition = import_zod26.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3509
3730
|
ref: "DateCondition"
|
3510
3731
|
});
|
3511
|
-
var QueryInput =
|
3512
|
-
() =>
|
3513
|
-
|
3514
|
-
|
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)
|
3515
3736
|
])
|
3516
3737
|
).openapi({
|
3517
3738
|
ref: "QueryInput"
|
3518
3739
|
});
|
3519
|
-
var QueryExpression =
|
3520
|
-
id:
|
3521
|
-
eventType:
|
3522
|
-
status:
|
3523
|
-
createdAt:
|
3524
|
-
updatedAt:
|
3525
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
3526
|
-
"legalStatuses.
|
3527
|
-
|
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])
|
3528
3749
|
),
|
3529
|
-
"legalStatuses.REGISTERED.
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3750
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3751
|
+
import_zod26.z.union([Within, Exact])
|
3752
|
+
),
|
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),
|
3538
3762
|
// @todo: The type for this comes out as "any"
|
3539
3763
|
data: QueryInput
|
3540
3764
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
@@ -3542,9 +3766,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3542
3766
|
}).openapi({
|
3543
3767
|
ref: "QueryExpression"
|
3544
3768
|
});
|
3545
|
-
var QueryType =
|
3546
|
-
type:
|
3547
|
-
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(
|
3548
3772
|
(val) => {
|
3549
3773
|
if (typeof val === "string") {
|
3550
3774
|
return [JSON.parse(val)];
|
@@ -3554,7 +3778,7 @@ var QueryType = import_zod25.z.object({
|
|
3554
3778
|
}
|
3555
3779
|
return val;
|
3556
3780
|
},
|
3557
|
-
|
3781
|
+
import_zod26.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3558
3782
|
default: [
|
3559
3783
|
{
|
3560
3784
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3581,56 +3805,56 @@ var SearchScopeAccessLevels = {
|
|
3581
3805
|
};
|
3582
3806
|
|
3583
3807
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3584
|
-
var SerializableExact =
|
3585
|
-
type:
|
3586
|
-
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])
|
3587
3811
|
});
|
3588
|
-
var SerializableWithin =
|
3589
|
-
type:
|
3590
|
-
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])
|
3591
3815
|
});
|
3592
|
-
var SerializedQueryExpression =
|
3593
|
-
eventType:
|
3594
|
-
status:
|
3595
|
-
createdAt:
|
3596
|
-
updatedAt:
|
3597
|
-
"legalStatuses.REGISTERED.createdAt":
|
3598
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
3599
|
-
|
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])
|
3600
3824
|
),
|
3601
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
3602
|
-
createdAtLocation:
|
3603
|
-
|
3825
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod27.z.optional(Exact),
|
3826
|
+
createdAtLocation: import_zod27.z.optional(
|
3827
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3604
3828
|
),
|
3605
|
-
updatedAtLocation:
|
3606
|
-
|
3829
|
+
updatedAtLocation: import_zod27.z.optional(
|
3830
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3607
3831
|
),
|
3608
|
-
assignedTo:
|
3609
|
-
createdBy:
|
3832
|
+
assignedTo: import_zod27.z.optional(SerializableExact),
|
3833
|
+
createdBy: import_zod27.z.optional(SerializableExact),
|
3610
3834
|
createdByUserType: ExactUserType,
|
3611
|
-
updatedBy:
|
3612
|
-
trackingId:
|
3613
|
-
flags:
|
3835
|
+
updatedBy: import_zod27.z.optional(SerializableExact),
|
3836
|
+
trackingId: import_zod27.z.optional(Exact),
|
3837
|
+
flags: import_zod27.z.optional(ContainsFlags),
|
3614
3838
|
data: QueryInput
|
3615
3839
|
}).partial();
|
3616
|
-
var Or2 =
|
3617
|
-
type:
|
3618
|
-
clauses:
|
3840
|
+
var Or2 = import_zod27.z.object({
|
3841
|
+
type: import_zod27.z.literal("or"),
|
3842
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3619
3843
|
});
|
3620
|
-
var And2 =
|
3621
|
-
type:
|
3622
|
-
clauses:
|
3844
|
+
var And2 = import_zod27.z.object({
|
3845
|
+
type: import_zod27.z.literal("and"),
|
3846
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3623
3847
|
});
|
3624
|
-
var CountryConfigQueryType =
|
3625
|
-
var CountryConfigQueryInputType =
|
3848
|
+
var CountryConfigQueryType = import_zod27.z.discriminatedUnion("type", [And2, Or2]);
|
3849
|
+
var CountryConfigQueryInputType = import_zod27.z.union([
|
3626
3850
|
SerializedQueryExpression,
|
3627
3851
|
And2,
|
3628
3852
|
Or2
|
3629
3853
|
]);
|
3630
3854
|
|
3631
3855
|
// ../commons/src/icons.ts
|
3632
|
-
var
|
3633
|
-
var AvailableIcons =
|
3856
|
+
var import_zod28 = require("zod");
|
3857
|
+
var AvailableIcons = import_zod28.z.enum([
|
3634
3858
|
"Archived",
|
3635
3859
|
"Assigned",
|
3636
3860
|
"Certified",
|
@@ -3751,43 +3975,45 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3751
3975
|
value: event.field("updatedAt")
|
3752
3976
|
}
|
3753
3977
|
]);
|
3754
|
-
var WorkqueueActionsWithDefault =
|
3978
|
+
var WorkqueueActionsWithDefault = import_zod29.z.enum([
|
3755
3979
|
...workqueueActions.options,
|
3756
3980
|
"DEFAULT"
|
3757
3981
|
]);
|
3758
|
-
var WorkqueueConfig =
|
3759
|
-
slug:
|
3982
|
+
var WorkqueueConfig = import_zod29.z.object({
|
3983
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3760
3984
|
name: TranslationConfig.describe(
|
3761
3985
|
"Title of the workflow (both in navigation and on the page)"
|
3762
3986
|
),
|
3763
3987
|
query: CountryConfigQueryType,
|
3764
|
-
actions:
|
3765
|
-
|
3988
|
+
actions: import_zod29.z.array(
|
3989
|
+
import_zod29.z.object({
|
3766
3990
|
type: WorkqueueActionsWithDefault,
|
3767
|
-
conditionals:
|
3991
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3768
3992
|
})
|
3769
3993
|
),
|
3770
|
-
columns:
|
3771
|
-
icon: AvailableIcons
|
3994
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3995
|
+
icon: AvailableIcons,
|
3996
|
+
emptyMessage: TranslationConfig.optional()
|
3772
3997
|
}).describe("Configuration for workqueue.");
|
3773
3998
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3774
3999
|
query: true,
|
3775
4000
|
columns: true
|
3776
4001
|
});
|
3777
|
-
var WorkqueueConfigInput =
|
3778
|
-
slug:
|
4002
|
+
var WorkqueueConfigInput = import_zod29.z.object({
|
4003
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3779
4004
|
name: TranslationConfig.describe(
|
3780
4005
|
"Title of the workflow (both in navigation and on the page)"
|
3781
4006
|
),
|
3782
4007
|
query: CountryConfigQueryInputType,
|
3783
|
-
actions:
|
3784
|
-
|
4008
|
+
actions: import_zod29.z.array(
|
4009
|
+
import_zod29.z.object({
|
3785
4010
|
type: WorkqueueActionsWithDefault,
|
3786
|
-
conditionals:
|
4011
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3787
4012
|
})
|
3788
4013
|
),
|
3789
|
-
columns:
|
3790
|
-
icon: AvailableIcons
|
4014
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
4015
|
+
icon: AvailableIcons,
|
4016
|
+
emptyMessage: TranslationConfig.optional()
|
3791
4017
|
});
|
3792
4018
|
function defineWorkqueue(workqueueInput) {
|
3793
4019
|
const queryInput = workqueueInput.query;
|
@@ -3797,10 +4023,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3797
4023
|
function defineWorkqueues(workqueues) {
|
3798
4024
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3799
4025
|
}
|
3800
|
-
var WorkqueueCountInput =
|
3801
|
-
|
4026
|
+
var WorkqueueCountInput = import_zod29.z.array(
|
4027
|
+
import_zod29.z.object({ slug: import_zod29.z.string(), query: QueryType })
|
3802
4028
|
);
|
3803
|
-
var WorkqueueCountOutput =
|
4029
|
+
var WorkqueueCountOutput = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.number());
|
3804
4030
|
|
3805
4031
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3806
4032
|
var defaultWorkqueueColumns = [
|
@@ -3823,42 +4049,42 @@ var defaultWorkqueueColumns = [
|
|
3823
4049
|
];
|
3824
4050
|
|
3825
4051
|
// ../commons/src/events/Draft.ts
|
3826
|
-
var
|
4052
|
+
var import_zod31 = require("zod");
|
3827
4053
|
|
3828
4054
|
// ../commons/src/events/ActionInput.ts
|
3829
|
-
var
|
4055
|
+
var import_zod30 = require("zod");
|
3830
4056
|
var import_zod_openapi11 = require("zod-openapi");
|
3831
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
3832
|
-
var BaseActionInput =
|
4057
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod30.z);
|
4058
|
+
var BaseActionInput = import_zod30.z.object({
|
3833
4059
|
eventId: UUID,
|
3834
|
-
transactionId:
|
4060
|
+
transactionId: import_zod30.z.string(),
|
3835
4061
|
declaration: ActionUpdate.default({}),
|
3836
4062
|
annotation: ActionUpdate.optional(),
|
3837
4063
|
originalActionId: UUID.optional(),
|
3838
4064
|
// should not be part of base action.
|
3839
|
-
keepAssignment:
|
4065
|
+
keepAssignment: import_zod30.z.boolean().optional()
|
3840
4066
|
});
|
3841
4067
|
var CreateActionInput = BaseActionInput.merge(
|
3842
|
-
|
3843
|
-
type:
|
4068
|
+
import_zod30.z.object({
|
4069
|
+
type: import_zod30.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3844
4070
|
createdAtLocation: CreatedAtLocation
|
3845
4071
|
})
|
3846
4072
|
);
|
3847
4073
|
var RegisterActionInput = BaseActionInput.merge(
|
3848
|
-
|
3849
|
-
type:
|
3850
|
-
registrationNumber:
|
4074
|
+
import_zod30.z.object({
|
4075
|
+
type: import_zod30.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
4076
|
+
registrationNumber: import_zod30.z.string().optional()
|
3851
4077
|
})
|
3852
4078
|
).strict();
|
3853
4079
|
var ValidateActionInput = BaseActionInput.merge(
|
3854
|
-
|
3855
|
-
type:
|
3856
|
-
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())
|
3857
4083
|
})
|
3858
4084
|
);
|
3859
4085
|
var NotifyActionInput = BaseActionInput.merge(
|
3860
|
-
|
3861
|
-
type:
|
4086
|
+
import_zod30.z.object({
|
4087
|
+
type: import_zod30.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3862
4088
|
})
|
3863
4089
|
).openapi({
|
3864
4090
|
default: {
|
@@ -3870,68 +4096,70 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3870
4096
|
}
|
3871
4097
|
});
|
3872
4098
|
var DeclareActionInput = BaseActionInput.merge(
|
3873
|
-
|
3874
|
-
type:
|
4099
|
+
import_zod30.z.object({
|
4100
|
+
type: import_zod30.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3875
4101
|
})
|
3876
4102
|
);
|
3877
4103
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3878
|
-
|
3879
|
-
type:
|
4104
|
+
import_zod30.z.object({
|
4105
|
+
type: import_zod30.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
4106
|
+
content: PrintContent.optional()
|
3880
4107
|
})
|
3881
4108
|
);
|
3882
4109
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3883
|
-
|
3884
|
-
type:
|
4110
|
+
import_zod30.z.object({
|
4111
|
+
type: import_zod30.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3885
4112
|
reason: RejectionReason
|
3886
4113
|
})
|
3887
4114
|
);
|
3888
4115
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3889
|
-
|
3890
|
-
type:
|
4116
|
+
import_zod30.z.object({
|
4117
|
+
type: import_zod30.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3891
4118
|
})
|
3892
4119
|
);
|
3893
4120
|
var ArchiveActionInput = BaseActionInput.merge(
|
3894
|
-
|
3895
|
-
type:
|
4121
|
+
import_zod30.z.object({
|
4122
|
+
type: import_zod30.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3896
4123
|
reason: RejectionReason
|
3897
4124
|
})
|
3898
4125
|
);
|
3899
4126
|
var AssignActionInput = BaseActionInput.merge(
|
3900
|
-
|
3901
|
-
type:
|
3902
|
-
assignedTo:
|
4127
|
+
import_zod30.z.object({
|
4128
|
+
type: import_zod30.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
4129
|
+
assignedTo: import_zod30.z.string()
|
3903
4130
|
})
|
3904
4131
|
);
|
3905
4132
|
var UnassignActionInput = BaseActionInput.merge(
|
3906
|
-
|
3907
|
-
type:
|
3908
|
-
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)
|
3909
4136
|
})
|
3910
4137
|
);
|
3911
4138
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3912
|
-
|
3913
|
-
type:
|
4139
|
+
import_zod30.z.object({
|
4140
|
+
type: import_zod30.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3914
4141
|
})
|
3915
4142
|
);
|
3916
4143
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3917
|
-
|
3918
|
-
requestId:
|
3919
|
-
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),
|
4147
|
+
reason: RejectionReason
|
3920
4148
|
})
|
3921
4149
|
);
|
3922
4150
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3923
|
-
|
3924
|
-
requestId:
|
3925
|
-
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)
|
3926
4154
|
})
|
3927
4155
|
);
|
3928
4156
|
var ReadActionInput = BaseActionInput.merge(
|
3929
|
-
|
3930
|
-
type:
|
4157
|
+
import_zod30.z.object({
|
4158
|
+
type: import_zod30.z.literal(ActionType.READ).default(ActionType.READ)
|
3931
4159
|
})
|
3932
4160
|
);
|
3933
|
-
var DeleteActionInput =
|
3934
|
-
var ActionInput =
|
4161
|
+
var DeleteActionInput = import_zod30.z.object({ eventId: UUID });
|
4162
|
+
var ActionInput = import_zod30.z.discriminatedUnion("type", [
|
3935
4163
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3936
4164
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3937
4165
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -3960,18 +4188,18 @@ var ActionInput = import_zod29.z.discriminatedUnion("type", [
|
|
3960
4188
|
});
|
3961
4189
|
|
3962
4190
|
// ../commons/src/events/Draft.ts
|
3963
|
-
var Draft =
|
4191
|
+
var Draft = import_zod31.z.object({
|
3964
4192
|
id: UUID,
|
3965
4193
|
eventId: UUID,
|
3966
|
-
transactionId:
|
3967
|
-
createdAt:
|
4194
|
+
transactionId: import_zod31.z.string(),
|
4195
|
+
createdAt: import_zod31.z.string().datetime(),
|
3968
4196
|
action: ActionBase.extend({
|
3969
|
-
type: ActionTypes
|
4197
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
|
3970
4198
|
}).omit({ id: true })
|
3971
4199
|
});
|
3972
4200
|
var DraftInput = BaseActionInput.extend({
|
3973
|
-
type: ActionTypes,
|
3974
|
-
status:
|
4201
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
|
4202
|
+
status: import_zod31.z.enum([
|
3975
4203
|
ActionStatus.Requested,
|
3976
4204
|
ActionStatus.Accepted,
|
3977
4205
|
ActionStatus.Rejected
|
@@ -3979,26 +4207,29 @@ var DraftInput = BaseActionInput.extend({
|
|
3979
4207
|
});
|
3980
4208
|
|
3981
4209
|
// ../commons/src/events/EventInput.ts
|
3982
|
-
var
|
4210
|
+
var import_zod32 = require("zod");
|
3983
4211
|
var import_uuid8 = require("uuid");
|
3984
|
-
var EventInput =
|
3985
|
-
transactionId:
|
3986
|
-
type:
|
4212
|
+
var EventInput = import_zod32.z.object({
|
4213
|
+
transactionId: import_zod32.z.string(),
|
4214
|
+
type: import_zod32.z.string()
|
3987
4215
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
3988
4216
|
|
3989
4217
|
// ../commons/src/events/EventDocument.ts
|
3990
|
-
var
|
4218
|
+
var import_zod33 = require("zod");
|
3991
4219
|
var import_zod_openapi12 = require("zod-openapi");
|
3992
|
-
(0, import_zod_openapi12.extendZodWithOpenApi)(
|
3993
|
-
var EventDocument =
|
4220
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod33.z);
|
4221
|
+
var EventDocument = import_zod33.z.object({
|
3994
4222
|
id: UUID,
|
3995
|
-
type:
|
3996
|
-
createdAt:
|
3997
|
-
updatedAt:
|
3998
|
-
actions:
|
3999
|
-
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()
|
4000
4228
|
}).openapi({ ref: "EventDocument" });
|
4001
4229
|
|
4230
|
+
// ../commons/src/events/state/index.ts
|
4231
|
+
var import_lodash3 = require("lodash");
|
4232
|
+
|
4002
4233
|
// ../commons/src/events/state/utils.ts
|
4003
4234
|
var import_lodash2 = require("lodash");
|
4004
4235
|
function getActionRequests(actionType, actions) {
|
@@ -4087,16 +4318,19 @@ function getLegalStatuses(actions) {
|
|
4087
4318
|
}
|
4088
4319
|
|
4089
4320
|
// ../commons/src/events/state/flags.ts
|
4090
|
-
function
|
4321
|
+
function isPendingCertification(actions) {
|
4322
|
+
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4323
|
+
return false;
|
4324
|
+
}
|
4091
4325
|
return actions.reduce((prev, { type }) => {
|
4092
4326
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
4093
|
-
return
|
4327
|
+
return false;
|
4094
4328
|
}
|
4095
4329
|
if (type === ActionType.APPROVE_CORRECTION) {
|
4096
|
-
return
|
4330
|
+
return true;
|
4097
4331
|
}
|
4098
4332
|
return prev;
|
4099
|
-
},
|
4333
|
+
}, true);
|
4100
4334
|
}
|
4101
4335
|
function isCorrectionRequested(actions) {
|
4102
4336
|
return actions.reduce((prev, { type }) => {
|
@@ -4131,8 +4365,8 @@ function getFlagsFromActions(actions) {
|
|
4131
4365
|
const flag = joinValues([type, status], ":").toLowerCase();
|
4132
4366
|
return flag;
|
4133
4367
|
});
|
4134
|
-
if (
|
4135
|
-
flags.push(InherentFlags.
|
4368
|
+
if (isPendingCertification(sortedActions)) {
|
4369
|
+
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
4136
4370
|
}
|
4137
4371
|
if (isCorrectionRequested(sortedActions)) {
|
4138
4372
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -4163,7 +4397,6 @@ function getStatusFromActions(actions) {
|
|
4163
4397
|
case ActionType.NOTIFY:
|
4164
4398
|
return EventStatus.enum.NOTIFIED;
|
4165
4399
|
case ActionType.PRINT_CERTIFICATE:
|
4166
|
-
return EventStatus.enum.CERTIFIED;
|
4167
4400
|
case ActionType.ASSIGN:
|
4168
4401
|
case ActionType.UNASSIGN:
|
4169
4402
|
case ActionType.REJECT:
|
@@ -4286,30 +4519,33 @@ function getCurrentEventState(event2, config) {
|
|
4286
4519
|
flags: getFlagsFromActions(event2.actions)
|
4287
4520
|
});
|
4288
4521
|
}
|
4289
|
-
function
|
4522
|
+
function dangerouslyGetCurrentEventStateWithDrafts({
|
4290
4523
|
event: event2,
|
4291
|
-
|
4524
|
+
draft,
|
4292
4525
|
configuration
|
4293
4526
|
}) {
|
4294
4527
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
4295
|
-
const
|
4296
|
-
|
4297
|
-
|
4298
|
-
|
4299
|
-
|
4300
|
-
|
4301
|
-
|
4302
|
-
|
4303
|
-
|
4528
|
+
const draftAction = 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
|
+
id: getUUID(),
|
4535
|
+
...draft.action,
|
4536
|
+
type: ActionType.APPROVE_CORRECTION
|
4304
4537
|
}
|
4305
|
-
|
4306
|
-
|
4307
|
-
|
4308
|
-
|
4538
|
+
) : { ...draft.action, id: getUUID() };
|
4539
|
+
const actionsWithDraft = (0, import_lodash3.orderBy)(
|
4540
|
+
[...actions, draftAction],
|
4541
|
+
["createdAt"],
|
4542
|
+
"asc"
|
4543
|
+
);
|
4544
|
+
const eventWithDraft = {
|
4309
4545
|
...event2,
|
4310
|
-
actions:
|
4546
|
+
actions: actionsWithDraft
|
4311
4547
|
};
|
4312
|
-
return getCurrentEventState(
|
4548
|
+
return getCurrentEventState(eventWithDraft, configuration);
|
4313
4549
|
}
|
4314
4550
|
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4315
4551
|
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
@@ -4323,18 +4559,18 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
4323
4559
|
declaration: updatedDeclaration
|
4324
4560
|
};
|
4325
4561
|
}
|
4326
|
-
function
|
4562
|
+
function applyDraftToEventIndex(eventIndex, draft, eventConfiguration) {
|
4327
4563
|
const indexedAt = eventIndex.updatedAt;
|
4328
|
-
const
|
4329
|
-
if (
|
4564
|
+
const activeDraft = draft && draft.createdAt >= indexedAt ? draft : void 0;
|
4565
|
+
if (!activeDraft) {
|
4330
4566
|
return eventIndex;
|
4331
4567
|
}
|
4332
4568
|
return applyDeclarationToEventIndex(
|
4333
4569
|
{
|
4334
4570
|
...eventIndex,
|
4335
|
-
updatedAt:
|
4571
|
+
updatedAt: activeDraft.createdAt
|
4336
4572
|
},
|
4337
|
-
|
4573
|
+
activeDraft.action.declaration,
|
4338
4574
|
eventConfiguration
|
4339
4575
|
);
|
4340
4576
|
}
|
@@ -4348,18 +4584,17 @@ function getAnnotationFromDrafts(drafts) {
|
|
4348
4584
|
function getActionAnnotation({
|
4349
4585
|
event: event2,
|
4350
4586
|
actionType,
|
4351
|
-
|
4587
|
+
draft
|
4352
4588
|
}) {
|
4353
4589
|
const activeActions = getAcceptedActions(event2);
|
4354
|
-
const action = activeActions.
|
4355
|
-
|
4590
|
+
const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
|
4591
|
+
const matchingDraft = draft?.action.type === actionType ? draft : void 0;
|
4592
|
+
const sortedActions = (0, import_lodash3.orderBy)(
|
4593
|
+
[action, matchingDraft?.action].filter((a) => a !== void 0),
|
4594
|
+
"createdAt",
|
4595
|
+
"asc"
|
4356
4596
|
);
|
4357
|
-
const
|
4358
|
-
const sorted = [
|
4359
|
-
...action ? [action] : [],
|
4360
|
-
...eventDrafts.map((draft) => draft.action)
|
4361
|
-
].sort();
|
4362
|
-
const annotation = sorted.reduce((ann, sortedAction) => {
|
4597
|
+
const annotation = sortedActions.reduce((ann, sortedAction) => {
|
4363
4598
|
return deepMerge(ann, sortedAction.annotation ?? {});
|
4364
4599
|
}, {});
|
4365
4600
|
return deepDropNulls(annotation);
|
@@ -4377,23 +4612,23 @@ function generateTransactionId() {
|
|
4377
4612
|
}
|
4378
4613
|
|
4379
4614
|
// ../commons/src/events/User.ts
|
4380
|
-
var
|
4381
|
-
var User =
|
4382
|
-
id:
|
4383
|
-
name:
|
4384
|
-
|
4385
|
-
use:
|
4386
|
-
given:
|
4387
|
-
family:
|
4615
|
+
var import_zod34 = require("zod");
|
4616
|
+
var User = import_zod34.z.object({
|
4617
|
+
id: import_zod34.z.string(),
|
4618
|
+
name: import_zod34.z.array(
|
4619
|
+
import_zod34.z.object({
|
4620
|
+
use: import_zod34.z.string(),
|
4621
|
+
given: import_zod34.z.array(import_zod34.z.string()),
|
4622
|
+
family: import_zod34.z.string()
|
4388
4623
|
})
|
4389
4624
|
),
|
4390
|
-
role:
|
4625
|
+
role: import_zod34.z.string(),
|
4391
4626
|
avatar: FullDocumentPath.optional(),
|
4392
4627
|
signature: FullDocumentPath.optional()
|
4393
4628
|
});
|
4394
4629
|
|
4395
4630
|
// ../commons/src/events/test.utils.ts
|
4396
|
-
var
|
4631
|
+
var import_lodash4 = require("lodash");
|
4397
4632
|
var import_date_fns4 = require("date-fns");
|
4398
4633
|
|
4399
4634
|
// ../commons/src/field-config/field-configuration.ts
|
@@ -5128,7 +5363,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5128
5363
|
defaultMessage: "Applicant's name",
|
5129
5364
|
description: "This is the label for the field",
|
5130
5365
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
5131
|
-
}
|
5366
|
+
},
|
5367
|
+
configuration: {
|
5368
|
+
name: {
|
5369
|
+
firstname: { required: true },
|
5370
|
+
middlename: { required: false },
|
5371
|
+
surname: { required: true }
|
5372
|
+
}
|
5373
|
+
},
|
5374
|
+
validation: [
|
5375
|
+
{
|
5376
|
+
validator: field("applicant.name").object({
|
5377
|
+
firstname: field("firstname").isValidEnglishName(),
|
5378
|
+
surname: field("surname").isValidEnglishName()
|
5379
|
+
}),
|
5380
|
+
message: {
|
5381
|
+
defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
|
5382
|
+
description: "This is the error message for invalid name",
|
5383
|
+
id: "v2.error.invalidName"
|
5384
|
+
}
|
5385
|
+
}
|
5386
|
+
]
|
5132
5387
|
},
|
5133
5388
|
{
|
5134
5389
|
id: "applicant.email",
|
@@ -5350,22 +5605,6 @@ var statusOptions = [
|
|
5350
5605
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5351
5606
|
}
|
5352
5607
|
},
|
5353
|
-
{
|
5354
|
-
value: EventStatus.enum.CERTIFIED,
|
5355
|
-
label: {
|
5356
|
-
defaultMessage: "Certified",
|
5357
|
-
description: "Option for form field: status of record",
|
5358
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
5359
|
-
}
|
5360
|
-
},
|
5361
|
-
{
|
5362
|
-
value: VisibleStatus.enum.REJECTED,
|
5363
|
-
label: {
|
5364
|
-
defaultMessage: "Rejected",
|
5365
|
-
description: "Option for form field: status of record",
|
5366
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
5367
|
-
}
|
5368
|
-
},
|
5369
5608
|
{
|
5370
5609
|
value: EventStatus.enum.ARCHIVED,
|
5371
5610
|
label: {
|
@@ -6391,9 +6630,9 @@ var v2BirthEvent = defineConfig({
|
|
6391
6630
|
});
|
6392
6631
|
|
6393
6632
|
// ../commons/src/events/test.utils.ts
|
6394
|
-
var
|
6633
|
+
var import_zod35 = require("zod");
|
6395
6634
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6396
|
-
var TestUserRole =
|
6635
|
+
var TestUserRole = import_zod35.z.enum([
|
6397
6636
|
"FIELD_AGENT",
|
6398
6637
|
"LOCAL_REGISTRAR",
|
6399
6638
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6558,7 +6797,7 @@ function eventPayloadGenerator(rng) {
|
|
6558
6797
|
eventId,
|
6559
6798
|
actionType,
|
6560
6799
|
annotation
|
6561
|
-
}, input = {}) => (0,
|
6800
|
+
}, input = {}) => (0, import_lodash4.merge)(
|
6562
6801
|
{
|
6563
6802
|
id: getUUID(),
|
6564
6803
|
eventId,
|
@@ -6617,13 +6856,13 @@ function eventPayloadGenerator(rng) {
|
|
6617
6856
|
notify: (eventId, input = {}) => {
|
6618
6857
|
let declaration = input.declaration;
|
6619
6858
|
if (!declaration) {
|
6620
|
-
const partialDeclaration = (0,
|
6859
|
+
const partialDeclaration = (0, import_lodash4.omitBy)(
|
6621
6860
|
generateActionDeclarationInput(
|
6622
6861
|
tennisClubMembershipEvent,
|
6623
6862
|
ActionType.DECLARE,
|
6624
6863
|
rng
|
6625
6864
|
),
|
6626
|
-
|
6865
|
+
import_lodash4.isString
|
6627
6866
|
);
|
6628
6867
|
declaration = partialDeclaration;
|
6629
6868
|
}
|
@@ -6670,7 +6909,6 @@ function eventPayloadGenerator(rng) {
|
|
6670
6909
|
type: ActionType.ARCHIVE,
|
6671
6910
|
transactionId: input.transactionId ?? getUUID(),
|
6672
6911
|
declaration: {},
|
6673
|
-
// @TODO: Check whether generator is needed?
|
6674
6912
|
annotation: {},
|
6675
6913
|
duplicates: [],
|
6676
6914
|
eventId,
|
@@ -6726,7 +6964,7 @@ function eventPayloadGenerator(rng) {
|
|
6726
6964
|
request: (eventId, input = {}) => ({
|
6727
6965
|
type: ActionType.REQUEST_CORRECTION,
|
6728
6966
|
transactionId: input.transactionId ?? getUUID(),
|
6729
|
-
declaration: input.declaration ?? (0,
|
6967
|
+
declaration: input.declaration ?? (0, import_lodash4.omit)(
|
6730
6968
|
generateActionDeclarationInput(
|
6731
6969
|
tennisClubMembershipEvent,
|
6732
6970
|
ActionType.REQUEST_CORRECTION,
|
@@ -6755,7 +6993,7 @@ function eventPayloadGenerator(rng) {
|
|
6755
6993
|
requestId,
|
6756
6994
|
keepAssignment: input.keepAssignment
|
6757
6995
|
}),
|
6758
|
-
reject: (eventId, requestId, input
|
6996
|
+
reject: (eventId, requestId, input) => ({
|
6759
6997
|
type: ActionType.REJECT_CORRECTION,
|
6760
6998
|
transactionId: input.transactionId ?? getUUID(),
|
6761
6999
|
declaration: {},
|
@@ -6766,7 +7004,8 @@ function eventPayloadGenerator(rng) {
|
|
6766
7004
|
),
|
6767
7005
|
eventId,
|
6768
7006
|
requestId,
|
6769
|
-
keepAssignment: input.keepAssignment
|
7007
|
+
keepAssignment: input.keepAssignment,
|
7008
|
+
reason: input.reason ?? { message: "" }
|
6770
7009
|
})
|
6771
7010
|
}
|
6772
7011
|
}
|
@@ -6816,7 +7055,11 @@ function generateActionDocument({
|
|
6816
7055
|
case ActionType.NOTIFY:
|
6817
7056
|
return { ...actionBase, type: action };
|
6818
7057
|
case ActionType.PRINT_CERTIFICATE:
|
6819
|
-
return {
|
7058
|
+
return {
|
7059
|
+
...actionBase,
|
7060
|
+
type: action,
|
7061
|
+
content: defaults.content
|
7062
|
+
};
|
6820
7063
|
case ActionType.REQUEST_CORRECTION:
|
6821
7064
|
return { ...actionBase, type: action };
|
6822
7065
|
case ActionType.APPROVE_CORRECTION:
|
@@ -6825,7 +7068,8 @@ function generateActionDocument({
|
|
6825
7068
|
return {
|
6826
7069
|
...actionBase,
|
6827
7070
|
requestId: getUUID(),
|
6828
|
-
type: action
|
7071
|
+
type: action,
|
7072
|
+
reason: { message: "Correction rejection" }
|
6829
7073
|
};
|
6830
7074
|
case ActionType.REGISTER:
|
6831
7075
|
return {
|
@@ -6878,7 +7122,8 @@ function generateEventDraftDocument({
|
|
6878
7122
|
declaration: {
|
6879
7123
|
...action.declaration,
|
6880
7124
|
...declaration
|
6881
|
-
}
|
7125
|
+
},
|
7126
|
+
annotation: action.annotation
|
6882
7127
|
},
|
6883
7128
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6884
7129
|
eventId
|
@@ -6985,7 +7230,12 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
6985
7230
|
type: "and",
|
6986
7231
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
6987
7232
|
},
|
6988
|
-
actions: [
|
7233
|
+
actions: [
|
7234
|
+
{
|
7235
|
+
type: "DEFAULT",
|
7236
|
+
conditionals: []
|
7237
|
+
}
|
7238
|
+
],
|
6989
7239
|
icon: "Draft"
|
6990
7240
|
}
|
6991
7241
|
]);
|
@@ -7001,9 +7251,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
7001
7251
|
if (isTemplateVariable(value)) {
|
7002
7252
|
return false;
|
7003
7253
|
}
|
7004
|
-
if (typeof value === "object" &&
|
7005
|
-
//@ts-ignore
|
7006
|
-
Object.values(value).some((val) => isTemplateVariable(val))) {
|
7254
|
+
if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
|
7007
7255
|
return false;
|
7008
7256
|
}
|
7009
7257
|
return true;
|
@@ -7025,7 +7273,7 @@ function isFieldConfigDefaultValue(value) {
|
|
7025
7273
|
}
|
7026
7274
|
|
7027
7275
|
// ../commons/src/events/scopes.ts
|
7028
|
-
var
|
7276
|
+
var import_lodash5 = require("lodash");
|
7029
7277
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
7030
7278
|
SCOPES.RECORD_DECLARE,
|
7031
7279
|
SCOPES.RECORD_READ,
|
@@ -7113,13 +7361,13 @@ var WRITE_ACTION_SCOPES = [
|
|
7113
7361
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
7114
7362
|
];
|
7115
7363
|
function hasAnyOfScopes(a, b) {
|
7116
|
-
return (0,
|
7364
|
+
return (0, import_lodash5.intersection)(a, b).length > 0;
|
7117
7365
|
}
|
7118
7366
|
|
7119
7367
|
// ../commons/src/events/serializers/user/deserializer.ts
|
7120
|
-
var
|
7368
|
+
var import_zod36 = require("zod");
|
7121
7369
|
var UserWithPrimaryOffice = User.extend({
|
7122
|
-
primaryOfficeId:
|
7370
|
+
primaryOfficeId: import_zod36.z.string()
|
7123
7371
|
});
|
7124
7372
|
function userDeserializer(serializedUserField, user2) {
|
7125
7373
|
if (typeof serializedUserField === "string") {
|
@@ -7215,14 +7463,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7215
7463
|
ActionType.REJECT_CORRECTION,
|
7216
7464
|
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7217
7465
|
],
|
7218
|
-
[EventStatus.enum.CERTIFIED]: [
|
7219
|
-
ActionType.READ,
|
7220
|
-
ActionType.PRINT_CERTIFICATE,
|
7221
|
-
ActionType.REQUEST_CORRECTION,
|
7222
|
-
ActionType.APPROVE_CORRECTION,
|
7223
|
-
ActionType.REJECT_CORRECTION,
|
7224
|
-
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7225
|
-
],
|
7226
7466
|
[EventStatus.enum.ARCHIVED]: [
|
7227
7467
|
ActionType.READ,
|
7228
7468
|
ActionType.ASSIGN,
|
@@ -7230,9 +7470,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7230
7470
|
]
|
7231
7471
|
};
|
7232
7472
|
var getAvailableActionsForEvent = (event2) => {
|
7233
|
-
|
7234
|
-
|
7235
|
-
|
7236
|
-
|
7237
|
-
|
7473
|
+
if (event2.flags.includes(InherentFlags.REJECTED)) {
|
7474
|
+
return [
|
7475
|
+
ActionType.READ,
|
7476
|
+
event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
|
7477
|
+
ActionType.ARCHIVE
|
7478
|
+
];
|
7479
|
+
}
|
7480
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7238
7481
|
};
|