@opencrvs/toolkit 2.1.0-rc.03f553a → 2.1.0-rc.05b7761
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/README.md +3 -12
- package/build.sh +12 -4
- package/create-countryconfig/index.js +441 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +347 -281
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +751 -0
- package/dist/cli.js +2082 -283
- package/dist/commons/api/router.d.ts +689 -110
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +4 -0
- package/dist/commons/events/ActionDocument.d.ts +5 -11
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +36 -12
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +99 -63
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +169 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +25 -4
- package/dist/commons/events/utils.d.ts +17 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +335 -64
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +15 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +47 -28
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +5 -9
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +21 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/environment/utils.d.ts +0 -12
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -28
- package/dist/events/index.js +7660 -7156
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +455 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1219 -0
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts +3 -0
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
- package/dist/migrations/v2.1/rename-trigger-paths.js +216 -0
- package/dist/notification/index.js +1845 -1426
- package/dist/scopes/index.d.ts +435 -36
- package/dist/scopes/index.js +336 -64
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +43 -0
- package/dist/templates/charts-values/dependencies/values.yaml +2 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/check.d.ts +21 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +132 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +345 -0
- package/opencrvs-toolkit-2.1.0-rc.05b7761.tgz +0 -0
- package/package.json +13 -7
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.03f553a.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -42,7 +42,7 @@ __export(application_config_exports, {
|
|
|
42
42
|
module.exports = __toCommonJS(application_config_exports);
|
|
43
43
|
|
|
44
44
|
// ../commons/src/application-config.ts
|
|
45
|
-
var
|
|
45
|
+
var z21 = __toESM(require("zod/v4"));
|
|
46
46
|
|
|
47
47
|
// ../commons/src/events/FieldConfig.ts
|
|
48
48
|
var import_v43 = __toESM(require("zod/v4"));
|
|
@@ -497,10 +497,10 @@ var SerializedUserField = z9.object({
|
|
|
497
497
|
var import_v4 = require("zod/v4");
|
|
498
498
|
|
|
499
499
|
// ../commons/src/events/EventMetadata.ts
|
|
500
|
-
var
|
|
500
|
+
var z16 = __toESM(require("zod/v4"));
|
|
501
501
|
|
|
502
502
|
// ../commons/src/events/ActionDocument.ts
|
|
503
|
-
var
|
|
503
|
+
var z15 = __toESM(require("zod/v4"));
|
|
504
504
|
|
|
505
505
|
// ../commons/src/events/ActionType.ts
|
|
506
506
|
var z10 = __toESM(require("zod/v4"));
|
|
@@ -612,16 +612,98 @@ var META_ACTIONS = [
|
|
|
612
612
|
|
|
613
613
|
// ../commons/src/authentication.ts
|
|
614
614
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
615
|
-
var
|
|
615
|
+
var z14 = __toESM(require("zod/v4"));
|
|
616
616
|
|
|
617
617
|
// ../commons/src/scopes.ts
|
|
618
|
-
var
|
|
618
|
+
var z13 = __toESM(require("zod/v4"));
|
|
619
619
|
var qs = __toESM(require("qs"));
|
|
620
|
-
|
|
620
|
+
|
|
621
|
+
// ../commons/src/events/ActionStatus.ts
|
|
622
|
+
var ActionStatus = {
|
|
623
|
+
Requested: "Requested",
|
|
624
|
+
Accepted: "Accepted",
|
|
625
|
+
Rejected: "Rejected"
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// ../commons/src/events/Flag.ts
|
|
629
|
+
var z11 = __toESM(require("zod/v4"));
|
|
630
|
+
var InherentFlags = {
|
|
631
|
+
INCOMPLETE: "incomplete",
|
|
632
|
+
REJECTED: "rejected",
|
|
633
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
634
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
635
|
+
/**
|
|
636
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
637
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
638
|
+
*
|
|
639
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
640
|
+
*/
|
|
641
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
642
|
+
};
|
|
643
|
+
var actionFlagPattern;
|
|
644
|
+
function getActionFlagPattern() {
|
|
645
|
+
actionFlagPattern ??= new RegExp(
|
|
646
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
647
|
+
ActionStatus
|
|
648
|
+
).join("|").toLowerCase()})$`
|
|
649
|
+
);
|
|
650
|
+
return actionFlagPattern;
|
|
651
|
+
}
|
|
652
|
+
var ActionFlag = z11.string().refine((value) => getActionFlagPattern().test(value), {
|
|
653
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
654
|
+
});
|
|
655
|
+
var CustomFlag = z11.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
656
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
657
|
+
InherentFlags
|
|
658
|
+
).join(", ")}`
|
|
659
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
660
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
661
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
662
|
+
var Flag = ActionFlag.or(z11.enum(InherentFlags)).or(CustomFlag);
|
|
663
|
+
var ContainsFlags = z11.object({
|
|
664
|
+
anyOf: z11.array(Flag).optional(),
|
|
665
|
+
noneOf: z11.array(Flag).optional(),
|
|
666
|
+
allOf: z11.array(Flag).optional()
|
|
667
|
+
}).meta({
|
|
668
|
+
id: "ContainsFlags"
|
|
669
|
+
});
|
|
670
|
+
var FlagConfig = z11.object({
|
|
671
|
+
id: CustomFlag,
|
|
672
|
+
requiresAction: z11.boolean().describe(
|
|
673
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
674
|
+
),
|
|
675
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
676
|
+
}).meta({
|
|
677
|
+
id: "FlagConfig",
|
|
678
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
679
|
+
});
|
|
680
|
+
var ActionFlagConfig = z11.object({
|
|
681
|
+
id: Flag,
|
|
682
|
+
operation: z11.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
683
|
+
conditional: Conditional.optional().describe(
|
|
684
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
685
|
+
)
|
|
686
|
+
}).meta({
|
|
687
|
+
id: "ActionFlagConfig",
|
|
688
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
// ../commons/src/events/EventStatus.ts
|
|
692
|
+
var z12 = __toESM(require("zod/v4"));
|
|
693
|
+
var EventStatus = z12.enum([
|
|
694
|
+
"CREATED",
|
|
695
|
+
"NOTIFIED",
|
|
696
|
+
"DECLARED",
|
|
697
|
+
"REGISTERED",
|
|
698
|
+
"ARCHIVED"
|
|
699
|
+
]);
|
|
700
|
+
|
|
701
|
+
// ../commons/src/scopes.ts
|
|
702
|
+
var JurisdictionFilter = z13.enum(["administrativeArea", "location", "all"]).describe(
|
|
621
703
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
622
704
|
);
|
|
623
|
-
var UserFilter =
|
|
624
|
-
var RecordScopeTypeV2 =
|
|
705
|
+
var UserFilter = z13.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
706
|
+
var RecordScopeTypeV2 = z13.enum([
|
|
625
707
|
"record.search",
|
|
626
708
|
"record.create",
|
|
627
709
|
"record.read",
|
|
@@ -639,91 +721,107 @@ var RecordScopeTypeV2 = z11.enum([
|
|
|
639
721
|
"record.unassign-others",
|
|
640
722
|
"record.custom-action"
|
|
641
723
|
]);
|
|
642
|
-
var PlainScopeType =
|
|
724
|
+
var PlainScopeType = z13.enum([
|
|
643
725
|
// Misc. system scopes
|
|
644
726
|
"bypassratelimit",
|
|
645
727
|
"record.reindex",
|
|
646
728
|
"user.data-seeding",
|
|
647
729
|
"integration.create",
|
|
730
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
731
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
732
|
+
// deliberately option-less: system clients have no office and no
|
|
733
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
734
|
+
"integration.audit.read",
|
|
648
735
|
"record.import",
|
|
649
736
|
"config.update-all",
|
|
737
|
+
"location.edit",
|
|
650
738
|
"attachment.upload",
|
|
651
739
|
"profile.electronic-signature",
|
|
652
740
|
"user.read-only-my-audit",
|
|
653
741
|
// Performance dashboard
|
|
654
742
|
"performance.read",
|
|
655
743
|
"performance.read-dashboards",
|
|
656
|
-
"performance.vital-statistics-export"
|
|
657
|
-
// Scopes used exclusively by countryconfig integration token
|
|
658
|
-
"record.confirm-registration",
|
|
659
|
-
"record.reject-registration"
|
|
744
|
+
"performance.vital-statistics-export"
|
|
660
745
|
]);
|
|
661
|
-
var scopeByEvent =
|
|
746
|
+
var scopeByEvent = z13.preprocess(
|
|
662
747
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
663
|
-
|
|
748
|
+
z13.array(z13.string()).optional()
|
|
664
749
|
).describe("Event type, e.g. birth, death");
|
|
665
|
-
var
|
|
750
|
+
var scopeByStatus = z13.preprocess(
|
|
751
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
752
|
+
z13.array(EventStatus).optional()
|
|
753
|
+
).describe(
|
|
754
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
755
|
+
);
|
|
756
|
+
var userRole = z13.preprocess(
|
|
666
757
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
667
|
-
|
|
758
|
+
z13.array(z13.string()).optional()
|
|
668
759
|
).describe("User role, e.g. admin, field agent");
|
|
669
|
-
var scopeOptionsPlaceEvent =
|
|
760
|
+
var scopeOptionsPlaceEvent = z13.object({
|
|
670
761
|
event: scopeByEvent,
|
|
671
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
762
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
763
|
+
createdBy: UserFilter.optional(),
|
|
764
|
+
createdIn: JurisdictionFilter.optional()
|
|
672
765
|
}).describe("Options applicable to all record scopes.");
|
|
673
766
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
674
767
|
notifiedIn: JurisdictionFilter.optional(),
|
|
675
768
|
notifiedBy: UserFilter.optional(),
|
|
676
769
|
declaredIn: JurisdictionFilter.optional(),
|
|
677
|
-
declaredBy: UserFilter.optional()
|
|
770
|
+
declaredBy: UserFilter.optional(),
|
|
771
|
+
status: scopeByStatus
|
|
678
772
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
679
773
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
680
774
|
registeredIn: JurisdictionFilter.optional(),
|
|
681
|
-
registeredBy: UserFilter.optional()
|
|
775
|
+
registeredBy: UserFilter.optional(),
|
|
776
|
+
flags: ContainsFlags.optional()
|
|
682
777
|
}).describe(
|
|
683
778
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
684
779
|
);
|
|
685
780
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
686
|
-
customActionTypes:
|
|
781
|
+
customActionTypes: z13.preprocess(
|
|
687
782
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
688
|
-
|
|
783
|
+
z13.array(z13.string()).optional()
|
|
689
784
|
).describe("Allowed custom action types")
|
|
690
785
|
});
|
|
691
|
-
var AccessLevelOptions =
|
|
786
|
+
var AccessLevelOptions = z13.object({
|
|
692
787
|
accessLevel: JurisdictionFilter.optional()
|
|
693
788
|
});
|
|
694
789
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
695
790
|
role: userRole.optional()
|
|
696
791
|
});
|
|
697
|
-
var WorkqueueOrDashboardOptions =
|
|
698
|
-
ids:
|
|
792
|
+
var WorkqueueOrDashboardOptions = z13.object({
|
|
793
|
+
ids: z13.preprocess(
|
|
699
794
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
700
|
-
|
|
795
|
+
z13.array(z13.string())
|
|
701
796
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
702
797
|
});
|
|
703
|
-
var AllScopeOptions =
|
|
798
|
+
var AllScopeOptions = z13.object({
|
|
704
799
|
...AllRecordScopeOptions.shape,
|
|
705
800
|
...AccessLevelOptions.shape,
|
|
706
801
|
...AllUserScopeOptions.shape,
|
|
707
802
|
...WorkqueueOrDashboardOptions.shape
|
|
708
803
|
});
|
|
709
804
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
710
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
805
|
+
var ResolvedScopeOptionsPlaceEvent = z13.object({
|
|
711
806
|
event: scopeByEvent,
|
|
712
|
-
placeOfEvent: UUID.nullish()
|
|
807
|
+
placeOfEvent: UUID.nullish(),
|
|
808
|
+
createdBy: z13.string().optional(),
|
|
809
|
+
createdIn: UUID.nullish()
|
|
713
810
|
}).describe(
|
|
714
811
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
715
812
|
);
|
|
716
813
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
717
814
|
notifiedIn: UUID.nullish(),
|
|
718
|
-
notifiedBy:
|
|
815
|
+
notifiedBy: z13.string().optional(),
|
|
719
816
|
declaredIn: UUID.nullish(),
|
|
720
|
-
declaredBy:
|
|
817
|
+
declaredBy: z13.string().optional()
|
|
721
818
|
}).describe(
|
|
722
819
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
723
820
|
);
|
|
724
821
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
725
822
|
registeredIn: UUID.nullish(),
|
|
726
|
-
registeredBy:
|
|
823
|
+
registeredBy: z13.string().optional(),
|
|
824
|
+
flags: ContainsFlags.optional()
|
|
727
825
|
}).describe(
|
|
728
826
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
729
827
|
);
|
|
@@ -737,7 +835,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
737
835
|
"record.reject",
|
|
738
836
|
"record.archive",
|
|
739
837
|
"record.unarchive",
|
|
740
|
-
"record.review-duplicates",
|
|
741
838
|
"record.register"
|
|
742
839
|
]);
|
|
743
840
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -745,41 +842,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
745
842
|
"record.read",
|
|
746
843
|
"record.request-correction",
|
|
747
844
|
"record.correct",
|
|
748
|
-
"record.unassign-others"
|
|
845
|
+
"record.unassign-others",
|
|
846
|
+
"record.review-duplicates"
|
|
749
847
|
]);
|
|
750
848
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
751
|
-
templates:
|
|
849
|
+
templates: z13.preprocess(
|
|
752
850
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
753
|
-
|
|
851
|
+
z13.array(z13.string()).optional()
|
|
754
852
|
).describe(
|
|
755
853
|
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
756
854
|
)
|
|
757
855
|
});
|
|
758
|
-
var RecordScopeV2 =
|
|
759
|
-
|
|
856
|
+
var RecordScopeV2 = z13.discriminatedUnion("type", [
|
|
857
|
+
z13.object({
|
|
760
858
|
type: ScopesWithPlaceEventOptions,
|
|
761
859
|
options: scopeOptionsPlaceEvent.optional()
|
|
762
860
|
}),
|
|
763
|
-
|
|
861
|
+
z13.object({
|
|
764
862
|
type: ScopesWithDeclaredOptions,
|
|
765
863
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
766
864
|
}),
|
|
767
|
-
|
|
865
|
+
z13.object({
|
|
768
866
|
type: ScopesWithFullOptions,
|
|
769
867
|
options: AllRecordScopeOptions.optional()
|
|
770
868
|
}),
|
|
771
|
-
|
|
772
|
-
type:
|
|
869
|
+
z13.object({
|
|
870
|
+
type: z13.literal("record.custom-action"),
|
|
773
871
|
options: CustomActionScopeOptions.optional()
|
|
774
872
|
}),
|
|
775
|
-
|
|
776
|
-
type:
|
|
873
|
+
z13.object({
|
|
874
|
+
type: z13.literal("record.print-certified-copies"),
|
|
777
875
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
778
876
|
})
|
|
779
877
|
]).describe(
|
|
780
878
|
"Scopes used to check user's permission to perform actions on a record."
|
|
781
879
|
);
|
|
782
|
-
var SystemScopeType =
|
|
880
|
+
var SystemScopeType = z13.enum([
|
|
783
881
|
"organisation.read-locations",
|
|
784
882
|
"user.read",
|
|
785
883
|
"user.create",
|
|
@@ -793,61 +891,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
793
891
|
"user.search"
|
|
794
892
|
]);
|
|
795
893
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
796
|
-
var UserScopeV2 =
|
|
797
|
-
|
|
894
|
+
var UserScopeV2 = z13.discriminatedUnion("type", [
|
|
895
|
+
z13.object({
|
|
798
896
|
type: ScopesWithRoleOption,
|
|
799
897
|
options: AllUserScopeOptions.optional()
|
|
800
898
|
}),
|
|
801
|
-
|
|
899
|
+
z13.object({
|
|
802
900
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
803
901
|
options: AccessLevelOptions.optional()
|
|
804
902
|
})
|
|
805
903
|
]);
|
|
806
|
-
var ResolvedRecordScopeV2 =
|
|
807
|
-
|
|
904
|
+
var ResolvedRecordScopeV2 = z13.discriminatedUnion("type", [
|
|
905
|
+
z13.object({
|
|
808
906
|
type: ScopesWithPlaceEventOptions,
|
|
809
907
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
810
908
|
}),
|
|
811
|
-
|
|
909
|
+
z13.object({
|
|
812
910
|
type: ScopesWithDeclaredOptions,
|
|
813
911
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
814
912
|
}),
|
|
815
|
-
|
|
913
|
+
z13.object({
|
|
816
914
|
type: ScopesWithFullOptions,
|
|
817
915
|
options: ResolvedScopeOptionsFull.optional()
|
|
818
916
|
}),
|
|
819
|
-
|
|
820
|
-
type:
|
|
917
|
+
z13.object({
|
|
918
|
+
type: z13.literal("record.print-certified-copies"),
|
|
821
919
|
options: ResolvedScopeOptionsFull.extend({
|
|
822
|
-
templates:
|
|
920
|
+
templates: z13.array(z13.string()).optional()
|
|
823
921
|
}).optional()
|
|
824
922
|
})
|
|
825
923
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
826
|
-
var Scope =
|
|
827
|
-
|
|
924
|
+
var Scope = z13.discriminatedUnion("type", [
|
|
925
|
+
z13.object({ type: PlainScopeType }),
|
|
828
926
|
...RecordScopeV2.options,
|
|
829
927
|
...UserScopeV2.options,
|
|
830
|
-
|
|
831
|
-
type:
|
|
928
|
+
z13.object({
|
|
929
|
+
type: z13.literal("organisation.read-locations"),
|
|
832
930
|
options: AccessLevelOptions.optional()
|
|
833
931
|
}),
|
|
834
|
-
|
|
835
|
-
type:
|
|
932
|
+
z13.object({
|
|
933
|
+
type: z13.literal("workqueue"),
|
|
836
934
|
options: WorkqueueOrDashboardOptions
|
|
837
935
|
}),
|
|
838
|
-
|
|
839
|
-
type:
|
|
936
|
+
z13.object({
|
|
937
|
+
type: z13.literal("dashboard.view"),
|
|
840
938
|
options: WorkqueueOrDashboardOptions
|
|
841
939
|
})
|
|
842
940
|
]);
|
|
843
|
-
var ScopeType =
|
|
941
|
+
var ScopeType = z13.enum([
|
|
844
942
|
...SystemScopeType.options,
|
|
845
943
|
...RecordScopeTypeV2.options,
|
|
846
944
|
...PlainScopeType.options,
|
|
847
945
|
"workqueue",
|
|
848
946
|
"dashboard.view"
|
|
849
947
|
]);
|
|
850
|
-
var EncodedScope =
|
|
948
|
+
var EncodedScope = z13.string().brand("EncodedScope");
|
|
851
949
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
852
950
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
853
951
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -857,30 +955,25 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
857
955
|
};
|
|
858
956
|
|
|
859
957
|
// ../commons/src/authentication.ts
|
|
860
|
-
var TokenUserType =
|
|
861
|
-
var TokenWithBearer =
|
|
958
|
+
var TokenUserType = z14.enum(["user", "system"]);
|
|
959
|
+
var TokenWithBearer = z14.string().regex(/^Bearer\s/);
|
|
862
960
|
|
|
863
961
|
// ../commons/src/events/ActionDocument.ts
|
|
864
|
-
var ActionUpdate =
|
|
962
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
865
963
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
866
964
|
);
|
|
867
|
-
var EventState =
|
|
965
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
868
966
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
869
967
|
);
|
|
870
|
-
var
|
|
871
|
-
Requested: "Requested",
|
|
872
|
-
Accepted: "Accepted",
|
|
873
|
-
Rejected: "Rejected"
|
|
874
|
-
};
|
|
875
|
-
var ActionBase = z13.object({
|
|
968
|
+
var ActionBase = z15.object({
|
|
876
969
|
id: UUID.describe("Unique identifier of the action."),
|
|
877
|
-
transactionId:
|
|
970
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
878
971
|
createdByUserType: TokenUserType.describe(
|
|
879
972
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
880
973
|
),
|
|
881
|
-
createdAt:
|
|
882
|
-
createdBy:
|
|
883
|
-
createdByRole:
|
|
974
|
+
createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
975
|
+
createdBy: z15.string().describe("Identifier of the user who created the action."),
|
|
976
|
+
createdByRole: z15.string().optional().describe("Role of the user who created the action."),
|
|
884
977
|
createdBySignature: DocumentPath.nullish().describe(
|
|
885
978
|
"Reference to the signature of the user who created the action."
|
|
886
979
|
),
|
|
@@ -892,7 +985,7 @@ var ActionBase = z13.object({
|
|
|
892
985
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
893
986
|
),
|
|
894
987
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
895
|
-
status:
|
|
988
|
+
status: z15.enum([
|
|
896
989
|
ActionStatus.Requested,
|
|
897
990
|
ActionStatus.Accepted,
|
|
898
991
|
ActionStatus.Rejected
|
|
@@ -904,139 +997,143 @@ var ActionBase = z13.object({
|
|
|
904
997
|
)
|
|
905
998
|
});
|
|
906
999
|
var AssignedAction = ActionBase.extend(
|
|
907
|
-
|
|
908
|
-
type:
|
|
909
|
-
assignedTo:
|
|
1000
|
+
z15.object({
|
|
1001
|
+
type: z15.literal(ActionType.ASSIGN),
|
|
1002
|
+
assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
|
|
910
1003
|
// TODO move into 'content' property
|
|
911
1004
|
}).shape
|
|
912
1005
|
);
|
|
913
1006
|
var UnassignedAction = ActionBase.extend(
|
|
914
|
-
|
|
915
|
-
type:
|
|
1007
|
+
z15.object({
|
|
1008
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
916
1009
|
}).shape
|
|
917
1010
|
);
|
|
918
1011
|
var RegisterAction = ActionBase.extend(
|
|
919
|
-
|
|
920
|
-
type:
|
|
921
|
-
registrationNumber:
|
|
1012
|
+
z15.object({
|
|
1013
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1014
|
+
registrationNumber: z15.string().optional().describe(
|
|
922
1015
|
"Registration number of the event. Always present for accepted registrations."
|
|
923
1016
|
)
|
|
924
1017
|
// TODO move into 'content' property
|
|
925
1018
|
}).shape
|
|
926
1019
|
);
|
|
927
1020
|
var DeclareAction = ActionBase.extend(
|
|
928
|
-
|
|
929
|
-
type:
|
|
1021
|
+
z15.object({
|
|
1022
|
+
type: z15.literal(ActionType.DECLARE)
|
|
930
1023
|
}).shape
|
|
931
1024
|
);
|
|
932
|
-
var ReasonContent =
|
|
933
|
-
reason:
|
|
1025
|
+
var ReasonContent = z15.object({
|
|
1026
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
934
1027
|
"Message describing the reason for rejecting or archiving the event."
|
|
935
1028
|
)
|
|
936
1029
|
});
|
|
937
1030
|
var RejectAction = ActionBase.extend(
|
|
938
|
-
|
|
939
|
-
type:
|
|
1031
|
+
z15.object({
|
|
1032
|
+
type: z15.literal(ActionType.REJECT),
|
|
940
1033
|
content: ReasonContent
|
|
941
1034
|
}).shape
|
|
942
1035
|
);
|
|
943
|
-
var PotentialDuplicate =
|
|
1036
|
+
var PotentialDuplicate = z15.object({
|
|
944
1037
|
id: UUID,
|
|
945
|
-
trackingId:
|
|
1038
|
+
trackingId: z15.string()
|
|
946
1039
|
});
|
|
947
1040
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
948
|
-
|
|
949
|
-
type:
|
|
950
|
-
content:
|
|
951
|
-
duplicates:
|
|
1041
|
+
z15.object({
|
|
1042
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1043
|
+
content: z15.object({
|
|
1044
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
952
1045
|
})
|
|
953
1046
|
}).shape
|
|
954
1047
|
);
|
|
955
1048
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
956
|
-
|
|
957
|
-
type:
|
|
1049
|
+
z15.object({
|
|
1050
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
958
1051
|
}).shape
|
|
959
1052
|
);
|
|
960
1053
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
961
|
-
|
|
962
|
-
type:
|
|
963
|
-
content:
|
|
1054
|
+
z15.object({
|
|
1055
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1056
|
+
content: z15.object({
|
|
964
1057
|
duplicateOf: UUID
|
|
965
1058
|
}).optional()
|
|
966
1059
|
}).shape
|
|
967
1060
|
);
|
|
968
1061
|
var ArchiveAction = ActionBase.extend(
|
|
969
|
-
|
|
970
|
-
type:
|
|
971
|
-
|
|
1062
|
+
z15.object({
|
|
1063
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1064
|
+
/**
|
|
1065
|
+
* Archiving does not collect a reason on its own. Only the
|
|
1066
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
1067
|
+
*/
|
|
1068
|
+
content: ReasonContent.optional()
|
|
972
1069
|
}).shape
|
|
973
1070
|
);
|
|
974
1071
|
var UnarchiveAction = ActionBase.extend(
|
|
975
|
-
|
|
976
|
-
type:
|
|
1072
|
+
z15.object({
|
|
1073
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
977
1074
|
}).shape
|
|
978
1075
|
);
|
|
979
1076
|
var CreatedAction = ActionBase.extend(
|
|
980
|
-
|
|
981
|
-
type:
|
|
1077
|
+
z15.object({
|
|
1078
|
+
type: z15.literal(ActionType.CREATE)
|
|
982
1079
|
}).shape
|
|
983
1080
|
);
|
|
984
1081
|
var NotifiedAction = ActionBase.extend(
|
|
985
|
-
|
|
986
|
-
type:
|
|
1082
|
+
z15.object({
|
|
1083
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
987
1084
|
}).shape
|
|
988
1085
|
);
|
|
989
1086
|
var EditAction = ActionBase.extend(
|
|
990
|
-
|
|
991
|
-
type:
|
|
1087
|
+
z15.object({
|
|
1088
|
+
type: z15.literal(ActionType.EDIT),
|
|
992
1089
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
993
|
-
content:
|
|
994
|
-
comment:
|
|
1090
|
+
content: z15.object({
|
|
1091
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
995
1092
|
}).optional()
|
|
996
1093
|
}).shape
|
|
997
1094
|
);
|
|
998
|
-
var PrintContent =
|
|
999
|
-
templateId:
|
|
1095
|
+
var PrintContent = z15.object({
|
|
1096
|
+
templateId: z15.string().optional()
|
|
1000
1097
|
});
|
|
1001
1098
|
var PrintCertificateAction = ActionBase.extend(
|
|
1002
|
-
|
|
1003
|
-
type:
|
|
1099
|
+
z15.object({
|
|
1100
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1004
1101
|
content: PrintContent.optional().nullable()
|
|
1005
1102
|
}).shape
|
|
1006
1103
|
);
|
|
1007
1104
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1008
|
-
|
|
1009
|
-
type:
|
|
1105
|
+
z15.object({
|
|
1106
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1010
1107
|
}).shape
|
|
1011
1108
|
);
|
|
1012
1109
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1013
|
-
|
|
1014
|
-
type:
|
|
1015
|
-
requestId:
|
|
1110
|
+
z15.object({
|
|
1111
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1112
|
+
requestId: z15.string(),
|
|
1016
1113
|
// TODO move into 'content' property
|
|
1017
|
-
content:
|
|
1114
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1018
1115
|
}).shape
|
|
1019
1116
|
);
|
|
1020
1117
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1021
|
-
|
|
1022
|
-
type:
|
|
1023
|
-
requestId:
|
|
1118
|
+
z15.object({
|
|
1119
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1120
|
+
requestId: z15.string(),
|
|
1024
1121
|
// TODO move into 'content' property
|
|
1025
1122
|
content: ReasonContent
|
|
1026
1123
|
}).shape
|
|
1027
1124
|
);
|
|
1028
1125
|
var ReadAction = ActionBase.extend(
|
|
1029
|
-
|
|
1030
|
-
type:
|
|
1126
|
+
z15.object({
|
|
1127
|
+
type: z15.literal(ActionType.READ)
|
|
1031
1128
|
}).shape
|
|
1032
1129
|
);
|
|
1033
1130
|
var CustomAction = ActionBase.merge(
|
|
1034
|
-
|
|
1035
|
-
type:
|
|
1036
|
-
customActionType:
|
|
1131
|
+
z15.object({
|
|
1132
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1133
|
+
customActionType: z15.string()
|
|
1037
1134
|
})
|
|
1038
1135
|
);
|
|
1039
|
-
var ActionDocument =
|
|
1136
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1040
1137
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1041
1138
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1042
1139
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1063,109 +1160,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1063
1160
|
declaration: true,
|
|
1064
1161
|
annotation: true
|
|
1065
1162
|
}).extend(
|
|
1066
|
-
|
|
1067
|
-
type:
|
|
1068
|
-
status:
|
|
1163
|
+
z15.object({
|
|
1164
|
+
type: z15.enum(ConfirmableActions),
|
|
1165
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1069
1166
|
}).shape
|
|
1070
1167
|
);
|
|
1071
|
-
var Action =
|
|
1072
|
-
|
|
1073
|
-
// ../commons/src/events/Flag.ts
|
|
1074
|
-
var z14 = __toESM(require("zod/v4"));
|
|
1075
|
-
var InherentFlags = {
|
|
1076
|
-
INCOMPLETE: "incomplete",
|
|
1077
|
-
REJECTED: "rejected",
|
|
1078
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1079
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1080
|
-
/**
|
|
1081
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1082
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1083
|
-
*
|
|
1084
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1085
|
-
*/
|
|
1086
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1087
|
-
};
|
|
1088
|
-
var ActionFlag = z14.string().regex(
|
|
1089
|
-
new RegExp(
|
|
1090
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1091
|
-
ActionStatus
|
|
1092
|
-
).join("|").toLowerCase()})$`
|
|
1093
|
-
),
|
|
1094
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1095
|
-
);
|
|
1096
|
-
var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1097
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1098
|
-
InherentFlags
|
|
1099
|
-
).join(", ")}`
|
|
1100
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1101
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1102
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1103
|
-
var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
|
|
1104
|
-
var FlagConfig = z14.object({
|
|
1105
|
-
id: CustomFlag,
|
|
1106
|
-
requiresAction: z14.boolean().describe(
|
|
1107
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1108
|
-
),
|
|
1109
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1110
|
-
}).meta({
|
|
1111
|
-
id: "FlagConfig",
|
|
1112
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1113
|
-
});
|
|
1114
|
-
var ActionFlagConfig = z14.object({
|
|
1115
|
-
id: Flag,
|
|
1116
|
-
operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1117
|
-
conditional: Conditional.optional().describe(
|
|
1118
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1119
|
-
)
|
|
1120
|
-
}).meta({
|
|
1121
|
-
id: "ActionFlagConfig",
|
|
1122
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1123
|
-
});
|
|
1168
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1124
1169
|
|
|
1125
1170
|
// ../commons/src/events/EventMetadata.ts
|
|
1126
|
-
var
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
"
|
|
1130
|
-
"
|
|
1131
|
-
"ARCHIVED"
|
|
1132
|
-
]);
|
|
1133
|
-
var ZodDate = z15.iso.date();
|
|
1134
|
-
var ZodDateTime = z15.string().datetime();
|
|
1135
|
-
var ActionCreationMetadata = z15.object({
|
|
1136
|
-
createdAt: z15.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1137
|
-
createdBy: z15.string().describe("ID of the user who created the action request."),
|
|
1171
|
+
var ZodDate = z16.iso.date();
|
|
1172
|
+
var ZodDateTime = z16.string().datetime();
|
|
1173
|
+
var ActionCreationMetadata = z16.object({
|
|
1174
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1175
|
+
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1138
1176
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1139
1177
|
createdAtLocation: UUID.nullish().describe(
|
|
1140
1178
|
"Location of the user who created the action request."
|
|
1141
1179
|
),
|
|
1142
|
-
createdByUserType:
|
|
1143
|
-
acceptedAt:
|
|
1144
|
-
createdByRole:
|
|
1180
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1181
|
+
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1182
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1145
1183
|
});
|
|
1146
1184
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1147
|
-
registrationNumber:
|
|
1185
|
+
registrationNumber: z16.string().describe(
|
|
1148
1186
|
"Registration number of the event. Always present for accepted registrations."
|
|
1149
1187
|
)
|
|
1150
1188
|
});
|
|
1151
|
-
var LegalStatuses =
|
|
1189
|
+
var LegalStatuses = z16.object({
|
|
1152
1190
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1153
1191
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1154
1192
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1155
1193
|
});
|
|
1156
|
-
var EventMetadata =
|
|
1194
|
+
var EventMetadata = z16.object({
|
|
1157
1195
|
id: UUID,
|
|
1158
|
-
type:
|
|
1196
|
+
type: z16.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1159
1197
|
status: EventStatus,
|
|
1160
1198
|
legalStatuses: LegalStatuses.describe(
|
|
1161
1199
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1162
1200
|
),
|
|
1163
|
-
createdAt:
|
|
1201
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1164
1202
|
dateOfEvent: ZodDate.nullish(),
|
|
1165
1203
|
placeOfEvent: UUID.nullish(),
|
|
1166
|
-
createdBy:
|
|
1167
|
-
createdByUserType:
|
|
1168
|
-
updatedByUserRole:
|
|
1204
|
+
createdBy: z16.string().describe("ID of the user who created the event."),
|
|
1205
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1206
|
+
updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
|
|
1169
1207
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1170
1208
|
createdAtLocation: UUID.nullish().describe(
|
|
1171
1209
|
"Location of the user who created the event."
|
|
@@ -1173,18 +1211,18 @@ var EventMetadata = z15.object({
|
|
|
1173
1211
|
updatedAtLocation: UUID.nullish().describe(
|
|
1174
1212
|
"Location of the user who last changed the status."
|
|
1175
1213
|
),
|
|
1176
|
-
updatedAt:
|
|
1214
|
+
updatedAt: z16.iso.datetime().describe(
|
|
1177
1215
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1178
1216
|
),
|
|
1179
|
-
assignedTo:
|
|
1180
|
-
updatedBy:
|
|
1181
|
-
trackingId:
|
|
1217
|
+
assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1218
|
+
updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
|
|
1219
|
+
trackingId: z16.string().describe(
|
|
1182
1220
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1183
1221
|
),
|
|
1184
|
-
potentialDuplicates:
|
|
1222
|
+
potentialDuplicates: z16.array(PotentialDuplicate).describe(
|
|
1185
1223
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1186
1224
|
),
|
|
1187
|
-
flags:
|
|
1225
|
+
flags: z16.array(Flag)
|
|
1188
1226
|
});
|
|
1189
1227
|
var EventMetadataKeysArray = [
|
|
1190
1228
|
"id",
|
|
@@ -1205,8 +1243,8 @@ var EventMetadataKeysArray = [
|
|
|
1205
1243
|
"legalStatuses",
|
|
1206
1244
|
"flags"
|
|
1207
1245
|
];
|
|
1208
|
-
var EventMetadataKeys =
|
|
1209
|
-
var EventMetadataDateFieldIdInput =
|
|
1246
|
+
var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
|
|
1247
|
+
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1210
1248
|
"createdAt",
|
|
1211
1249
|
"updatedAt",
|
|
1212
1250
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1216,7 +1254,7 @@ var EventMetadataDateFieldIdInput = z15.enum([
|
|
|
1216
1254
|
"legalStatuses.REGISTERED.createdAt",
|
|
1217
1255
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1218
1256
|
]);
|
|
1219
|
-
var EventMetadataDateFieldId =
|
|
1257
|
+
var EventMetadataDateFieldId = z16.enum([
|
|
1220
1258
|
"event.createdAt",
|
|
1221
1259
|
"event.updatedAt",
|
|
1222
1260
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1281,13 +1319,6 @@ var Range = import_v4.z.object({
|
|
|
1281
1319
|
}).meta({
|
|
1282
1320
|
id: "Range"
|
|
1283
1321
|
});
|
|
1284
|
-
var ContainsFlags = import_v4.z.object({
|
|
1285
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1286
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1287
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1288
|
-
}).meta({
|
|
1289
|
-
id: "ContainsFlags"
|
|
1290
|
-
});
|
|
1291
1322
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1292
1323
|
id: "Within"
|
|
1293
1324
|
});
|
|
@@ -1482,8 +1513,8 @@ var BaseField = import_v43.default.object({
|
|
|
1482
1513
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1483
1514
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1484
1515
|
),
|
|
1485
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1486
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1516
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1517
|
+
"Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1487
1518
|
),
|
|
1488
1519
|
placeholder: TranslationConfig.optional(),
|
|
1489
1520
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -1881,7 +1912,13 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1881
1912
|
configuration: import_v43.default.object({
|
|
1882
1913
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1883
1914
|
type: AdministrativeAreas,
|
|
1884
|
-
allowedLocations: AllowedLocations
|
|
1915
|
+
allowedLocations: AllowedLocations,
|
|
1916
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1917
|
+
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
1918
|
+
),
|
|
1919
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
1920
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
|
|
1921
|
+
)
|
|
1885
1922
|
}).describe("Administrative area options")
|
|
1886
1923
|
}).meta({
|
|
1887
1924
|
description: "Administrative area input field",
|
|
@@ -1892,7 +1929,13 @@ var LocationInput = BaseField.extend({
|
|
|
1892
1929
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1893
1930
|
configuration: import_v43.default.object({
|
|
1894
1931
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1895
|
-
allowedLocations: AllowedLocations
|
|
1932
|
+
allowedLocations: AllowedLocations,
|
|
1933
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1934
|
+
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
1935
|
+
),
|
|
1936
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
1937
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
|
|
1938
|
+
)
|
|
1896
1939
|
}).optional()
|
|
1897
1940
|
}).meta({
|
|
1898
1941
|
description: "A field for selecting a location",
|
|
@@ -1918,12 +1961,20 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1918
1961
|
var Facility = BaseField.extend({
|
|
1919
1962
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1920
1963
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1921
|
-
configuration: import_v43.default.object({
|
|
1964
|
+
configuration: import_v43.default.object({
|
|
1965
|
+
allowedLocations: AllowedLocations,
|
|
1966
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
1967
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
1968
|
+
}).optional()
|
|
1922
1969
|
}).describe("Input field for a facility");
|
|
1923
1970
|
var Office = BaseField.extend({
|
|
1924
1971
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1925
1972
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1926
|
-
configuration: import_v43.default.object({
|
|
1973
|
+
configuration: import_v43.default.object({
|
|
1974
|
+
allowedLocations: AllowedLocations,
|
|
1975
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
1976
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
1977
|
+
}).optional()
|
|
1927
1978
|
}).describe("Input field for an office");
|
|
1928
1979
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
1929
1980
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -1956,7 +2007,13 @@ var Address = BaseField.extend({
|
|
|
1956
2007
|
parent: FieldReference.optional()
|
|
1957
2008
|
})
|
|
1958
2009
|
).optional(),
|
|
1959
|
-
allowedLocations: AllowedLocations
|
|
2010
|
+
allowedLocations: AllowedLocations,
|
|
2011
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2012
|
+
"Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
|
|
2013
|
+
),
|
|
2014
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2015
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that. Propagated to the embedded admin-area selectors."
|
|
2016
|
+
)
|
|
1960
2017
|
}).optional(),
|
|
1961
2018
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
1962
2019
|
}).meta({
|
|
@@ -2011,10 +2068,19 @@ var ButtonField = BaseField.extend({
|
|
|
2011
2068
|
description: "A generic button that can be used to trigger an action",
|
|
2012
2069
|
id: "ButtonField"
|
|
2013
2070
|
});
|
|
2071
|
+
var FieldGroupConfiguration = import_v43.default.object({
|
|
2072
|
+
separator: import_v43.default.string().optional().describe(
|
|
2073
|
+
'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
|
|
2074
|
+
),
|
|
2075
|
+
hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
|
|
2076
|
+
"Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
|
|
2077
|
+
)
|
|
2078
|
+
});
|
|
2014
2079
|
var FieldGroup = BaseField.extend({
|
|
2015
2080
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2016
2081
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2017
|
-
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2082
|
+
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
|
|
2083
|
+
configuration: FieldGroupConfiguration.optional()
|
|
2018
2084
|
}).meta({
|
|
2019
2085
|
description: "A group of fields that are displayed together",
|
|
2020
2086
|
id: "FieldGroup"
|
|
@@ -2257,7 +2323,7 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2257
2323
|
]);
|
|
2258
2324
|
|
|
2259
2325
|
// ../commons/src/application-config.ts
|
|
2260
|
-
var SearchCriteria =
|
|
2326
|
+
var SearchCriteria = z21.enum([
|
|
2261
2327
|
"TRACKING_ID",
|
|
2262
2328
|
"REGISTRATION_NUMBER",
|
|
2263
2329
|
"NATIONAL_ID",
|
|
@@ -2265,69 +2331,69 @@ var SearchCriteria = z20.enum([
|
|
|
2265
2331
|
"PHONE_NUMBER",
|
|
2266
2332
|
"EMAIL"
|
|
2267
2333
|
]);
|
|
2268
|
-
var ApplicationConfig =
|
|
2269
|
-
APPLICATION_NAME:
|
|
2270
|
-
COUNTRY_LOGO:
|
|
2271
|
-
fileName:
|
|
2272
|
-
file:
|
|
2334
|
+
var ApplicationConfig = z21.object({
|
|
2335
|
+
APPLICATION_NAME: z21.string(),
|
|
2336
|
+
COUNTRY_LOGO: z21.object({
|
|
2337
|
+
fileName: z21.string(),
|
|
2338
|
+
file: z21.string()
|
|
2273
2339
|
}),
|
|
2274
|
-
SYSTEM_IANA_TIMEZONE:
|
|
2275
|
-
CURRENCY:
|
|
2276
|
-
languagesAndCountry:
|
|
2277
|
-
isoCode:
|
|
2340
|
+
SYSTEM_IANA_TIMEZONE: z21.string(),
|
|
2341
|
+
CURRENCY: z21.object({
|
|
2342
|
+
languagesAndCountry: z21.array(z21.string()),
|
|
2343
|
+
isoCode: z21.string()
|
|
2278
2344
|
}),
|
|
2279
|
-
ADMIN_STRUCTURE:
|
|
2280
|
-
|
|
2281
|
-
id:
|
|
2345
|
+
ADMIN_STRUCTURE: z21.array(
|
|
2346
|
+
z21.object({
|
|
2347
|
+
id: z21.string(),
|
|
2282
2348
|
label: TranslationConfig
|
|
2283
2349
|
})
|
|
2284
2350
|
),
|
|
2285
|
-
PHONE_NUMBER_PATTERN:
|
|
2286
|
-
USER_NOTIFICATION_DELIVERY_METHOD:
|
|
2287
|
-
INFORMANT_NOTIFICATION_DELIVERY_METHOD:
|
|
2351
|
+
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2352
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2353
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2288
2354
|
SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
|
|
2289
|
-
ADDITIONAL_USER_FIELDS:
|
|
2355
|
+
ADDITIONAL_USER_FIELDS: z21.array(FieldConfig).optional().default([])
|
|
2290
2356
|
});
|
|
2291
2357
|
var defineApplicationConfig = (config) => {
|
|
2292
2358
|
return ApplicationConfig.parse(config);
|
|
2293
2359
|
};
|
|
2294
|
-
var BackgroundConfig =
|
|
2295
|
-
backgroundColor:
|
|
2296
|
-
backgroundImage:
|
|
2297
|
-
imageFit:
|
|
2360
|
+
var BackgroundConfig = z21.object({
|
|
2361
|
+
backgroundColor: z21.string().optional(),
|
|
2362
|
+
backgroundImage: z21.string().optional(),
|
|
2363
|
+
imageFit: z21.string().optional()
|
|
2298
2364
|
}).refine(
|
|
2299
2365
|
(data) => !!(data.backgroundColor || data.backgroundImage),
|
|
2300
2366
|
"backgroundColor and backgroundImage cannot be empty at the same time"
|
|
2301
2367
|
);
|
|
2302
|
-
var LoginConfig =
|
|
2303
|
-
COUNTRY:
|
|
2304
|
-
LANGUAGES:
|
|
2305
|
-
USER_NOTIFICATION_DELIVERY_METHOD:
|
|
2306
|
-
INFORMANT_NOTIFICATION_DELIVERY_METHOD:
|
|
2307
|
-
PHONE_NUMBER_PATTERN:
|
|
2368
|
+
var LoginConfig = z21.object({
|
|
2369
|
+
COUNTRY: z21.string(),
|
|
2370
|
+
LANGUAGES: z21.array(z21.string()),
|
|
2371
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2372
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2373
|
+
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2308
2374
|
LOGIN_BACKGROUND: BackgroundConfig,
|
|
2309
|
-
SENTRY:
|
|
2375
|
+
SENTRY: z21.string().optional()
|
|
2310
2376
|
});
|
|
2311
2377
|
var defineLoginConfig = (config) => {
|
|
2312
2378
|
return LoginConfig.parse(config);
|
|
2313
2379
|
};
|
|
2314
|
-
var ClientConfig =
|
|
2315
|
-
COUNTRY:
|
|
2316
|
-
LANGUAGES:
|
|
2317
|
-
SENTRY:
|
|
2318
|
-
LOGIN_URL:
|
|
2380
|
+
var ClientConfig = z21.object({
|
|
2381
|
+
COUNTRY: z21.string(),
|
|
2382
|
+
LANGUAGES: z21.array(z21.string()),
|
|
2383
|
+
SENTRY: z21.string().optional(),
|
|
2384
|
+
LOGIN_URL: z21.string().optional(),
|
|
2319
2385
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2320
|
-
DASHBOARDS:
|
|
2321
|
-
|
|
2322
|
-
id:
|
|
2386
|
+
DASHBOARDS: z21.array(
|
|
2387
|
+
z21.object({
|
|
2388
|
+
id: z21.string(),
|
|
2323
2389
|
title: TranslationConfig,
|
|
2324
|
-
url:
|
|
2325
|
-
context:
|
|
2326
|
-
auth:
|
|
2390
|
+
url: z21.string(),
|
|
2391
|
+
context: z21.object({
|
|
2392
|
+
auth: z21.literal("REQUEST_AUTH_TOKEN")
|
|
2327
2393
|
}).optional()
|
|
2328
2394
|
})
|
|
2329
2395
|
),
|
|
2330
|
-
FEATURES:
|
|
2396
|
+
FEATURES: z21.object({ V2_EVENTS: z21.boolean().optional().default(true) }).optional().default({ V2_EVENTS: true })
|
|
2331
2397
|
});
|
|
2332
2398
|
var defineClientConfig = (config) => {
|
|
2333
2399
|
return ClientConfig.parse(config);
|