@opencrvs/toolkit 1.9.2-rc.c3822a1 → 1.9.2-rc.f6dcfa6
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 +1620 -26666
- package/dist/commons/conditionals/conditionals.d.ts +1 -10
- package/dist/commons/conditionals/validate.d.ts +4 -11
- package/dist/commons/events/ActionConfig.d.ts +1525 -21293
- package/dist/commons/events/ActionDocument.d.ts +1849 -764
- package/dist/commons/events/ActionInput.d.ts +1066 -264
- package/dist/commons/events/ActionType.d.ts +8 -85
- package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -211
- package/dist/commons/events/CompositeFieldValue.d.ts +176 -25
- package/dist/commons/events/Conditional.d.ts +38 -26
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +4169 -919
- package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
- package/dist/commons/events/DeduplicationConfig.d.ts +150 -15
- package/dist/commons/events/Draft.d.ts +105 -70
- package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
- package/dist/commons/events/EventConfig.d.ts +2096 -17110
- package/dist/commons/events/EventConfigInput.d.ts +1 -1
- package/dist/commons/events/EventDocument.d.ts +1326 -311
- package/dist/commons/events/EventIndex.d.ts +967 -191
- package/dist/commons/events/EventInput.d.ts +8 -2
- package/dist/commons/events/EventMetadata.d.ts +345 -102
- package/dist/commons/events/FieldConfig.d.ts +11775 -4088
- package/dist/commons/events/FieldType.d.ts +2 -6
- package/dist/commons/events/FieldTypeMapping.d.ts +810 -164
- package/dist/commons/events/FieldValue.d.ts +354 -80
- package/dist/commons/events/FormConfig.d.ts +697 -12636
- package/dist/commons/events/PageConfig.d.ts +314 -8441
- package/dist/commons/events/SummaryConfig.d.ts +161 -14
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +36 -70
- package/dist/commons/events/WorkqueueConfig.d.ts +7080 -1597
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +155 -24703
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +19 -15
- package/dist/commons/events/scopes.d.ts +0 -1
- package/dist/commons/events/state/availableActions.d.ts +1 -2
- package/dist/commons/events/state/flags.d.ts +3 -21
- package/dist/commons/events/state/index.d.ts +19 -17
- package/dist/commons/events/state/utils.d.ts +112 -127
- package/dist/commons/events/test.utils.d.ts +5 -11
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +359 -49444
- package/dist/commons/notification/UserNotifications.d.ts +636 -55
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +5 -38
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +1360 -1502
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1279 -1276
- package/dist/scopes/index.d.ts +136 -106
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +93 -116
- package/package.json +5 -5
- package/dist/commons/events/Flag.d.ts +0 -43
package/dist/events/index.js
CHANGED
|
@@ -39,7 +39,6 @@ __export(events_exports, {
|
|
|
39
39
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
|
40
40
|
ActionDocument: () => ActionDocument,
|
|
41
41
|
ActionFlag: () => ActionFlag,
|
|
42
|
-
ActionFlagConfig: () => ActionFlagConfig,
|
|
43
42
|
ActionFormConfig: () => ActionFormConfig,
|
|
44
43
|
ActionInput: () => ActionInput,
|
|
45
44
|
ActionStatus: () => ActionStatus,
|
|
@@ -61,10 +60,10 @@ __export(events_exports, {
|
|
|
61
60
|
ArchiveActionInput: () => ArchiveActionInput,
|
|
62
61
|
AssignActionInput: () => AssignActionInput,
|
|
63
62
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
|
63
|
+
BIRTH_EVENT: () => BIRTH_EVENT,
|
|
64
64
|
BaseActionInput: () => BaseActionInput,
|
|
65
65
|
BearerTokenByUserType: () => BearerTokenByUserType,
|
|
66
66
|
ButtonFieldValue: () => ButtonFieldValue,
|
|
67
|
-
CHILD_ONBOARDING_EVENT: () => CHILD_ONBOARDING_EVENT,
|
|
68
67
|
CertificateConfig: () => CertificateConfig,
|
|
69
68
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
|
70
69
|
CheckboxFieldValue: () => CheckboxFieldValue,
|
|
@@ -74,8 +73,6 @@ __export(events_exports, {
|
|
|
74
73
|
ConditionalType: () => ConditionalType,
|
|
75
74
|
ConfirmableActions: () => ConfirmableActions,
|
|
76
75
|
ContainsFlags: () => ContainsFlags,
|
|
77
|
-
CustomActionInput: () => CustomActionInput,
|
|
78
|
-
CustomFlag: () => CustomFlag,
|
|
79
76
|
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
|
80
77
|
DataEntry: () => DataEntry,
|
|
81
78
|
DataFieldValue: () => DataFieldValue,
|
|
@@ -83,6 +80,7 @@ __export(events_exports, {
|
|
|
83
80
|
DateRangeFieldValue: () => DateRangeFieldValue,
|
|
84
81
|
DateValue: () => DateValue,
|
|
85
82
|
DatetimeValue: () => DatetimeValue,
|
|
83
|
+
DeclarationActionBase: () => DeclarationActionBase,
|
|
86
84
|
DeclarationActionConfig: () => DeclarationActionConfig,
|
|
87
85
|
DeclarationActions: () => DeclarationActions,
|
|
88
86
|
DeclarationFormConfig: () => DeclarationFormConfig,
|
|
@@ -132,7 +130,6 @@ __export(events_exports, {
|
|
|
132
130
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
|
133
131
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
|
134
132
|
Flag: () => Flag,
|
|
135
|
-
FlagConfig: () => FlagConfig,
|
|
136
133
|
FormConfig: () => FormConfig,
|
|
137
134
|
FormPageConfig: () => FormPageConfig,
|
|
138
135
|
Fuzzy: () => Fuzzy,
|
|
@@ -214,7 +211,6 @@ __export(events_exports, {
|
|
|
214
211
|
WorkqueueCountInput: () => WorkqueueCountInput,
|
|
215
212
|
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
|
216
213
|
ZodDate: () => ZodDate,
|
|
217
|
-
actionConfigTypes: () => actionConfigTypes,
|
|
218
214
|
ageToDate: () => ageToDate,
|
|
219
215
|
aggregateActionDeclarations: () => aggregateActionDeclarations,
|
|
220
216
|
alwaysTrue: () => alwaysTrue,
|
|
@@ -258,7 +254,6 @@ __export(events_exports, {
|
|
|
258
254
|
findAllFields: () => findAllFields,
|
|
259
255
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
|
260
256
|
findRecordActionPages: () => findRecordActionPages,
|
|
261
|
-
flag: () => flag,
|
|
262
257
|
generateActionDeclarationInput: () => generateActionDeclarationInput,
|
|
263
258
|
generateActionDocument: () => generateActionDocument,
|
|
264
259
|
generateActionDuplicateDeclarationInput: () => generateActionDuplicateDeclarationInput,
|
|
@@ -276,7 +271,6 @@ __export(events_exports, {
|
|
|
276
271
|
getAcceptedActions: () => getAcceptedActions,
|
|
277
272
|
getActionAnnotation: () => getActionAnnotation,
|
|
278
273
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
|
279
|
-
getActionConfig: () => getActionConfig,
|
|
280
274
|
getActionReview: () => getActionReview,
|
|
281
275
|
getActionReviewFields: () => getActionReviewFields,
|
|
282
276
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
@@ -288,7 +282,6 @@ __export(events_exports, {
|
|
|
288
282
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
289
283
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
290
284
|
getCurrentEventState: () => getCurrentEventState,
|
|
291
|
-
getCustomActionFields: () => getCustomActionFields,
|
|
292
285
|
getDeclaration: () => getDeclaration,
|
|
293
286
|
getDeclarationFieldById: () => getDeclarationFieldById,
|
|
294
287
|
getDeclarationFields: () => getDeclarationFields,
|
|
@@ -303,11 +296,7 @@ __export(events_exports, {
|
|
|
303
296
|
getValidatorsForField: () => getValidatorsForField,
|
|
304
297
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
|
305
298
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
|
306
|
-
isActionAvailable: () => isActionAvailable,
|
|
307
|
-
isActionConfigType: () => isActionConfigType,
|
|
308
|
-
isActionEnabled: () => isActionEnabled,
|
|
309
299
|
isActionInScope: () => isActionInScope,
|
|
310
|
-
isActionVisible: () => isActionVisible,
|
|
311
300
|
isAddressFieldType: () => isAddressFieldType,
|
|
312
301
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
|
313
302
|
isAgeFieldType: () => isAgeFieldType,
|
|
@@ -367,18 +356,16 @@ __export(events_exports, {
|
|
|
367
356
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
|
368
357
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
|
369
358
|
mergeDrafts: () => mergeDrafts,
|
|
370
|
-
never: () =>
|
|
359
|
+
never: () => never,
|
|
371
360
|
not: () => not,
|
|
372
361
|
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
|
373
362
|
omitHiddenFields: () => omitHiddenFields,
|
|
374
363
|
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
|
375
364
|
or: () => or,
|
|
376
|
-
pickRandom: () => pickRandom,
|
|
377
365
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
378
366
|
runFieldValidations: () => runFieldValidations,
|
|
379
367
|
runStructuralValidations: () => runStructuralValidations,
|
|
380
368
|
safeUnion: () => safeUnion,
|
|
381
|
-
status: () => status,
|
|
382
369
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
|
383
370
|
user: () => user,
|
|
384
371
|
validate: () => validate,
|
|
@@ -392,28 +379,30 @@ module.exports = __toCommonJS(events_exports);
|
|
|
392
379
|
|
|
393
380
|
// ../commons/src/events/Constants.ts
|
|
394
381
|
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
395
|
-
var
|
|
382
|
+
var BIRTH_EVENT = "birth";
|
|
396
383
|
|
|
397
384
|
// ../commons/src/events/ActionConfig.ts
|
|
398
|
-
var
|
|
385
|
+
var import_zod19 = require("zod");
|
|
399
386
|
|
|
400
387
|
// ../commons/src/events/TranslationConfig.ts
|
|
401
|
-
var
|
|
402
|
-
var
|
|
403
|
-
|
|
388
|
+
var import_zod = require("zod");
|
|
389
|
+
var import_zod_openapi = require("zod-openapi");
|
|
390
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
|
|
391
|
+
var TranslationConfig = import_zod.z.object({
|
|
392
|
+
id: import_zod.z.string().describe(
|
|
404
393
|
"The identifier of the translation referred in translation CSV files"
|
|
405
394
|
),
|
|
406
|
-
defaultMessage: z.string().describe("Default translation message"),
|
|
407
|
-
description: z.string().describe(
|
|
395
|
+
defaultMessage: import_zod.z.string().describe("Default translation message"),
|
|
396
|
+
description: import_zod.z.string().describe(
|
|
408
397
|
"Describe the translation for a translator to be able to identify it."
|
|
409
398
|
)
|
|
410
|
-
}).
|
|
399
|
+
}).openapi({
|
|
411
400
|
description: "Translation configuration",
|
|
412
|
-
|
|
401
|
+
ref: "TranslationConfig"
|
|
413
402
|
});
|
|
414
403
|
|
|
415
404
|
// ../commons/src/events/ActionType.ts
|
|
416
|
-
var
|
|
405
|
+
var import_zod2 = require("zod");
|
|
417
406
|
var ActionType = {
|
|
418
407
|
// Pre-declaration actions
|
|
419
408
|
DELETE: "DELETE",
|
|
@@ -438,9 +427,7 @@ var ActionType = {
|
|
|
438
427
|
// General actions
|
|
439
428
|
READ: "READ",
|
|
440
429
|
ASSIGN: "ASSIGN",
|
|
441
|
-
UNASSIGN: "UNASSIGN"
|
|
442
|
-
// Custom action
|
|
443
|
-
CUSTOM: "CUSTOM"
|
|
430
|
+
UNASSIGN: "UNASSIGN"
|
|
444
431
|
};
|
|
445
432
|
var ConfirmableActions = [
|
|
446
433
|
ActionType.NOTIFY,
|
|
@@ -452,10 +439,9 @@ var ConfirmableActions = [
|
|
|
452
439
|
ActionType.PRINT_CERTIFICATE,
|
|
453
440
|
ActionType.REQUEST_CORRECTION,
|
|
454
441
|
ActionType.APPROVE_CORRECTION,
|
|
455
|
-
ActionType.REJECT_CORRECTION
|
|
456
|
-
ActionType.CUSTOM
|
|
442
|
+
ActionType.REJECT_CORRECTION
|
|
457
443
|
];
|
|
458
|
-
var ActionTypes =
|
|
444
|
+
var ActionTypes = import_zod2.z.enum([
|
|
459
445
|
"DELETE",
|
|
460
446
|
"CREATE",
|
|
461
447
|
"NOTIFY",
|
|
@@ -473,8 +459,7 @@ var ActionTypes = z2.enum([
|
|
|
473
459
|
"APPROVE_CORRECTION",
|
|
474
460
|
"READ",
|
|
475
461
|
"ASSIGN",
|
|
476
|
-
"UNASSIGN"
|
|
477
|
-
"CUSTOM"
|
|
462
|
+
"UNASSIGN"
|
|
478
463
|
]);
|
|
479
464
|
var ClientSpecificAction = {
|
|
480
465
|
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
@@ -502,14 +487,13 @@ var writeActions = ActionTypes.exclude([
|
|
|
502
487
|
ActionType.UNASSIGN
|
|
503
488
|
]);
|
|
504
489
|
var workqueueActions = ActionTypes.exclude([
|
|
505
|
-
ActionType.READ,
|
|
506
490
|
ActionType.CREATE,
|
|
507
491
|
ActionType.NOTIFY,
|
|
508
492
|
ActionType.DUPLICATE_DETECTED,
|
|
493
|
+
ActionType.REJECT,
|
|
509
494
|
ActionType.MARK_AS_NOT_DUPLICATE,
|
|
510
495
|
ActionType.REJECT_CORRECTION,
|
|
511
|
-
ActionType.APPROVE_CORRECTION
|
|
512
|
-
ActionType.CUSTOM
|
|
496
|
+
ActionType.APPROVE_CORRECTION
|
|
513
497
|
]);
|
|
514
498
|
var META_ACTIONS = [
|
|
515
499
|
ActionType.ASSIGN,
|
|
@@ -521,57 +505,59 @@ function isMetaAction(actionType) {
|
|
|
521
505
|
}
|
|
522
506
|
|
|
523
507
|
// ../commons/src/events/FieldConfig.ts
|
|
524
|
-
var
|
|
508
|
+
var import_zod15 = require("zod");
|
|
525
509
|
|
|
526
510
|
// ../commons/src/events/Conditional.ts
|
|
527
|
-
var
|
|
528
|
-
var
|
|
511
|
+
var import_zod3 = require("zod");
|
|
512
|
+
var import_zod_openapi2 = require("zod-openapi");
|
|
513
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod3.z);
|
|
514
|
+
var Conditional = import_zod3.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
|
529
515
|
description: "JSON schema conditional configuration",
|
|
530
|
-
|
|
516
|
+
ref: "Conditional"
|
|
531
517
|
});
|
|
532
518
|
var ConditionalType = {
|
|
533
519
|
SHOW: "SHOW",
|
|
534
520
|
ENABLE: "ENABLE",
|
|
535
521
|
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
536
522
|
};
|
|
537
|
-
var ShowConditional =
|
|
538
|
-
type:
|
|
523
|
+
var ShowConditional = import_zod3.z.object({
|
|
524
|
+
type: import_zod3.z.literal(ConditionalType.SHOW),
|
|
539
525
|
conditional: Conditional
|
|
540
526
|
}).describe(
|
|
541
527
|
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
542
528
|
);
|
|
543
|
-
var EnableConditional =
|
|
544
|
-
type:
|
|
529
|
+
var EnableConditional = import_zod3.z.object({
|
|
530
|
+
type: import_zod3.z.literal(ConditionalType.ENABLE),
|
|
545
531
|
conditional: Conditional
|
|
546
532
|
}).describe(
|
|
547
533
|
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
548
534
|
);
|
|
549
|
-
var ActionConditional =
|
|
535
|
+
var ActionConditional = import_zod3.z.discriminatedUnion("type", [
|
|
550
536
|
// Action can be shown / hidden
|
|
551
537
|
ShowConditional,
|
|
552
538
|
// Action can be shown to the user in the list but as disabled
|
|
553
539
|
EnableConditional
|
|
554
540
|
]);
|
|
555
|
-
var DisplayOnReviewConditional =
|
|
556
|
-
type:
|
|
541
|
+
var DisplayOnReviewConditional = import_zod3.z.object({
|
|
542
|
+
type: import_zod3.z.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
557
543
|
conditional: Conditional
|
|
558
544
|
}).describe(
|
|
559
545
|
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
560
546
|
);
|
|
561
|
-
var FieldConditional =
|
|
547
|
+
var FieldConditional = import_zod3.z.discriminatedUnion("type", [
|
|
562
548
|
// Field input can be shown / hidden
|
|
563
549
|
ShowConditional,
|
|
564
550
|
// Field input can be shown to the user but as disabled
|
|
565
551
|
EnableConditional,
|
|
566
552
|
// Field output can be shown / hidden on the review page
|
|
567
553
|
DisplayOnReviewConditional
|
|
568
|
-
]).
|
|
554
|
+
]).openapi({
|
|
569
555
|
description: "Field conditional configuration",
|
|
570
|
-
|
|
556
|
+
ref: "FieldConditional"
|
|
571
557
|
});
|
|
572
558
|
|
|
573
559
|
// ../commons/src/events/FieldType.ts
|
|
574
|
-
var
|
|
560
|
+
var import_zod4 = require("zod");
|
|
575
561
|
var FieldType = {
|
|
576
562
|
NAME: "NAME",
|
|
577
563
|
PHONE: "PHONE",
|
|
@@ -615,7 +601,7 @@ var FieldType = {
|
|
|
615
601
|
ID_READER: "ID_READER",
|
|
616
602
|
LOADER: "LOADER"
|
|
617
603
|
};
|
|
618
|
-
var FileFieldType =
|
|
604
|
+
var FileFieldType = import_zod4.z.enum([
|
|
619
605
|
FieldType.FILE,
|
|
620
606
|
FieldType.FILE_WITH_OPTIONS,
|
|
621
607
|
FieldType.SIGNATURE
|
|
@@ -642,22 +628,24 @@ var FieldTypesToHideInReview = [
|
|
|
642
628
|
];
|
|
643
629
|
|
|
644
630
|
// ../commons/src/events/FieldValue.ts
|
|
645
|
-
var
|
|
631
|
+
var import_zod7 = require("zod");
|
|
646
632
|
|
|
647
633
|
// ../commons/src/documents.ts
|
|
648
|
-
var
|
|
649
|
-
var
|
|
634
|
+
var import_zod5 = require("zod");
|
|
635
|
+
var import_zod_openapi3 = require("zod-openapi");
|
|
636
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
|
637
|
+
var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
|
|
650
638
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
|
|
651
639
|
);
|
|
652
|
-
var FullDocumentPath =
|
|
640
|
+
var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
|
653
641
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
654
642
|
);
|
|
655
|
-
var DocumentPath =
|
|
643
|
+
var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
|
|
656
644
|
"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"
|
|
657
645
|
);
|
|
658
646
|
|
|
659
647
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
660
|
-
var
|
|
648
|
+
var import_zod6 = require("zod");
|
|
661
649
|
var GeographicalArea = {
|
|
662
650
|
URBAN: "URBAN",
|
|
663
651
|
RURAL: "RURAL"
|
|
@@ -666,120 +654,120 @@ var AddressType = {
|
|
|
666
654
|
DOMESTIC: "DOMESTIC",
|
|
667
655
|
INTERNATIONAL: "INTERNATIONAL"
|
|
668
656
|
};
|
|
669
|
-
var FileFieldValue =
|
|
657
|
+
var FileFieldValue = import_zod6.z.object({
|
|
670
658
|
path: FullDocumentPath,
|
|
671
|
-
originalFilename:
|
|
672
|
-
type:
|
|
659
|
+
originalFilename: import_zod6.z.string(),
|
|
660
|
+
type: import_zod6.z.string()
|
|
673
661
|
});
|
|
674
|
-
var NameFieldValue =
|
|
675
|
-
firstname:
|
|
676
|
-
surname:
|
|
677
|
-
middlename:
|
|
662
|
+
var NameFieldValue = import_zod6.z.object({
|
|
663
|
+
firstname: import_zod6.z.string(),
|
|
664
|
+
surname: import_zod6.z.string(),
|
|
665
|
+
middlename: import_zod6.z.string().optional()
|
|
678
666
|
});
|
|
679
|
-
var NameFieldUpdateValue =
|
|
680
|
-
firstname:
|
|
681
|
-
surname:
|
|
682
|
-
middlename:
|
|
683
|
-
}).or(
|
|
684
|
-
var StreetLevelDetailsValue =
|
|
685
|
-
var StreetLevelDetailsUpdateValue =
|
|
686
|
-
var BaseAddressFieldValue =
|
|
687
|
-
country:
|
|
667
|
+
var NameFieldUpdateValue = import_zod6.z.object({
|
|
668
|
+
firstname: import_zod6.z.string().nullish(),
|
|
669
|
+
surname: import_zod6.z.string().nullish(),
|
|
670
|
+
middlename: import_zod6.z.string().nullish()
|
|
671
|
+
}).or(import_zod6.z.null()).or(import_zod6.z.undefined());
|
|
672
|
+
var StreetLevelDetailsValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional();
|
|
673
|
+
var StreetLevelDetailsUpdateValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string().nullable()).nullish();
|
|
674
|
+
var BaseAddressFieldValue = import_zod6.z.object({
|
|
675
|
+
country: import_zod6.z.string(),
|
|
688
676
|
streetLevelDetails: StreetLevelDetailsValue
|
|
689
677
|
});
|
|
690
|
-
var BaseAddressFieldUpdateValue =
|
|
691
|
-
country:
|
|
678
|
+
var BaseAddressFieldUpdateValue = import_zod6.z.object({
|
|
679
|
+
country: import_zod6.z.string().nullish(),
|
|
692
680
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
693
681
|
});
|
|
694
682
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
695
|
-
addressType:
|
|
696
|
-
administrativeArea:
|
|
683
|
+
addressType: import_zod6.z.literal(AddressType.DOMESTIC),
|
|
684
|
+
administrativeArea: import_zod6.z.string().uuid()
|
|
697
685
|
});
|
|
698
686
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
699
|
-
addressType:
|
|
687
|
+
addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
|
|
700
688
|
});
|
|
701
|
-
var AddressFieldValue =
|
|
689
|
+
var AddressFieldValue = import_zod6.z.discriminatedUnion("addressType", [
|
|
702
690
|
DomesticAddressFieldValue,
|
|
703
691
|
InternationalAddressFieldValue
|
|
704
692
|
]);
|
|
705
693
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
706
|
-
addressType:
|
|
707
|
-
administrativeArea:
|
|
694
|
+
addressType: import_zod6.z.literal(AddressType.DOMESTIC),
|
|
695
|
+
administrativeArea: import_zod6.z.string().uuid().nullish()
|
|
708
696
|
/* Leaf level admin structure */
|
|
709
697
|
});
|
|
710
698
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
711
699
|
{
|
|
712
|
-
addressType:
|
|
700
|
+
addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
|
|
713
701
|
}
|
|
714
702
|
);
|
|
715
|
-
var AddressFieldUpdateValue =
|
|
703
|
+
var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("addressType", [
|
|
716
704
|
DomesticAddressUpdateFieldValue,
|
|
717
705
|
InternationalAddressUpdateFieldValue
|
|
718
706
|
]).nullish();
|
|
719
|
-
var FileFieldValueWithOption =
|
|
707
|
+
var FileFieldValueWithOption = import_zod6.z.object({
|
|
720
708
|
path: FullDocumentPath,
|
|
721
|
-
originalFilename:
|
|
722
|
-
type:
|
|
723
|
-
option:
|
|
709
|
+
originalFilename: import_zod6.z.string(),
|
|
710
|
+
type: import_zod6.z.string(),
|
|
711
|
+
option: import_zod6.z.string()
|
|
724
712
|
});
|
|
725
|
-
var FileFieldWithOptionValue =
|
|
726
|
-
var HttpFieldValue =
|
|
727
|
-
loading:
|
|
728
|
-
error:
|
|
729
|
-
data:
|
|
713
|
+
var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
|
|
714
|
+
var HttpFieldValue = import_zod6.z.object({
|
|
715
|
+
loading: import_zod6.z.boolean(),
|
|
716
|
+
error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
|
|
717
|
+
data: import_zod6.z.any()
|
|
730
718
|
});
|
|
731
|
-
var HttpFieldUpdateValue =
|
|
732
|
-
loading:
|
|
733
|
-
error:
|
|
734
|
-
data:
|
|
735
|
-
}).or(
|
|
736
|
-
var QueryParamReaderFieldValue =
|
|
737
|
-
data:
|
|
719
|
+
var HttpFieldUpdateValue = import_zod6.z.object({
|
|
720
|
+
loading: import_zod6.z.boolean().nullish(),
|
|
721
|
+
error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
|
|
722
|
+
data: import_zod6.z.any().nullish()
|
|
723
|
+
}).or(import_zod6.z.null()).or(import_zod6.z.undefined());
|
|
724
|
+
var QueryParamReaderFieldValue = import_zod6.z.object({
|
|
725
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
|
|
738
726
|
}).nullish();
|
|
739
|
-
var QueryParamReaderFieldUpdateValue =
|
|
740
|
-
data:
|
|
727
|
+
var QueryParamReaderFieldUpdateValue = import_zod6.z.object({
|
|
728
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
|
|
741
729
|
});
|
|
742
|
-
var ReadDataValue =
|
|
743
|
-
data:
|
|
730
|
+
var ReadDataValue = import_zod6.z.object({
|
|
731
|
+
data: import_zod6.z.any()
|
|
744
732
|
});
|
|
745
733
|
var QrReaderFieldValue = ReadDataValue;
|
|
746
734
|
var IdReaderFieldValue = ReadDataValue;
|
|
747
735
|
|
|
748
736
|
// ../commons/src/events/FieldValue.ts
|
|
749
|
-
var TextValue =
|
|
737
|
+
var TextValue = import_zod7.z.string();
|
|
750
738
|
var NonEmptyTextValue = TextValue.min(1);
|
|
751
|
-
var DateValue =
|
|
752
|
-
var AgeValue =
|
|
753
|
-
age:
|
|
754
|
-
asOfDateRef:
|
|
739
|
+
var DateValue = import_zod7.z.string().date().describe("Date in the format YYYY-MM-DD");
|
|
740
|
+
var AgeValue = import_zod7.z.object({
|
|
741
|
+
age: import_zod7.z.number(),
|
|
742
|
+
asOfDateRef: import_zod7.z.string()
|
|
755
743
|
});
|
|
756
744
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
757
|
-
var TimeValue =
|
|
758
|
-
var DatetimeValue =
|
|
759
|
-
var SelectDateRangeValue =
|
|
745
|
+
var TimeValue = import_zod7.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
746
|
+
var DatetimeValue = import_zod7.z.string().datetime();
|
|
747
|
+
var SelectDateRangeValue = import_zod7.z.enum([
|
|
760
748
|
"last7Days",
|
|
761
749
|
"last30Days",
|
|
762
750
|
"last90Days",
|
|
763
751
|
"last365Days"
|
|
764
752
|
]);
|
|
765
|
-
var DateRangeFieldValue =
|
|
753
|
+
var DateRangeFieldValue = import_zod7.z.object({
|
|
766
754
|
start: DateValue,
|
|
767
755
|
end: DateValue
|
|
768
756
|
}).or(DateValue).describe(
|
|
769
757
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
770
758
|
);
|
|
771
|
-
var EmailValue =
|
|
772
|
-
var CheckboxFieldValue =
|
|
773
|
-
var NumberFieldValue =
|
|
774
|
-
var SignatureFieldValue =
|
|
775
|
-
var ButtonFieldValue =
|
|
776
|
-
var VerificationStatusValue =
|
|
759
|
+
var EmailValue = import_zod7.z.string().email();
|
|
760
|
+
var CheckboxFieldValue = import_zod7.z.boolean();
|
|
761
|
+
var NumberFieldValue = import_zod7.z.number();
|
|
762
|
+
var SignatureFieldValue = import_zod7.z.string();
|
|
763
|
+
var ButtonFieldValue = import_zod7.z.number();
|
|
764
|
+
var VerificationStatusValue = import_zod7.z.enum([
|
|
777
765
|
"verified",
|
|
778
766
|
"authenticated",
|
|
779
767
|
"failed",
|
|
780
768
|
"pending"
|
|
781
769
|
]);
|
|
782
|
-
var FieldValuesWithoutDataField =
|
|
770
|
+
var FieldValuesWithoutDataField = import_zod7.z.union([
|
|
783
771
|
AddressFieldValue,
|
|
784
772
|
TextValue,
|
|
785
773
|
DateValue,
|
|
@@ -800,10 +788,10 @@ var FieldValuesWithoutDataField = z7.union([
|
|
|
800
788
|
QrReaderFieldValue,
|
|
801
789
|
IdReaderFieldValue
|
|
802
790
|
]);
|
|
803
|
-
var DataFieldValue =
|
|
804
|
-
data:
|
|
791
|
+
var DataFieldValue = import_zod7.z.object({
|
|
792
|
+
data: import_zod7.z.record(import_zod7.z.string(), FieldValuesWithoutDataField)
|
|
805
793
|
}).nullish();
|
|
806
|
-
var FieldValue =
|
|
794
|
+
var FieldValue = import_zod7.z.union([
|
|
807
795
|
FieldValuesWithoutDataField,
|
|
808
796
|
DataFieldValue
|
|
809
797
|
]);
|
|
@@ -823,38 +811,22 @@ var PRIORITY_ORDER = [
|
|
|
823
811
|
"DataFieldValue"
|
|
824
812
|
];
|
|
825
813
|
function schemaPriority(schema) {
|
|
826
|
-
const name = schema.description;
|
|
827
|
-
if (!name) {
|
|
828
|
-
return 9999;
|
|
829
|
-
}
|
|
814
|
+
const name = schema._def?.description;
|
|
830
815
|
const idx = PRIORITY_ORDER.indexOf(name);
|
|
831
816
|
return idx === -1 ? 9999 : idx;
|
|
832
817
|
}
|
|
833
818
|
function safeUnion(schemas) {
|
|
834
|
-
return
|
|
819
|
+
return import_zod7.z.custom((val) => {
|
|
835
820
|
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
836
821
|
if (successful.length === 1) {
|
|
837
|
-
return;
|
|
822
|
+
return true;
|
|
838
823
|
}
|
|
839
824
|
if (successful.length === 0) {
|
|
840
|
-
|
|
841
|
-
code: "invalid_type",
|
|
842
|
-
expected: "custom",
|
|
843
|
-
message: "Value does not match any schema"
|
|
844
|
-
});
|
|
845
|
-
return;
|
|
825
|
+
return false;
|
|
846
826
|
}
|
|
847
827
|
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
848
828
|
const best = successful[0];
|
|
849
|
-
|
|
850
|
-
ctx.addIssue({
|
|
851
|
-
expected: "custom",
|
|
852
|
-
code: "invalid_type",
|
|
853
|
-
message: "Value did not match the best schema"
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
}).meta({
|
|
857
|
-
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
829
|
+
return best.safeParse(val).success;
|
|
858
830
|
});
|
|
859
831
|
}
|
|
860
832
|
var FieldUpdateValue = safeUnion([
|
|
@@ -875,18 +847,21 @@ var FieldUpdateValue = safeUnion([
|
|
|
875
847
|
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
|
|
876
848
|
]);
|
|
877
849
|
|
|
850
|
+
// ../commons/src/events/FieldConfig.ts
|
|
851
|
+
var import_zod_openapi6 = require("zod-openapi");
|
|
852
|
+
|
|
878
853
|
// ../commons/src/uuid.ts
|
|
879
854
|
var import_uuid = require("uuid");
|
|
880
|
-
var
|
|
881
|
-
var UUID =
|
|
855
|
+
var import_zod8 = require("zod");
|
|
856
|
+
var UUID = import_zod8.z.string().uuid().brand("UUID");
|
|
882
857
|
function getUUID() {
|
|
883
858
|
return (0, import_uuid.v4)();
|
|
884
859
|
}
|
|
885
860
|
|
|
886
861
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
887
|
-
var
|
|
888
|
-
var SerializedUserField =
|
|
889
|
-
$userField:
|
|
862
|
+
var import_zod9 = require("zod");
|
|
863
|
+
var SerializedUserField = import_zod9.z.object({
|
|
864
|
+
$userField: import_zod9.z.enum([
|
|
890
865
|
"id",
|
|
891
866
|
"name",
|
|
892
867
|
"role",
|
|
@@ -894,7 +869,7 @@ var SerializedUserField = z9.object({
|
|
|
894
869
|
"avatar",
|
|
895
870
|
"primaryOfficeId"
|
|
896
871
|
]),
|
|
897
|
-
$location:
|
|
872
|
+
$location: import_zod9.z.string().optional()
|
|
898
873
|
});
|
|
899
874
|
function userSerializer(userField) {
|
|
900
875
|
return {
|
|
@@ -914,23 +889,24 @@ function userSerializer(userField) {
|
|
|
914
889
|
}
|
|
915
890
|
|
|
916
891
|
// ../commons/src/events/EventIndex.ts
|
|
917
|
-
var
|
|
892
|
+
var import_zod14 = require("zod");
|
|
918
893
|
|
|
919
894
|
// ../commons/src/events/EventMetadata.ts
|
|
920
|
-
var
|
|
895
|
+
var import_zod13 = require("zod");
|
|
921
896
|
|
|
922
897
|
// ../commons/src/events/ActionDocument.ts
|
|
923
|
-
var
|
|
898
|
+
var import_zod12 = require("zod");
|
|
899
|
+
var import_zod_openapi4 = require("zod-openapi");
|
|
924
900
|
|
|
925
901
|
// ../commons/src/events/CreatedAtLocation.ts
|
|
926
902
|
var CreatedAtLocation = UUID.nullish();
|
|
927
903
|
|
|
928
904
|
// ../commons/src/authentication.ts
|
|
929
905
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
930
|
-
var
|
|
906
|
+
var import_zod11 = require("zod");
|
|
931
907
|
|
|
932
908
|
// ../commons/src/scopes.ts
|
|
933
|
-
var
|
|
909
|
+
var import_zod10 = require("zod");
|
|
934
910
|
var SCOPES = {
|
|
935
911
|
// TODO v1.8 legacy scopes
|
|
936
912
|
BYPASSRATELIMIT: "bypassratelimit",
|
|
@@ -1009,91 +985,91 @@ var SCOPES = {
|
|
|
1009
985
|
// data seeding
|
|
1010
986
|
USER_DATA_SEEDING: "user.data-seeding"
|
|
1011
987
|
};
|
|
1012
|
-
var LegacyScopes =
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
988
|
+
var LegacyScopes = import_zod10.z.union([
|
|
989
|
+
import_zod10.z.literal(SCOPES.BYPASSRATELIMIT),
|
|
990
|
+
import_zod10.z.literal(SCOPES.REGISTER),
|
|
991
|
+
import_zod10.z.literal(SCOPES.DEMO),
|
|
992
|
+
import_zod10.z.literal(SCOPES.CONFIG)
|
|
1017
993
|
]);
|
|
1018
|
-
var IntegrationScopes =
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
994
|
+
var IntegrationScopes = import_zod10.z.union([
|
|
995
|
+
import_zod10.z.literal(SCOPES.WEBHOOK),
|
|
996
|
+
import_zod10.z.literal(SCOPES.NATIONALID),
|
|
997
|
+
import_zod10.z.literal(SCOPES.NOTIFICATION_API),
|
|
998
|
+
import_zod10.z.literal(SCOPES.RECORDSEARCH)
|
|
1023
999
|
]);
|
|
1024
|
-
var InternalOperationsScopes =
|
|
1025
|
-
|
|
1026
|
-
|
|
1000
|
+
var InternalOperationsScopes = import_zod10.z.union([
|
|
1001
|
+
import_zod10.z.literal(SCOPES.RECORD_REINDEX),
|
|
1002
|
+
import_zod10.z.literal(SCOPES.RECORD_IMPORT)
|
|
1027
1003
|
]);
|
|
1028
|
-
var DeclareScopes =
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1004
|
+
var DeclareScopes = import_zod10.z.union([
|
|
1005
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
|
1006
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
|
1007
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
|
1008
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
|
1009
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
|
1010
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
|
1011
|
+
import_zod10.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
|
1012
|
+
import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
|
1037
1013
|
]);
|
|
1038
|
-
var UnassignScope =
|
|
1039
|
-
var ValidateScopes =
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1014
|
+
var UnassignScope = import_zod10.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
|
1015
|
+
var ValidateScopes = import_zod10.z.union([
|
|
1016
|
+
import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
|
1017
|
+
import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
|
1018
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
|
1019
|
+
import_zod10.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
|
1020
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
|
1021
|
+
import_zod10.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
|
1046
1022
|
]);
|
|
1047
|
-
var RegisterScope =
|
|
1048
|
-
var CorrectionScopes =
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1023
|
+
var RegisterScope = import_zod10.z.literal(SCOPES.RECORD_REGISTER);
|
|
1024
|
+
var CorrectionScopes = import_zod10.z.union([
|
|
1025
|
+
import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
|
1026
|
+
import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
|
1027
|
+
import_zod10.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
|
1028
|
+
import_zod10.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
|
1053
1029
|
]);
|
|
1054
|
-
var SearchScopes =
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1030
|
+
var SearchScopes = import_zod10.z.union([
|
|
1031
|
+
import_zod10.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
|
1032
|
+
import_zod10.z.literal(SCOPES.SEARCH_BIRTH),
|
|
1033
|
+
import_zod10.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
|
1034
|
+
import_zod10.z.literal(SCOPES.SEARCH_DEATH),
|
|
1035
|
+
import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
|
1036
|
+
import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE)
|
|
1061
1037
|
]);
|
|
1062
|
-
var AuditScopes =
|
|
1063
|
-
var PerformanceScopes =
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1038
|
+
var AuditScopes = import_zod10.z.literal(SCOPES.RECORD_READ);
|
|
1039
|
+
var PerformanceScopes = import_zod10.z.union([
|
|
1040
|
+
import_zod10.z.literal(SCOPES.PERFORMANCE_READ),
|
|
1041
|
+
import_zod10.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
|
1042
|
+
import_zod10.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
|
1067
1043
|
]);
|
|
1068
|
-
var OrganisationScopes =
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1044
|
+
var OrganisationScopes = import_zod10.z.union([
|
|
1045
|
+
import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
|
1046
|
+
import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
|
1047
|
+
import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
|
1072
1048
|
]);
|
|
1073
|
-
var UserScopes =
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1049
|
+
var UserScopes = import_zod10.z.union([
|
|
1050
|
+
import_zod10.z.literal(SCOPES.USER_READ),
|
|
1051
|
+
import_zod10.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
|
1052
|
+
import_zod10.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
|
1053
|
+
import_zod10.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
|
1054
|
+
import_zod10.z.literal(SCOPES.USER_CREATE),
|
|
1055
|
+
import_zod10.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
|
1056
|
+
import_zod10.z.literal(SCOPES.USER_UPDATE),
|
|
1057
|
+
import_zod10.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
|
1082
1058
|
]);
|
|
1083
|
-
var ConfigScope =
|
|
1084
|
-
var DataSeedingScope =
|
|
1085
|
-
var LiteralScopes =
|
|
1059
|
+
var ConfigScope = import_zod10.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
|
1060
|
+
var DataSeedingScope = import_zod10.z.literal(SCOPES.USER_DATA_SEEDING);
|
|
1061
|
+
var LiteralScopes = import_zod10.z.union([
|
|
1086
1062
|
LegacyScopes,
|
|
1087
1063
|
IntegrationScopes,
|
|
1088
1064
|
UnassignScope,
|
|
1089
1065
|
DeclareScopes,
|
|
1090
1066
|
ValidateScopes,
|
|
1091
1067
|
RegisterScope,
|
|
1092
|
-
|
|
1068
|
+
import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
1093
1069
|
CorrectionScopes,
|
|
1094
1070
|
SearchScopes,
|
|
1095
1071
|
AuditScopes,
|
|
1096
|
-
|
|
1072
|
+
import_zod10.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
1097
1073
|
PerformanceScopes,
|
|
1098
1074
|
OrganisationScopes,
|
|
1099
1075
|
UserScopes,
|
|
@@ -1102,33 +1078,33 @@ var LiteralScopes = z10.union([
|
|
|
1102
1078
|
InternalOperationsScopes
|
|
1103
1079
|
]);
|
|
1104
1080
|
var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
|
1105
|
-
var rawConfigurableScope =
|
|
1106
|
-
var CreateUserScope =
|
|
1107
|
-
type:
|
|
1108
|
-
options:
|
|
1109
|
-
role:
|
|
1081
|
+
var rawConfigurableScope = import_zod10.z.string().regex(rawConfigurableScopeRegex);
|
|
1082
|
+
var CreateUserScope = import_zod10.z.object({
|
|
1083
|
+
type: import_zod10.z.literal("user.create"),
|
|
1084
|
+
options: import_zod10.z.object({
|
|
1085
|
+
role: import_zod10.z.array(import_zod10.z.string())
|
|
1110
1086
|
})
|
|
1111
1087
|
});
|
|
1112
|
-
var EditUserScope =
|
|
1113
|
-
type:
|
|
1114
|
-
options:
|
|
1115
|
-
role:
|
|
1088
|
+
var EditUserScope = import_zod10.z.object({
|
|
1089
|
+
type: import_zod10.z.literal("user.edit"),
|
|
1090
|
+
options: import_zod10.z.object({
|
|
1091
|
+
role: import_zod10.z.array(import_zod10.z.string())
|
|
1116
1092
|
})
|
|
1117
1093
|
});
|
|
1118
|
-
var WorkqueueScope =
|
|
1119
|
-
type:
|
|
1120
|
-
options:
|
|
1121
|
-
id:
|
|
1094
|
+
var WorkqueueScope = import_zod10.z.object({
|
|
1095
|
+
type: import_zod10.z.literal("workqueue"),
|
|
1096
|
+
options: import_zod10.z.object({
|
|
1097
|
+
id: import_zod10.z.array(import_zod10.z.string())
|
|
1122
1098
|
})
|
|
1123
1099
|
});
|
|
1124
|
-
var SearchScope =
|
|
1125
|
-
type:
|
|
1126
|
-
options:
|
|
1127
|
-
event:
|
|
1128
|
-
access:
|
|
1100
|
+
var SearchScope = import_zod10.z.object({
|
|
1101
|
+
type: import_zod10.z.literal("search"),
|
|
1102
|
+
options: import_zod10.z.object({
|
|
1103
|
+
event: import_zod10.z.array(import_zod10.z.string()).length(1),
|
|
1104
|
+
access: import_zod10.z.array(import_zod10.z.enum(["my-jurisdiction", "all"])).length(1)
|
|
1129
1105
|
})
|
|
1130
1106
|
});
|
|
1131
|
-
var RecordScopeType =
|
|
1107
|
+
var RecordScopeType = import_zod10.z.enum([
|
|
1132
1108
|
"record.create",
|
|
1133
1109
|
"record.read",
|
|
1134
1110
|
"record.declare",
|
|
@@ -1143,28 +1119,20 @@ var RecordScopeType = z10.enum([
|
|
|
1143
1119
|
"record.registered.correct",
|
|
1144
1120
|
"record.unassign-others"
|
|
1145
1121
|
]);
|
|
1146
|
-
var RecordScope =
|
|
1122
|
+
var RecordScope = import_zod10.z.object({
|
|
1147
1123
|
type: RecordScopeType,
|
|
1148
|
-
options:
|
|
1149
|
-
event:
|
|
1124
|
+
options: import_zod10.z.object({
|
|
1125
|
+
event: import_zod10.z.array(import_zod10.z.string()).describe("Event type, e.g. birth, death")
|
|
1150
1126
|
})
|
|
1151
1127
|
}).describe(
|
|
1152
1128
|
"Scopes used to check user's permission to perform actions on a record."
|
|
1153
1129
|
);
|
|
1154
|
-
var
|
|
1155
|
-
type: z10.literal("record.custom-action"),
|
|
1156
|
-
options: z10.object({
|
|
1157
|
-
event: z10.array(z10.string()).describe("Allowed event type, e.g. birth, death"),
|
|
1158
|
-
customActionType: z10.array(z10.string()).describe("Allowed custom action types")
|
|
1159
|
-
})
|
|
1160
|
-
});
|
|
1161
|
-
var ConfigurableRawScopes = z10.discriminatedUnion("type", [
|
|
1130
|
+
var ConfigurableRawScopes = import_zod10.z.discriminatedUnion("type", [
|
|
1162
1131
|
SearchScope,
|
|
1163
1132
|
CreateUserScope,
|
|
1164
1133
|
EditUserScope,
|
|
1165
1134
|
WorkqueueScope,
|
|
1166
|
-
RecordScope
|
|
1167
|
-
CustomActionScope
|
|
1135
|
+
RecordScope
|
|
1168
1136
|
]);
|
|
1169
1137
|
function flattenAndMergeScopes(scopes2) {
|
|
1170
1138
|
if (scopes2.length === 0) return null;
|
|
@@ -1221,11 +1189,11 @@ function getAuthorizedEventsFromScopes(scopes2) {
|
|
|
1221
1189
|
}).filter((event2) => event2 !== void 0).filter((event2, index, self) => self.indexOf(event2) === index);
|
|
1222
1190
|
}
|
|
1223
1191
|
var scopes = Object.values(SCOPES);
|
|
1224
|
-
var ActionScopes =
|
|
1192
|
+
var ActionScopes = import_zod10.z.union([
|
|
1225
1193
|
DeclareScopes,
|
|
1226
1194
|
ValidateScopes,
|
|
1227
1195
|
RegisterScope,
|
|
1228
|
-
|
|
1196
|
+
import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
1229
1197
|
CorrectionScopes
|
|
1230
1198
|
]);
|
|
1231
1199
|
|
|
@@ -1359,14 +1327,15 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
|
1359
1327
|
]
|
|
1360
1328
|
}
|
|
1361
1329
|
];
|
|
1362
|
-
var TokenUserType =
|
|
1363
|
-
var TokenWithBearer =
|
|
1330
|
+
var TokenUserType = import_zod11.z.enum(["user", "system"]);
|
|
1331
|
+
var TokenWithBearer = import_zod11.z.string().regex(/^Bearer\s/);
|
|
1364
1332
|
|
|
1365
1333
|
// ../commons/src/events/ActionDocument.ts
|
|
1366
|
-
|
|
1334
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod12.z);
|
|
1335
|
+
var ActionUpdate = import_zod12.z.record(import_zod12.z.string(), FieldUpdateValue).describe(
|
|
1367
1336
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1368
1337
|
);
|
|
1369
|
-
var EventState =
|
|
1338
|
+
var EventState = import_zod12.z.record(import_zod12.z.string(), FieldValue).describe(
|
|
1370
1339
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1371
1340
|
);
|
|
1372
1341
|
var ActionStatus = {
|
|
@@ -1374,16 +1343,16 @@ var ActionStatus = {
|
|
|
1374
1343
|
Accepted: "Accepted",
|
|
1375
1344
|
Rejected: "Rejected"
|
|
1376
1345
|
};
|
|
1377
|
-
var ActionBase =
|
|
1346
|
+
var ActionBase = import_zod12.z.object({
|
|
1378
1347
|
id: UUID.describe("Unique identifier of the action."),
|
|
1379
|
-
transactionId:
|
|
1348
|
+
transactionId: import_zod12.z.string().describe("Unique identifier of the transaction."),
|
|
1380
1349
|
createdByUserType: TokenUserType.describe(
|
|
1381
1350
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1382
1351
|
),
|
|
1383
|
-
createdAt:
|
|
1384
|
-
createdBy:
|
|
1385
|
-
createdByRole:
|
|
1386
|
-
createdBySignature:
|
|
1352
|
+
createdAt: import_zod12.z.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1353
|
+
createdBy: import_zod12.z.string().describe("Identifier of the user who created the action."),
|
|
1354
|
+
createdByRole: import_zod12.z.string().describe("Role of the user who created the action."),
|
|
1355
|
+
createdBySignature: import_zod12.z.string().nullish().describe("Reference to the signature of the user who created the action."),
|
|
1387
1356
|
createdAtLocation: CreatedAtLocation.describe(
|
|
1388
1357
|
"Reference to the location of the user who created the action."
|
|
1389
1358
|
),
|
|
@@ -1391,7 +1360,7 @@ var ActionBase = z12.object({
|
|
|
1391
1360
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1392
1361
|
),
|
|
1393
1362
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1394
|
-
status:
|
|
1363
|
+
status: import_zod12.z.enum([
|
|
1395
1364
|
ActionStatus.Requested,
|
|
1396
1365
|
ActionStatus.Accepted,
|
|
1397
1366
|
ActionStatus.Rejected
|
|
@@ -1402,164 +1371,164 @@ var ActionBase = z12.object({
|
|
|
1402
1371
|
"Reference to the original action asynchronously accepted or rejected by a third-party integration."
|
|
1403
1372
|
)
|
|
1404
1373
|
});
|
|
1405
|
-
var AssignedAction = ActionBase.
|
|
1406
|
-
|
|
1407
|
-
type:
|
|
1408
|
-
assignedTo:
|
|
1374
|
+
var AssignedAction = ActionBase.merge(
|
|
1375
|
+
import_zod12.z.object({
|
|
1376
|
+
type: import_zod12.z.literal(ActionType.ASSIGN),
|
|
1377
|
+
assignedTo: import_zod12.z.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1409
1378
|
// TODO move into 'content' property
|
|
1410
|
-
})
|
|
1379
|
+
})
|
|
1411
1380
|
);
|
|
1412
|
-
var UnassignedAction = ActionBase.
|
|
1413
|
-
|
|
1414
|
-
type:
|
|
1415
|
-
})
|
|
1381
|
+
var UnassignedAction = ActionBase.merge(
|
|
1382
|
+
import_zod12.z.object({
|
|
1383
|
+
type: import_zod12.z.literal(ActionType.UNASSIGN)
|
|
1384
|
+
})
|
|
1416
1385
|
);
|
|
1417
|
-
var RegisterAction = ActionBase.
|
|
1418
|
-
|
|
1419
|
-
type:
|
|
1420
|
-
registrationNumber:
|
|
1386
|
+
var RegisterAction = ActionBase.merge(
|
|
1387
|
+
import_zod12.z.object({
|
|
1388
|
+
type: import_zod12.z.literal(ActionType.REGISTER),
|
|
1389
|
+
registrationNumber: import_zod12.z.string().optional().describe(
|
|
1421
1390
|
"Registration number of the event. Always present for accepted registrations."
|
|
1422
1391
|
)
|
|
1423
1392
|
// TODO move into 'content' property
|
|
1424
|
-
})
|
|
1393
|
+
})
|
|
1425
1394
|
);
|
|
1426
|
-
var DeclareAction = ActionBase.
|
|
1427
|
-
|
|
1428
|
-
type:
|
|
1429
|
-
})
|
|
1395
|
+
var DeclareAction = ActionBase.merge(
|
|
1396
|
+
import_zod12.z.object({
|
|
1397
|
+
type: import_zod12.z.literal(ActionType.DECLARE)
|
|
1398
|
+
})
|
|
1430
1399
|
);
|
|
1431
|
-
var ValidateAction = ActionBase.
|
|
1432
|
-
|
|
1433
|
-
type:
|
|
1434
|
-
})
|
|
1400
|
+
var ValidateAction = ActionBase.merge(
|
|
1401
|
+
import_zod12.z.object({
|
|
1402
|
+
type: import_zod12.z.literal(ActionType.VALIDATE)
|
|
1403
|
+
})
|
|
1435
1404
|
);
|
|
1436
|
-
var ReasonContent =
|
|
1437
|
-
reason:
|
|
1405
|
+
var ReasonContent = import_zod12.z.object({
|
|
1406
|
+
reason: import_zod12.z.string().min(1, { message: "Message cannot be empty" }).describe(
|
|
1438
1407
|
"Message describing the reason for rejecting or archiving the event."
|
|
1439
1408
|
)
|
|
1440
1409
|
});
|
|
1441
|
-
var RejectAction = ActionBase.
|
|
1442
|
-
|
|
1443
|
-
type:
|
|
1410
|
+
var RejectAction = ActionBase.merge(
|
|
1411
|
+
import_zod12.z.object({
|
|
1412
|
+
type: import_zod12.z.literal(ActionType.REJECT),
|
|
1444
1413
|
content: ReasonContent
|
|
1445
|
-
})
|
|
1414
|
+
})
|
|
1446
1415
|
);
|
|
1447
|
-
var PotentialDuplicate =
|
|
1416
|
+
var PotentialDuplicate = import_zod12.z.object({
|
|
1448
1417
|
id: UUID,
|
|
1449
|
-
trackingId:
|
|
1418
|
+
trackingId: import_zod12.z.string()
|
|
1450
1419
|
});
|
|
1451
|
-
var DuplicateDetectedAction = ActionBase.
|
|
1452
|
-
|
|
1453
|
-
type:
|
|
1454
|
-
content:
|
|
1455
|
-
duplicates:
|
|
1420
|
+
var DuplicateDetectedAction = ActionBase.merge(
|
|
1421
|
+
import_zod12.z.object({
|
|
1422
|
+
type: import_zod12.z.literal(ActionType.DUPLICATE_DETECTED),
|
|
1423
|
+
content: import_zod12.z.object({
|
|
1424
|
+
duplicates: import_zod12.z.array(PotentialDuplicate)
|
|
1456
1425
|
})
|
|
1457
|
-
})
|
|
1426
|
+
})
|
|
1458
1427
|
);
|
|
1459
|
-
var MarkNotDuplicateAction = ActionBase.
|
|
1460
|
-
|
|
1461
|
-
type:
|
|
1462
|
-
})
|
|
1428
|
+
var MarkNotDuplicateAction = ActionBase.merge(
|
|
1429
|
+
import_zod12.z.object({
|
|
1430
|
+
type: import_zod12.z.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1431
|
+
})
|
|
1463
1432
|
);
|
|
1464
|
-
var MarkAsDuplicateAction = ActionBase.
|
|
1465
|
-
|
|
1466
|
-
type:
|
|
1467
|
-
content:
|
|
1433
|
+
var MarkAsDuplicateAction = ActionBase.merge(
|
|
1434
|
+
import_zod12.z.object({
|
|
1435
|
+
type: import_zod12.z.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1436
|
+
content: import_zod12.z.object({
|
|
1468
1437
|
duplicateOf: UUID
|
|
1469
1438
|
}).optional()
|
|
1470
|
-
})
|
|
1439
|
+
})
|
|
1471
1440
|
);
|
|
1472
|
-
var ArchiveAction = ActionBase.
|
|
1473
|
-
|
|
1474
|
-
type:
|
|
1441
|
+
var ArchiveAction = ActionBase.merge(
|
|
1442
|
+
import_zod12.z.object({
|
|
1443
|
+
type: import_zod12.z.literal(ActionType.ARCHIVE),
|
|
1475
1444
|
content: ReasonContent
|
|
1476
|
-
})
|
|
1445
|
+
})
|
|
1477
1446
|
);
|
|
1478
|
-
var CreatedAction = ActionBase.
|
|
1479
|
-
|
|
1480
|
-
type:
|
|
1481
|
-
})
|
|
1447
|
+
var CreatedAction = ActionBase.merge(
|
|
1448
|
+
import_zod12.z.object({
|
|
1449
|
+
type: import_zod12.z.literal(ActionType.CREATE)
|
|
1450
|
+
})
|
|
1482
1451
|
);
|
|
1483
|
-
var NotifiedAction = ActionBase.
|
|
1484
|
-
|
|
1485
|
-
type:
|
|
1486
|
-
})
|
|
1452
|
+
var NotifiedAction = ActionBase.merge(
|
|
1453
|
+
import_zod12.z.object({
|
|
1454
|
+
type: import_zod12.z.literal(ActionType.NOTIFY)
|
|
1455
|
+
})
|
|
1487
1456
|
);
|
|
1488
|
-
var PrintContent =
|
|
1489
|
-
templateId:
|
|
1457
|
+
var PrintContent = import_zod12.z.object({
|
|
1458
|
+
templateId: import_zod12.z.string().optional()
|
|
1490
1459
|
});
|
|
1491
|
-
var PrintCertificateAction = ActionBase.
|
|
1492
|
-
|
|
1493
|
-
type:
|
|
1460
|
+
var PrintCertificateAction = ActionBase.merge(
|
|
1461
|
+
import_zod12.z.object({
|
|
1462
|
+
type: import_zod12.z.literal(ActionType.PRINT_CERTIFICATE),
|
|
1494
1463
|
content: PrintContent.optional().nullable()
|
|
1495
|
-
})
|
|
1464
|
+
})
|
|
1496
1465
|
);
|
|
1497
|
-
var RequestedCorrectionAction = ActionBase.
|
|
1498
|
-
|
|
1499
|
-
type:
|
|
1500
|
-
})
|
|
1466
|
+
var RequestedCorrectionAction = ActionBase.merge(
|
|
1467
|
+
import_zod12.z.object({
|
|
1468
|
+
type: import_zod12.z.literal(ActionType.REQUEST_CORRECTION)
|
|
1469
|
+
})
|
|
1501
1470
|
);
|
|
1502
|
-
var ApprovedCorrectionAction = ActionBase.
|
|
1503
|
-
|
|
1504
|
-
type:
|
|
1505
|
-
requestId:
|
|
1471
|
+
var ApprovedCorrectionAction = ActionBase.merge(
|
|
1472
|
+
import_zod12.z.object({
|
|
1473
|
+
type: import_zod12.z.literal(ActionType.APPROVE_CORRECTION),
|
|
1474
|
+
requestId: import_zod12.z.string()
|
|
1506
1475
|
// TODO move into 'content' property
|
|
1507
|
-
})
|
|
1476
|
+
})
|
|
1508
1477
|
);
|
|
1509
|
-
var RejectedCorrectionAction = ActionBase.
|
|
1510
|
-
|
|
1511
|
-
type:
|
|
1512
|
-
requestId:
|
|
1478
|
+
var RejectedCorrectionAction = ActionBase.merge(
|
|
1479
|
+
import_zod12.z.object({
|
|
1480
|
+
type: import_zod12.z.literal(ActionType.REJECT_CORRECTION),
|
|
1481
|
+
requestId: import_zod12.z.string(),
|
|
1513
1482
|
// TODO move into 'content' property
|
|
1514
1483
|
content: ReasonContent
|
|
1515
|
-
})
|
|
1516
|
-
);
|
|
1517
|
-
var ReadAction = ActionBase.extend(
|
|
1518
|
-
z12.object({
|
|
1519
|
-
type: z12.literal(ActionType.READ)
|
|
1520
|
-
}).shape
|
|
1484
|
+
})
|
|
1521
1485
|
);
|
|
1522
|
-
var
|
|
1523
|
-
|
|
1524
|
-
type:
|
|
1525
|
-
customActionType: z12.string()
|
|
1486
|
+
var ReadAction = ActionBase.merge(
|
|
1487
|
+
import_zod12.z.object({
|
|
1488
|
+
type: import_zod12.z.literal(ActionType.READ)
|
|
1526
1489
|
})
|
|
1527
1490
|
);
|
|
1528
|
-
var ActionDocument =
|
|
1529
|
-
CreatedAction.
|
|
1530
|
-
ValidateAction.
|
|
1531
|
-
RejectAction.
|
|
1532
|
-
DuplicateDetectedAction.
|
|
1533
|
-
MarkNotDuplicateAction.
|
|
1534
|
-
MarkAsDuplicateAction.
|
|
1535
|
-
ArchiveAction.
|
|
1536
|
-
NotifiedAction.
|
|
1537
|
-
RegisterAction.
|
|
1538
|
-
DeclareAction.
|
|
1539
|
-
AssignedAction.
|
|
1540
|
-
RequestedCorrectionAction.
|
|
1541
|
-
ApprovedCorrectionAction.
|
|
1542
|
-
RejectedCorrectionAction.
|
|
1543
|
-
UnassignedAction.
|
|
1544
|
-
PrintCertificateAction.
|
|
1545
|
-
ReadAction.
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
id: "ActionDocument"
|
|
1491
|
+
var ActionDocument = import_zod12.z.discriminatedUnion("type", [
|
|
1492
|
+
CreatedAction.openapi({ ref: "CreatedAction" }),
|
|
1493
|
+
ValidateAction.openapi({ ref: "ValidateAction" }),
|
|
1494
|
+
RejectAction.openapi({ ref: "RejectAction" }),
|
|
1495
|
+
DuplicateDetectedAction.openapi({ ref: "DuplicateDetectedAction" }),
|
|
1496
|
+
MarkNotDuplicateAction.openapi({ ref: "MarkNotDuplicateAction" }),
|
|
1497
|
+
MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
|
|
1498
|
+
ArchiveAction.openapi({ ref: "ArchiveAction" }),
|
|
1499
|
+
NotifiedAction.openapi({ ref: "NotifiedAction" }),
|
|
1500
|
+
RegisterAction.openapi({ ref: "RegisterAction" }),
|
|
1501
|
+
DeclareAction.openapi({ ref: "DeclareAction" }),
|
|
1502
|
+
AssignedAction.openapi({ ref: "AssignedAction" }),
|
|
1503
|
+
RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
|
|
1504
|
+
ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
|
|
1505
|
+
RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
|
|
1506
|
+
UnassignedAction.openapi({ ref: "UnassignedAction" }),
|
|
1507
|
+
PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
|
|
1508
|
+
ReadAction.openapi({ ref: "ReadAction" })
|
|
1509
|
+
]).openapi({
|
|
1510
|
+
ref: "ActionDocument"
|
|
1549
1511
|
});
|
|
1550
1512
|
var AsyncRejectActionDocument = ActionBase.omit({
|
|
1551
1513
|
declaration: true,
|
|
1552
1514
|
annotation: true
|
|
1553
|
-
}).
|
|
1554
|
-
|
|
1555
|
-
type:
|
|
1556
|
-
status:
|
|
1557
|
-
})
|
|
1515
|
+
}).merge(
|
|
1516
|
+
import_zod12.z.object({
|
|
1517
|
+
type: import_zod12.z.enum(ConfirmableActions),
|
|
1518
|
+
status: import_zod12.z.literal(ActionStatus.Rejected)
|
|
1519
|
+
})
|
|
1558
1520
|
);
|
|
1559
|
-
var Action =
|
|
1521
|
+
var Action = import_zod12.z.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1560
1522
|
|
|
1561
|
-
// ../commons/src/events/
|
|
1562
|
-
var
|
|
1523
|
+
// ../commons/src/events/EventMetadata.ts
|
|
1524
|
+
var EventStatus = import_zod13.z.enum([
|
|
1525
|
+
"CREATED",
|
|
1526
|
+
"NOTIFIED",
|
|
1527
|
+
"DECLARED",
|
|
1528
|
+
"VALIDATED",
|
|
1529
|
+
"REGISTERED",
|
|
1530
|
+
"ARCHIVED"
|
|
1531
|
+
]);
|
|
1563
1532
|
var InherentFlags = {
|
|
1564
1533
|
PENDING_CERTIFICATION: "pending-certification",
|
|
1565
1534
|
INCOMPLETE: "incomplete",
|
|
@@ -1567,7 +1536,7 @@ var InherentFlags = {
|
|
|
1567
1536
|
CORRECTION_REQUESTED: "correction-requested",
|
|
1568
1537
|
POTENTIAL_DUPLICATE: "potential-duplicate"
|
|
1569
1538
|
};
|
|
1570
|
-
var ActionFlag =
|
|
1539
|
+
var ActionFlag = import_zod13.z.string().regex(
|
|
1571
1540
|
new RegExp(
|
|
1572
1541
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1573
1542
|
ActionStatus
|
|
@@ -1575,89 +1544,59 @@ var ActionFlag = z13.string().regex(
|
|
|
1575
1544
|
),
|
|
1576
1545
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1577
1546
|
);
|
|
1578
|
-
var
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
).
|
|
1582
|
-
|
|
1583
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1584
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1585
|
-
var Flag = ActionFlag.or(z13.enum(InherentFlags)).or(CustomFlag);
|
|
1586
|
-
var FlagConfig = z13.object({
|
|
1587
|
-
id: CustomFlag,
|
|
1588
|
-
requiresAction: z13.boolean().describe(
|
|
1589
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1590
|
-
),
|
|
1591
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1592
|
-
});
|
|
1593
|
-
var ActionFlagConfig = z13.object({
|
|
1594
|
-
id: CustomFlag,
|
|
1595
|
-
operation: z13.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1596
|
-
conditional: Conditional.optional().describe(
|
|
1597
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1598
|
-
)
|
|
1599
|
-
});
|
|
1600
|
-
|
|
1601
|
-
// ../commons/src/events/EventMetadata.ts
|
|
1602
|
-
var EventStatus = z14.enum([
|
|
1603
|
-
"CREATED",
|
|
1604
|
-
"NOTIFIED",
|
|
1605
|
-
"DECLARED",
|
|
1606
|
-
"REGISTERED",
|
|
1607
|
-
"ARCHIVED"
|
|
1608
|
-
]);
|
|
1609
|
-
var ZodDate = z14.iso.date();
|
|
1610
|
-
var ActionCreationMetadata = z14.object({
|
|
1611
|
-
createdAt: z14.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1612
|
-
createdBy: z14.string().describe("ID of the user who created the action request."),
|
|
1547
|
+
var Flag = ActionFlag.or(import_zod13.z.nativeEnum(InherentFlags));
|
|
1548
|
+
var ZodDate = import_zod13.z.string().date();
|
|
1549
|
+
var ActionCreationMetadata = import_zod13.z.object({
|
|
1550
|
+
createdAt: import_zod13.z.string().datetime().describe("The timestamp when the action request was created."),
|
|
1551
|
+
createdBy: import_zod13.z.string().describe("ID of the user who created the action request."),
|
|
1613
1552
|
createdAtLocation: CreatedAtLocation.describe(
|
|
1614
1553
|
"Location of the user who created the action request."
|
|
1615
1554
|
),
|
|
1616
|
-
createdByUserType:
|
|
1617
|
-
acceptedAt:
|
|
1618
|
-
createdByRole:
|
|
1619
|
-
createdBySignature:
|
|
1555
|
+
createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1556
|
+
acceptedAt: import_zod13.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
|
1557
|
+
createdByRole: import_zod13.z.string().describe("Role of the user at the time of action request creation."),
|
|
1558
|
+
createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the action request.")
|
|
1620
1559
|
});
|
|
1621
1560
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1622
|
-
registrationNumber:
|
|
1561
|
+
registrationNumber: import_zod13.z.string().describe(
|
|
1623
1562
|
"Registration number of the event. Always present for accepted registrations."
|
|
1624
1563
|
)
|
|
1625
1564
|
});
|
|
1626
|
-
var LegalStatuses =
|
|
1565
|
+
var LegalStatuses = import_zod13.z.object({
|
|
1627
1566
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1628
1567
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1629
1568
|
});
|
|
1630
|
-
var EventMetadata =
|
|
1569
|
+
var EventMetadata = import_zod13.z.object({
|
|
1631
1570
|
id: UUID,
|
|
1632
|
-
type:
|
|
1571
|
+
type: import_zod13.z.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1633
1572
|
status: EventStatus,
|
|
1634
1573
|
legalStatuses: LegalStatuses.describe(
|
|
1635
1574
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1636
1575
|
),
|
|
1637
|
-
createdAt:
|
|
1576
|
+
createdAt: import_zod13.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
|
1638
1577
|
dateOfEvent: ZodDate.nullish(),
|
|
1639
|
-
createdBy:
|
|
1640
|
-
createdByUserType:
|
|
1641
|
-
updatedByUserRole:
|
|
1578
|
+
createdBy: import_zod13.z.string().describe("ID of the user who created the event."),
|
|
1579
|
+
createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1580
|
+
updatedByUserRole: import_zod13.z.string().describe("Role of the user who last changed the status."),
|
|
1642
1581
|
createdAtLocation: CreatedAtLocation.describe(
|
|
1643
1582
|
"Location of the user who created the event."
|
|
1644
1583
|
),
|
|
1645
|
-
createdBySignature:
|
|
1584
|
+
createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the event."),
|
|
1646
1585
|
updatedAtLocation: UUID.nullish().describe(
|
|
1647
1586
|
"Location of the user who last changed the status."
|
|
1648
1587
|
),
|
|
1649
|
-
updatedAt:
|
|
1588
|
+
updatedAt: import_zod13.z.string().datetime().describe(
|
|
1650
1589
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1651
1590
|
),
|
|
1652
|
-
assignedTo:
|
|
1653
|
-
updatedBy:
|
|
1654
|
-
trackingId:
|
|
1591
|
+
assignedTo: import_zod13.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1592
|
+
updatedBy: import_zod13.z.string().nullish().describe("ID of the user who last changed the status."),
|
|
1593
|
+
trackingId: import_zod13.z.string().describe(
|
|
1655
1594
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1656
1595
|
),
|
|
1657
|
-
potentialDuplicates:
|
|
1596
|
+
potentialDuplicates: import_zod13.z.array(PotentialDuplicate).describe(
|
|
1658
1597
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1659
1598
|
),
|
|
1660
|
-
flags:
|
|
1599
|
+
flags: import_zod13.z.array(Flag)
|
|
1661
1600
|
});
|
|
1662
1601
|
var EventMetadataKeysArray = [
|
|
1663
1602
|
"id",
|
|
@@ -1677,7 +1616,7 @@ var EventMetadataKeysArray = [
|
|
|
1677
1616
|
"legalStatuses",
|
|
1678
1617
|
"flags"
|
|
1679
1618
|
];
|
|
1680
|
-
var EventMetadataKeys =
|
|
1619
|
+
var EventMetadataKeys = import_zod13.z.enum(EventMetadataKeysArray);
|
|
1681
1620
|
var eventMetadataLabelMap = {
|
|
1682
1621
|
"event.assignedTo": {
|
|
1683
1622
|
id: "event.assignedTo.label",
|
|
@@ -1757,125 +1696,127 @@ var eventMetadataLabelMap = {
|
|
|
1757
1696
|
};
|
|
1758
1697
|
|
|
1759
1698
|
// ../commons/src/events/EventIndex.ts
|
|
1699
|
+
var import_zod_openapi5 = require("zod-openapi");
|
|
1700
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod14.z);
|
|
1760
1701
|
var EventIndex = EventMetadata.extend({
|
|
1761
1702
|
declaration: EventState
|
|
1762
|
-
}).
|
|
1763
|
-
|
|
1703
|
+
}).openapi({
|
|
1704
|
+
ref: "EventIndex"
|
|
1764
1705
|
});
|
|
1765
|
-
var EventSearchIndex =
|
|
1766
|
-
|
|
1767
|
-
type:
|
|
1706
|
+
var EventSearchIndex = import_zod14.z.record(import_zod14.z.string(), import_zod14.z.any()).and(
|
|
1707
|
+
import_zod14.z.object({
|
|
1708
|
+
type: import_zod14.z.string()
|
|
1768
1709
|
// Ensures "type" (event-id) exists and is a string
|
|
1769
1710
|
})
|
|
1770
|
-
).
|
|
1771
|
-
|
|
1711
|
+
).openapi({
|
|
1712
|
+
ref: "EventSearchIndex"
|
|
1772
1713
|
});
|
|
1773
|
-
var Fuzzy =
|
|
1774
|
-
|
|
1714
|
+
var Fuzzy = import_zod14.z.object({ type: import_zod14.z.literal("fuzzy"), term: import_zod14.z.string() }).openapi({
|
|
1715
|
+
ref: "Fuzzy"
|
|
1775
1716
|
});
|
|
1776
|
-
var Exact =
|
|
1777
|
-
|
|
1717
|
+
var Exact = import_zod14.z.object({ type: import_zod14.z.literal("exact"), term: import_zod14.z.string() }).openapi({
|
|
1718
|
+
ref: "Exact"
|
|
1778
1719
|
});
|
|
1779
|
-
var ExactStatus =
|
|
1780
|
-
type:
|
|
1720
|
+
var ExactStatus = import_zod14.z.object({
|
|
1721
|
+
type: import_zod14.z.literal("exact"),
|
|
1781
1722
|
term: EventStatus
|
|
1782
|
-
}).
|
|
1783
|
-
|
|
1723
|
+
}).openapi({
|
|
1724
|
+
ref: "ExactStatus"
|
|
1784
1725
|
});
|
|
1785
|
-
var ExactUserType =
|
|
1786
|
-
type:
|
|
1726
|
+
var ExactUserType = import_zod14.z.object({
|
|
1727
|
+
type: import_zod14.z.literal("exact"),
|
|
1787
1728
|
term: TokenUserType
|
|
1788
|
-
}).
|
|
1789
|
-
|
|
1729
|
+
}).openapi({
|
|
1730
|
+
ref: "ExactUserType"
|
|
1790
1731
|
});
|
|
1791
|
-
var AnyOf =
|
|
1792
|
-
type:
|
|
1793
|
-
terms:
|
|
1794
|
-
}).
|
|
1795
|
-
|
|
1732
|
+
var AnyOf = import_zod14.z.object({
|
|
1733
|
+
type: import_zod14.z.literal("anyOf"),
|
|
1734
|
+
terms: import_zod14.z.array(import_zod14.z.string())
|
|
1735
|
+
}).openapi({
|
|
1736
|
+
ref: "AnyOf"
|
|
1796
1737
|
});
|
|
1797
|
-
var AnyOfStatus =
|
|
1798
|
-
type:
|
|
1799
|
-
terms:
|
|
1800
|
-
}).
|
|
1801
|
-
|
|
1738
|
+
var AnyOfStatus = import_zod14.z.object({
|
|
1739
|
+
type: import_zod14.z.literal("anyOf"),
|
|
1740
|
+
terms: import_zod14.z.array(EventStatus)
|
|
1741
|
+
}).openapi({
|
|
1742
|
+
ref: "AnyOfStatus"
|
|
1802
1743
|
});
|
|
1803
|
-
var Range =
|
|
1804
|
-
type:
|
|
1805
|
-
gte:
|
|
1806
|
-
lte:
|
|
1807
|
-
}).
|
|
1808
|
-
|
|
1744
|
+
var Range = import_zod14.z.object({
|
|
1745
|
+
type: import_zod14.z.literal("range"),
|
|
1746
|
+
gte: import_zod14.z.string(),
|
|
1747
|
+
lte: import_zod14.z.string()
|
|
1748
|
+
}).openapi({
|
|
1749
|
+
ref: "Range"
|
|
1809
1750
|
});
|
|
1810
|
-
var ContainsFlags =
|
|
1811
|
-
anyOf:
|
|
1812
|
-
noneOf:
|
|
1813
|
-
}).
|
|
1814
|
-
|
|
1751
|
+
var ContainsFlags = import_zod14.z.object({
|
|
1752
|
+
anyOf: import_zod14.z.array(Flag).optional(),
|
|
1753
|
+
noneOf: import_zod14.z.array(Flag).optional()
|
|
1754
|
+
}).openapi({
|
|
1755
|
+
ref: "ContainsFlags"
|
|
1815
1756
|
});
|
|
1816
|
-
var Within =
|
|
1817
|
-
|
|
1757
|
+
var Within = import_zod14.z.object({ type: import_zod14.z.literal("within"), location: import_zod14.z.string() }).openapi({
|
|
1758
|
+
ref: "Within"
|
|
1818
1759
|
});
|
|
1819
|
-
var RangeDate =
|
|
1820
|
-
type:
|
|
1821
|
-
gte:
|
|
1822
|
-
lte:
|
|
1823
|
-
}).
|
|
1760
|
+
var RangeDate = import_zod14.z.object({
|
|
1761
|
+
type: import_zod14.z.literal("range"),
|
|
1762
|
+
gte: import_zod14.z.string().date().or(import_zod14.z.string().datetime()),
|
|
1763
|
+
lte: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
|
|
1764
|
+
}).openapi({ ref: "RangeDate" });
|
|
1824
1765
|
var ExactDate = Exact.extend({
|
|
1825
|
-
term:
|
|
1826
|
-
}).
|
|
1827
|
-
|
|
1766
|
+
term: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
|
|
1767
|
+
}).openapi({
|
|
1768
|
+
ref: "ExactDate"
|
|
1828
1769
|
});
|
|
1829
|
-
var TimePeriod =
|
|
1830
|
-
type:
|
|
1770
|
+
var TimePeriod = import_zod14.z.object({
|
|
1771
|
+
type: import_zod14.z.literal("timePeriod"),
|
|
1831
1772
|
term: SelectDateRangeValue
|
|
1832
|
-
}).
|
|
1833
|
-
|
|
1773
|
+
}).openapi({
|
|
1774
|
+
ref: "TimePeriod"
|
|
1834
1775
|
});
|
|
1835
|
-
var DateCondition =
|
|
1836
|
-
|
|
1776
|
+
var DateCondition = import_zod14.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
|
1777
|
+
ref: "DateCondition"
|
|
1837
1778
|
});
|
|
1838
|
-
var QueryInput =
|
|
1839
|
-
() =>
|
|
1840
|
-
|
|
1841
|
-
|
|
1779
|
+
var QueryInput = import_zod14.z.lazy(
|
|
1780
|
+
() => import_zod14.z.union([
|
|
1781
|
+
import_zod14.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
|
1782
|
+
import_zod14.z.record(import_zod14.z.string(), QueryInput)
|
|
1842
1783
|
])
|
|
1843
|
-
).
|
|
1844
|
-
|
|
1784
|
+
).openapi({
|
|
1785
|
+
ref: "QueryInput"
|
|
1845
1786
|
});
|
|
1846
|
-
var QueryExpression =
|
|
1847
|
-
id:
|
|
1848
|
-
eventType:
|
|
1849
|
-
status:
|
|
1850
|
-
createdAt:
|
|
1851
|
-
updatedAt:
|
|
1852
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
|
1853
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
1854
|
-
|
|
1787
|
+
var QueryExpression = import_zod14.z.object({
|
|
1788
|
+
id: import_zod14.z.optional(import_zod14.z.string()),
|
|
1789
|
+
eventType: import_zod14.z.string(),
|
|
1790
|
+
status: import_zod14.z.optional(import_zod14.z.union([AnyOfStatus, ExactStatus])),
|
|
1791
|
+
createdAt: import_zod14.z.optional(DateCondition),
|
|
1792
|
+
updatedAt: import_zod14.z.optional(DateCondition),
|
|
1793
|
+
"legalStatuses.REGISTERED.acceptedAt": import_zod14.z.optional(DateCondition),
|
|
1794
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod14.z.optional(
|
|
1795
|
+
import_zod14.z.union([Within, Exact])
|
|
1855
1796
|
),
|
|
1856
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
1857
|
-
|
|
1797
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod14.z.optional(
|
|
1798
|
+
import_zod14.z.union([Within, Exact])
|
|
1858
1799
|
),
|
|
1859
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
1860
|
-
createdAtLocation:
|
|
1861
|
-
updatedAtLocation:
|
|
1862
|
-
assignedTo:
|
|
1863
|
-
createdByUserType:
|
|
1864
|
-
createdBy:
|
|
1865
|
-
updatedBy:
|
|
1866
|
-
trackingId:
|
|
1867
|
-
flags:
|
|
1800
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod14.z.optional(Exact),
|
|
1801
|
+
createdAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
|
|
1802
|
+
updatedAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
|
|
1803
|
+
assignedTo: import_zod14.z.optional(Exact),
|
|
1804
|
+
createdByUserType: import_zod14.z.optional(ExactUserType),
|
|
1805
|
+
createdBy: import_zod14.z.optional(Exact),
|
|
1806
|
+
updatedBy: import_zod14.z.optional(Exact),
|
|
1807
|
+
trackingId: import_zod14.z.optional(Exact),
|
|
1808
|
+
flags: import_zod14.z.optional(ContainsFlags),
|
|
1868
1809
|
// @todo: The type for this comes out as "any"
|
|
1869
1810
|
data: QueryInput
|
|
1870
1811
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
|
1871
|
-
|
|
1872
|
-
}).
|
|
1873
|
-
|
|
1812
|
+
message: "At least one query field must be specified."
|
|
1813
|
+
}).openapi({
|
|
1814
|
+
ref: "QueryExpression"
|
|
1874
1815
|
});
|
|
1875
|
-
var QueryType =
|
|
1876
|
-
() =>
|
|
1877
|
-
type:
|
|
1878
|
-
clauses:
|
|
1816
|
+
var QueryType = import_zod14.z.lazy(
|
|
1817
|
+
() => import_zod14.z.object({
|
|
1818
|
+
type: import_zod14.z.literal("and").or(import_zod14.z.literal("or")).openapi({ default: "and" }),
|
|
1819
|
+
clauses: import_zod14.z.array(import_zod14.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").openapi({
|
|
1879
1820
|
default: [
|
|
1880
1821
|
{
|
|
1881
1822
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
|
@@ -1893,8 +1834,8 @@ var QueryType = import_v4.z.lazy(
|
|
|
1893
1834
|
]
|
|
1894
1835
|
})
|
|
1895
1836
|
})
|
|
1896
|
-
).
|
|
1897
|
-
|
|
1837
|
+
).openapi({
|
|
1838
|
+
ref: "QueryType"
|
|
1898
1839
|
});
|
|
1899
1840
|
function parseStringifiedQueryField(val) {
|
|
1900
1841
|
if (typeof val === "string") {
|
|
@@ -1902,8 +1843,8 @@ function parseStringifiedQueryField(val) {
|
|
|
1902
1843
|
}
|
|
1903
1844
|
return val;
|
|
1904
1845
|
}
|
|
1905
|
-
var SearchQuery =
|
|
1906
|
-
query:
|
|
1846
|
+
var SearchQuery = import_zod14.z.object({
|
|
1847
|
+
query: import_zod14.z.preprocess(parseStringifiedQueryField, QueryType).openapi({
|
|
1907
1848
|
default: {
|
|
1908
1849
|
type: "and",
|
|
1909
1850
|
clauses: [
|
|
@@ -1923,19 +1864,19 @@ var SearchQuery = import_v4.z.object({
|
|
|
1923
1864
|
]
|
|
1924
1865
|
}
|
|
1925
1866
|
}),
|
|
1926
|
-
limit:
|
|
1927
|
-
offset:
|
|
1928
|
-
sort:
|
|
1867
|
+
limit: import_zod14.z.number().optional().default(100),
|
|
1868
|
+
offset: import_zod14.z.number().optional().default(0),
|
|
1869
|
+
sort: import_zod14.z.preprocess(
|
|
1929
1870
|
parseStringifiedQueryField,
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
field:
|
|
1933
|
-
direction:
|
|
1871
|
+
import_zod14.z.array(
|
|
1872
|
+
import_zod14.z.object({
|
|
1873
|
+
field: import_zod14.z.string(),
|
|
1874
|
+
direction: import_zod14.z.enum(["asc", "desc"]).default("asc")
|
|
1934
1875
|
})
|
|
1935
1876
|
)
|
|
1936
1877
|
).optional()
|
|
1937
|
-
}).
|
|
1938
|
-
|
|
1878
|
+
}).openapi({
|
|
1879
|
+
ref: "SearchQuery"
|
|
1939
1880
|
});
|
|
1940
1881
|
var SearchScopeAccessLevels = {
|
|
1941
1882
|
MY_JURISDICTION: "my-jurisdiction",
|
|
@@ -1943,168 +1884,174 @@ var SearchScopeAccessLevels = {
|
|
|
1943
1884
|
};
|
|
1944
1885
|
|
|
1945
1886
|
// ../commons/src/events/FieldConfig.ts
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1887
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod15.z);
|
|
1888
|
+
var FieldId = import_zod15.z.string().refine(
|
|
1889
|
+
/*
|
|
1890
|
+
* Disallow underscores '_' in field ids.
|
|
1891
|
+
* Why? Theres two reasons:
|
|
1892
|
+
* 1. We transform dots to underscores as separator in Formik field ids, so this avoids any issues with the Formik transformations.
|
|
1893
|
+
* 2. On Kysely-SQL queries, we use the CamelCasePlugin. This plugin transforms snake_case to camelCase also on nested (jsonb) object keys.
|
|
1894
|
+
* This could be disabled via 'maintainNestedObjectKeys: true', but this would also affect SQL queries which use e.g. json_agg() or to_jsonb() to aggregate results.
|
|
1895
|
+
*/
|
|
1896
|
+
(val) => !val.includes("_"),
|
|
1897
|
+
(val) => ({
|
|
1898
|
+
message: `id: '${val}' must not contain underscores '_'`
|
|
1899
|
+
})
|
|
1900
|
+
).describe("Unique identifier for the field");
|
|
1901
|
+
var FieldReference = import_zod15.z.object({
|
|
1955
1902
|
$$field: FieldId,
|
|
1956
|
-
$$subfield:
|
|
1903
|
+
$$subfield: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
|
1957
1904
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1958
1905
|
)
|
|
1959
1906
|
}).describe("Reference to a field by its ID");
|
|
1960
|
-
var ValidationConfig =
|
|
1907
|
+
var ValidationConfig = import_zod15.z.object({
|
|
1961
1908
|
validator: Conditional,
|
|
1962
1909
|
message: TranslationConfig
|
|
1963
1910
|
});
|
|
1964
|
-
var requiredSchema =
|
|
1965
|
-
|
|
1966
|
-
|
|
1911
|
+
var requiredSchema = import_zod15.z.union([
|
|
1912
|
+
import_zod15.z.boolean(),
|
|
1913
|
+
import_zod15.z.object({
|
|
1967
1914
|
message: TranslationConfig.describe("Custom required validation message")
|
|
1968
1915
|
})
|
|
1969
1916
|
]).default(false).optional();
|
|
1970
|
-
var BaseField =
|
|
1917
|
+
var BaseField = import_zod15.z.object({
|
|
1971
1918
|
id: FieldId.describe("Unique identifier of the field."),
|
|
1972
1919
|
label: TranslationConfig.describe("Human-readable label of the field."),
|
|
1973
|
-
parent: FieldReference.or(
|
|
1920
|
+
parent: FieldReference.or(import_zod15.z.array(FieldReference)).optional().describe(
|
|
1974
1921
|
"Reference to the parent field or fields. When a parent field changes, this field is reset."
|
|
1975
1922
|
),
|
|
1976
1923
|
required: requiredSchema.describe(
|
|
1977
1924
|
"Indicates whether the field is mandatory."
|
|
1978
1925
|
),
|
|
1979
|
-
conditionals:
|
|
1926
|
+
conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
|
|
1980
1927
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1981
1928
|
),
|
|
1982
|
-
secured:
|
|
1929
|
+
secured: import_zod15.z.boolean().default(false).optional().describe(
|
|
1983
1930
|
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1984
1931
|
),
|
|
1985
1932
|
placeholder: TranslationConfig.optional(),
|
|
1986
|
-
validation:
|
|
1933
|
+
validation: import_zod15.z.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
1987
1934
|
helperText: TranslationConfig.optional(),
|
|
1988
|
-
hideLabel:
|
|
1989
|
-
uncorrectable:
|
|
1935
|
+
hideLabel: import_zod15.z.boolean().default(false).optional(),
|
|
1936
|
+
uncorrectable: import_zod15.z.boolean().default(false).optional().describe(
|
|
1990
1937
|
"Indicates whether the field can be modified during record correction."
|
|
1991
1938
|
),
|
|
1992
|
-
value: FieldReference.or(
|
|
1939
|
+
value: FieldReference.or(import_zod15.z.array(FieldReference)).optional().describe(
|
|
1993
1940
|
"Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
|
|
1994
1941
|
),
|
|
1995
|
-
analytics:
|
|
1942
|
+
analytics: import_zod15.z.boolean().default(false).optional().describe(
|
|
1996
1943
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
1997
1944
|
)
|
|
1998
1945
|
}).describe("Common properties shared across all field types.");
|
|
1999
1946
|
var Divider = BaseField.extend({
|
|
2000
|
-
type:
|
|
1947
|
+
type: import_zod15.z.literal(FieldType.DIVIDER)
|
|
2001
1948
|
});
|
|
2002
1949
|
var TextField = BaseField.extend({
|
|
2003
|
-
type:
|
|
1950
|
+
type: import_zod15.z.literal(FieldType.TEXT),
|
|
2004
1951
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2005
|
-
configuration:
|
|
2006
|
-
maxLength:
|
|
2007
|
-
type:
|
|
1952
|
+
configuration: import_zod15.z.object({
|
|
1953
|
+
maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
|
|
1954
|
+
type: import_zod15.z.enum(["text", "password"]).optional(),
|
|
2008
1955
|
prefix: TranslationConfig.optional(),
|
|
2009
1956
|
postfix: TranslationConfig.optional()
|
|
2010
1957
|
}).default({ type: "text" }).optional()
|
|
2011
1958
|
}).describe("Text input");
|
|
2012
1959
|
var NumberField = BaseField.extend({
|
|
2013
|
-
type:
|
|
1960
|
+
type: import_zod15.z.literal(FieldType.NUMBER),
|
|
2014
1961
|
defaultValue: NumberFieldValue.optional(),
|
|
2015
|
-
configuration:
|
|
2016
|
-
min:
|
|
2017
|
-
max:
|
|
1962
|
+
configuration: import_zod15.z.object({
|
|
1963
|
+
min: import_zod15.z.number().optional().describe("Minimum value"),
|
|
1964
|
+
max: import_zod15.z.number().optional().describe("Maximum value"),
|
|
2018
1965
|
prefix: TranslationConfig.optional(),
|
|
2019
1966
|
postfix: TranslationConfig.optional()
|
|
2020
1967
|
}).optional()
|
|
2021
1968
|
}).describe("Number input");
|
|
2022
1969
|
var TextAreaField = BaseField.extend({
|
|
2023
|
-
type:
|
|
1970
|
+
type: import_zod15.z.literal(FieldType.TEXTAREA),
|
|
2024
1971
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2025
|
-
configuration:
|
|
2026
|
-
maxLength:
|
|
2027
|
-
rows:
|
|
2028
|
-
cols:
|
|
1972
|
+
configuration: import_zod15.z.object({
|
|
1973
|
+
maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
|
|
1974
|
+
rows: import_zod15.z.number().optional().describe("Number of visible text lines"),
|
|
1975
|
+
cols: import_zod15.z.number().optional().describe("Number of visible columns"),
|
|
2029
1976
|
prefix: TranslationConfig.optional(),
|
|
2030
1977
|
postfix: TranslationConfig.optional()
|
|
2031
1978
|
}).default({ rows: 4 }).optional()
|
|
2032
1979
|
}).describe("Multiline text input");
|
|
2033
|
-
var ImageMimeType =
|
|
1980
|
+
var ImageMimeType = import_zod15.z.enum([
|
|
2034
1981
|
"image/png",
|
|
2035
1982
|
"image/jpg",
|
|
2036
1983
|
"image/jpeg",
|
|
2037
1984
|
"image/svg+xml"
|
|
2038
1985
|
]);
|
|
2039
|
-
var DocumentMimeType =
|
|
1986
|
+
var DocumentMimeType = import_zod15.z.enum([
|
|
2040
1987
|
"application/pdf",
|
|
2041
1988
|
"application/msword",
|
|
2042
1989
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
2043
1990
|
"application/vnd.oasis.opendocument.text"
|
|
2044
1991
|
]);
|
|
2045
|
-
var MimeType =
|
|
1992
|
+
var MimeType = import_zod15.z.enum([
|
|
2046
1993
|
...ImageMimeType.options,
|
|
2047
1994
|
...DocumentMimeType.options
|
|
2048
1995
|
]);
|
|
2049
1996
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
2050
1997
|
var SignatureField = BaseField.extend({
|
|
2051
|
-
type:
|
|
1998
|
+
type: import_zod15.z.literal(FieldType.SIGNATURE),
|
|
2052
1999
|
signaturePromptLabel: TranslationConfig.describe(
|
|
2053
2000
|
"Title of the signature modal"
|
|
2054
2001
|
),
|
|
2055
2002
|
defaultValue: SignatureFieldValue.optional(),
|
|
2056
|
-
configuration:
|
|
2057
|
-
maxFileSize:
|
|
2003
|
+
configuration: import_zod15.z.object({
|
|
2004
|
+
maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2058
2005
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
2059
2006
|
}).default({
|
|
2060
2007
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2061
2008
|
})
|
|
2062
2009
|
}).describe("Signature input field");
|
|
2063
2010
|
var EmailField = BaseField.extend({
|
|
2064
|
-
type:
|
|
2065
|
-
configuration:
|
|
2066
|
-
maxLength:
|
|
2067
|
-
}).default({ maxLength:
|
|
2011
|
+
type: import_zod15.z.literal(FieldType.EMAIL),
|
|
2012
|
+
configuration: import_zod15.z.object({
|
|
2013
|
+
maxLength: import_zod15.z.number().optional().describe("Maximum length of the text")
|
|
2014
|
+
}).default({ maxLength: 10 }).optional(),
|
|
2068
2015
|
defaultValue: NonEmptyTextValue.optional()
|
|
2069
2016
|
});
|
|
2070
2017
|
var DateField = BaseField.extend({
|
|
2071
|
-
type:
|
|
2018
|
+
type: import_zod15.z.literal(FieldType.DATE),
|
|
2072
2019
|
defaultValue: DateValue.optional(),
|
|
2073
|
-
configuration:
|
|
2020
|
+
configuration: import_zod15.z.object({
|
|
2074
2021
|
notice: TranslationConfig.describe(
|
|
2075
2022
|
"Text to display above the date input"
|
|
2076
2023
|
).optional()
|
|
2077
2024
|
}).optional()
|
|
2078
2025
|
}).describe("A single date input (yyyy-MM-dd)");
|
|
2079
2026
|
var AgeField = BaseField.extend({
|
|
2080
|
-
type:
|
|
2027
|
+
type: import_zod15.z.literal(FieldType.AGE),
|
|
2081
2028
|
defaultValue: NumberFieldValue.optional(),
|
|
2082
|
-
configuration:
|
|
2029
|
+
configuration: import_zod15.z.object({
|
|
2083
2030
|
asOfDate: FieldReference,
|
|
2084
2031
|
prefix: TranslationConfig.optional(),
|
|
2085
2032
|
postfix: TranslationConfig.optional()
|
|
2086
2033
|
})
|
|
2087
2034
|
}).describe("An age input field which uses the current date as the asOfDate");
|
|
2088
2035
|
var TimeField = BaseField.extend({
|
|
2089
|
-
type:
|
|
2036
|
+
type: import_zod15.z.literal(FieldType.TIME),
|
|
2090
2037
|
defaultValue: TimeValue.optional(),
|
|
2091
|
-
configuration:
|
|
2092
|
-
use12HourFormat:
|
|
2038
|
+
configuration: import_zod15.z.object({
|
|
2039
|
+
use12HourFormat: import_zod15.z.boolean().optional().describe("Whether to use 12-hour format"),
|
|
2093
2040
|
notice: TranslationConfig.describe(
|
|
2094
2041
|
"Text to display above the time input"
|
|
2095
2042
|
).optional()
|
|
2096
2043
|
}).optional()
|
|
2097
2044
|
}).describe("A single date input (HH-mm)");
|
|
2098
2045
|
var DateRangeField = BaseField.extend({
|
|
2099
|
-
type:
|
|
2046
|
+
type: import_zod15.z.literal(FieldType.DATE_RANGE),
|
|
2100
2047
|
defaultValue: DateRangeFieldValue.optional(),
|
|
2101
|
-
configuration:
|
|
2048
|
+
configuration: import_zod15.z.object({
|
|
2102
2049
|
notice: TranslationConfig.describe(
|
|
2103
2050
|
"Text to display above the date input"
|
|
2104
2051
|
).optional()
|
|
2105
2052
|
}).optional()
|
|
2106
2053
|
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
|
2107
|
-
var HtmlFontVariant =
|
|
2054
|
+
var HtmlFontVariant = import_zod15.z.enum([
|
|
2108
2055
|
"reg12",
|
|
2109
2056
|
"reg14",
|
|
2110
2057
|
"reg16",
|
|
@@ -2114,31 +2061,31 @@ var HtmlFontVariant = z16.enum([
|
|
|
2114
2061
|
"h2",
|
|
2115
2062
|
"h1"
|
|
2116
2063
|
]);
|
|
2117
|
-
var ParagraphConfiguration =
|
|
2118
|
-
styles:
|
|
2064
|
+
var ParagraphConfiguration = import_zod15.z.object({
|
|
2065
|
+
styles: import_zod15.z.object({
|
|
2119
2066
|
fontVariant: HtmlFontVariant.optional().describe(
|
|
2120
2067
|
"Font variant to use for the paragraph text"
|
|
2121
2068
|
),
|
|
2122
|
-
hint:
|
|
2069
|
+
hint: import_zod15.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
|
|
2123
2070
|
}).optional()
|
|
2124
2071
|
}).default({});
|
|
2125
2072
|
var Paragraph = BaseField.extend({
|
|
2126
|
-
type:
|
|
2073
|
+
type: import_zod15.z.literal(FieldType.PARAGRAPH),
|
|
2127
2074
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2128
2075
|
configuration: ParagraphConfiguration
|
|
2129
2076
|
}).describe("A read-only HTML <p> paragraph");
|
|
2130
2077
|
var PageHeader = BaseField.extend({
|
|
2131
|
-
type:
|
|
2078
|
+
type: import_zod15.z.literal(FieldType.PAGE_HEADER),
|
|
2132
2079
|
defaultValue: NonEmptyTextValue.optional()
|
|
2133
2080
|
}).describe("A read-only header component for form pages");
|
|
2134
2081
|
var File = BaseField.extend({
|
|
2135
|
-
type:
|
|
2082
|
+
type: import_zod15.z.literal(FieldType.FILE),
|
|
2136
2083
|
defaultValue: FileFieldValue.optional(),
|
|
2137
|
-
configuration:
|
|
2138
|
-
maxFileSize:
|
|
2084
|
+
configuration: import_zod15.z.object({
|
|
2085
|
+
maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2139
2086
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
2140
|
-
style:
|
|
2141
|
-
width:
|
|
2087
|
+
style: import_zod15.z.object({
|
|
2088
|
+
width: import_zod15.z.enum(["full", "auto"]).optional().describe(
|
|
2142
2089
|
"Whether the file upload button should take the full width of the container or not"
|
|
2143
2090
|
)
|
|
2144
2091
|
}).optional(),
|
|
@@ -2147,34 +2094,34 @@ var File = BaseField.extend({
|
|
|
2147
2094
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2148
2095
|
})
|
|
2149
2096
|
}).describe("File upload");
|
|
2150
|
-
var SelectOption =
|
|
2151
|
-
value:
|
|
2152
|
-
label:
|
|
2097
|
+
var SelectOption = import_zod15.z.object({
|
|
2098
|
+
value: import_zod15.z.string().describe("The value of the option"),
|
|
2099
|
+
label: import_zod15.z.union([import_zod15.z.string(), TranslationConfig]).describe("The label of the option")
|
|
2153
2100
|
});
|
|
2154
2101
|
var RadioGroup = BaseField.extend({
|
|
2155
|
-
type:
|
|
2102
|
+
type: import_zod15.z.literal(FieldType.RADIO_GROUP),
|
|
2156
2103
|
defaultValue: TextValue.optional(),
|
|
2157
|
-
options:
|
|
2158
|
-
configuration:
|
|
2159
|
-
styles:
|
|
2160
|
-
size:
|
|
2104
|
+
options: import_zod15.z.array(SelectOption).describe("A list of options"),
|
|
2105
|
+
configuration: import_zod15.z.object({
|
|
2106
|
+
styles: import_zod15.z.object({
|
|
2107
|
+
size: import_zod15.z.enum(["NORMAL", "LARGE"]).optional()
|
|
2161
2108
|
}).optional()
|
|
2162
2109
|
}).optional()
|
|
2163
2110
|
}).describe("Grouped radio options");
|
|
2164
2111
|
var BulletList = BaseField.extend({
|
|
2165
|
-
type:
|
|
2112
|
+
type: import_zod15.z.literal(FieldType.BULLET_LIST),
|
|
2166
2113
|
defaultValue: TextValue.optional(),
|
|
2167
|
-
items:
|
|
2168
|
-
configuration:
|
|
2169
|
-
styles:
|
|
2114
|
+
items: import_zod15.z.array(TranslationConfig).describe("A list of items"),
|
|
2115
|
+
configuration: import_zod15.z.object({
|
|
2116
|
+
styles: import_zod15.z.object({
|
|
2170
2117
|
fontVariant: HtmlFontVariant.optional()
|
|
2171
2118
|
}).optional()
|
|
2172
2119
|
}).default({})
|
|
2173
2120
|
}).describe("A list of bullet points");
|
|
2174
2121
|
var Select = BaseField.extend({
|
|
2175
|
-
type:
|
|
2122
|
+
type: import_zod15.z.literal(FieldType.SELECT),
|
|
2176
2123
|
defaultValue: TextValue.optional(),
|
|
2177
|
-
options:
|
|
2124
|
+
options: import_zod15.z.array(SelectOption).describe("A list of options"),
|
|
2178
2125
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
2179
2126
|
`
|
|
2180
2127
|
A translation configuration object used to display a message when no options are available.
|
|
@@ -2186,34 +2133,34 @@ var Select = BaseField.extend({
|
|
|
2186
2133
|
`
|
|
2187
2134
|
)
|
|
2188
2135
|
}).describe("Select input");
|
|
2189
|
-
var SelectDateRangeOption =
|
|
2136
|
+
var SelectDateRangeOption = import_zod15.z.object({
|
|
2190
2137
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2191
2138
|
label: TranslationConfig.describe("The label of the option")
|
|
2192
2139
|
});
|
|
2193
2140
|
var SelectDateRangeField = BaseField.extend({
|
|
2194
|
-
type:
|
|
2141
|
+
type: import_zod15.z.literal(FieldType.SELECT_DATE_RANGE),
|
|
2195
2142
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2196
|
-
options:
|
|
2143
|
+
options: import_zod15.z.array(SelectDateRangeOption).describe("A list of options")
|
|
2197
2144
|
}).describe("Select input with date range options");
|
|
2198
|
-
var NameConfig =
|
|
2199
|
-
firstname:
|
|
2200
|
-
middlename:
|
|
2201
|
-
surname:
|
|
2145
|
+
var NameConfig = import_zod15.z.object({
|
|
2146
|
+
firstname: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2147
|
+
middlename: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2148
|
+
surname: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
|
|
2202
2149
|
});
|
|
2203
2150
|
var NameField = BaseField.extend({
|
|
2204
|
-
type:
|
|
2205
|
-
defaultValue:
|
|
2151
|
+
type: import_zod15.z.literal(FieldType.NAME),
|
|
2152
|
+
defaultValue: import_zod15.z.object({
|
|
2206
2153
|
firstname: NonEmptyTextValue.optional(),
|
|
2207
2154
|
middlename: NonEmptyTextValue.optional(),
|
|
2208
2155
|
surname: NonEmptyTextValue.optional()
|
|
2209
2156
|
}).optional(),
|
|
2210
|
-
configuration:
|
|
2157
|
+
configuration: import_zod15.z.object({
|
|
2211
2158
|
name: NameConfig.default({
|
|
2212
2159
|
firstname: { required: true },
|
|
2213
2160
|
surname: { required: true }
|
|
2214
2161
|
}).optional(),
|
|
2215
|
-
order:
|
|
2216
|
-
maxLength:
|
|
2162
|
+
order: import_zod15.z.array(import_zod15.z.enum(["firstname", "middlename", "surname"])).optional(),
|
|
2163
|
+
maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
|
|
2217
2164
|
prefix: TranslationConfig.optional(),
|
|
2218
2165
|
postfix: TranslationConfig.optional()
|
|
2219
2166
|
}).default({
|
|
@@ -2225,142 +2172,142 @@ var NameField = BaseField.extend({
|
|
|
2225
2172
|
}).describe("Name input field");
|
|
2226
2173
|
var PhoneField = BaseField.extend({
|
|
2227
2174
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2228
|
-
type:
|
|
2175
|
+
type: import_zod15.z.literal(FieldType.PHONE)
|
|
2229
2176
|
}).describe("Phone input field");
|
|
2230
2177
|
var IdField = BaseField.extend({
|
|
2231
2178
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2232
|
-
type:
|
|
2179
|
+
type: import_zod15.z.literal(FieldType.ID)
|
|
2233
2180
|
}).describe("ID input field");
|
|
2234
2181
|
var Checkbox = BaseField.extend({
|
|
2235
|
-
type:
|
|
2182
|
+
type: import_zod15.z.literal(FieldType.CHECKBOX),
|
|
2236
2183
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2237
2184
|
}).describe("Boolean checkbox field");
|
|
2238
2185
|
var Country = BaseField.extend({
|
|
2239
|
-
type:
|
|
2186
|
+
type: import_zod15.z.literal(FieldType.COUNTRY),
|
|
2240
2187
|
defaultValue: NonEmptyTextValue.optional()
|
|
2241
2188
|
}).describe("Country select field");
|
|
2242
|
-
var AdministrativeAreas =
|
|
2189
|
+
var AdministrativeAreas = import_zod15.z.enum([
|
|
2243
2190
|
"ADMIN_STRUCTURE",
|
|
2244
2191
|
"HEALTH_FACILITY",
|
|
2245
2192
|
"CRVS_OFFICE"
|
|
2246
2193
|
]);
|
|
2247
|
-
var AdministrativeAreaConfiguration =
|
|
2248
|
-
partOf:
|
|
2249
|
-
$declaration:
|
|
2194
|
+
var AdministrativeAreaConfiguration = import_zod15.z.object({
|
|
2195
|
+
partOf: import_zod15.z.object({
|
|
2196
|
+
$declaration: import_zod15.z.string()
|
|
2250
2197
|
}).optional().describe("Parent location"),
|
|
2251
2198
|
type: AdministrativeAreas
|
|
2252
2199
|
}).describe("Administrative area options");
|
|
2253
2200
|
var AdministrativeArea = BaseField.extend({
|
|
2254
|
-
type:
|
|
2201
|
+
type: import_zod15.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2255
2202
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2256
2203
|
configuration: AdministrativeAreaConfiguration
|
|
2257
2204
|
}).describe("Administrative area input field e.g. facility, office");
|
|
2258
2205
|
var LocationInput = BaseField.extend({
|
|
2259
|
-
type:
|
|
2206
|
+
type: import_zod15.z.literal(FieldType.LOCATION),
|
|
2260
2207
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2261
|
-
configuration:
|
|
2262
|
-
searchableResource:
|
|
2208
|
+
configuration: import_zod15.z.object({
|
|
2209
|
+
searchableResource: import_zod15.z.array(import_zod15.z.enum(["locations", "facilities", "offices"]))
|
|
2263
2210
|
})
|
|
2264
2211
|
}).describe("Input field for a location");
|
|
2265
2212
|
var FileUploadWithOptions = BaseField.extend({
|
|
2266
|
-
type:
|
|
2267
|
-
options:
|
|
2213
|
+
type: import_zod15.z.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2214
|
+
options: import_zod15.z.array(SelectOption).describe("A list of options"),
|
|
2268
2215
|
defaultValue: FileFieldWithOptionValue.optional(),
|
|
2269
|
-
configuration:
|
|
2270
|
-
maxFileSize:
|
|
2216
|
+
configuration: import_zod15.z.object({
|
|
2217
|
+
maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2271
2218
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
2272
2219
|
}).default({
|
|
2273
2220
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2274
2221
|
})
|
|
2275
2222
|
});
|
|
2276
2223
|
var Facility = BaseField.extend({
|
|
2277
|
-
type:
|
|
2224
|
+
type: import_zod15.z.literal(FieldType.FACILITY),
|
|
2278
2225
|
defaultValue: NonEmptyTextValue.optional()
|
|
2279
2226
|
}).describe("Input field for a facility");
|
|
2280
2227
|
var Office = BaseField.extend({
|
|
2281
|
-
type:
|
|
2228
|
+
type: import_zod15.z.literal(FieldType.OFFICE),
|
|
2282
2229
|
defaultValue: NonEmptyTextValue.optional()
|
|
2283
2230
|
}).describe("Input field for an office");
|
|
2284
2231
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2285
|
-
administrativeArea:
|
|
2232
|
+
administrativeArea: import_zod15.z.union([UUID, SerializedUserField]).optional()
|
|
2286
2233
|
});
|
|
2287
2234
|
var Address = BaseField.extend({
|
|
2288
|
-
type:
|
|
2289
|
-
configuration:
|
|
2290
|
-
lineSeparator:
|
|
2291
|
-
fields:
|
|
2292
|
-
administrativeLevels:
|
|
2293
|
-
streetAddressForm:
|
|
2294
|
-
|
|
2295
|
-
id:
|
|
2235
|
+
type: import_zod15.z.literal(FieldType.ADDRESS),
|
|
2236
|
+
configuration: import_zod15.z.object({
|
|
2237
|
+
lineSeparator: import_zod15.z.string().optional(),
|
|
2238
|
+
fields: import_zod15.z.array(import_zod15.z.enum(["country", "administrativeArea"])).optional(),
|
|
2239
|
+
administrativeLevels: import_zod15.z.array(import_zod15.z.string()).optional(),
|
|
2240
|
+
streetAddressForm: import_zod15.z.array(
|
|
2241
|
+
import_zod15.z.object({
|
|
2242
|
+
id: import_zod15.z.string(),
|
|
2296
2243
|
required: requiredSchema,
|
|
2297
2244
|
label: TranslationConfig,
|
|
2298
|
-
type:
|
|
2299
|
-
conditionals:
|
|
2245
|
+
type: import_zod15.z.literal(FieldType.TEXT),
|
|
2246
|
+
conditionals: import_zod15.z.array(FieldConditional).default([]).optional(),
|
|
2300
2247
|
parent: FieldReference.optional()
|
|
2301
2248
|
})
|
|
2302
2249
|
).optional()
|
|
2303
2250
|
}).optional(),
|
|
2304
2251
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2305
2252
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
|
2306
|
-
var StaticDataEntry =
|
|
2307
|
-
id:
|
|
2253
|
+
var StaticDataEntry = import_zod15.z.object({
|
|
2254
|
+
id: import_zod15.z.string().describe("ID for the data entry."),
|
|
2308
2255
|
label: TranslationConfig,
|
|
2309
|
-
value: TranslationConfig.or(
|
|
2256
|
+
value: TranslationConfig.or(import_zod15.z.string()).or(FieldReference)
|
|
2310
2257
|
}).describe("Static data entry");
|
|
2311
|
-
var DataEntry =
|
|
2258
|
+
var DataEntry = import_zod15.z.union([StaticDataEntry, import_zod15.z.object({ fieldId: import_zod15.z.string() })]).describe(
|
|
2312
2259
|
"Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
|
|
2313
2260
|
);
|
|
2314
2261
|
var DataField = BaseField.extend({
|
|
2315
|
-
type:
|
|
2316
|
-
configuration:
|
|
2262
|
+
type: import_zod15.z.literal(FieldType.DATA),
|
|
2263
|
+
configuration: import_zod15.z.object({
|
|
2317
2264
|
subtitle: TranslationConfig.optional(),
|
|
2318
|
-
data:
|
|
2265
|
+
data: import_zod15.z.array(DataEntry)
|
|
2319
2266
|
})
|
|
2320
2267
|
}).describe("Data field for displaying read-only data");
|
|
2321
2268
|
var ButtonField = BaseField.extend({
|
|
2322
|
-
type:
|
|
2269
|
+
type: import_zod15.z.literal(FieldType.BUTTON),
|
|
2323
2270
|
defaultValue: ButtonFieldValue.optional(),
|
|
2324
|
-
configuration:
|
|
2325
|
-
icon:
|
|
2271
|
+
configuration: import_zod15.z.object({
|
|
2272
|
+
icon: import_zod15.z.string().optional().describe(
|
|
2326
2273
|
"Icon for the button. You can find icons from OpenCRVS UI-Kit."
|
|
2327
2274
|
),
|
|
2328
|
-
loading:
|
|
2275
|
+
loading: import_zod15.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
2329
2276
|
text: TranslationConfig.describe("Text to display on the button")
|
|
2330
2277
|
})
|
|
2331
2278
|
}).describe("Generic button without any built-in functionality");
|
|
2332
2279
|
var AlphaPrintButton = BaseField.extend({
|
|
2333
|
-
type:
|
|
2334
|
-
configuration:
|
|
2335
|
-
template:
|
|
2280
|
+
type: import_zod15.z.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
2281
|
+
configuration: import_zod15.z.object({
|
|
2282
|
+
template: import_zod15.z.string().describe("Template ID from countryconfig templates to use for printing"),
|
|
2336
2283
|
buttonLabel: TranslationConfig.optional().describe(
|
|
2337
2284
|
"Label for the print button"
|
|
2338
2285
|
)
|
|
2339
2286
|
})
|
|
2340
2287
|
}).describe("Print button field for printing certificates");
|
|
2341
2288
|
var HttpField = BaseField.extend({
|
|
2342
|
-
type:
|
|
2289
|
+
type: import_zod15.z.literal(FieldType.HTTP),
|
|
2343
2290
|
defaultValue: HttpFieldValue.optional(),
|
|
2344
|
-
configuration:
|
|
2291
|
+
configuration: import_zod15.z.object({
|
|
2345
2292
|
trigger: FieldReference,
|
|
2346
|
-
url:
|
|
2347
|
-
method:
|
|
2348
|
-
headers:
|
|
2349
|
-
body:
|
|
2350
|
-
errorValue:
|
|
2351
|
-
params:
|
|
2352
|
-
timeout:
|
|
2293
|
+
url: import_zod15.z.string().describe("URL to send the HTTP request to"),
|
|
2294
|
+
method: import_zod15.z.enum(["GET", "POST", "PUT", "DELETE"]),
|
|
2295
|
+
headers: import_zod15.z.record(import_zod15.z.string()).optional(),
|
|
2296
|
+
body: import_zod15.z.record(import_zod15.z.any()).optional(),
|
|
2297
|
+
errorValue: import_zod15.z.any().optional().describe("Value to set if the request fails"),
|
|
2298
|
+
params: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.union([import_zod15.z.string(), FieldReference])).optional(),
|
|
2299
|
+
timeout: import_zod15.z.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2353
2300
|
})
|
|
2354
2301
|
}).describe("HTTP request function triggered by a button click or other event");
|
|
2355
2302
|
var SearchField = HttpField.extend({
|
|
2356
|
-
type:
|
|
2303
|
+
type: import_zod15.z.literal(FieldType.SEARCH),
|
|
2357
2304
|
configuration: SearchQuery.pick({
|
|
2358
2305
|
query: true,
|
|
2359
2306
|
limit: true,
|
|
2360
2307
|
offset: true
|
|
2361
2308
|
}).extend({
|
|
2362
2309
|
validation: ValidationConfig,
|
|
2363
|
-
indicators:
|
|
2310
|
+
indicators: import_zod15.z.object({
|
|
2364
2311
|
loading: TranslationConfig.optional().describe(
|
|
2365
2312
|
"Text to display while the search is in progress"
|
|
2366
2313
|
),
|
|
@@ -2375,7 +2322,7 @@ var SearchField = HttpField.extend({
|
|
|
2375
2322
|
),
|
|
2376
2323
|
confirmButton: TranslationConfig.optional(),
|
|
2377
2324
|
clearButton: TranslationConfig.optional(),
|
|
2378
|
-
clearModal:
|
|
2325
|
+
clearModal: import_zod15.z.object({
|
|
2379
2326
|
title: TranslationConfig.optional(),
|
|
2380
2327
|
description: TranslationConfig.optional(),
|
|
2381
2328
|
cancel: TranslationConfig.optional(),
|
|
@@ -2386,17 +2333,17 @@ var SearchField = HttpField.extend({
|
|
|
2386
2333
|
})
|
|
2387
2334
|
});
|
|
2388
2335
|
var LinkButtonField = BaseField.extend({
|
|
2389
|
-
type:
|
|
2390
|
-
configuration:
|
|
2391
|
-
url:
|
|
2336
|
+
type: import_zod15.z.literal(FieldType.LINK_BUTTON),
|
|
2337
|
+
configuration: import_zod15.z.object({
|
|
2338
|
+
url: import_zod15.z.string().describe("URL to open"),
|
|
2392
2339
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2393
|
-
icon:
|
|
2340
|
+
icon: import_zod15.z.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2394
2341
|
})
|
|
2395
2342
|
}).describe("Button that opens a link");
|
|
2396
2343
|
var VerificationStatus = BaseField.extend({
|
|
2397
|
-
type:
|
|
2344
|
+
type: import_zod15.z.literal(FieldType.VERIFICATION_STATUS),
|
|
2398
2345
|
defaultValue: VerificationStatusValue.optional(),
|
|
2399
|
-
configuration:
|
|
2346
|
+
configuration: import_zod15.z.object({
|
|
2400
2347
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2401
2348
|
description: TranslationConfig.describe(
|
|
2402
2349
|
"Explaining text on the banner in form."
|
|
@@ -2404,42 +2351,38 @@ var VerificationStatus = BaseField.extend({
|
|
|
2404
2351
|
})
|
|
2405
2352
|
});
|
|
2406
2353
|
var QueryParamReaderField = BaseField.extend({
|
|
2407
|
-
type:
|
|
2408
|
-
configuration:
|
|
2409
|
-
pickParams:
|
|
2354
|
+
type: import_zod15.z.literal(FieldType.QUERY_PARAM_READER),
|
|
2355
|
+
configuration: import_zod15.z.object({
|
|
2356
|
+
pickParams: import_zod15.z.array(import_zod15.z.string()).describe("List of query parameters to read from the URL")
|
|
2410
2357
|
})
|
|
2411
2358
|
}).describe(
|
|
2412
2359
|
"A field that maps URL query params into form values and clears them afterward"
|
|
2413
2360
|
);
|
|
2414
2361
|
var QrReaderField = BaseField.extend({
|
|
2415
|
-
type:
|
|
2362
|
+
type: import_zod15.z.literal(FieldType.QR_READER),
|
|
2416
2363
|
defaultValue: QrReaderFieldValue.optional(),
|
|
2417
|
-
configuration:
|
|
2418
|
-
validator:
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
})
|
|
2364
|
+
configuration: import_zod15.z.object({
|
|
2365
|
+
validator: import_zod15.z.custom(
|
|
2366
|
+
(val) => typeof val === "object" && val !== null
|
|
2367
|
+
)
|
|
2422
2368
|
}).optional()
|
|
2423
|
-
}).meta({
|
|
2424
|
-
description: "Configuration for QR code reader field, including optional JSON Schema validator.",
|
|
2425
|
-
id: "QrReaderField"
|
|
2426
2369
|
});
|
|
2427
2370
|
var IdReaderField = BaseField.extend({
|
|
2428
|
-
type:
|
|
2371
|
+
type: import_zod15.z.literal(FieldType.ID_READER),
|
|
2429
2372
|
defaultValue: IdReaderFieldValue.optional(),
|
|
2430
|
-
methods:
|
|
2431
|
-
|
|
2373
|
+
methods: import_zod15.z.array(
|
|
2374
|
+
import_zod15.z.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2432
2375
|
)
|
|
2433
2376
|
});
|
|
2434
2377
|
var LoaderField = BaseField.extend({
|
|
2435
|
-
type:
|
|
2436
|
-
configuration:
|
|
2378
|
+
type: import_zod15.z.literal(FieldType.LOADER),
|
|
2379
|
+
configuration: import_zod15.z.object({
|
|
2437
2380
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2438
2381
|
})
|
|
2439
2382
|
}).describe(
|
|
2440
2383
|
"A non-interactive field that indicates an in progress operation in form"
|
|
2441
2384
|
);
|
|
2442
|
-
var FieldConfig =
|
|
2385
|
+
var FieldConfig = import_zod15.z.discriminatedUnion("type", [
|
|
2443
2386
|
Address,
|
|
2444
2387
|
TextField,
|
|
2445
2388
|
NumberField,
|
|
@@ -2479,75 +2422,79 @@ var FieldConfig = z16.discriminatedUnion("type", [
|
|
|
2479
2422
|
QueryParamReaderField,
|
|
2480
2423
|
LoaderField,
|
|
2481
2424
|
SearchField
|
|
2482
|
-
]).
|
|
2425
|
+
]).openapi({
|
|
2483
2426
|
description: "Form field configuration",
|
|
2484
|
-
|
|
2427
|
+
ref: "FieldConfig"
|
|
2485
2428
|
});
|
|
2486
|
-
var AnyFileField =
|
|
2429
|
+
var AnyFileField = import_zod15.z.discriminatedUnion("type", [
|
|
2487
2430
|
SignatureField,
|
|
2488
2431
|
File,
|
|
2489
2432
|
FileUploadWithOptions
|
|
2490
2433
|
]);
|
|
2491
2434
|
|
|
2492
2435
|
// ../commons/src/events/FormConfig.ts
|
|
2493
|
-
var
|
|
2436
|
+
var import_zod17 = require("zod");
|
|
2494
2437
|
|
|
2495
2438
|
// ../commons/src/events/PageConfig.ts
|
|
2496
|
-
var
|
|
2497
|
-
var
|
|
2498
|
-
|
|
2499
|
-
|
|
2439
|
+
var import_zod16 = require("zod");
|
|
2440
|
+
var import_zod_openapi7 = require("zod-openapi");
|
|
2441
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
|
2442
|
+
var PageTypes = import_zod16.z.enum(["FORM", "VERIFICATION"]);
|
|
2443
|
+
var PageConfigBase = import_zod16.z.object({
|
|
2444
|
+
id: import_zod16.z.string().describe("Unique identifier for the page"),
|
|
2500
2445
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2501
|
-
fields:
|
|
2446
|
+
fields: import_zod16.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2502
2447
|
conditional: Conditional.optional().describe(
|
|
2503
2448
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2504
2449
|
)
|
|
2505
|
-
}).
|
|
2450
|
+
}).openapi({
|
|
2506
2451
|
description: "Form page configuration",
|
|
2507
|
-
|
|
2452
|
+
ref: "FormPageConfig"
|
|
2508
2453
|
});
|
|
2509
2454
|
var FormPageConfig = PageConfigBase.extend({
|
|
2510
|
-
type:
|
|
2455
|
+
type: import_zod16.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2511
2456
|
});
|
|
2512
|
-
var VerificationActionConfig =
|
|
2513
|
-
verify:
|
|
2514
|
-
cancel:
|
|
2457
|
+
var VerificationActionConfig = import_zod16.z.object({
|
|
2458
|
+
verify: import_zod16.z.object({ label: TranslationConfig }),
|
|
2459
|
+
cancel: import_zod16.z.object({
|
|
2515
2460
|
label: TranslationConfig,
|
|
2516
|
-
confirmation:
|
|
2461
|
+
confirmation: import_zod16.z.object({
|
|
2517
2462
|
title: TranslationConfig,
|
|
2518
2463
|
body: TranslationConfig
|
|
2519
2464
|
})
|
|
2520
2465
|
})
|
|
2521
|
-
}).describe("Actions available on the verification page").
|
|
2466
|
+
}).describe("Actions available on the verification page").openapi({
|
|
2522
2467
|
description: "Verification action configuration",
|
|
2523
|
-
|
|
2468
|
+
ref: "VerificationActionConfig"
|
|
2524
2469
|
});
|
|
2525
2470
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2526
|
-
type:
|
|
2471
|
+
type: import_zod16.z.literal(PageTypes.enum.VERIFICATION),
|
|
2527
2472
|
actions: VerificationActionConfig
|
|
2528
2473
|
});
|
|
2529
|
-
var PageConfig =
|
|
2474
|
+
var PageConfig = import_zod16.z.discriminatedUnion("type", [
|
|
2530
2475
|
FormPageConfig,
|
|
2531
2476
|
VerificationPageConfig
|
|
2532
2477
|
]);
|
|
2533
2478
|
|
|
2534
2479
|
// ../commons/src/events/FormConfig.ts
|
|
2535
|
-
var DeclarationFormConfig =
|
|
2480
|
+
var DeclarationFormConfig = import_zod17.z.object({
|
|
2536
2481
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2537
|
-
pages:
|
|
2482
|
+
pages: import_zod17.z.array(FormPageConfig)
|
|
2538
2483
|
}).describe("Configuration of the declaration form.");
|
|
2539
|
-
var ActionFormConfig =
|
|
2484
|
+
var ActionFormConfig = import_zod17.z.object({
|
|
2540
2485
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2541
|
-
pages:
|
|
2486
|
+
pages: import_zod17.z.array(PageConfig)
|
|
2542
2487
|
}).describe(
|
|
2543
2488
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
2544
2489
|
);
|
|
2545
|
-
var FormConfig =
|
|
2490
|
+
var FormConfig = import_zod17.z.union([DeclarationFormConfig, ActionFormConfig]);
|
|
2546
2491
|
|
|
2547
2492
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
2548
|
-
var
|
|
2549
|
-
var
|
|
2550
|
-
|
|
2493
|
+
var import_zod18 = require("zod");
|
|
2494
|
+
var import_zod_openapi8 = require("zod-openapi");
|
|
2495
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
|
2496
|
+
var FieldReference2 = import_zod18.z.string();
|
|
2497
|
+
var Matcher = import_zod18.z.object({
|
|
2551
2498
|
/**
|
|
2552
2499
|
* Reference to the field used in matching.
|
|
2553
2500
|
*
|
|
@@ -2555,68 +2502,68 @@ var Matcher = z19.object({
|
|
|
2555
2502
|
* be used as the origin date to calculate the distance from.
|
|
2556
2503
|
*/
|
|
2557
2504
|
fieldId: FieldReference2,
|
|
2558
|
-
options:
|
|
2559
|
-
boost:
|
|
2505
|
+
options: import_zod18.z.object({
|
|
2506
|
+
boost: import_zod18.z.number().optional()
|
|
2560
2507
|
}).optional().default({
|
|
2561
2508
|
boost: 1
|
|
2562
2509
|
})
|
|
2563
2510
|
});
|
|
2564
2511
|
var FuzzyMatcher = Matcher.extend({
|
|
2565
|
-
type:
|
|
2566
|
-
options:
|
|
2512
|
+
type: import_zod18.z.literal("fuzzy"),
|
|
2513
|
+
options: import_zod18.z.object({
|
|
2567
2514
|
/**
|
|
2568
2515
|
* Names of length 3 or less characters = 0 edits allowed
|
|
2569
2516
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
2570
2517
|
* Names of length >7 characters = 2 edits allowed
|
|
2571
2518
|
*/
|
|
2572
|
-
fuzziness:
|
|
2573
|
-
boost:
|
|
2519
|
+
fuzziness: import_zod18.z.union([import_zod18.z.string(), import_zod18.z.number()]).optional().default("AUTO:4,7"),
|
|
2520
|
+
boost: import_zod18.z.number().optional().default(1)
|
|
2574
2521
|
}).optional().default({
|
|
2575
2522
|
fuzziness: "AUTO:4,7",
|
|
2576
2523
|
boost: 1
|
|
2577
2524
|
})
|
|
2578
2525
|
});
|
|
2579
2526
|
var StrictMatcher = Matcher.extend({
|
|
2580
|
-
type:
|
|
2581
|
-
options:
|
|
2582
|
-
boost:
|
|
2527
|
+
type: import_zod18.z.literal("strict"),
|
|
2528
|
+
options: import_zod18.z.object({
|
|
2529
|
+
boost: import_zod18.z.number().optional().default(1),
|
|
2583
2530
|
/**
|
|
2584
2531
|
* The constant value to be present in the field for both records
|
|
2585
2532
|
*/
|
|
2586
|
-
value:
|
|
2533
|
+
value: import_zod18.z.string().optional()
|
|
2587
2534
|
}).optional().default({
|
|
2588
2535
|
boost: 1
|
|
2589
2536
|
})
|
|
2590
2537
|
});
|
|
2591
2538
|
var DateRangeMatcher = Matcher.extend({
|
|
2592
|
-
type:
|
|
2593
|
-
options:
|
|
2539
|
+
type: import_zod18.z.literal("dateRange"),
|
|
2540
|
+
options: import_zod18.z.object({
|
|
2594
2541
|
/**
|
|
2595
2542
|
* The distance pivot in days. Distance from the origin (the value of
|
|
2596
2543
|
* fieldId) at which relevance scores receive half of the boost value
|
|
2597
2544
|
*/
|
|
2598
|
-
pivot:
|
|
2599
|
-
days:
|
|
2600
|
-
boost:
|
|
2545
|
+
pivot: import_zod18.z.number().optional(),
|
|
2546
|
+
days: import_zod18.z.number(),
|
|
2547
|
+
boost: import_zod18.z.number().optional().default(1)
|
|
2601
2548
|
})
|
|
2602
2549
|
});
|
|
2603
|
-
var Not =
|
|
2604
|
-
type:
|
|
2550
|
+
var Not = import_zod18.z.object({
|
|
2551
|
+
type: import_zod18.z.literal("not"),
|
|
2605
2552
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2606
|
-
clause:
|
|
2553
|
+
clause: import_zod18.z.lazy(() => Clause)
|
|
2607
2554
|
});
|
|
2608
|
-
var And =
|
|
2609
|
-
type:
|
|
2555
|
+
var And = import_zod18.z.object({
|
|
2556
|
+
type: import_zod18.z.literal("and"),
|
|
2610
2557
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2611
|
-
clauses:
|
|
2558
|
+
clauses: import_zod18.z.lazy(() => Clause.array())
|
|
2612
2559
|
});
|
|
2613
|
-
var Or =
|
|
2614
|
-
type:
|
|
2560
|
+
var Or = import_zod18.z.object({
|
|
2561
|
+
type: import_zod18.z.literal("or"),
|
|
2615
2562
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2616
|
-
clauses:
|
|
2563
|
+
clauses: import_zod18.z.lazy(() => Clause.array())
|
|
2617
2564
|
});
|
|
2618
|
-
var Clause =
|
|
2619
|
-
() =>
|
|
2565
|
+
var Clause = import_zod18.z.lazy(
|
|
2566
|
+
() => import_zod18.z.discriminatedUnion("type", [
|
|
2620
2567
|
Not,
|
|
2621
2568
|
And,
|
|
2622
2569
|
Or,
|
|
@@ -2624,192 +2571,193 @@ var Clause = z19.lazy(
|
|
|
2624
2571
|
StrictMatcher,
|
|
2625
2572
|
DateRangeMatcher
|
|
2626
2573
|
])
|
|
2627
|
-
).
|
|
2628
|
-
|
|
2574
|
+
).openapi({
|
|
2575
|
+
ref: "Clause"
|
|
2629
2576
|
});
|
|
2630
|
-
var DeduplicationConfig =
|
|
2631
|
-
id:
|
|
2577
|
+
var DeduplicationConfig = import_zod18.z.object({
|
|
2578
|
+
id: import_zod18.z.string(),
|
|
2632
2579
|
label: TranslationConfig,
|
|
2633
2580
|
query: Clause
|
|
2634
2581
|
});
|
|
2635
2582
|
|
|
2636
2583
|
// ../commons/src/events/ActionConfig.ts
|
|
2637
|
-
var
|
|
2584
|
+
var import_zod_openapi9 = require("zod-openapi");
|
|
2585
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod19.z);
|
|
2586
|
+
var DeclarationReviewConfig = import_zod19.z.object({
|
|
2638
2587
|
title: TranslationConfig.describe("Title of the review page"),
|
|
2639
|
-
fields:
|
|
2588
|
+
fields: import_zod19.z.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
2640
2589
|
}).describe(
|
|
2641
2590
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
2642
2591
|
);
|
|
2643
|
-
var ActionConfigBase =
|
|
2644
|
-
label: TranslationConfig.describe("Human readable description of the action")
|
|
2645
|
-
flags: z20.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
2646
|
-
auditHistoryLabel: TranslationConfig.describe(
|
|
2647
|
-
'The label to show in audit history for this action. For example "Approved".'
|
|
2648
|
-
).optional(),
|
|
2649
|
-
supportingCopy: TranslationConfig.optional().describe(
|
|
2650
|
-
"Text displayed on the confirmation"
|
|
2651
|
-
),
|
|
2652
|
-
conditionals: z20.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
2592
|
+
var ActionConfigBase = import_zod19.z.object({
|
|
2593
|
+
label: TranslationConfig.describe("Human readable description of the action")
|
|
2653
2594
|
});
|
|
2654
2595
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2596
|
+
review: DeclarationReviewConfig,
|
|
2655
2597
|
deduplication: DeduplicationConfig.optional()
|
|
2656
2598
|
});
|
|
2657
|
-
var ReadActionConfig = ActionConfigBase.
|
|
2658
|
-
|
|
2659
|
-
type:
|
|
2599
|
+
var ReadActionConfig = ActionConfigBase.merge(
|
|
2600
|
+
import_zod19.z.object({
|
|
2601
|
+
type: import_zod19.z.literal(ActionType.READ),
|
|
2660
2602
|
review: DeclarationReviewConfig.describe(
|
|
2661
2603
|
"Configuration of the review page for read-only view."
|
|
2662
|
-
),
|
|
2663
|
-
conditionals: z20.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2664
|
-
}).shape
|
|
2665
|
-
);
|
|
2666
|
-
var DeclareConfig = DeclarationActionBase.extend(
|
|
2667
|
-
z20.object({
|
|
2668
|
-
type: z20.literal(ActionType.DECLARE),
|
|
2669
|
-
review: DeclarationReviewConfig.describe(
|
|
2670
|
-
"Configuration of the review page fields."
|
|
2671
2604
|
)
|
|
2672
|
-
})
|
|
2605
|
+
})
|
|
2673
2606
|
);
|
|
2674
|
-
var
|
|
2675
|
-
|
|
2676
|
-
type:
|
|
2677
|
-
})
|
|
2607
|
+
var DeclareConfig = DeclarationActionBase.merge(
|
|
2608
|
+
import_zod19.z.object({
|
|
2609
|
+
type: import_zod19.z.literal(ActionType.DECLARE)
|
|
2610
|
+
})
|
|
2611
|
+
);
|
|
2612
|
+
var ValidateConfig = DeclarationActionBase.merge(
|
|
2613
|
+
import_zod19.z.object({
|
|
2614
|
+
type: import_zod19.z.literal(ActionType.VALIDATE)
|
|
2615
|
+
})
|
|
2678
2616
|
);
|
|
2679
|
-
var
|
|
2680
|
-
|
|
2681
|
-
type:
|
|
2682
|
-
})
|
|
2617
|
+
var RegisterConfig = DeclarationActionBase.merge(
|
|
2618
|
+
import_zod19.z.object({
|
|
2619
|
+
type: import_zod19.z.literal(ActionType.REGISTER)
|
|
2620
|
+
})
|
|
2683
2621
|
);
|
|
2684
|
-
var
|
|
2685
|
-
|
|
2686
|
-
type:
|
|
2687
|
-
})
|
|
2622
|
+
var RejectDeclarationConfig = ActionConfigBase.merge(
|
|
2623
|
+
import_zod19.z.object({
|
|
2624
|
+
type: import_zod19.z.literal(ActionType.REJECT)
|
|
2625
|
+
})
|
|
2688
2626
|
);
|
|
2689
|
-
var
|
|
2690
|
-
|
|
2691
|
-
type:
|
|
2627
|
+
var ArchiveConfig = ActionConfigBase.merge(
|
|
2628
|
+
import_zod19.z.object({
|
|
2629
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE)
|
|
2630
|
+
})
|
|
2631
|
+
);
|
|
2632
|
+
var DeleteConfig = ActionConfigBase.merge(
|
|
2633
|
+
import_zod19.z.object({
|
|
2634
|
+
type: import_zod19.z.literal(ActionType.DELETE)
|
|
2635
|
+
})
|
|
2636
|
+
);
|
|
2637
|
+
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
|
2638
|
+
import_zod19.z.object({
|
|
2639
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
|
|
2692
2640
|
printForm: ActionFormConfig
|
|
2693
|
-
})
|
|
2641
|
+
})
|
|
2694
2642
|
);
|
|
2695
|
-
var RequestCorrectionConfig = ActionConfigBase.
|
|
2696
|
-
|
|
2697
|
-
type:
|
|
2643
|
+
var RequestCorrectionConfig = ActionConfigBase.merge(
|
|
2644
|
+
import_zod19.z.object({
|
|
2645
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION),
|
|
2698
2646
|
correctionForm: ActionFormConfig
|
|
2699
|
-
})
|
|
2647
|
+
})
|
|
2700
2648
|
);
|
|
2701
|
-
var
|
|
2702
|
-
|
|
2703
|
-
type:
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
)
|
|
2649
|
+
var RejectCorrectionConfig = ActionConfigBase.merge(
|
|
2650
|
+
import_zod19.z.object({
|
|
2651
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION)
|
|
2652
|
+
})
|
|
2653
|
+
);
|
|
2654
|
+
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
|
2655
|
+
import_zod19.z.object({
|
|
2656
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION)
|
|
2709
2657
|
})
|
|
2710
2658
|
);
|
|
2711
|
-
var ActionConfig =
|
|
2659
|
+
var ActionConfig = import_zod19.z.discriminatedUnion("type", [
|
|
2712
2660
|
/*
|
|
2713
2661
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2714
2662
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
2715
2663
|
*/
|
|
2716
|
-
ReadActionConfig.
|
|
2717
|
-
DeclareConfig.
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2664
|
+
ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
|
|
2665
|
+
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
|
2666
|
+
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
|
2667
|
+
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
|
2668
|
+
ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
|
|
2669
|
+
RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
|
|
2670
|
+
DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
|
|
2671
|
+
PrintCertificateActionConfig.openapi({
|
|
2672
|
+
ref: "PrintCertificateActionConfig"
|
|
2723
2673
|
}),
|
|
2724
|
-
RequestCorrectionConfig.
|
|
2725
|
-
|
|
2674
|
+
RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
|
|
2675
|
+
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
|
2676
|
+
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
|
2726
2677
|
]).describe(
|
|
2727
2678
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
2728
|
-
).
|
|
2729
|
-
var
|
|
2730
|
-
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
2731
|
-
);
|
|
2732
|
-
var DeclarationActionConfig = z20.discriminatedUnion("type", [
|
|
2679
|
+
).openapi({ ref: "ActionConfig" });
|
|
2680
|
+
var DeclarationActionConfig = import_zod19.z.discriminatedUnion("type", [
|
|
2733
2681
|
DeclareConfig,
|
|
2734
2682
|
ValidateConfig,
|
|
2735
2683
|
RegisterConfig
|
|
2736
2684
|
]);
|
|
2737
2685
|
|
|
2738
2686
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
2739
|
-
var
|
|
2740
|
-
var FontFamily =
|
|
2741
|
-
normal:
|
|
2742
|
-
bold:
|
|
2743
|
-
italics:
|
|
2744
|
-
bolditalics:
|
|
2687
|
+
var import_zod20 = require("zod");
|
|
2688
|
+
var FontFamily = import_zod20.z.object({
|
|
2689
|
+
normal: import_zod20.z.string(),
|
|
2690
|
+
bold: import_zod20.z.string(),
|
|
2691
|
+
italics: import_zod20.z.string(),
|
|
2692
|
+
bolditalics: import_zod20.z.string()
|
|
2745
2693
|
});
|
|
2746
|
-
var CertificateConfig =
|
|
2747
|
-
id:
|
|
2748
|
-
event:
|
|
2749
|
-
isV2Template:
|
|
2694
|
+
var CertificateConfig = import_zod20.z.object({
|
|
2695
|
+
id: import_zod20.z.string(),
|
|
2696
|
+
event: import_zod20.z.string(),
|
|
2697
|
+
isV2Template: import_zod20.z.boolean().optional(),
|
|
2750
2698
|
label: TranslationConfig,
|
|
2751
|
-
isDefault:
|
|
2752
|
-
fee:
|
|
2753
|
-
onTime:
|
|
2754
|
-
late:
|
|
2755
|
-
delayed:
|
|
2699
|
+
isDefault: import_zod20.z.boolean(),
|
|
2700
|
+
fee: import_zod20.z.object({
|
|
2701
|
+
onTime: import_zod20.z.number(),
|
|
2702
|
+
late: import_zod20.z.number(),
|
|
2703
|
+
delayed: import_zod20.z.number()
|
|
2756
2704
|
}),
|
|
2757
|
-
svgUrl:
|
|
2758
|
-
fonts:
|
|
2759
|
-
conditionals:
|
|
2705
|
+
svgUrl: import_zod20.z.string(),
|
|
2706
|
+
fonts: import_zod20.z.record(FontFamily).optional(),
|
|
2707
|
+
conditionals: import_zod20.z.array(ShowConditional).optional()
|
|
2760
2708
|
});
|
|
2761
2709
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
2762
|
-
hash:
|
|
2763
|
-
svg:
|
|
2710
|
+
hash: import_zod20.z.string().optional(),
|
|
2711
|
+
svg: import_zod20.z.string()
|
|
2764
2712
|
});
|
|
2765
2713
|
|
|
2766
2714
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
2767
|
-
var
|
|
2768
|
-
var LanguageConfig =
|
|
2769
|
-
lang:
|
|
2715
|
+
var import_zod21 = require("zod");
|
|
2716
|
+
var LanguageConfig = import_zod21.z.object({
|
|
2717
|
+
lang: import_zod21.z.string(),
|
|
2770
2718
|
/**
|
|
2771
2719
|
* client.csv contents
|
|
2772
2720
|
*/
|
|
2773
|
-
messages:
|
|
2721
|
+
messages: import_zod21.z.record(import_zod21.z.string())
|
|
2774
2722
|
});
|
|
2775
2723
|
|
|
2776
2724
|
// ../commons/src/events/EventConfig.ts
|
|
2777
|
-
var
|
|
2725
|
+
var import_zod26 = require("zod");
|
|
2778
2726
|
|
|
2779
2727
|
// ../commons/src/events/SummaryConfig.ts
|
|
2780
|
-
var
|
|
2781
|
-
var BaseField2 =
|
|
2728
|
+
var import_zod22 = require("zod");
|
|
2729
|
+
var BaseField2 = import_zod22.z.object({
|
|
2782
2730
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
2783
2731
|
"Default message displayed when the field value is empty."
|
|
2784
2732
|
),
|
|
2785
|
-
conditionals:
|
|
2733
|
+
conditionals: import_zod22.z.array(ShowConditional).default([]).optional()
|
|
2786
2734
|
});
|
|
2787
2735
|
var ReferenceField = BaseField2.extend({
|
|
2788
|
-
fieldId:
|
|
2736
|
+
fieldId: import_zod22.z.string(),
|
|
2789
2737
|
label: TranslationConfig.optional().describe(
|
|
2790
2738
|
"Overrides the default label from the referenced field when provided."
|
|
2791
2739
|
)
|
|
2792
2740
|
}).describe("Field referencing existing event data by field ID.");
|
|
2793
2741
|
var Field = BaseField2.extend({
|
|
2794
|
-
id:
|
|
2742
|
+
id: import_zod22.z.string().describe("Identifier of the summary field."),
|
|
2795
2743
|
value: TranslationConfig.describe(
|
|
2796
2744
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
2797
2745
|
),
|
|
2798
2746
|
label: TranslationConfig
|
|
2799
2747
|
}).describe("Custom field defined for the summary view.");
|
|
2800
|
-
var SummaryConfig =
|
|
2801
|
-
fields:
|
|
2748
|
+
var SummaryConfig = import_zod22.z.object({
|
|
2749
|
+
fields: import_zod22.z.array(import_zod22.z.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
2802
2750
|
}).describe("Configuration of the event summary section.");
|
|
2803
2751
|
|
|
2804
2752
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
2805
|
-
var
|
|
2806
|
-
var MatchType =
|
|
2807
|
-
var BaseField3 =
|
|
2808
|
-
config:
|
|
2753
|
+
var import_zod23 = require("zod");
|
|
2754
|
+
var MatchType = import_zod23.z.enum(["fuzzy", "exact", "range", "within"]);
|
|
2755
|
+
var BaseField3 = import_zod23.z.object({
|
|
2756
|
+
config: import_zod23.z.object({
|
|
2809
2757
|
type: MatchType.describe(
|
|
2810
2758
|
"Determines the search type of field. How to match value."
|
|
2811
2759
|
),
|
|
2812
|
-
searchFields:
|
|
2760
|
+
searchFields: import_zod23.z.array(import_zod23.z.string()).optional().describe(
|
|
2813
2761
|
`
|
|
2814
2762
|
Defines multiple form fields that should be searched when this field has a value.
|
|
2815
2763
|
All specified fields will be combined using OR logic.
|
|
@@ -2819,7 +2767,7 @@ var BaseField3 = z24.object({
|
|
|
2819
2767
|
`
|
|
2820
2768
|
)
|
|
2821
2769
|
}),
|
|
2822
|
-
type:
|
|
2770
|
+
type: import_zod23.z.nativeEnum(FieldType).optional().describe(
|
|
2823
2771
|
`
|
|
2824
2772
|
Explicitly specify the field type for searchFields.
|
|
2825
2773
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -2833,7 +2781,7 @@ var BaseField3 = z24.object({
|
|
|
2833
2781
|
This is required when searchFields is defined.
|
|
2834
2782
|
`
|
|
2835
2783
|
),
|
|
2836
|
-
options:
|
|
2784
|
+
options: import_zod23.z.array(SelectOption).optional(),
|
|
2837
2785
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
2838
2786
|
`
|
|
2839
2787
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -2854,7 +2802,7 @@ var BaseField3 = z24.object({
|
|
|
2854
2802
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
2855
2803
|
`
|
|
2856
2804
|
),
|
|
2857
|
-
conditionals:
|
|
2805
|
+
conditionals: import_zod23.z.array(FieldConditional).default([]).optional().describe(
|
|
2858
2806
|
`
|
|
2859
2807
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
2860
2808
|
|
|
@@ -2868,20 +2816,20 @@ var BaseField3 = z24.object({
|
|
|
2868
2816
|
are always rendered in the advanced search form.
|
|
2869
2817
|
`
|
|
2870
2818
|
),
|
|
2871
|
-
validations:
|
|
2819
|
+
validations: import_zod23.z.array(ValidationConfig).default([]).optional().describe(
|
|
2872
2820
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
2873
2821
|
)
|
|
2874
2822
|
});
|
|
2875
|
-
var SearchQueryParams =
|
|
2876
|
-
eventType:
|
|
2823
|
+
var SearchQueryParams = import_zod23.z.object({
|
|
2824
|
+
eventType: import_zod23.z.string().optional().describe(
|
|
2877
2825
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
2878
2826
|
)
|
|
2879
2827
|
}).catchall(FieldValue);
|
|
2880
2828
|
var FieldConfigSchema = BaseField3.extend({
|
|
2881
|
-
fieldId:
|
|
2882
|
-
fieldType:
|
|
2829
|
+
fieldId: import_zod23.z.string(),
|
|
2830
|
+
fieldType: import_zod23.z.literal("field")
|
|
2883
2831
|
});
|
|
2884
|
-
var EventFieldIdInput =
|
|
2832
|
+
var EventFieldIdInput = import_zod23.z.enum([
|
|
2885
2833
|
"trackingId",
|
|
2886
2834
|
"status",
|
|
2887
2835
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -2889,7 +2837,7 @@ var EventFieldIdInput = z24.enum([
|
|
|
2889
2837
|
"updatedAt"
|
|
2890
2838
|
]);
|
|
2891
2839
|
var METADATA_FIELD_PREFIX = "event.";
|
|
2892
|
-
var EventFieldId =
|
|
2840
|
+
var EventFieldId = import_zod23.z.enum([
|
|
2893
2841
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
2894
2842
|
`${METADATA_FIELD_PREFIX}status`,
|
|
2895
2843
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -2898,29 +2846,29 @@ var EventFieldId = z24.enum([
|
|
|
2898
2846
|
]);
|
|
2899
2847
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
2900
2848
|
fieldId: EventFieldId,
|
|
2901
|
-
fieldType:
|
|
2849
|
+
fieldType: import_zod23.z.literal("event")
|
|
2902
2850
|
});
|
|
2903
|
-
var AdvancedSearchField =
|
|
2851
|
+
var AdvancedSearchField = import_zod23.z.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
2904
2852
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
2905
2853
|
if (!data.label) {
|
|
2906
2854
|
ctx.addIssue({
|
|
2907
|
-
code:
|
|
2855
|
+
code: import_zod23.z.ZodIssueCode.custom,
|
|
2908
2856
|
message: "label is required when config.searchFields is defined.",
|
|
2909
2857
|
path: ["label"]
|
|
2910
2858
|
});
|
|
2911
2859
|
}
|
|
2912
2860
|
if (!data.type) {
|
|
2913
2861
|
ctx.addIssue({
|
|
2914
|
-
code:
|
|
2862
|
+
code: import_zod23.z.ZodIssueCode.custom,
|
|
2915
2863
|
message: "type is required when config.searchFields is defined.",
|
|
2916
2864
|
path: ["type"]
|
|
2917
2865
|
});
|
|
2918
2866
|
}
|
|
2919
2867
|
}
|
|
2920
2868
|
});
|
|
2921
|
-
var AdvancedSearchConfig =
|
|
2869
|
+
var AdvancedSearchConfig = import_zod23.z.object({
|
|
2922
2870
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
2923
|
-
fields:
|
|
2871
|
+
fields: import_zod23.z.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
2924
2872
|
});
|
|
2925
2873
|
|
|
2926
2874
|
// ../commons/src/events/utils.ts
|
|
@@ -2929,14 +2877,14 @@ var import_lodash = require("lodash");
|
|
|
2929
2877
|
// ../commons/src/conditionals/validate.ts
|
|
2930
2878
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
2931
2879
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
2932
|
-
var
|
|
2880
|
+
var import_zod25 = require("zod");
|
|
2933
2881
|
var import_date_fns = require("date-fns");
|
|
2934
2882
|
|
|
2935
2883
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
2936
|
-
var
|
|
2884
|
+
var import_zod24 = require("zod");
|
|
2937
2885
|
function getDynamicNameValue(field3) {
|
|
2938
2886
|
const nameConfiguration = field3.configuration?.name;
|
|
2939
|
-
return
|
|
2887
|
+
return import_zod24.z.object({
|
|
2940
2888
|
firstname: nameConfiguration?.firstname?.required ? NonEmptyTextValue : TextValue,
|
|
2941
2889
|
surname: nameConfiguration?.surname?.required ? NonEmptyTextValue : TextValue,
|
|
2942
2890
|
middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
|
|
@@ -2946,10 +2894,7 @@ function getDynamicAddressFieldValue(field3) {
|
|
|
2946
2894
|
const schema = field3.required ? AddressFieldValue : AddressFieldUpdateValue;
|
|
2947
2895
|
const configIds = field3.configuration?.streetAddressForm?.map((a) => a.id) ?? [];
|
|
2948
2896
|
return schema.refine((arg) => {
|
|
2949
|
-
|
|
2950
|
-
return true;
|
|
2951
|
-
}
|
|
2952
|
-
const submittedKeys = Object.keys(arg.streetLevelDetails ?? {});
|
|
2897
|
+
const submittedKeys = Object.keys(arg?.streetLevelDetails ?? {});
|
|
2953
2898
|
const invalidKeys = submittedKeys.filter((k) => !configIds.includes(k));
|
|
2954
2899
|
if (invalidKeys.length) {
|
|
2955
2900
|
console.log(
|
|
@@ -3232,9 +3177,9 @@ var ajv = new import__.default({
|
|
|
3232
3177
|
strict: false
|
|
3233
3178
|
// Allow minContains and other newer features
|
|
3234
3179
|
});
|
|
3235
|
-
var DataContext =
|
|
3236
|
-
rootData:
|
|
3237
|
-
$leafAdminStructureLocationIds:
|
|
3180
|
+
var DataContext = import_zod25.z.object({
|
|
3181
|
+
rootData: import_zod25.z.object({
|
|
3182
|
+
$leafAdminStructureLocationIds: import_zod25.z.array(import_zod25.z.object({ id: UUID }))
|
|
3238
3183
|
})
|
|
3239
3184
|
});
|
|
3240
3185
|
(0, import_ajv_formats.default)(ajv);
|
|
@@ -3314,15 +3259,13 @@ function isOnline() {
|
|
|
3314
3259
|
}
|
|
3315
3260
|
return true;
|
|
3316
3261
|
}
|
|
3317
|
-
function isConditionMet(conditional, values, context
|
|
3262
|
+
function isConditionMet(conditional, values, context) {
|
|
3318
3263
|
return validate(conditional, {
|
|
3319
3264
|
$form: values,
|
|
3320
3265
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3321
3266
|
$online: isOnline(),
|
|
3322
3267
|
$user: context.user,
|
|
3323
|
-
$leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? []
|
|
3324
|
-
$flags: eventIndex?.flags ?? [],
|
|
3325
|
-
$status: eventIndex?.status
|
|
3268
|
+
$leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? []
|
|
3326
3269
|
});
|
|
3327
3270
|
}
|
|
3328
3271
|
function getConditionalActionsForField(field3, values) {
|
|
@@ -3331,9 +3274,9 @@ function getConditionalActionsForField(field3, values) {
|
|
|
3331
3274
|
}
|
|
3332
3275
|
return field3.conditionals.filter((conditional) => validate(conditional.conditional, values)).map((conditional) => conditional.type);
|
|
3333
3276
|
}
|
|
3334
|
-
function areConditionsMet(conditions, values, context
|
|
3277
|
+
function areConditionsMet(conditions, values, context) {
|
|
3335
3278
|
return conditions.every(
|
|
3336
|
-
(condition) => isConditionMet(condition.conditional, values, context
|
|
3279
|
+
(condition) => isConditionMet(condition.conditional, values, context)
|
|
3337
3280
|
);
|
|
3338
3281
|
}
|
|
3339
3282
|
function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
@@ -3365,37 +3308,6 @@ function isFieldEnabled(field3, form, context) {
|
|
|
3365
3308
|
function isFieldDisplayedOnReview(field3, form, context) {
|
|
3366
3309
|
return isFieldVisible(field3, form, context) && isFieldConditionMet(field3, form, ConditionalType.DISPLAY_ON_REVIEW, context);
|
|
3367
3310
|
}
|
|
3368
|
-
function isActionConditionMet(actionConfig, event2, context, conditionalType) {
|
|
3369
|
-
if (!actionConfig.conditionals) {
|
|
3370
|
-
return true;
|
|
3371
|
-
}
|
|
3372
|
-
const rule = actionConfig.conditionals.find(
|
|
3373
|
-
(conditional) => conditional.type === conditionalType
|
|
3374
|
-
);
|
|
3375
|
-
if (!rule) {
|
|
3376
|
-
return true;
|
|
3377
|
-
}
|
|
3378
|
-
return isConditionMet(rule.conditional, event2.declaration, context, event2);
|
|
3379
|
-
}
|
|
3380
|
-
function isActionEnabled(actionConfig, event2, context) {
|
|
3381
|
-
return isActionConditionMet(
|
|
3382
|
-
actionConfig,
|
|
3383
|
-
event2,
|
|
3384
|
-
context,
|
|
3385
|
-
ConditionalType.ENABLE
|
|
3386
|
-
);
|
|
3387
|
-
}
|
|
3388
|
-
function isActionVisible(actionConfig, event2, context) {
|
|
3389
|
-
return isActionConditionMet(
|
|
3390
|
-
actionConfig,
|
|
3391
|
-
event2,
|
|
3392
|
-
context,
|
|
3393
|
-
ConditionalType.SHOW
|
|
3394
|
-
);
|
|
3395
|
-
}
|
|
3396
|
-
function isActionAvailable(actionConfig, event2, context) {
|
|
3397
|
-
return isActionVisible(actionConfig, event2, context) && isActionEnabled(actionConfig, event2, context);
|
|
3398
|
-
}
|
|
3399
3311
|
var errorMessages = {
|
|
3400
3312
|
hiddenField: {
|
|
3401
3313
|
id: "error.hidden",
|
|
@@ -3440,51 +3352,43 @@ function createIntlError(message) {
|
|
|
3440
3352
|
}
|
|
3441
3353
|
};
|
|
3442
3354
|
}
|
|
3443
|
-
function zodToIntlErrorMap(issue,
|
|
3355
|
+
function zodToIntlErrorMap(issue, _ctx, field3) {
|
|
3444
3356
|
const requiredMessage = field3.required && typeof field3.required === "object" ? field3.required.message : errorMessages.requiredField;
|
|
3445
3357
|
switch (issue.code) {
|
|
3446
|
-
case "
|
|
3447
|
-
if (
|
|
3358
|
+
case "invalid_string": {
|
|
3359
|
+
if (_ctx.data === "") {
|
|
3448
3360
|
return createIntlError(requiredMessage);
|
|
3449
3361
|
}
|
|
3362
|
+
if (issue.validation === "date") {
|
|
3363
|
+
return createIntlError(errorMessages.invalidDate);
|
|
3364
|
+
}
|
|
3365
|
+
if (issue.validation === "email") {
|
|
3366
|
+
return createIntlError(errorMessages.invalidEmail);
|
|
3367
|
+
}
|
|
3450
3368
|
break;
|
|
3451
3369
|
}
|
|
3452
3370
|
case "invalid_type": {
|
|
3453
|
-
if (issue.
|
|
3371
|
+
if (issue.expected !== issue.received && (issue.received === "undefined" || issue.received === "null")) {
|
|
3454
3372
|
return createIntlError(requiredMessage);
|
|
3455
3373
|
}
|
|
3456
|
-
|
|
3374
|
+
break;
|
|
3375
|
+
}
|
|
3376
|
+
case "too_small": {
|
|
3377
|
+
if (issue.message === void 0) {
|
|
3378
|
+
return createIntlError(requiredMessage);
|
|
3379
|
+
}
|
|
3380
|
+
break;
|
|
3457
3381
|
}
|
|
3458
3382
|
case "invalid_union": {
|
|
3459
|
-
for (const
|
|
3460
|
-
for (const e of
|
|
3461
|
-
|
|
3462
|
-
if (intlErr.message.message.id !== "error.required") {
|
|
3383
|
+
for (const { issues } of issue.unionErrors) {
|
|
3384
|
+
for (const e of issues) {
|
|
3385
|
+
if (zodToIntlErrorMap(e, _ctx, field3).message.message.id !== "error.required") {
|
|
3463
3386
|
return createIntlError(errorMessages.invalidInput);
|
|
3464
3387
|
}
|
|
3465
3388
|
}
|
|
3466
3389
|
}
|
|
3467
3390
|
return createIntlError(requiredMessage);
|
|
3468
3391
|
}
|
|
3469
|
-
case "invalid_format":
|
|
3470
|
-
if (value === "") {
|
|
3471
|
-
return createIntlError(requiredMessage);
|
|
3472
|
-
}
|
|
3473
|
-
if (issue.format === "date-time" || issue.format === "date") {
|
|
3474
|
-
return createIntlError(errorMessages.invalidDate);
|
|
3475
|
-
}
|
|
3476
|
-
if (issue.format === "email") {
|
|
3477
|
-
return createIntlError(errorMessages.invalidEmail);
|
|
3478
|
-
}
|
|
3479
|
-
return createIntlError(errorMessages.invalidInput);
|
|
3480
|
-
case "custom":
|
|
3481
|
-
case "unrecognized_keys":
|
|
3482
|
-
case "invalid_value":
|
|
3483
|
-
case "invalid_key":
|
|
3484
|
-
case "too_big":
|
|
3485
|
-
case "not_multiple_of":
|
|
3486
|
-
case "invalid_element":
|
|
3487
|
-
return createIntlError(errorMessages.invalidInput);
|
|
3488
3392
|
}
|
|
3489
3393
|
return createIntlError(errorMessages.invalidInput);
|
|
3490
3394
|
}
|
|
@@ -3504,7 +3408,7 @@ function validateFieldInput({
|
|
|
3504
3408
|
const zodType = mapFieldTypeToZod(field3, actionType);
|
|
3505
3409
|
const rawError = zodType.safeParse(value, {
|
|
3506
3410
|
// @ts-expect-error
|
|
3507
|
-
|
|
3411
|
+
errorMap: (issue, _ctx) => zodToIntlErrorMap(issue, _ctx, field3)
|
|
3508
3412
|
});
|
|
3509
3413
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
|
3510
3414
|
}
|
|
@@ -3539,6 +3443,7 @@ function runFieldValidations({
|
|
|
3539
3443
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
3540
3444
|
* Make sure that the context contains only the locations that are needed for validation.
|
|
3541
3445
|
* E.g. if the user is a leaf admin, only the leaf locations under their admin structure are needed.
|
|
3446
|
+
*
|
|
3542
3447
|
* Loading few megabytes of locations to memory just for validation is not efficient and will choke the application.
|
|
3543
3448
|
*/
|
|
3544
3449
|
$leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? [],
|
|
@@ -3605,7 +3510,7 @@ function areCertificateConditionsMet(conditions, values) {
|
|
|
3605
3510
|
}
|
|
3606
3511
|
|
|
3607
3512
|
// ../commons/src/utils.ts
|
|
3608
|
-
var
|
|
3513
|
+
var z26 = __toESM(require("zod"));
|
|
3609
3514
|
function getOrThrow(x, message) {
|
|
3610
3515
|
if (x === void 0 || x === null) {
|
|
3611
3516
|
throw new Error(message);
|
|
@@ -3615,11 +3520,11 @@ function getOrThrow(x, message) {
|
|
|
3615
3520
|
function joinValues(values, separator = " ") {
|
|
3616
3521
|
return values.filter((value) => !!value).join(separator).trim();
|
|
3617
3522
|
}
|
|
3618
|
-
var FullNameV1 =
|
|
3619
|
-
|
|
3620
|
-
use:
|
|
3621
|
-
family:
|
|
3622
|
-
given:
|
|
3523
|
+
var FullNameV1 = z26.array(
|
|
3524
|
+
z26.object({
|
|
3525
|
+
use: z26.string(),
|
|
3526
|
+
family: z26.string(),
|
|
3527
|
+
given: z26.array(z26.string())
|
|
3623
3528
|
})
|
|
3624
3529
|
);
|
|
3625
3530
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -3644,6 +3549,9 @@ function ageToDate(age, asOfDate) {
|
|
|
3644
3549
|
const date = new Date(asOfDate);
|
|
3645
3550
|
return DateValue.parse((0, import_date_fns2.format)((0, import_date_fns2.subYears)(date, age), "yyyy-MM-dd"));
|
|
3646
3551
|
}
|
|
3552
|
+
function isDeclarationActionConfig(action) {
|
|
3553
|
+
return DeclarationActions.safeParse(action.type).success;
|
|
3554
|
+
}
|
|
3647
3555
|
function getDeclarationFields(configuration) {
|
|
3648
3556
|
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
3649
3557
|
}
|
|
@@ -3653,38 +3561,6 @@ function getDeclarationPages(configuration) {
|
|
|
3653
3561
|
function getDeclaration(configuration) {
|
|
3654
3562
|
return configuration.declaration;
|
|
3655
3563
|
}
|
|
3656
|
-
function isActionConfigType(type) {
|
|
3657
|
-
return actionConfigTypes.has(type);
|
|
3658
|
-
}
|
|
3659
|
-
function getActionConfig({
|
|
3660
|
-
eventConfiguration,
|
|
3661
|
-
actionType,
|
|
3662
|
-
customActionType
|
|
3663
|
-
}) {
|
|
3664
|
-
return eventConfiguration.actions.find((a) => {
|
|
3665
|
-
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
3666
|
-
return a.customActionType === customActionType;
|
|
3667
|
-
}
|
|
3668
|
-
if (actionType === ActionType.NOTIFY) {
|
|
3669
|
-
return a.type === ActionType.DECLARE;
|
|
3670
|
-
}
|
|
3671
|
-
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
3672
|
-
return a.type === ActionType.REQUEST_CORRECTION;
|
|
3673
|
-
}
|
|
3674
|
-
return a.type === actionType;
|
|
3675
|
-
});
|
|
3676
|
-
}
|
|
3677
|
-
function getCustomActionFields(eventConfiguration, customActionType) {
|
|
3678
|
-
const actionConfig = getActionConfig({
|
|
3679
|
-
eventConfiguration,
|
|
3680
|
-
customActionType,
|
|
3681
|
-
actionType: ActionType.CUSTOM
|
|
3682
|
-
});
|
|
3683
|
-
if (!actionConfig || !("form" in actionConfig)) {
|
|
3684
|
-
return [];
|
|
3685
|
-
}
|
|
3686
|
-
return actionConfig.form;
|
|
3687
|
-
}
|
|
3688
3564
|
function getPrintCertificatePages(configuration) {
|
|
3689
3565
|
const action = configuration.actions.find(
|
|
3690
3566
|
(a) => a.type === ActionType.PRINT_CERTIFICATE
|
|
@@ -3701,7 +3577,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
3701
3577
|
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
3702
3578
|
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
3703
3579
|
}
|
|
3704
|
-
if (
|
|
3580
|
+
if (isDeclarationActionConfig(actionConfig)) {
|
|
3705
3581
|
return actionConfig.review.fields;
|
|
3706
3582
|
}
|
|
3707
3583
|
return [];
|
|
@@ -3730,17 +3606,13 @@ function getActionReview(configuration, actionType) {
|
|
|
3730
3606
|
const [actionConfig] = configuration.actions.filter(
|
|
3731
3607
|
(a) => a.type === actionType
|
|
3732
3608
|
);
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3609
|
+
return getOrThrow(
|
|
3610
|
+
actionConfig.review,
|
|
3611
|
+
`No review config found for ${actionType}`
|
|
3612
|
+
);
|
|
3737
3613
|
}
|
|
3738
3614
|
function getActionReviewFields(configuration, actionType) {
|
|
3739
|
-
|
|
3740
|
-
if (!review) {
|
|
3741
|
-
return [];
|
|
3742
|
-
}
|
|
3743
|
-
return review.fields;
|
|
3615
|
+
return getActionReview(configuration, actionType).fields;
|
|
3744
3616
|
}
|
|
3745
3617
|
function isPageVisible(page, formValues, context) {
|
|
3746
3618
|
if (!page.conditional) {
|
|
@@ -3795,7 +3667,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
|
3795
3667
|
declaration: {},
|
|
3796
3668
|
annotation: {},
|
|
3797
3669
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3798
|
-
createdByUserType: TokenUserType.
|
|
3670
|
+
createdByUserType: TokenUserType.Enum.user,
|
|
3799
3671
|
createdBy: "@todo",
|
|
3800
3672
|
status: ActionStatus.Accepted,
|
|
3801
3673
|
transactionId: "@todo",
|
|
@@ -3997,8 +3869,10 @@ function aggregateActionDeclarations(event2) {
|
|
|
3997
3869
|
}
|
|
3998
3870
|
|
|
3999
3871
|
// ../commons/src/events/EventConfig.ts
|
|
4000
|
-
var
|
|
4001
|
-
|
|
3872
|
+
var import_zod_openapi10 = require("zod-openapi");
|
|
3873
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
|
3874
|
+
var EventConfig = import_zod26.z.object({
|
|
3875
|
+
id: import_zod26.z.string().describe(
|
|
4002
3876
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4003
3877
|
),
|
|
4004
3878
|
dateOfEvent: FieldReference.optional().describe(
|
|
@@ -4016,17 +3890,14 @@ var EventConfig = z28.object({
|
|
|
4016
3890
|
label: TranslationConfig.describe(
|
|
4017
3891
|
"Human-readable label for the event type."
|
|
4018
3892
|
),
|
|
4019
|
-
actions:
|
|
3893
|
+
actions: import_zod26.z.array(ActionConfig).describe(
|
|
4020
3894
|
"Configuration of system-defined actions associated with the event."
|
|
4021
3895
|
),
|
|
4022
3896
|
declaration: DeclarationFormConfig.describe(
|
|
4023
3897
|
"Configuration of the form used to gather event data."
|
|
4024
3898
|
),
|
|
4025
|
-
advancedSearch:
|
|
3899
|
+
advancedSearch: import_zod26.z.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4026
3900
|
"Configuration of fields available in the advanced search feature."
|
|
4027
|
-
),
|
|
4028
|
-
flags: z28.array(FlagConfig).optional().default([]).describe(
|
|
4029
|
-
"Configuration of flags associated with the actions of this event type."
|
|
4030
3901
|
)
|
|
4031
3902
|
}).superRefine((event2, ctx) => {
|
|
4032
3903
|
const allFields = findAllFields(event2);
|
|
@@ -4078,21 +3949,8 @@ var EventConfig = z28.object({
|
|
|
4078
3949
|
});
|
|
4079
3950
|
}
|
|
4080
3951
|
}
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
(action) => action.flags.map((flag2) => flag2.id)
|
|
4084
|
-
);
|
|
4085
|
-
for (const actionFlagId of actionFlagIds) {
|
|
4086
|
-
if (!configuredFlagIds.includes(actionFlagId)) {
|
|
4087
|
-
ctx.addIssue({
|
|
4088
|
-
code: "custom",
|
|
4089
|
-
message: `Action flag id must match a configured flag in the flags array. Invalid action flag ID for event '${event2.id}': '${actionFlagId}'`,
|
|
4090
|
-
path: ["actions"]
|
|
4091
|
-
});
|
|
4092
|
-
}
|
|
4093
|
-
}
|
|
4094
|
-
}).meta({
|
|
4095
|
-
id: "EventConfig"
|
|
3952
|
+
}).openapi({
|
|
3953
|
+
ref: "EventConfig"
|
|
4096
3954
|
}).describe("Configuration defining an event type.");
|
|
4097
3955
|
|
|
4098
3956
|
// ../commons/src/events/EventConfigInput.ts
|
|
@@ -4102,7 +3960,7 @@ var definePage = (page) => PageConfig.parse(page);
|
|
|
4102
3960
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
4103
3961
|
|
|
4104
3962
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4105
|
-
var
|
|
3963
|
+
var import_zod30 = require("zod");
|
|
4106
3964
|
|
|
4107
3965
|
// ../commons/src/conditionals/conditionals.ts
|
|
4108
3966
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -4147,7 +4005,7 @@ function not(condition) {
|
|
|
4147
4005
|
required: []
|
|
4148
4006
|
});
|
|
4149
4007
|
}
|
|
4150
|
-
function
|
|
4008
|
+
function never() {
|
|
4151
4009
|
return not(alwaysTrue());
|
|
4152
4010
|
}
|
|
4153
4011
|
function jsonFieldPath(field3) {
|
|
@@ -4289,33 +4147,6 @@ function defineComparison(field3, value, keyword) {
|
|
|
4289
4147
|
required: [field3.$$field]
|
|
4290
4148
|
});
|
|
4291
4149
|
}
|
|
4292
|
-
function flag(flagvalue) {
|
|
4293
|
-
return defineConditional({
|
|
4294
|
-
type: "object",
|
|
4295
|
-
properties: {
|
|
4296
|
-
$flags: {
|
|
4297
|
-
type: "array",
|
|
4298
|
-
contains: {
|
|
4299
|
-
type: "string",
|
|
4300
|
-
const: flagvalue
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
},
|
|
4304
|
-
required: ["$flags"]
|
|
4305
|
-
});
|
|
4306
|
-
}
|
|
4307
|
-
function status(statusValue) {
|
|
4308
|
-
return defineConditional({
|
|
4309
|
-
type: "object",
|
|
4310
|
-
properties: {
|
|
4311
|
-
$status: {
|
|
4312
|
-
type: "string",
|
|
4313
|
-
const: statusValue
|
|
4314
|
-
}
|
|
4315
|
-
},
|
|
4316
|
-
required: ["$status"]
|
|
4317
|
-
});
|
|
4318
|
-
}
|
|
4319
4150
|
function createFieldConditionals(fieldId) {
|
|
4320
4151
|
const getDayRange = (field3, days, clause) => ({
|
|
4321
4152
|
type: "object",
|
|
@@ -4823,17 +4654,17 @@ var event = Object.assign(eventFn, {
|
|
|
4823
4654
|
});
|
|
4824
4655
|
|
|
4825
4656
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4826
|
-
var
|
|
4657
|
+
var import_zod27 = require("zod");
|
|
4827
4658
|
var WorkqueueColumnKeysArray = [
|
|
4828
4659
|
...EventMetadataKeysArray,
|
|
4829
4660
|
"title",
|
|
4830
4661
|
"outbox"
|
|
4831
4662
|
];
|
|
4832
|
-
var WorkqueueColumnKeys =
|
|
4833
|
-
var WorkqueueColumnValue =
|
|
4663
|
+
var WorkqueueColumnKeys = import_zod27.z.enum(WorkqueueColumnKeysArray);
|
|
4664
|
+
var WorkqueueColumnValue = import_zod27.z.object({
|
|
4834
4665
|
$event: WorkqueueColumnKeys
|
|
4835
4666
|
});
|
|
4836
|
-
var WorkqueueColumn =
|
|
4667
|
+
var WorkqueueColumn = import_zod27.z.object({
|
|
4837
4668
|
label: TranslationConfig,
|
|
4838
4669
|
value: WorkqueueColumnValue
|
|
4839
4670
|
});
|
|
@@ -4844,57 +4675,57 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4844
4675
|
}
|
|
4845
4676
|
|
|
4846
4677
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4847
|
-
var
|
|
4848
|
-
var SerializableExact =
|
|
4849
|
-
type:
|
|
4850
|
-
term:
|
|
4678
|
+
var import_zod28 = require("zod");
|
|
4679
|
+
var SerializableExact = import_zod28.z.object({
|
|
4680
|
+
type: import_zod28.z.literal("exact"),
|
|
4681
|
+
term: import_zod28.z.union([import_zod28.z.string(), SerializedUserField])
|
|
4851
4682
|
});
|
|
4852
|
-
var SerializableWithin =
|
|
4853
|
-
type:
|
|
4854
|
-
location:
|
|
4683
|
+
var SerializableWithin = import_zod28.z.object({
|
|
4684
|
+
type: import_zod28.z.literal("within"),
|
|
4685
|
+
location: import_zod28.z.union([import_zod28.z.string(), SerializedUserField])
|
|
4855
4686
|
});
|
|
4856
|
-
var SerializedQueryExpression =
|
|
4857
|
-
eventType:
|
|
4858
|
-
status:
|
|
4859
|
-
createdAt:
|
|
4860
|
-
updatedAt:
|
|
4861
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4862
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4863
|
-
|
|
4687
|
+
var SerializedQueryExpression = import_zod28.z.object({
|
|
4688
|
+
eventType: import_zod28.z.string(),
|
|
4689
|
+
status: import_zod28.z.optional(import_zod28.z.union([AnyOfStatus, ExactStatus])),
|
|
4690
|
+
createdAt: import_zod28.z.optional(DateCondition),
|
|
4691
|
+
updatedAt: import_zod28.z.optional(DateCondition),
|
|
4692
|
+
"legalStatuses.REGISTERED.createdAt": import_zod28.z.optional(DateCondition),
|
|
4693
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod28.z.optional(
|
|
4694
|
+
import_zod28.z.union([Within, Exact])
|
|
4864
4695
|
),
|
|
4865
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4866
|
-
createdAtLocation:
|
|
4867
|
-
|
|
4696
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod28.z.optional(Exact),
|
|
4697
|
+
createdAtLocation: import_zod28.z.optional(
|
|
4698
|
+
import_zod28.z.union([SerializableWithin, SerializableExact])
|
|
4868
4699
|
),
|
|
4869
|
-
updatedAtLocation:
|
|
4870
|
-
|
|
4700
|
+
updatedAtLocation: import_zod28.z.optional(
|
|
4701
|
+
import_zod28.z.union([SerializableWithin, SerializableExact])
|
|
4871
4702
|
),
|
|
4872
|
-
assignedTo:
|
|
4873
|
-
createdBy:
|
|
4703
|
+
assignedTo: import_zod28.z.optional(SerializableExact),
|
|
4704
|
+
createdBy: import_zod28.z.optional(SerializableExact),
|
|
4874
4705
|
createdByUserType: ExactUserType,
|
|
4875
|
-
updatedBy:
|
|
4876
|
-
trackingId:
|
|
4877
|
-
flags:
|
|
4706
|
+
updatedBy: import_zod28.z.optional(SerializableExact),
|
|
4707
|
+
trackingId: import_zod28.z.optional(Exact),
|
|
4708
|
+
flags: import_zod28.z.optional(ContainsFlags),
|
|
4878
4709
|
data: QueryInput
|
|
4879
4710
|
}).partial();
|
|
4880
|
-
var Or2 =
|
|
4881
|
-
type:
|
|
4882
|
-
clauses:
|
|
4711
|
+
var Or2 = import_zod28.z.object({
|
|
4712
|
+
type: import_zod28.z.literal("or"),
|
|
4713
|
+
clauses: import_zod28.z.array(SerializedQueryExpression)
|
|
4883
4714
|
});
|
|
4884
|
-
var And2 =
|
|
4885
|
-
type:
|
|
4886
|
-
clauses:
|
|
4715
|
+
var And2 = import_zod28.z.object({
|
|
4716
|
+
type: import_zod28.z.literal("and"),
|
|
4717
|
+
clauses: import_zod28.z.array(SerializedQueryExpression)
|
|
4887
4718
|
});
|
|
4888
|
-
var CountryConfigQueryType =
|
|
4889
|
-
var CountryConfigQueryInputType =
|
|
4719
|
+
var CountryConfigQueryType = import_zod28.z.discriminatedUnion("type", [And2, Or2]);
|
|
4720
|
+
var CountryConfigQueryInputType = import_zod28.z.union([
|
|
4890
4721
|
SerializedQueryExpression,
|
|
4891
4722
|
And2,
|
|
4892
4723
|
Or2
|
|
4893
4724
|
]);
|
|
4894
4725
|
|
|
4895
4726
|
// ../commons/src/icons.ts
|
|
4896
|
-
var
|
|
4897
|
-
var AvailableIcons =
|
|
4727
|
+
var import_zod29 = require("zod");
|
|
4728
|
+
var AvailableIcons = import_zod29.z.enum([
|
|
4898
4729
|
"Archived",
|
|
4899
4730
|
"Assigned",
|
|
4900
4731
|
"Certified",
|
|
@@ -5015,24 +4846,23 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
5015
4846
|
value: event.field("updatedAt")
|
|
5016
4847
|
}
|
|
5017
4848
|
]);
|
|
5018
|
-
var WorkqueueActionsWithDefault =
|
|
4849
|
+
var WorkqueueActionsWithDefault = import_zod30.z.enum([
|
|
5019
4850
|
...workqueueActions.options,
|
|
5020
|
-
"DEFAULT"
|
|
5021
|
-
ActionType.READ
|
|
4851
|
+
"DEFAULT"
|
|
5022
4852
|
]);
|
|
5023
|
-
var WorkqueueConfig =
|
|
5024
|
-
slug:
|
|
4853
|
+
var WorkqueueConfig = import_zod30.z.object({
|
|
4854
|
+
slug: import_zod30.z.string().describe("Determines the url of the workqueue."),
|
|
5025
4855
|
name: TranslationConfig.describe(
|
|
5026
4856
|
"Title of the workflow (both in navigation and on the page)"
|
|
5027
4857
|
),
|
|
5028
4858
|
query: CountryConfigQueryType,
|
|
5029
|
-
actions:
|
|
5030
|
-
|
|
4859
|
+
actions: import_zod30.z.array(
|
|
4860
|
+
import_zod30.z.object({
|
|
5031
4861
|
type: WorkqueueActionsWithDefault,
|
|
5032
|
-
conditionals:
|
|
4862
|
+
conditionals: import_zod30.z.array(Conditional).optional()
|
|
5033
4863
|
})
|
|
5034
4864
|
),
|
|
5035
|
-
columns:
|
|
4865
|
+
columns: import_zod30.z.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5036
4866
|
icon: AvailableIcons,
|
|
5037
4867
|
emptyMessage: TranslationConfig.optional()
|
|
5038
4868
|
}).describe("Configuration for workqueue.");
|
|
@@ -5040,19 +4870,19 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5040
4870
|
query: true,
|
|
5041
4871
|
columns: true
|
|
5042
4872
|
});
|
|
5043
|
-
var WorkqueueConfigInput =
|
|
5044
|
-
slug:
|
|
4873
|
+
var WorkqueueConfigInput = import_zod30.z.object({
|
|
4874
|
+
slug: import_zod30.z.string().describe("Determines the url of the workqueue."),
|
|
5045
4875
|
name: TranslationConfig.describe(
|
|
5046
4876
|
"Title of the workflow (both in navigation and on the page)"
|
|
5047
4877
|
),
|
|
5048
4878
|
query: CountryConfigQueryInputType,
|
|
5049
|
-
actions:
|
|
5050
|
-
|
|
4879
|
+
actions: import_zod30.z.array(
|
|
4880
|
+
import_zod30.z.object({
|
|
5051
4881
|
type: WorkqueueActionsWithDefault,
|
|
5052
|
-
conditionals:
|
|
4882
|
+
conditionals: import_zod30.z.array(Conditional).optional()
|
|
5053
4883
|
})
|
|
5054
4884
|
),
|
|
5055
|
-
columns:
|
|
4885
|
+
columns: import_zod30.z.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5056
4886
|
icon: AvailableIcons,
|
|
5057
4887
|
emptyMessage: TranslationConfig.optional()
|
|
5058
4888
|
});
|
|
@@ -5064,10 +4894,10 @@ function defineWorkqueue(workqueueInput) {
|
|
|
5064
4894
|
function defineWorkqueues(workqueues) {
|
|
5065
4895
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
|
5066
4896
|
}
|
|
5067
|
-
var WorkqueueCountInput =
|
|
5068
|
-
|
|
4897
|
+
var WorkqueueCountInput = import_zod30.z.array(
|
|
4898
|
+
import_zod30.z.object({ slug: import_zod30.z.string(), query: QueryType })
|
|
5069
4899
|
);
|
|
5070
|
-
var WorkqueueCountOutput =
|
|
4900
|
+
var WorkqueueCountOutput = import_zod30.z.record(import_zod30.z.string(), import_zod30.z.number());
|
|
5071
4901
|
|
|
5072
4902
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
5073
4903
|
var defaultWorkqueueColumns = [
|
|
@@ -5090,45 +4920,47 @@ var defaultWorkqueueColumns = [
|
|
|
5090
4920
|
];
|
|
5091
4921
|
|
|
5092
4922
|
// ../commons/src/events/Draft.ts
|
|
5093
|
-
var
|
|
4923
|
+
var import_zod32 = require("zod");
|
|
5094
4924
|
|
|
5095
4925
|
// ../commons/src/events/ActionInput.ts
|
|
5096
|
-
var
|
|
5097
|
-
var
|
|
4926
|
+
var import_zod31 = require("zod");
|
|
4927
|
+
var import_zod_openapi11 = require("zod-openapi");
|
|
4928
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
|
|
4929
|
+
var BaseActionInput = import_zod31.z.object({
|
|
5098
4930
|
eventId: UUID,
|
|
5099
|
-
transactionId:
|
|
4931
|
+
transactionId: import_zod31.z.string(),
|
|
5100
4932
|
declaration: ActionUpdate.default({}),
|
|
5101
4933
|
annotation: ActionUpdate.optional(),
|
|
5102
4934
|
originalActionId: UUID.optional(),
|
|
5103
4935
|
// should not be part of base action.
|
|
5104
|
-
keepAssignment:
|
|
4936
|
+
keepAssignment: import_zod31.z.boolean().optional(),
|
|
5105
4937
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5106
4938
|
createdAtLocation: CreatedAtLocation.describe(
|
|
5107
4939
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
5108
4940
|
)
|
|
5109
4941
|
});
|
|
5110
|
-
var CreateActionInput = BaseActionInput.
|
|
5111
|
-
|
|
5112
|
-
type:
|
|
4942
|
+
var CreateActionInput = BaseActionInput.merge(
|
|
4943
|
+
import_zod31.z.object({
|
|
4944
|
+
type: import_zod31.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
5113
4945
|
createdAtLocation: CreatedAtLocation
|
|
5114
|
-
})
|
|
5115
|
-
);
|
|
5116
|
-
var RegisterActionInput = BaseActionInput.extend(
|
|
5117
|
-
z33.strictObject({
|
|
5118
|
-
type: z33.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
5119
|
-
registrationNumber: z33.string().optional()
|
|
5120
|
-
}).shape
|
|
4946
|
+
})
|
|
5121
4947
|
);
|
|
5122
|
-
var
|
|
5123
|
-
|
|
5124
|
-
type:
|
|
5125
|
-
|
|
4948
|
+
var RegisterActionInput = BaseActionInput.merge(
|
|
4949
|
+
import_zod31.z.object({
|
|
4950
|
+
type: import_zod31.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
4951
|
+
registrationNumber: import_zod31.z.string().optional()
|
|
4952
|
+
})
|
|
4953
|
+
).strict();
|
|
4954
|
+
var ValidateActionInput = BaseActionInput.merge(
|
|
4955
|
+
import_zod31.z.object({
|
|
4956
|
+
type: import_zod31.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
|
|
4957
|
+
})
|
|
5126
4958
|
);
|
|
5127
|
-
var NotifyActionInput = BaseActionInput.
|
|
5128
|
-
|
|
5129
|
-
type:
|
|
5130
|
-
})
|
|
5131
|
-
).
|
|
4959
|
+
var NotifyActionInput = BaseActionInput.merge(
|
|
4960
|
+
import_zod31.z.object({
|
|
4961
|
+
type: import_zod31.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
|
4962
|
+
})
|
|
4963
|
+
).openapi({
|
|
5132
4964
|
default: {
|
|
5133
4965
|
eventId: "<event-id-here>",
|
|
5134
4966
|
transactionId: getUUID(),
|
|
@@ -5137,142 +4969,135 @@ var NotifyActionInput = BaseActionInput.extend(
|
|
|
5137
4969
|
type: ActionType.NOTIFY
|
|
5138
4970
|
}
|
|
5139
4971
|
});
|
|
5140
|
-
var DeclareActionInput = BaseActionInput.
|
|
5141
|
-
|
|
5142
|
-
type:
|
|
5143
|
-
})
|
|
4972
|
+
var DeclareActionInput = BaseActionInput.merge(
|
|
4973
|
+
import_zod31.z.object({
|
|
4974
|
+
type: import_zod31.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
4975
|
+
})
|
|
5144
4976
|
);
|
|
5145
|
-
var PrintCertificateActionInput = BaseActionInput.
|
|
5146
|
-
|
|
5147
|
-
type:
|
|
4977
|
+
var PrintCertificateActionInput = BaseActionInput.merge(
|
|
4978
|
+
import_zod31.z.object({
|
|
4979
|
+
type: import_zod31.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
5148
4980
|
content: PrintContent.optional()
|
|
5149
|
-
})
|
|
4981
|
+
})
|
|
5150
4982
|
);
|
|
5151
|
-
var RejectDeclarationActionInput = BaseActionInput.
|
|
5152
|
-
|
|
5153
|
-
type:
|
|
4983
|
+
var RejectDeclarationActionInput = BaseActionInput.merge(
|
|
4984
|
+
import_zod31.z.object({
|
|
4985
|
+
type: import_zod31.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
5154
4986
|
content: ReasonContent
|
|
5155
|
-
})
|
|
4987
|
+
})
|
|
5156
4988
|
);
|
|
5157
|
-
var DuplicateDetectedActionInput = BaseActionInput.
|
|
5158
|
-
|
|
5159
|
-
type:
|
|
5160
|
-
content:
|
|
5161
|
-
duplicates:
|
|
4989
|
+
var DuplicateDetectedActionInput = BaseActionInput.merge(
|
|
4990
|
+
import_zod31.z.object({
|
|
4991
|
+
type: import_zod31.z.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
4992
|
+
content: import_zod31.z.object({
|
|
4993
|
+
duplicates: import_zod31.z.array(PotentialDuplicate)
|
|
5162
4994
|
})
|
|
5163
|
-
})
|
|
4995
|
+
})
|
|
5164
4996
|
);
|
|
5165
|
-
var MarkAsDuplicateActionInput = BaseActionInput.
|
|
5166
|
-
|
|
5167
|
-
type:
|
|
5168
|
-
content:
|
|
4997
|
+
var MarkAsDuplicateActionInput = BaseActionInput.merge(
|
|
4998
|
+
import_zod31.z.object({
|
|
4999
|
+
type: import_zod31.z.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
5000
|
+
content: import_zod31.z.object({
|
|
5169
5001
|
duplicateOf: UUID
|
|
5170
5002
|
}).optional()
|
|
5171
|
-
})
|
|
5003
|
+
})
|
|
5172
5004
|
);
|
|
5173
|
-
var MarkNotDuplicateActionInput = BaseActionInput.
|
|
5174
|
-
|
|
5175
|
-
type:
|
|
5176
|
-
})
|
|
5005
|
+
var MarkNotDuplicateActionInput = BaseActionInput.merge(
|
|
5006
|
+
import_zod31.z.object({
|
|
5007
|
+
type: import_zod31.z.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
5008
|
+
})
|
|
5177
5009
|
);
|
|
5178
|
-
var ArchiveActionInput = BaseActionInput.
|
|
5179
|
-
|
|
5180
|
-
type:
|
|
5010
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
|
5011
|
+
import_zod31.z.object({
|
|
5012
|
+
type: import_zod31.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
5181
5013
|
content: ReasonContent
|
|
5182
|
-
})
|
|
5014
|
+
})
|
|
5183
5015
|
);
|
|
5184
|
-
var AssignActionInput = BaseActionInput.
|
|
5185
|
-
|
|
5186
|
-
type:
|
|
5187
|
-
assignedTo:
|
|
5188
|
-
})
|
|
5016
|
+
var AssignActionInput = BaseActionInput.merge(
|
|
5017
|
+
import_zod31.z.object({
|
|
5018
|
+
type: import_zod31.z.literal(ActionType.ASSIGN),
|
|
5019
|
+
assignedTo: import_zod31.z.string()
|
|
5020
|
+
})
|
|
5189
5021
|
);
|
|
5190
|
-
var UnassignActionInput = BaseActionInput.
|
|
5191
|
-
|
|
5192
|
-
type:
|
|
5193
|
-
assignedTo:
|
|
5194
|
-
})
|
|
5022
|
+
var UnassignActionInput = BaseActionInput.merge(
|
|
5023
|
+
import_zod31.z.object({
|
|
5024
|
+
type: import_zod31.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
5025
|
+
assignedTo: import_zod31.z.literal(null).default(null)
|
|
5026
|
+
})
|
|
5195
5027
|
);
|
|
5196
|
-
var RequestCorrectionActionInput = BaseActionInput.
|
|
5197
|
-
|
|
5198
|
-
type:
|
|
5199
|
-
})
|
|
5028
|
+
var RequestCorrectionActionInput = BaseActionInput.merge(
|
|
5029
|
+
import_zod31.z.object({
|
|
5030
|
+
type: import_zod31.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
5031
|
+
})
|
|
5200
5032
|
);
|
|
5201
|
-
var RejectCorrectionActionInput = BaseActionInput.
|
|
5202
|
-
|
|
5203
|
-
requestId:
|
|
5204
|
-
type:
|
|
5033
|
+
var RejectCorrectionActionInput = BaseActionInput.merge(
|
|
5034
|
+
import_zod31.z.object({
|
|
5035
|
+
requestId: import_zod31.z.string(),
|
|
5036
|
+
type: import_zod31.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
5205
5037
|
content: ReasonContent
|
|
5206
|
-
})
|
|
5207
|
-
);
|
|
5208
|
-
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
5209
|
-
z33.object({
|
|
5210
|
-
requestId: z33.string(),
|
|
5211
|
-
type: z33.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
5212
|
-
}).shape
|
|
5038
|
+
})
|
|
5213
5039
|
);
|
|
5214
|
-
var
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5040
|
+
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
|
5041
|
+
import_zod31.z.object({
|
|
5042
|
+
requestId: import_zod31.z.string(),
|
|
5043
|
+
type: import_zod31.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
5044
|
+
})
|
|
5218
5045
|
);
|
|
5219
|
-
var
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
customActionType: z33.string().describe("Name of the custom action.")
|
|
5224
|
-
}).shape
|
|
5046
|
+
var ReadActionInput = BaseActionInput.merge(
|
|
5047
|
+
import_zod31.z.object({
|
|
5048
|
+
type: import_zod31.z.literal(ActionType.READ).default(ActionType.READ)
|
|
5049
|
+
})
|
|
5225
5050
|
);
|
|
5226
|
-
var
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5051
|
+
var DeleteActionInput = import_zod31.z.object({ eventId: UUID });
|
|
5052
|
+
var ActionInput = import_zod31.z.discriminatedUnion("type", [
|
|
5053
|
+
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
|
5054
|
+
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
|
5055
|
+
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
|
5056
|
+
NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
|
|
5057
|
+
DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
|
|
5058
|
+
RejectDeclarationActionInput.openapi({
|
|
5059
|
+
ref: "RejectDeclarationActionInput"
|
|
5234
5060
|
}),
|
|
5235
|
-
DuplicateDetectedActionInput.
|
|
5236
|
-
|
|
5061
|
+
DuplicateDetectedActionInput.openapi({
|
|
5062
|
+
ref: "DuplicateDetectedActionInput"
|
|
5237
5063
|
}),
|
|
5238
|
-
MarkAsDuplicateActionInput.
|
|
5239
|
-
|
|
5064
|
+
MarkAsDuplicateActionInput.openapi({
|
|
5065
|
+
ref: "MarkAsDuplicateActionInput"
|
|
5240
5066
|
}),
|
|
5241
|
-
MarkNotDuplicateActionInput.
|
|
5242
|
-
|
|
5067
|
+
MarkNotDuplicateActionInput.openapi({
|
|
5068
|
+
ref: "MarkNotDuplicateActionInput"
|
|
5243
5069
|
}),
|
|
5244
|
-
ArchiveActionInput.
|
|
5245
|
-
AssignActionInput.
|
|
5246
|
-
UnassignActionInput.
|
|
5247
|
-
PrintCertificateActionInput.
|
|
5248
|
-
RequestCorrectionActionInput.
|
|
5249
|
-
|
|
5070
|
+
ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
|
|
5071
|
+
AssignActionInput.openapi({ ref: "AssignActionInput" }),
|
|
5072
|
+
UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
|
|
5073
|
+
PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
|
|
5074
|
+
RequestCorrectionActionInput.openapi({
|
|
5075
|
+
ref: "RequestCorrectionActionInput"
|
|
5250
5076
|
}),
|
|
5251
|
-
RejectCorrectionActionInput.
|
|
5252
|
-
ApproveCorrectionActionInput.
|
|
5253
|
-
|
|
5077
|
+
RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
|
|
5078
|
+
ApproveCorrectionActionInput.openapi({
|
|
5079
|
+
ref: "ApproveCorrectionActionInput"
|
|
5254
5080
|
}),
|
|
5255
|
-
ReadActionInput.
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
id: "ActionInput"
|
|
5081
|
+
ReadActionInput.openapi({ ref: "ReadActionInput" })
|
|
5082
|
+
]).openapi({
|
|
5083
|
+
ref: "ActionInput"
|
|
5259
5084
|
});
|
|
5260
5085
|
|
|
5261
5086
|
// ../commons/src/events/Draft.ts
|
|
5262
|
-
var Draft =
|
|
5087
|
+
var Draft = import_zod32.z.object({
|
|
5263
5088
|
id: UUID,
|
|
5264
5089
|
eventId: UUID,
|
|
5265
|
-
transactionId:
|
|
5266
|
-
createdAt:
|
|
5090
|
+
transactionId: import_zod32.z.string(),
|
|
5091
|
+
createdAt: import_zod32.z.string().datetime(),
|
|
5267
5092
|
action: ActionBase.extend({
|
|
5268
|
-
type: ActionTypes.exclude([ActionTypes.
|
|
5093
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
|
|
5269
5094
|
}).omit({ id: true, createdAtLocation: true })
|
|
5270
5095
|
}).describe(
|
|
5271
5096
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
5272
5097
|
);
|
|
5273
5098
|
var DraftInput = BaseActionInput.extend({
|
|
5274
|
-
type: ActionTypes.exclude([ActionTypes.
|
|
5275
|
-
status:
|
|
5099
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
|
|
5100
|
+
status: import_zod32.z.enum([
|
|
5276
5101
|
ActionStatus.Requested,
|
|
5277
5102
|
ActionStatus.Accepted,
|
|
5278
5103
|
ActionStatus.Rejected
|
|
@@ -5280,30 +5105,32 @@ var DraftInput = BaseActionInput.extend({
|
|
|
5280
5105
|
});
|
|
5281
5106
|
|
|
5282
5107
|
// ../commons/src/events/EventInput.ts
|
|
5283
|
-
var
|
|
5108
|
+
var import_zod33 = require("zod");
|
|
5284
5109
|
var import_uuid10 = require("uuid");
|
|
5285
|
-
var EventInput =
|
|
5286
|
-
transactionId:
|
|
5287
|
-
type:
|
|
5288
|
-
}).
|
|
5110
|
+
var EventInput = import_zod33.z.object({
|
|
5111
|
+
transactionId: import_zod33.z.string(),
|
|
5112
|
+
type: import_zod33.z.string()
|
|
5113
|
+
}).openapi({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
|
|
5289
5114
|
|
|
5290
5115
|
// ../commons/src/events/EventDocument.ts
|
|
5291
|
-
var
|
|
5292
|
-
var
|
|
5116
|
+
var import_zod34 = require("zod");
|
|
5117
|
+
var import_zod_openapi12 = require("zod-openapi");
|
|
5118
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod34.z);
|
|
5119
|
+
var EventDocument = import_zod34.z.object({
|
|
5293
5120
|
id: UUID.describe("Unique identifier of the event."),
|
|
5294
|
-
type:
|
|
5295
|
-
createdAt:
|
|
5296
|
-
updatedAt:
|
|
5121
|
+
type: import_zod34.z.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
5122
|
+
createdAt: import_zod34.z.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
5123
|
+
updatedAt: import_zod34.z.string().datetime().describe(
|
|
5297
5124
|
"Timestamp of the last update, excluding changes from actions."
|
|
5298
5125
|
),
|
|
5299
|
-
actions:
|
|
5300
|
-
trackingId:
|
|
5126
|
+
actions: import_zod34.z.array(Action).describe("Ordered list of actions associated with the event."),
|
|
5127
|
+
trackingId: import_zod34.z.string().describe(
|
|
5301
5128
|
"System-generated tracking identifier used to look up the event."
|
|
5302
5129
|
)
|
|
5303
|
-
}).
|
|
5130
|
+
}).openapi({ ref: "EventDocument" });
|
|
5304
5131
|
|
|
5305
5132
|
// ../commons/src/events/state/index.ts
|
|
5306
|
-
var
|
|
5133
|
+
var import_lodash3 = require("lodash");
|
|
5307
5134
|
|
|
5308
5135
|
// ../commons/src/events/state/utils.ts
|
|
5309
5136
|
var import_lodash2 = require("lodash");
|
|
@@ -5368,7 +5195,7 @@ function getActionUpdateMetadata(actions) {
|
|
|
5368
5195
|
"createdAtLocation",
|
|
5369
5196
|
"createdByRole"
|
|
5370
5197
|
];
|
|
5371
|
-
return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status
|
|
5198
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status }) => status === ActionStatus.Accepted).reduce(
|
|
5372
5199
|
(_, action) => {
|
|
5373
5200
|
if (action.originalActionId) {
|
|
5374
5201
|
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
@@ -5393,8 +5220,6 @@ function getLegalStatuses(actions) {
|
|
|
5393
5220
|
}
|
|
5394
5221
|
|
|
5395
5222
|
// ../commons/src/events/state/flags.ts
|
|
5396
|
-
var import_lodash3 = require("lodash");
|
|
5397
|
-
var import_date_fns3 = require("date-fns");
|
|
5398
5223
|
function isPendingCertification(actions) {
|
|
5399
5224
|
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
|
5400
5225
|
return false;
|
|
@@ -5440,70 +5265,18 @@ function isPotentialDuplicate(actions) {
|
|
|
5440
5265
|
return prev;
|
|
5441
5266
|
}, false);
|
|
5442
5267
|
}
|
|
5443
|
-
function
|
|
5444
|
-
const
|
|
5445
|
-
return validate(conditional, {
|
|
5446
|
-
$form: form,
|
|
5447
|
-
$now: now,
|
|
5448
|
-
$online: true,
|
|
5449
|
-
$user: {
|
|
5450
|
-
sub: "",
|
|
5451
|
-
exp: "",
|
|
5452
|
-
role: action.createdByRole,
|
|
5453
|
-
algorithm: "",
|
|
5454
|
-
scope: [],
|
|
5455
|
-
userType: action.createdByUserType
|
|
5456
|
-
}
|
|
5457
|
-
});
|
|
5458
|
-
}
|
|
5459
|
-
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
5460
|
-
const acceptedActions = getAcceptedActions(event2);
|
|
5461
|
-
const actions = acceptedActions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
5462
|
-
return actions.reduce((acc, action, idx) => {
|
|
5463
|
-
let actionConfig;
|
|
5464
|
-
if (isActionConfigType(action.type)) {
|
|
5465
|
-
actionConfig = getActionConfig({
|
|
5466
|
-
eventConfiguration,
|
|
5467
|
-
actionType: action.type,
|
|
5468
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
5469
|
-
});
|
|
5470
|
-
}
|
|
5471
|
-
if (!actionConfig) {
|
|
5472
|
-
return acc;
|
|
5473
|
-
}
|
|
5474
|
-
const eventUpToThisAction = {
|
|
5475
|
-
...event2,
|
|
5476
|
-
actions: actions.slice(0, idx + 1)
|
|
5477
|
-
};
|
|
5478
|
-
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
5479
|
-
const annotation = aggregateActionDeclarations(eventUpToThisAction);
|
|
5480
|
-
const form = { ...declaration, ...annotation };
|
|
5481
|
-
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
5482
|
-
({ conditional }) => (
|
|
5483
|
-
// If conditional is not provided, the flag is resolved
|
|
5484
|
-
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
5485
|
-
)
|
|
5486
|
-
);
|
|
5487
|
-
const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
|
|
5488
|
-
const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
|
|
5489
|
-
const flags = [...acc, ...addedFlags].filter(
|
|
5490
|
-
(flagId) => !removedFlags.includes(flagId)
|
|
5491
|
-
);
|
|
5492
|
-
return (0, import_lodash3.uniq)(flags);
|
|
5493
|
-
}, []);
|
|
5494
|
-
}
|
|
5495
|
-
function getEventFlags(event2, config) {
|
|
5496
|
-
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
5268
|
+
function getFlagsFromActions(actions) {
|
|
5269
|
+
const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
5497
5270
|
const actionStatus = sortedActions.reduce(
|
|
5498
|
-
(actionStatuses, { type, status
|
|
5271
|
+
(actionStatuses, { type, status }) => ({
|
|
5499
5272
|
...actionStatuses,
|
|
5500
|
-
[type]:
|
|
5273
|
+
[type]: status
|
|
5501
5274
|
}),
|
|
5502
5275
|
{}
|
|
5503
5276
|
);
|
|
5504
|
-
const flags = Object.entries(actionStatus).filter(([,
|
|
5505
|
-
const
|
|
5506
|
-
return
|
|
5277
|
+
const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
|
|
5278
|
+
const flag = joinValues([type, status], ":").toLowerCase();
|
|
5279
|
+
return flag;
|
|
5507
5280
|
});
|
|
5508
5281
|
if (isPendingCertification(sortedActions)) {
|
|
5509
5282
|
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
|
@@ -5520,24 +5293,25 @@ function getEventFlags(event2, config) {
|
|
|
5520
5293
|
if (isPotentialDuplicate(sortedActions)) {
|
|
5521
5294
|
flags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
5522
5295
|
}
|
|
5523
|
-
return
|
|
5296
|
+
return flags;
|
|
5524
5297
|
}
|
|
5525
5298
|
|
|
5526
5299
|
// ../commons/src/events/state/index.ts
|
|
5527
5300
|
function getStatusFromActions(actions) {
|
|
5528
|
-
return actions.filter(({ status
|
|
5301
|
+
return actions.filter(({ status }) => status === ActionStatus.Accepted).reduce((status, action) => {
|
|
5529
5302
|
switch (action.type) {
|
|
5530
5303
|
case ActionType.CREATE:
|
|
5531
5304
|
return EventStatus.enum.CREATED;
|
|
5532
5305
|
case ActionType.DECLARE:
|
|
5533
5306
|
return EventStatus.enum.DECLARED;
|
|
5307
|
+
case ActionType.VALIDATE:
|
|
5308
|
+
return EventStatus.enum.VALIDATED;
|
|
5534
5309
|
case ActionType.REGISTER:
|
|
5535
5310
|
return EventStatus.enum.REGISTERED;
|
|
5536
5311
|
case ActionType.ARCHIVE:
|
|
5537
5312
|
return EventStatus.enum.ARCHIVED;
|
|
5538
5313
|
case ActionType.NOTIFY:
|
|
5539
5314
|
return EventStatus.enum.NOTIFIED;
|
|
5540
|
-
case ActionType.CUSTOM:
|
|
5541
5315
|
case ActionType.PRINT_CERTIFICATE:
|
|
5542
5316
|
case ActionType.ASSIGN:
|
|
5543
5317
|
case ActionType.UNASSIGN:
|
|
@@ -5549,10 +5323,8 @@ function getStatusFromActions(actions) {
|
|
|
5549
5323
|
case ActionType.MARK_AS_DUPLICATE:
|
|
5550
5324
|
case ActionType.REJECT_CORRECTION:
|
|
5551
5325
|
case ActionType.READ:
|
|
5552
|
-
case ActionType.CUSTOM:
|
|
5553
|
-
case ActionType.VALIDATE:
|
|
5554
5326
|
default:
|
|
5555
|
-
return
|
|
5327
|
+
return status;
|
|
5556
5328
|
}
|
|
5557
5329
|
}, EventStatus.enum.CREATED);
|
|
5558
5330
|
}
|
|
@@ -5594,8 +5366,8 @@ function deepDropNulls(obj) {
|
|
|
5594
5366
|
}
|
|
5595
5367
|
return obj;
|
|
5596
5368
|
}
|
|
5597
|
-
function isUndeclaredDraft(
|
|
5598
|
-
return
|
|
5369
|
+
function isUndeclaredDraft(status) {
|
|
5370
|
+
return status === EventStatus.enum.CREATED;
|
|
5599
5371
|
}
|
|
5600
5372
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
5601
5373
|
function resolveDateOfEvent(eventMetadata, declaration, config) {
|
|
@@ -5650,7 +5422,7 @@ function getCurrentEventState(event2, config) {
|
|
|
5650
5422
|
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
5651
5423
|
dateOfEvent: resolveDateOfEvent(event2, declaration, config),
|
|
5652
5424
|
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
5653
|
-
flags:
|
|
5425
|
+
flags: getFlagsFromActions(sortedActions)
|
|
5654
5426
|
});
|
|
5655
5427
|
}
|
|
5656
5428
|
function dangerouslyGetCurrentEventStateWithDrafts({
|
|
@@ -5673,7 +5445,7 @@ function dangerouslyGetCurrentEventStateWithDrafts({
|
|
|
5673
5445
|
}
|
|
5674
5446
|
]
|
|
5675
5447
|
) : [{ ...draft.action, id: getUUID() }];
|
|
5676
|
-
const actionsWithDraft = (0,
|
|
5448
|
+
const actionsWithDraft = (0, import_lodash3.orderBy)(
|
|
5677
5449
|
[...actions, ...draftActions],
|
|
5678
5450
|
["createdAt"],
|
|
5679
5451
|
"asc"
|
|
@@ -5719,13 +5491,13 @@ function getActionAnnotation({
|
|
|
5719
5491
|
draft
|
|
5720
5492
|
}) {
|
|
5721
5493
|
const activeActions = getAcceptedActions(event2);
|
|
5722
|
-
const action = (0,
|
|
5494
|
+
const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
|
|
5723
5495
|
const actionWithCompleteAnnotation = action && {
|
|
5724
5496
|
...action,
|
|
5725
5497
|
annotation: getCompleteActionAnnotation({}, event2, action)
|
|
5726
5498
|
};
|
|
5727
5499
|
const matchingDraft = draft?.action.type === actionType ? draft : void 0;
|
|
5728
|
-
const sortedActions = (0,
|
|
5500
|
+
const sortedActions = (0, import_lodash3.orderBy)(
|
|
5729
5501
|
[actionWithCompleteAnnotation, matchingDraft?.action].filter(
|
|
5730
5502
|
(a) => a !== void 0
|
|
5731
5503
|
),
|
|
@@ -5750,7 +5522,7 @@ function generateTransactionId() {
|
|
|
5750
5522
|
}
|
|
5751
5523
|
|
|
5752
5524
|
// ../commons/src/events/test.utils.ts
|
|
5753
|
-
var
|
|
5525
|
+
var import_lodash4 = require("lodash");
|
|
5754
5526
|
var import_date_fns4 = require("date-fns");
|
|
5755
5527
|
|
|
5756
5528
|
// ../commons/src/field-config/field-configuration.ts
|
|
@@ -5772,6 +5544,7 @@ function field(fieldId, options = {}) {
|
|
|
5772
5544
|
}
|
|
5773
5545
|
|
|
5774
5546
|
// ../commons/src/fixtures/forms.ts
|
|
5547
|
+
var import_date_fns3 = require("date-fns");
|
|
5775
5548
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
5776
5549
|
label: {
|
|
5777
5550
|
id: "event.tennis-club-membership.action.certificate.form.label",
|
|
@@ -6569,7 +6342,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
6569
6342
|
conditionals: [
|
|
6570
6343
|
{
|
|
6571
6344
|
type: ConditionalType.DISPLAY_ON_REVIEW,
|
|
6572
|
-
conditional:
|
|
6345
|
+
conditional: never()
|
|
6573
6346
|
}
|
|
6574
6347
|
]
|
|
6575
6348
|
},
|
|
@@ -6952,16 +6725,119 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
6952
6725
|
}
|
|
6953
6726
|
}
|
|
6954
6727
|
],
|
|
6955
|
-
conditional: not(
|
|
6728
|
+
conditional: not(never())
|
|
6956
6729
|
// Intentional always-true page conditional to exercise interactions between page-level and field-level conditionals in tests
|
|
6957
6730
|
}
|
|
6958
6731
|
]
|
|
6959
6732
|
});
|
|
6733
|
+
var statusOptions = [
|
|
6734
|
+
{
|
|
6735
|
+
value: "ALL",
|
|
6736
|
+
label: {
|
|
6737
|
+
defaultMessage: "Any status",
|
|
6738
|
+
description: "Option for form field: status of record",
|
|
6739
|
+
id: "advancedSearch.form.recordStatusAny"
|
|
6740
|
+
}
|
|
6741
|
+
},
|
|
6742
|
+
{
|
|
6743
|
+
value: EventStatus.enum.CREATED,
|
|
6744
|
+
label: {
|
|
6745
|
+
defaultMessage: "Draft",
|
|
6746
|
+
description: "Option for form field: status of record",
|
|
6747
|
+
id: "advancedSearch.form.recordStatusCreated"
|
|
6748
|
+
}
|
|
6749
|
+
},
|
|
6750
|
+
{
|
|
6751
|
+
value: EventStatus.enum.NOTIFIED,
|
|
6752
|
+
label: {
|
|
6753
|
+
defaultMessage: "Notified",
|
|
6754
|
+
description: "Option for form field: status of record",
|
|
6755
|
+
id: "advancedSearch.form.recordStatusNotified"
|
|
6756
|
+
}
|
|
6757
|
+
},
|
|
6758
|
+
{
|
|
6759
|
+
value: EventStatus.enum.DECLARED,
|
|
6760
|
+
label: {
|
|
6761
|
+
defaultMessage: "Declared",
|
|
6762
|
+
description: "Option for form field: status of record",
|
|
6763
|
+
id: "advancedSearch.form.recordStatusDeclared"
|
|
6764
|
+
}
|
|
6765
|
+
},
|
|
6766
|
+
{
|
|
6767
|
+
value: EventStatus.enum.VALIDATED,
|
|
6768
|
+
label: {
|
|
6769
|
+
defaultMessage: "Validated",
|
|
6770
|
+
description: "Option for form field: status of record",
|
|
6771
|
+
id: "advancedSearch.form.recordStatusValidated"
|
|
6772
|
+
}
|
|
6773
|
+
},
|
|
6774
|
+
{
|
|
6775
|
+
value: EventStatus.enum.REGISTERED,
|
|
6776
|
+
label: {
|
|
6777
|
+
defaultMessage: "Registered",
|
|
6778
|
+
description: "Option for form field: status of record",
|
|
6779
|
+
id: "advancedSearch.form.recordStatusRegistered"
|
|
6780
|
+
}
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
value: EventStatus.enum.ARCHIVED,
|
|
6784
|
+
label: {
|
|
6785
|
+
defaultMessage: "Archived",
|
|
6786
|
+
description: "Option for form field: status of record",
|
|
6787
|
+
id: "advancedSearch.form.recordStatusArchived"
|
|
6788
|
+
}
|
|
6789
|
+
}
|
|
6790
|
+
];
|
|
6791
|
+
var timePeriodOptions = [
|
|
6792
|
+
{
|
|
6793
|
+
label: {
|
|
6794
|
+
defaultMessage: "Last 7 days",
|
|
6795
|
+
description: "Label for option of time period select: last 7 days",
|
|
6796
|
+
id: "form.section.label.timePeriodLast7Days"
|
|
6797
|
+
},
|
|
6798
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
6799
|
+
/* @__PURE__ */ new Date(),
|
|
6800
|
+
"yyyy-MM-dd"
|
|
6801
|
+
)}`
|
|
6802
|
+
},
|
|
6803
|
+
{
|
|
6804
|
+
label: {
|
|
6805
|
+
defaultMessage: "Last 30 days",
|
|
6806
|
+
description: "Label for option of time period select: last 30 days",
|
|
6807
|
+
id: "form.section.label.timePeriodLast30Days"
|
|
6808
|
+
},
|
|
6809
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
6810
|
+
/* @__PURE__ */ new Date(),
|
|
6811
|
+
"yyyy-MM-dd"
|
|
6812
|
+
)}`
|
|
6813
|
+
},
|
|
6814
|
+
{
|
|
6815
|
+
label: {
|
|
6816
|
+
defaultMessage: "Last 90 days",
|
|
6817
|
+
description: "Label for option of time period select: last 90 days",
|
|
6818
|
+
id: "form.section.label.timePeriodLast90Days"
|
|
6819
|
+
},
|
|
6820
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
6821
|
+
/* @__PURE__ */ new Date(),
|
|
6822
|
+
"yyyy-MM-dd"
|
|
6823
|
+
)}`
|
|
6824
|
+
},
|
|
6825
|
+
{
|
|
6826
|
+
label: {
|
|
6827
|
+
defaultMessage: "Last year",
|
|
6828
|
+
description: "Label for option of time period select: last year",
|
|
6829
|
+
id: "form.section.label.timePeriodLastYear"
|
|
6830
|
+
},
|
|
6831
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
6832
|
+
/* @__PURE__ */ new Date(),
|
|
6833
|
+
"yyyy-MM-dd"
|
|
6834
|
+
)}`
|
|
6835
|
+
}
|
|
6836
|
+
];
|
|
6960
6837
|
|
|
6961
6838
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
|
6962
6839
|
var tennisClubMembershipEvent = defineConfig({
|
|
6963
6840
|
id: TENNIS_CLUB_MEMBERSHIP,
|
|
6964
|
-
declaration: TENNIS_CLUB_DECLARATION_FORM,
|
|
6965
6841
|
label: {
|
|
6966
6842
|
defaultMessage: "Tennis club membership application",
|
|
6967
6843
|
description: "This is what this event is referred as in the system",
|
|
@@ -6992,17 +6868,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
6992
6868
|
}
|
|
6993
6869
|
]
|
|
6994
6870
|
},
|
|
6995
|
-
flags: [
|
|
6996
|
-
{
|
|
6997
|
-
id: "validated",
|
|
6998
|
-
label: {
|
|
6999
|
-
id: "event.tennis-club-membership.flag.validated",
|
|
7000
|
-
defaultMessage: "Validated",
|
|
7001
|
-
description: "Flag label for validated"
|
|
7002
|
-
},
|
|
7003
|
-
requiresAction: true
|
|
7004
|
-
}
|
|
7005
|
-
],
|
|
7006
6871
|
actions: [
|
|
7007
6872
|
{
|
|
7008
6873
|
type: ActionType.READ,
|
|
@@ -7029,19 +6894,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7029
6894
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7030
6895
|
id: "event.tennis-club-membership.action.validate.label"
|
|
7031
6896
|
},
|
|
7032
|
-
|
|
7033
|
-
conditionals: [
|
|
7034
|
-
{ type: ConditionalType.SHOW, conditional: not(flag("validated")) }
|
|
7035
|
-
]
|
|
7036
|
-
},
|
|
7037
|
-
{
|
|
7038
|
-
type: ActionType.REJECT,
|
|
7039
|
-
label: {
|
|
7040
|
-
defaultMessage: "Reject",
|
|
7041
|
-
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7042
|
-
id: "event.tennis-club-membership.action.reject.label"
|
|
7043
|
-
},
|
|
7044
|
-
flags: [{ id: "validated", operation: "remove" }]
|
|
6897
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
7045
6898
|
},
|
|
7046
6899
|
{
|
|
7047
6900
|
type: ActionType.REGISTER,
|
|
@@ -7049,7 +6902,8 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7049
6902
|
defaultMessage: "Register",
|
|
7050
6903
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7051
6904
|
id: "event.tennis-club-membership.action.register.label"
|
|
7052
|
-
}
|
|
6905
|
+
},
|
|
6906
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
7053
6907
|
},
|
|
7054
6908
|
{
|
|
7055
6909
|
type: ActionType.REQUEST_CORRECTION,
|
|
@@ -7252,6 +7106,14 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7252
7106
|
]
|
|
7253
7107
|
}
|
|
7254
7108
|
},
|
|
7109
|
+
{
|
|
7110
|
+
type: ActionType.APPROVE_CORRECTION,
|
|
7111
|
+
label: {
|
|
7112
|
+
defaultMessage: "Approve correction",
|
|
7113
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7114
|
+
id: "event.tennis-club-membership.action.correction.approve.label"
|
|
7115
|
+
}
|
|
7116
|
+
},
|
|
7255
7117
|
{
|
|
7256
7118
|
type: ActionType.PRINT_CERTIFICATE,
|
|
7257
7119
|
label: {
|
|
@@ -7260,6 +7122,22 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7260
7122
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
7261
7123
|
},
|
|
7262
7124
|
printForm: PRINT_CERTIFICATE_FORM
|
|
7125
|
+
},
|
|
7126
|
+
{
|
|
7127
|
+
type: ActionType.ARCHIVE,
|
|
7128
|
+
label: {
|
|
7129
|
+
id: "event.tennis-club-membership.action.archive.label",
|
|
7130
|
+
defaultMessage: "Archive",
|
|
7131
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
7132
|
+
}
|
|
7133
|
+
},
|
|
7134
|
+
{
|
|
7135
|
+
type: ActionType.REJECT,
|
|
7136
|
+
label: {
|
|
7137
|
+
id: "event.tennis-club-membership.action.reject.label",
|
|
7138
|
+
defaultMessage: "Reject",
|
|
7139
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
7140
|
+
}
|
|
7263
7141
|
}
|
|
7264
7142
|
],
|
|
7265
7143
|
advancedSearch: [
|
|
@@ -7296,7 +7174,8 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7296
7174
|
},
|
|
7297
7175
|
fields: [field("recommender.name").fuzzy()]
|
|
7298
7176
|
}
|
|
7299
|
-
]
|
|
7177
|
+
],
|
|
7178
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
|
7300
7179
|
});
|
|
7301
7180
|
|
|
7302
7181
|
// ../commons/src/fixtures/football-club-membership-event.ts
|
|
@@ -7370,7 +7249,8 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
7370
7249
|
defaultMessage: "Validate",
|
|
7371
7250
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7372
7251
|
id: "event.football-club-membership.action.validate.label"
|
|
7373
|
-
}
|
|
7252
|
+
},
|
|
7253
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
7374
7254
|
},
|
|
7375
7255
|
{
|
|
7376
7256
|
type: ActionType.REGISTER,
|
|
@@ -7378,7 +7258,8 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
7378
7258
|
defaultMessage: "Register",
|
|
7379
7259
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7380
7260
|
id: "event.football-club-membership.action.register.label"
|
|
7381
|
-
}
|
|
7261
|
+
},
|
|
7262
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
7382
7263
|
},
|
|
7383
7264
|
{
|
|
7384
7265
|
type: ActionType.REQUEST_CORRECTION,
|
|
@@ -7584,6 +7465,14 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
7584
7465
|
]
|
|
7585
7466
|
}
|
|
7586
7467
|
},
|
|
7468
|
+
{
|
|
7469
|
+
type: ActionType.APPROVE_CORRECTION,
|
|
7470
|
+
label: {
|
|
7471
|
+
defaultMessage: "Approve correction",
|
|
7472
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7473
|
+
id: "event.football-club-membership.action.correction.approve.label"
|
|
7474
|
+
}
|
|
7475
|
+
},
|
|
7587
7476
|
{
|
|
7588
7477
|
type: ActionType.PRINT_CERTIFICATE,
|
|
7589
7478
|
label: {
|
|
@@ -7592,6 +7481,22 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
7592
7481
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
7593
7482
|
},
|
|
7594
7483
|
printForm: PRINT_CERTIFICATE_FORM
|
|
7484
|
+
},
|
|
7485
|
+
{
|
|
7486
|
+
type: ActionType.ARCHIVE,
|
|
7487
|
+
label: {
|
|
7488
|
+
id: "event.football-club-membership.action.archive.label",
|
|
7489
|
+
defaultMessage: "Archive",
|
|
7490
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
7491
|
+
}
|
|
7492
|
+
},
|
|
7493
|
+
{
|
|
7494
|
+
type: ActionType.REJECT,
|
|
7495
|
+
label: {
|
|
7496
|
+
id: "event.football-club-membership.action.reject.label",
|
|
7497
|
+
defaultMessage: "Reject",
|
|
7498
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
7499
|
+
}
|
|
7595
7500
|
}
|
|
7596
7501
|
],
|
|
7597
7502
|
advancedSearch: [
|
|
@@ -7691,7 +7596,7 @@ var libraryMembershipEvent = defineConfig({
|
|
|
7691
7596
|
declaration: libraryMembershipForm
|
|
7692
7597
|
});
|
|
7693
7598
|
|
|
7694
|
-
// ../commons/src/fixtures/
|
|
7599
|
+
// ../commons/src/fixtures/v2-birth-event.ts
|
|
7695
7600
|
function generateTranslationConfig(message) {
|
|
7696
7601
|
return {
|
|
7697
7602
|
defaultMessage: message,
|
|
@@ -7720,61 +7625,6 @@ var child = defineFormPage({
|
|
|
7720
7625
|
secured: true,
|
|
7721
7626
|
validation: [],
|
|
7722
7627
|
label: generateTranslationConfig("Date of birth")
|
|
7723
|
-
},
|
|
7724
|
-
{
|
|
7725
|
-
id: "child.placeOfBirth",
|
|
7726
|
-
analytics: true,
|
|
7727
|
-
type: FieldType.SELECT,
|
|
7728
|
-
required: true,
|
|
7729
|
-
secured: true,
|
|
7730
|
-
label: {
|
|
7731
|
-
defaultMessage: "Place of delivery",
|
|
7732
|
-
description: "This is the label for the field",
|
|
7733
|
-
id: "event.birth.action.declare.form.section.child.field.placeOfBirth.label"
|
|
7734
|
-
},
|
|
7735
|
-
options: [
|
|
7736
|
-
{
|
|
7737
|
-
value: "child.placeOfBirth-SELECT-2",
|
|
7738
|
-
label: generateTranslationConfig("Health Institution")
|
|
7739
|
-
},
|
|
7740
|
-
{
|
|
7741
|
-
value: "PRIVATE_HOME",
|
|
7742
|
-
label: generateTranslationConfig("Residential address")
|
|
7743
|
-
}
|
|
7744
|
-
]
|
|
7745
|
-
},
|
|
7746
|
-
{
|
|
7747
|
-
id: "child.birthLocation",
|
|
7748
|
-
analytics: true,
|
|
7749
|
-
type: "FACILITY",
|
|
7750
|
-
required: true,
|
|
7751
|
-
secured: true,
|
|
7752
|
-
label: generateTranslationConfig("Health Institution"),
|
|
7753
|
-
conditionals: [
|
|
7754
|
-
{
|
|
7755
|
-
type: "SHOW",
|
|
7756
|
-
conditional: field("child.placeOfBirth").isEqualTo(
|
|
7757
|
-
"child.placeOfBirth-SELECT-2"
|
|
7758
|
-
)
|
|
7759
|
-
}
|
|
7760
|
-
]
|
|
7761
|
-
},
|
|
7762
|
-
{
|
|
7763
|
-
id: "child.birthLocation.privateHome",
|
|
7764
|
-
analytics: true,
|
|
7765
|
-
type: FieldType.ADDRESS,
|
|
7766
|
-
secured: true,
|
|
7767
|
-
hideLabel: true,
|
|
7768
|
-
label: generateTranslationConfig("Child's address"),
|
|
7769
|
-
conditionals: [
|
|
7770
|
-
{
|
|
7771
|
-
type: "SHOW",
|
|
7772
|
-
conditional: field("child.placeOfBirth").isEqualTo("PRIVATE_HOME")
|
|
7773
|
-
}
|
|
7774
|
-
],
|
|
7775
|
-
configuration: {
|
|
7776
|
-
streetAddressForm: []
|
|
7777
|
-
}
|
|
7778
7628
|
}
|
|
7779
7629
|
]
|
|
7780
7630
|
});
|
|
@@ -7851,7 +7701,7 @@ var mother = defineFormPage({
|
|
|
7851
7701
|
}
|
|
7852
7702
|
]
|
|
7853
7703
|
});
|
|
7854
|
-
var
|
|
7704
|
+
var BIRTH_DECLARATION_REVIEW = {
|
|
7855
7705
|
title: generateTranslationConfig(
|
|
7856
7706
|
"{child.name.firstname, select, __EMPTY__ {Birth declaration} other {{child.name.surname, select, __EMPTY__ {Birth declaration for {child.name.firstname}} other {Birth declaration for {child.name.firstname} {child.name.surname}}}}}"
|
|
7857
7707
|
),
|
|
@@ -7871,12 +7721,12 @@ var CHILD_ONBOARDING_DECLARATION_REVIEW = {
|
|
|
7871
7721
|
}
|
|
7872
7722
|
]
|
|
7873
7723
|
};
|
|
7874
|
-
var
|
|
7724
|
+
var BIRTH_DECLARATION_FORM = defineDeclarationForm({
|
|
7875
7725
|
label: generateTranslationConfig("Birth decalration form"),
|
|
7876
7726
|
pages: [child, mother]
|
|
7877
7727
|
});
|
|
7878
|
-
var
|
|
7879
|
-
id:
|
|
7728
|
+
var v2BirthEvent = defineConfig({
|
|
7729
|
+
id: BIRTH_EVENT,
|
|
7880
7730
|
title: generateTranslationConfig(
|
|
7881
7731
|
"{child.name.firstname} {child.name.surname}"
|
|
7882
7732
|
),
|
|
@@ -7884,34 +7734,36 @@ var ChildOnboardingEvent = defineConfig({
|
|
|
7884
7734
|
summary: {
|
|
7885
7735
|
fields: []
|
|
7886
7736
|
},
|
|
7887
|
-
declaration:
|
|
7737
|
+
declaration: BIRTH_DECLARATION_FORM,
|
|
7888
7738
|
actions: [
|
|
7889
7739
|
{
|
|
7890
7740
|
type: ActionType.READ,
|
|
7891
7741
|
label: generateTranslationConfig("Read"),
|
|
7892
|
-
review:
|
|
7742
|
+
review: BIRTH_DECLARATION_REVIEW
|
|
7893
7743
|
},
|
|
7894
7744
|
{
|
|
7895
7745
|
type: ActionType.DECLARE,
|
|
7896
7746
|
label: generateTranslationConfig("Declare"),
|
|
7897
|
-
review:
|
|
7747
|
+
review: BIRTH_DECLARATION_REVIEW
|
|
7898
7748
|
},
|
|
7899
7749
|
{
|
|
7900
7750
|
type: ActionType.VALIDATE,
|
|
7901
|
-
label: generateTranslationConfig("Validate")
|
|
7751
|
+
label: generateTranslationConfig("Validate"),
|
|
7752
|
+
review: BIRTH_DECLARATION_REVIEW
|
|
7902
7753
|
},
|
|
7903
7754
|
{
|
|
7904
7755
|
type: ActionType.REGISTER,
|
|
7905
|
-
label: generateTranslationConfig("Register")
|
|
7756
|
+
label: generateTranslationConfig("Register"),
|
|
7757
|
+
review: BIRTH_DECLARATION_REVIEW
|
|
7906
7758
|
}
|
|
7907
7759
|
],
|
|
7908
7760
|
advancedSearch: []
|
|
7909
7761
|
});
|
|
7910
7762
|
|
|
7911
7763
|
// ../commons/src/events/test.utils.ts
|
|
7912
|
-
var
|
|
7764
|
+
var import_zod35 = require("zod");
|
|
7913
7765
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
|
7914
|
-
var TestUserRole =
|
|
7766
|
+
var TestUserRole = import_zod35.z.enum([
|
|
7915
7767
|
"FIELD_AGENT",
|
|
7916
7768
|
"LOCAL_REGISTRAR",
|
|
7917
7769
|
"LOCAL_SYSTEM_ADMIN",
|
|
@@ -7967,13 +7819,13 @@ function generateUuid(rng = () => 0.1) {
|
|
|
7967
7819
|
});
|
|
7968
7820
|
}
|
|
7969
7821
|
function generateTrackingId(rng) {
|
|
7970
|
-
const
|
|
7971
|
-
const trackingId =
|
|
7822
|
+
const uuid = generateUuid(rng).replace(/-/g, "");
|
|
7823
|
+
const trackingId = uuid.slice(0, 6).toUpperCase();
|
|
7972
7824
|
return trackingId;
|
|
7973
7825
|
}
|
|
7974
7826
|
function generateRegistrationNumber(rng) {
|
|
7975
|
-
const
|
|
7976
|
-
const registrationNumber =
|
|
7827
|
+
const uuid = generateUuid(rng).replace(/-/g, "");
|
|
7828
|
+
const registrationNumber = uuid.slice(0, 12).toUpperCase();
|
|
7977
7829
|
return registrationNumber;
|
|
7978
7830
|
}
|
|
7979
7831
|
function generateRandomSignature(rng) {
|
|
@@ -8080,7 +7932,7 @@ function fieldConfigsToActionPayload(fields, rng) {
|
|
|
8080
7932
|
}
|
|
8081
7933
|
function generateActionDeclarationInput(configuration, action, rng, overrides) {
|
|
8082
7934
|
const parsed = DeclarationUpdateActions.safeParse(action);
|
|
8083
|
-
if ((0,
|
|
7935
|
+
if ((0, import_lodash4.isEmpty)(overrides) && typeof overrides === "object") {
|
|
8084
7936
|
return {};
|
|
8085
7937
|
}
|
|
8086
7938
|
if (parsed.success) {
|
|
@@ -8182,12 +8034,12 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8182
8034
|
},
|
|
8183
8035
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8184
8036
|
createdBy: "@todo",
|
|
8185
|
-
createdByUserType: TokenUserType.
|
|
8037
|
+
createdByUserType: TokenUserType.Enum.user,
|
|
8186
8038
|
createdByRole: "@todo"
|
|
8187
8039
|
}
|
|
8188
8040
|
};
|
|
8189
|
-
base.action.declaration = (0,
|
|
8190
|
-
return (0,
|
|
8041
|
+
base.action.declaration = (0, import_lodash4.omit)(base.action.declaration, omitFields);
|
|
8042
|
+
return (0, import_lodash4.merge)(base, input);
|
|
8191
8043
|
},
|
|
8192
8044
|
actions: {
|
|
8193
8045
|
declare: (eventId, input = {}) => ({
|
|
@@ -8208,13 +8060,13 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8208
8060
|
notify: (eventId, input = {}) => {
|
|
8209
8061
|
let declaration = input.declaration;
|
|
8210
8062
|
if (!declaration) {
|
|
8211
|
-
const partialDeclaration = (0,
|
|
8063
|
+
const partialDeclaration = (0, import_lodash4.omitBy)(
|
|
8212
8064
|
generateActionDeclarationInput(
|
|
8213
8065
|
configuration,
|
|
8214
8066
|
ActionType.NOTIFY,
|
|
8215
8067
|
rng
|
|
8216
8068
|
),
|
|
8217
|
-
|
|
8069
|
+
import_lodash4.isString
|
|
8218
8070
|
);
|
|
8219
8071
|
declaration = partialDeclaration;
|
|
8220
8072
|
}
|
|
@@ -8239,6 +8091,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8239
8091
|
ActionType.VALIDATE,
|
|
8240
8092
|
rng
|
|
8241
8093
|
),
|
|
8094
|
+
duplicates: [],
|
|
8242
8095
|
eventId,
|
|
8243
8096
|
...input
|
|
8244
8097
|
}),
|
|
@@ -8261,6 +8114,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8261
8114
|
transactionId: input.transactionId ?? getUUID(),
|
|
8262
8115
|
declaration: {},
|
|
8263
8116
|
annotation: {},
|
|
8117
|
+
duplicates: [],
|
|
8264
8118
|
eventId,
|
|
8265
8119
|
content: {
|
|
8266
8120
|
reason: `${ActionType.ARCHIVE}`
|
|
@@ -8272,6 +8126,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8272
8126
|
transactionId: input.transactionId ?? getUUID(),
|
|
8273
8127
|
declaration: {},
|
|
8274
8128
|
annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.REJECT, rng),
|
|
8129
|
+
duplicates: [],
|
|
8275
8130
|
eventId,
|
|
8276
8131
|
content: { reason: `${ActionType.REJECT}` },
|
|
8277
8132
|
...input
|
|
@@ -8308,7 +8163,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8308
8163
|
request: (eventId, input = {}) => ({
|
|
8309
8164
|
type: ActionType.REQUEST_CORRECTION,
|
|
8310
8165
|
transactionId: input.transactionId ?? getUUID(),
|
|
8311
|
-
declaration: input.declaration ?? (0,
|
|
8166
|
+
declaration: input.declaration ?? (0, import_lodash4.omit)(
|
|
8312
8167
|
generateActionDeclarationInput(
|
|
8313
8168
|
configuration,
|
|
8314
8169
|
ActionType.REQUEST_CORRECTION,
|
|
@@ -8401,8 +8256,8 @@ function generateActionDocument({
|
|
|
8401
8256
|
// @TODO: This should be fixed in the future.
|
|
8402
8257
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
|
8403
8258
|
createdBy: generateUuid(rng),
|
|
8404
|
-
createdByUserType: TokenUserType.
|
|
8405
|
-
createdByRole: TestUserRole.
|
|
8259
|
+
createdByUserType: TokenUserType.Enum.user,
|
|
8260
|
+
createdByRole: TestUserRole.Enum.FIELD_AGENT,
|
|
8406
8261
|
id: getUUID(),
|
|
8407
8262
|
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
8408
8263
|
declaration: generateActionDeclarationInput(
|
|
@@ -8417,12 +8272,6 @@ function generateActionDocument({
|
|
|
8417
8272
|
...defaults
|
|
8418
8273
|
};
|
|
8419
8274
|
switch (action) {
|
|
8420
|
-
case ActionType.CUSTOM:
|
|
8421
|
-
return {
|
|
8422
|
-
...actionBase,
|
|
8423
|
-
type: action,
|
|
8424
|
-
customActionType: "CUSTOM_ACTION_TYPE"
|
|
8425
|
-
};
|
|
8426
8275
|
case ActionType.READ:
|
|
8427
8276
|
return { ...actionBase, type: action };
|
|
8428
8277
|
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
@@ -8507,7 +8356,7 @@ function generateEventDocument({
|
|
|
8507
8356
|
defaults = {}
|
|
8508
8357
|
}) {
|
|
8509
8358
|
return {
|
|
8510
|
-
trackingId:
|
|
8359
|
+
trackingId: getUUID(),
|
|
8511
8360
|
type: configuration.id,
|
|
8512
8361
|
actions: actions.map(
|
|
8513
8362
|
(action, i) => generateActionDocument({
|
|
@@ -8690,7 +8539,7 @@ function isFieldConfigDefaultValue(value) {
|
|
|
8690
8539
|
}
|
|
8691
8540
|
|
|
8692
8541
|
// ../commons/src/events/scopes.ts
|
|
8693
|
-
var
|
|
8542
|
+
var import_lodash5 = require("lodash");
|
|
8694
8543
|
var ACTION_SCOPE_MAP = {
|
|
8695
8544
|
[ActionType.READ]: ["record.read"],
|
|
8696
8545
|
[ActionType.CREATE]: ["record.create"],
|
|
@@ -8719,11 +8568,10 @@ var ACTION_SCOPE_MAP = {
|
|
|
8719
8568
|
[ActionType.REJECT]: ["record.declared.reject"],
|
|
8720
8569
|
[ActionType.ASSIGN]: null,
|
|
8721
8570
|
[ActionType.UNASSIGN]: null,
|
|
8722
|
-
[ActionType.DUPLICATE_DETECTED]: []
|
|
8723
|
-
[ActionType.CUSTOM]: []
|
|
8571
|
+
[ActionType.DUPLICATE_DETECTED]: []
|
|
8724
8572
|
};
|
|
8725
8573
|
function hasAnyOfScopes(a, b) {
|
|
8726
|
-
return (0,
|
|
8574
|
+
return (0, import_lodash5.intersection)(a, b).length > 0;
|
|
8727
8575
|
}
|
|
8728
8576
|
function configurableEventScopeAllowed(scopes2, allowedConfigurableScopes, eventType) {
|
|
8729
8577
|
const parsedScopes = allowedConfigurableScopes.map((scope) => findScope(scopes2, scope)).filter((scope) => scope !== void 0);
|
|
@@ -8822,25 +8670,28 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
8822
8670
|
ActionType.READ,
|
|
8823
8671
|
ActionType.DECLARE,
|
|
8824
8672
|
ActionType.NOTIFY,
|
|
8825
|
-
ActionType.DELETE
|
|
8826
|
-
ActionType.CUSTOM
|
|
8673
|
+
ActionType.DELETE
|
|
8827
8674
|
],
|
|
8828
8675
|
[EventStatus.enum.NOTIFIED]: [
|
|
8829
8676
|
ActionType.READ,
|
|
8830
8677
|
ActionType.DECLARE,
|
|
8831
8678
|
ActionType.MARK_AS_DUPLICATE,
|
|
8832
8679
|
ActionType.ARCHIVE,
|
|
8833
|
-
ActionType.REJECT
|
|
8834
|
-
ActionType.CUSTOM
|
|
8680
|
+
ActionType.REJECT
|
|
8835
8681
|
],
|
|
8836
8682
|
[EventStatus.enum.DECLARED]: [
|
|
8837
8683
|
ActionType.READ,
|
|
8838
8684
|
ActionType.VALIDATE,
|
|
8685
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8686
|
+
ActionType.ARCHIVE,
|
|
8687
|
+
ActionType.REJECT
|
|
8688
|
+
],
|
|
8689
|
+
[EventStatus.enum.VALIDATED]: [
|
|
8690
|
+
ActionType.READ,
|
|
8839
8691
|
ActionType.REGISTER,
|
|
8840
8692
|
ActionType.MARK_AS_DUPLICATE,
|
|
8841
8693
|
ActionType.ARCHIVE,
|
|
8842
|
-
ActionType.REJECT
|
|
8843
|
-
ActionType.CUSTOM
|
|
8694
|
+
ActionType.REJECT
|
|
8844
8695
|
],
|
|
8845
8696
|
[EventStatus.enum.REGISTERED]: [
|
|
8846
8697
|
ActionType.READ,
|
|
@@ -8848,65 +8699,72 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
8848
8699
|
ActionType.REQUEST_CORRECTION,
|
|
8849
8700
|
ActionType.APPROVE_CORRECTION,
|
|
8850
8701
|
ActionType.REJECT_CORRECTION,
|
|
8851
|
-
ActionType.CUSTOM,
|
|
8852
8702
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
8853
8703
|
],
|
|
8854
8704
|
[EventStatus.enum.ARCHIVED]: [
|
|
8855
8705
|
ActionType.READ,
|
|
8856
8706
|
ActionType.ASSIGN,
|
|
8857
|
-
ActionType.UNASSIGN
|
|
8858
|
-
ActionType.CUSTOM
|
|
8707
|
+
ActionType.UNASSIGN
|
|
8859
8708
|
]
|
|
8860
8709
|
};
|
|
8861
8710
|
var ACTION_FILTERS = {
|
|
8862
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8863
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8864
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8865
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8866
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8867
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
8868
|
-
[ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
8869
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
8870
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((
|
|
8871
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((
|
|
8711
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8712
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8713
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8714
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8715
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8716
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8717
|
+
[ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8718
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8719
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
8720
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
8872
8721
|
};
|
|
8873
8722
|
function filterActionsByFlags(actions, flags) {
|
|
8874
8723
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
8875
8724
|
}
|
|
8876
|
-
function getAvailableActionsWithoutFlagFilters(
|
|
8877
|
-
switch (
|
|
8878
|
-
case EventStatus.
|
|
8879
|
-
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[
|
|
8725
|
+
function getAvailableActionsWithoutFlagFilters(status, flags) {
|
|
8726
|
+
switch (status) {
|
|
8727
|
+
case EventStatus.Enum.CREATED: {
|
|
8728
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
|
|
8880
8729
|
}
|
|
8881
|
-
case EventStatus.
|
|
8730
|
+
case EventStatus.Enum.NOTIFIED: {
|
|
8882
8731
|
if (flags.includes(InherentFlags.REJECTED)) {
|
|
8883
8732
|
return getAvailableActionsWithoutFlagFilters(
|
|
8884
|
-
EventStatus.
|
|
8885
|
-
flags.filter((
|
|
8733
|
+
EventStatus.Enum.CREATED,
|
|
8734
|
+
flags.filter((flag) => flag !== InherentFlags.REJECTED)
|
|
8886
8735
|
).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
|
|
8887
8736
|
}
|
|
8888
|
-
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[
|
|
8737
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
|
|
8889
8738
|
}
|
|
8890
|
-
case EventStatus.
|
|
8739
|
+
case EventStatus.Enum.DECLARED: {
|
|
8891
8740
|
if (flags.includes(InherentFlags.REJECTED)) {
|
|
8892
8741
|
return getAvailableActionsWithoutFlagFilters(
|
|
8893
|
-
EventStatus.
|
|
8894
|
-
flags.filter((
|
|
8742
|
+
EventStatus.Enum.CREATED,
|
|
8743
|
+
flags.filter((flag) => flag !== InherentFlags.REJECTED)
|
|
8895
8744
|
).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
|
|
8896
8745
|
}
|
|
8897
|
-
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[
|
|
8746
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
|
|
8898
8747
|
}
|
|
8899
|
-
case EventStatus.
|
|
8900
|
-
|
|
8748
|
+
case EventStatus.Enum.VALIDATED: {
|
|
8749
|
+
if (flags.includes(InherentFlags.REJECTED)) {
|
|
8750
|
+
return getAvailableActionsWithoutFlagFilters(
|
|
8751
|
+
EventStatus.Enum.DECLARED,
|
|
8752
|
+
flags.filter((flag) => flag !== InherentFlags.REJECTED)
|
|
8753
|
+
);
|
|
8754
|
+
}
|
|
8755
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
|
|
8901
8756
|
}
|
|
8902
|
-
case EventStatus.
|
|
8903
|
-
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[
|
|
8757
|
+
case EventStatus.Enum.REGISTERED: {
|
|
8758
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
|
|
8759
|
+
}
|
|
8760
|
+
case EventStatus.Enum.ARCHIVED: {
|
|
8761
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
|
|
8904
8762
|
}
|
|
8905
8763
|
}
|
|
8906
8764
|
}
|
|
8907
|
-
function getAvailableActions(
|
|
8765
|
+
function getAvailableActions(status, flags) {
|
|
8908
8766
|
return filterActionsByFlags(
|
|
8909
|
-
getAvailableActionsWithoutFlagFilters(
|
|
8767
|
+
getAvailableActionsWithoutFlagFilters(status, flags),
|
|
8910
8768
|
flags
|
|
8911
8769
|
);
|
|
8912
8770
|
}
|
|
@@ -8918,7 +8776,7 @@ function getAvailableActionsForEvent(event2) {
|
|
|
8918
8776
|
}
|
|
8919
8777
|
|
|
8920
8778
|
// ../commons/src/events/FileUtils.ts
|
|
8921
|
-
var
|
|
8779
|
+
var import_lodash6 = require("lodash");
|
|
8922
8780
|
function getFilePathsFromEvent(event2) {
|
|
8923
8781
|
const filepaths = event2.actions.filter(
|
|
8924
8782
|
(action) => action.status !== ActionStatus.Rejected
|
|
@@ -8941,20 +8799,20 @@ function getFilePathsFromEvent(event2) {
|
|
|
8941
8799
|
});
|
|
8942
8800
|
return actionFilePaths;
|
|
8943
8801
|
});
|
|
8944
|
-
return (0,
|
|
8802
|
+
return (0, import_lodash6.uniq)(filepaths);
|
|
8945
8803
|
}
|
|
8946
8804
|
|
|
8947
8805
|
// ../commons/src/events/locations.ts
|
|
8948
|
-
var
|
|
8949
|
-
var LocationType =
|
|
8806
|
+
var import_zod36 = require("zod");
|
|
8807
|
+
var LocationType = import_zod36.z.enum([
|
|
8950
8808
|
"ADMIN_STRUCTURE",
|
|
8951
8809
|
"CRVS_OFFICE",
|
|
8952
8810
|
"HEALTH_FACILITY"
|
|
8953
8811
|
]);
|
|
8954
|
-
var Location =
|
|
8812
|
+
var Location = import_zod36.z.object({
|
|
8955
8813
|
id: UUID,
|
|
8956
|
-
name:
|
|
8814
|
+
name: import_zod36.z.string(),
|
|
8957
8815
|
parentId: UUID.nullable(),
|
|
8958
|
-
validUntil:
|
|
8816
|
+
validUntil: import_zod36.z.string().datetime().nullable(),
|
|
8959
8817
|
locationType: LocationType.nullable()
|
|
8960
8818
|
});
|