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