@opencrvs/toolkit 2.1.0-rc.1b9e49f → 2.1.0-rc.1bb0cb2
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 +1 -0
- package/build.sh +5 -1
- package/create-countryconfig/index.js +284 -62
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +343 -275
- package/dist/cli.js +1423 -152
- package/dist/commons/api/router.d.ts +3971 -3373
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +105 -105
- package/dist/commons/events/ActionDocument.d.ts +121 -127
- package/dist/commons/events/ActionInput.d.ts +4 -10
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +531 -507
- package/dist/commons/events/AuditLog.d.ts +189 -42
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
- package/dist/commons/events/Draft.d.ts +37 -37
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -5
- package/dist/commons/events/EventDocument.d.ts +518 -50
- package/dist/commons/events/EventIndex.d.ts +49 -72
- package/dist/commons/events/EventMetadata.d.ts +39 -49
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +424 -389
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +86 -86
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +817 -814
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- 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 +243 -14
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +47 -46
- package/dist/commons/events/utils.d.ts +114 -114
- package/dist/commons/notification/UserNotifications.d.ts +38 -23
- package/dist/commons/notification/dispatch.d.ts +15 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +328 -58
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/derived-variables.d.ts +119 -131
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +0 -14
- 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 +3 -3
- package/dist/environment/manage-users.js +17 -7
- 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 +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +11 -30
- package/dist/environment/swarm-to-k8s.js +17 -7
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +34 -12
- 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 +28 -20
- package/dist/environment/utils.d.ts +1 -1
- package/dist/environment/utils.js +17 -7
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +3760 -3361
- 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/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- 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 +438 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1058 -0
- package/dist/notification/index.js +1865 -1467
- package/dist/scopes/index.d.ts +464 -169
- package/dist/scopes/index.js +329 -58
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/dependencies/values.yaml +0 -3
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
- 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 +23 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +128 -0
- package/opencrvs-toolkit-2.1.0-rc.1bb0cb2.tgz +0 -0
- package/package.json +10 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -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.1b9e49f.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,14 +721,20 @@ 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",
|
|
@@ -658,15 +746,21 @@ var PlainScopeType = z11.enum([
|
|
|
658
746
|
"record.confirm-registration",
|
|
659
747
|
"record.reject-registration"
|
|
660
748
|
]);
|
|
661
|
-
var scopeByEvent =
|
|
749
|
+
var scopeByEvent = z13.preprocess(
|
|
662
750
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
663
|
-
|
|
751
|
+
z13.array(z13.string()).optional()
|
|
664
752
|
).describe("Event type, e.g. birth, death");
|
|
665
|
-
var
|
|
753
|
+
var scopeByStatus = z13.preprocess(
|
|
754
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
755
|
+
z13.array(EventStatus).optional()
|
|
756
|
+
).describe(
|
|
757
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
758
|
+
);
|
|
759
|
+
var userRole = z13.preprocess(
|
|
666
760
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
667
|
-
|
|
761
|
+
z13.array(z13.string()).optional()
|
|
668
762
|
).describe("User role, e.g. admin, field agent");
|
|
669
|
-
var scopeOptionsPlaceEvent =
|
|
763
|
+
var scopeOptionsPlaceEvent = z13.object({
|
|
670
764
|
event: scopeByEvent,
|
|
671
765
|
placeOfEvent: JurisdictionFilter.optional()
|
|
672
766
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -674,40 +768,42 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
674
768
|
notifiedIn: JurisdictionFilter.optional(),
|
|
675
769
|
notifiedBy: UserFilter.optional(),
|
|
676
770
|
declaredIn: JurisdictionFilter.optional(),
|
|
677
|
-
declaredBy: UserFilter.optional()
|
|
771
|
+
declaredBy: UserFilter.optional(),
|
|
772
|
+
status: scopeByStatus
|
|
678
773
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
679
774
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
680
775
|
registeredIn: JurisdictionFilter.optional(),
|
|
681
|
-
registeredBy: UserFilter.optional()
|
|
776
|
+
registeredBy: UserFilter.optional(),
|
|
777
|
+
flags: ContainsFlags.optional()
|
|
682
778
|
}).describe(
|
|
683
779
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
684
780
|
);
|
|
685
781
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
686
|
-
customActionTypes:
|
|
782
|
+
customActionTypes: z13.preprocess(
|
|
687
783
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
688
|
-
|
|
784
|
+
z13.array(z13.string()).optional()
|
|
689
785
|
).describe("Allowed custom action types")
|
|
690
786
|
});
|
|
691
|
-
var AccessLevelOptions =
|
|
787
|
+
var AccessLevelOptions = z13.object({
|
|
692
788
|
accessLevel: JurisdictionFilter.optional()
|
|
693
789
|
});
|
|
694
790
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
695
791
|
role: userRole.optional()
|
|
696
792
|
});
|
|
697
|
-
var WorkqueueOrDashboardOptions =
|
|
698
|
-
ids:
|
|
793
|
+
var WorkqueueOrDashboardOptions = z13.object({
|
|
794
|
+
ids: z13.preprocess(
|
|
699
795
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
700
|
-
|
|
796
|
+
z13.array(z13.string())
|
|
701
797
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
702
798
|
});
|
|
703
|
-
var AllScopeOptions =
|
|
799
|
+
var AllScopeOptions = z13.object({
|
|
704
800
|
...AllRecordScopeOptions.shape,
|
|
705
801
|
...AccessLevelOptions.shape,
|
|
706
802
|
...AllUserScopeOptions.shape,
|
|
707
803
|
...WorkqueueOrDashboardOptions.shape
|
|
708
804
|
});
|
|
709
805
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
710
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
806
|
+
var ResolvedScopeOptionsPlaceEvent = z13.object({
|
|
711
807
|
event: scopeByEvent,
|
|
712
808
|
placeOfEvent: UUID.nullish()
|
|
713
809
|
}).describe(
|
|
@@ -715,15 +811,16 @@ var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
|
715
811
|
);
|
|
716
812
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
717
813
|
notifiedIn: UUID.nullish(),
|
|
718
|
-
notifiedBy:
|
|
814
|
+
notifiedBy: z13.string().optional(),
|
|
719
815
|
declaredIn: UUID.nullish(),
|
|
720
|
-
declaredBy:
|
|
816
|
+
declaredBy: z13.string().optional()
|
|
721
817
|
}).describe(
|
|
722
818
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
723
819
|
);
|
|
724
820
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
725
821
|
registeredIn: UUID.nullish(),
|
|
726
|
-
registeredBy:
|
|
822
|
+
registeredBy: z13.string().optional(),
|
|
823
|
+
flags: ContainsFlags.optional()
|
|
727
824
|
}).describe(
|
|
728
825
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
729
826
|
);
|
|
@@ -737,7 +834,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
737
834
|
"record.reject",
|
|
738
835
|
"record.archive",
|
|
739
836
|
"record.unarchive",
|
|
740
|
-
"record.review-duplicates",
|
|
741
837
|
"record.register"
|
|
742
838
|
]);
|
|
743
839
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -745,41 +841,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
745
841
|
"record.read",
|
|
746
842
|
"record.request-correction",
|
|
747
843
|
"record.correct",
|
|
748
|
-
"record.unassign-others"
|
|
844
|
+
"record.unassign-others",
|
|
845
|
+
"record.review-duplicates"
|
|
749
846
|
]);
|
|
750
847
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
751
|
-
templates:
|
|
848
|
+
templates: z13.preprocess(
|
|
752
849
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
753
|
-
|
|
850
|
+
z13.array(z13.string()).optional()
|
|
754
851
|
).describe(
|
|
755
852
|
"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
853
|
)
|
|
757
854
|
});
|
|
758
|
-
var RecordScopeV2 =
|
|
759
|
-
|
|
855
|
+
var RecordScopeV2 = z13.discriminatedUnion("type", [
|
|
856
|
+
z13.object({
|
|
760
857
|
type: ScopesWithPlaceEventOptions,
|
|
761
858
|
options: scopeOptionsPlaceEvent.optional()
|
|
762
859
|
}),
|
|
763
|
-
|
|
860
|
+
z13.object({
|
|
764
861
|
type: ScopesWithDeclaredOptions,
|
|
765
862
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
766
863
|
}),
|
|
767
|
-
|
|
864
|
+
z13.object({
|
|
768
865
|
type: ScopesWithFullOptions,
|
|
769
866
|
options: AllRecordScopeOptions.optional()
|
|
770
867
|
}),
|
|
771
|
-
|
|
772
|
-
type:
|
|
868
|
+
z13.object({
|
|
869
|
+
type: z13.literal("record.custom-action"),
|
|
773
870
|
options: CustomActionScopeOptions.optional()
|
|
774
871
|
}),
|
|
775
|
-
|
|
776
|
-
type:
|
|
872
|
+
z13.object({
|
|
873
|
+
type: z13.literal("record.print-certified-copies"),
|
|
777
874
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
778
875
|
})
|
|
779
876
|
]).describe(
|
|
780
877
|
"Scopes used to check user's permission to perform actions on a record."
|
|
781
878
|
);
|
|
782
|
-
var SystemScopeType =
|
|
879
|
+
var SystemScopeType = z13.enum([
|
|
783
880
|
"organisation.read-locations",
|
|
784
881
|
"user.read",
|
|
785
882
|
"user.create",
|
|
@@ -793,61 +890,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
793
890
|
"user.search"
|
|
794
891
|
]);
|
|
795
892
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
796
|
-
var UserScopeV2 =
|
|
797
|
-
|
|
893
|
+
var UserScopeV2 = z13.discriminatedUnion("type", [
|
|
894
|
+
z13.object({
|
|
798
895
|
type: ScopesWithRoleOption,
|
|
799
896
|
options: AllUserScopeOptions.optional()
|
|
800
897
|
}),
|
|
801
|
-
|
|
898
|
+
z13.object({
|
|
802
899
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
803
900
|
options: AccessLevelOptions.optional()
|
|
804
901
|
})
|
|
805
902
|
]);
|
|
806
|
-
var ResolvedRecordScopeV2 =
|
|
807
|
-
|
|
903
|
+
var ResolvedRecordScopeV2 = z13.discriminatedUnion("type", [
|
|
904
|
+
z13.object({
|
|
808
905
|
type: ScopesWithPlaceEventOptions,
|
|
809
906
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
810
907
|
}),
|
|
811
|
-
|
|
908
|
+
z13.object({
|
|
812
909
|
type: ScopesWithDeclaredOptions,
|
|
813
910
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
814
911
|
}),
|
|
815
|
-
|
|
912
|
+
z13.object({
|
|
816
913
|
type: ScopesWithFullOptions,
|
|
817
914
|
options: ResolvedScopeOptionsFull.optional()
|
|
818
915
|
}),
|
|
819
|
-
|
|
820
|
-
type:
|
|
916
|
+
z13.object({
|
|
917
|
+
type: z13.literal("record.print-certified-copies"),
|
|
821
918
|
options: ResolvedScopeOptionsFull.extend({
|
|
822
|
-
templates:
|
|
919
|
+
templates: z13.array(z13.string()).optional()
|
|
823
920
|
}).optional()
|
|
824
921
|
})
|
|
825
922
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
826
|
-
var Scope =
|
|
827
|
-
|
|
923
|
+
var Scope = z13.discriminatedUnion("type", [
|
|
924
|
+
z13.object({ type: PlainScopeType }),
|
|
828
925
|
...RecordScopeV2.options,
|
|
829
926
|
...UserScopeV2.options,
|
|
830
|
-
|
|
831
|
-
type:
|
|
927
|
+
z13.object({
|
|
928
|
+
type: z13.literal("organisation.read-locations"),
|
|
832
929
|
options: AccessLevelOptions.optional()
|
|
833
930
|
}),
|
|
834
|
-
|
|
835
|
-
type:
|
|
931
|
+
z13.object({
|
|
932
|
+
type: z13.literal("workqueue"),
|
|
836
933
|
options: WorkqueueOrDashboardOptions
|
|
837
934
|
}),
|
|
838
|
-
|
|
839
|
-
type:
|
|
935
|
+
z13.object({
|
|
936
|
+
type: z13.literal("dashboard.view"),
|
|
840
937
|
options: WorkqueueOrDashboardOptions
|
|
841
938
|
})
|
|
842
939
|
]);
|
|
843
|
-
var ScopeType =
|
|
940
|
+
var ScopeType = z13.enum([
|
|
844
941
|
...SystemScopeType.options,
|
|
845
942
|
...RecordScopeTypeV2.options,
|
|
846
943
|
...PlainScopeType.options,
|
|
847
944
|
"workqueue",
|
|
848
945
|
"dashboard.view"
|
|
849
946
|
]);
|
|
850
|
-
var EncodedScope =
|
|
947
|
+
var EncodedScope = z13.string().brand("EncodedScope");
|
|
851
948
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
852
949
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
853
950
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -857,30 +954,25 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
857
954
|
};
|
|
858
955
|
|
|
859
956
|
// ../commons/src/authentication.ts
|
|
860
|
-
var TokenUserType =
|
|
861
|
-
var TokenWithBearer =
|
|
957
|
+
var TokenUserType = z14.enum(["user", "system"]);
|
|
958
|
+
var TokenWithBearer = z14.string().regex(/^Bearer\s/);
|
|
862
959
|
|
|
863
960
|
// ../commons/src/events/ActionDocument.ts
|
|
864
|
-
var ActionUpdate =
|
|
961
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
865
962
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
866
963
|
);
|
|
867
|
-
var EventState =
|
|
964
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
868
965
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
869
966
|
);
|
|
870
|
-
var
|
|
871
|
-
Requested: "Requested",
|
|
872
|
-
Accepted: "Accepted",
|
|
873
|
-
Rejected: "Rejected"
|
|
874
|
-
};
|
|
875
|
-
var ActionBase = z13.object({
|
|
967
|
+
var ActionBase = z15.object({
|
|
876
968
|
id: UUID.describe("Unique identifier of the action."),
|
|
877
|
-
transactionId:
|
|
969
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
878
970
|
createdByUserType: TokenUserType.describe(
|
|
879
971
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
880
972
|
),
|
|
881
|
-
createdAt:
|
|
882
|
-
createdBy:
|
|
883
|
-
createdByRole:
|
|
973
|
+
createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
974
|
+
createdBy: z15.string().describe("Identifier of the user who created the action."),
|
|
975
|
+
createdByRole: z15.string().optional().describe("Role of the user who created the action."),
|
|
884
976
|
createdBySignature: DocumentPath.nullish().describe(
|
|
885
977
|
"Reference to the signature of the user who created the action."
|
|
886
978
|
),
|
|
@@ -892,7 +984,7 @@ var ActionBase = z13.object({
|
|
|
892
984
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
893
985
|
),
|
|
894
986
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
895
|
-
status:
|
|
987
|
+
status: z15.enum([
|
|
896
988
|
ActionStatus.Requested,
|
|
897
989
|
ActionStatus.Accepted,
|
|
898
990
|
ActionStatus.Rejected
|
|
@@ -904,138 +996,143 @@ var ActionBase = z13.object({
|
|
|
904
996
|
)
|
|
905
997
|
});
|
|
906
998
|
var AssignedAction = ActionBase.extend(
|
|
907
|
-
|
|
908
|
-
type:
|
|
909
|
-
assignedTo:
|
|
999
|
+
z15.object({
|
|
1000
|
+
type: z15.literal(ActionType.ASSIGN),
|
|
1001
|
+
assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
|
|
910
1002
|
// TODO move into 'content' property
|
|
911
1003
|
}).shape
|
|
912
1004
|
);
|
|
913
1005
|
var UnassignedAction = ActionBase.extend(
|
|
914
|
-
|
|
915
|
-
type:
|
|
1006
|
+
z15.object({
|
|
1007
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
916
1008
|
}).shape
|
|
917
1009
|
);
|
|
918
1010
|
var RegisterAction = ActionBase.extend(
|
|
919
|
-
|
|
920
|
-
type:
|
|
921
|
-
registrationNumber:
|
|
1011
|
+
z15.object({
|
|
1012
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1013
|
+
registrationNumber: z15.string().optional().describe(
|
|
922
1014
|
"Registration number of the event. Always present for accepted registrations."
|
|
923
1015
|
)
|
|
924
1016
|
// TODO move into 'content' property
|
|
925
1017
|
}).shape
|
|
926
1018
|
);
|
|
927
1019
|
var DeclareAction = ActionBase.extend(
|
|
928
|
-
|
|
929
|
-
type:
|
|
1020
|
+
z15.object({
|
|
1021
|
+
type: z15.literal(ActionType.DECLARE)
|
|
930
1022
|
}).shape
|
|
931
1023
|
);
|
|
932
|
-
var ReasonContent =
|
|
933
|
-
reason:
|
|
1024
|
+
var ReasonContent = z15.object({
|
|
1025
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
934
1026
|
"Message describing the reason for rejecting or archiving the event."
|
|
935
1027
|
)
|
|
936
1028
|
});
|
|
937
1029
|
var RejectAction = ActionBase.extend(
|
|
938
|
-
|
|
939
|
-
type:
|
|
1030
|
+
z15.object({
|
|
1031
|
+
type: z15.literal(ActionType.REJECT),
|
|
940
1032
|
content: ReasonContent
|
|
941
1033
|
}).shape
|
|
942
1034
|
);
|
|
943
|
-
var PotentialDuplicate =
|
|
1035
|
+
var PotentialDuplicate = z15.object({
|
|
944
1036
|
id: UUID,
|
|
945
|
-
trackingId:
|
|
1037
|
+
trackingId: z15.string()
|
|
946
1038
|
});
|
|
947
1039
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
948
|
-
|
|
949
|
-
type:
|
|
950
|
-
content:
|
|
951
|
-
duplicates:
|
|
1040
|
+
z15.object({
|
|
1041
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1042
|
+
content: z15.object({
|
|
1043
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
952
1044
|
})
|
|
953
1045
|
}).shape
|
|
954
1046
|
);
|
|
955
1047
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
956
|
-
|
|
957
|
-
type:
|
|
1048
|
+
z15.object({
|
|
1049
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
958
1050
|
}).shape
|
|
959
1051
|
);
|
|
960
1052
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
961
|
-
|
|
962
|
-
type:
|
|
963
|
-
content:
|
|
1053
|
+
z15.object({
|
|
1054
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1055
|
+
content: z15.object({
|
|
964
1056
|
duplicateOf: UUID
|
|
965
1057
|
}).optional()
|
|
966
1058
|
}).shape
|
|
967
1059
|
);
|
|
968
1060
|
var ArchiveAction = ActionBase.extend(
|
|
969
|
-
|
|
970
|
-
type:
|
|
971
|
-
|
|
1061
|
+
z15.object({
|
|
1062
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1063
|
+
/**
|
|
1064
|
+
* Archiving does not collect a reason on its own. Only the
|
|
1065
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
1066
|
+
*/
|
|
1067
|
+
content: ReasonContent.optional()
|
|
972
1068
|
}).shape
|
|
973
1069
|
);
|
|
974
1070
|
var UnarchiveAction = ActionBase.extend(
|
|
975
|
-
|
|
976
|
-
type:
|
|
1071
|
+
z15.object({
|
|
1072
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
977
1073
|
}).shape
|
|
978
1074
|
);
|
|
979
1075
|
var CreatedAction = ActionBase.extend(
|
|
980
|
-
|
|
981
|
-
type:
|
|
1076
|
+
z15.object({
|
|
1077
|
+
type: z15.literal(ActionType.CREATE)
|
|
982
1078
|
}).shape
|
|
983
1079
|
);
|
|
984
1080
|
var NotifiedAction = ActionBase.extend(
|
|
985
|
-
|
|
986
|
-
type:
|
|
1081
|
+
z15.object({
|
|
1082
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
987
1083
|
}).shape
|
|
988
1084
|
);
|
|
989
1085
|
var EditAction = ActionBase.extend(
|
|
990
|
-
|
|
991
|
-
type:
|
|
992
|
-
content
|
|
993
|
-
|
|
994
|
-
|
|
1086
|
+
z15.object({
|
|
1087
|
+
type: z15.literal(ActionType.EDIT),
|
|
1088
|
+
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1089
|
+
content: z15.object({
|
|
1090
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
1091
|
+
}).optional()
|
|
995
1092
|
}).shape
|
|
996
1093
|
);
|
|
997
|
-
var PrintContent =
|
|
998
|
-
templateId:
|
|
1094
|
+
var PrintContent = z15.object({
|
|
1095
|
+
templateId: z15.string().optional()
|
|
999
1096
|
});
|
|
1000
1097
|
var PrintCertificateAction = ActionBase.extend(
|
|
1001
|
-
|
|
1002
|
-
type:
|
|
1098
|
+
z15.object({
|
|
1099
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1003
1100
|
content: PrintContent.optional().nullable()
|
|
1004
1101
|
}).shape
|
|
1005
1102
|
);
|
|
1006
1103
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1007
|
-
|
|
1008
|
-
type:
|
|
1104
|
+
z15.object({
|
|
1105
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1009
1106
|
}).shape
|
|
1010
1107
|
);
|
|
1011
1108
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1012
|
-
|
|
1013
|
-
type:
|
|
1014
|
-
requestId:
|
|
1109
|
+
z15.object({
|
|
1110
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1111
|
+
requestId: z15.string(),
|
|
1015
1112
|
// TODO move into 'content' property
|
|
1016
|
-
content:
|
|
1113
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1017
1114
|
}).shape
|
|
1018
1115
|
);
|
|
1019
1116
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1020
|
-
|
|
1021
|
-
type:
|
|
1022
|
-
requestId:
|
|
1117
|
+
z15.object({
|
|
1118
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1119
|
+
requestId: z15.string(),
|
|
1023
1120
|
// TODO move into 'content' property
|
|
1024
1121
|
content: ReasonContent
|
|
1025
1122
|
}).shape
|
|
1026
1123
|
);
|
|
1027
1124
|
var ReadAction = ActionBase.extend(
|
|
1028
|
-
|
|
1029
|
-
type:
|
|
1125
|
+
z15.object({
|
|
1126
|
+
type: z15.literal(ActionType.READ)
|
|
1030
1127
|
}).shape
|
|
1031
1128
|
);
|
|
1032
1129
|
var CustomAction = ActionBase.merge(
|
|
1033
|
-
|
|
1034
|
-
type:
|
|
1035
|
-
customActionType:
|
|
1130
|
+
z15.object({
|
|
1131
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1132
|
+
customActionType: z15.string()
|
|
1036
1133
|
})
|
|
1037
1134
|
);
|
|
1038
|
-
var ActionDocument =
|
|
1135
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1039
1136
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1040
1137
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1041
1138
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1062,109 +1159,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1062
1159
|
declaration: true,
|
|
1063
1160
|
annotation: true
|
|
1064
1161
|
}).extend(
|
|
1065
|
-
|
|
1066
|
-
type:
|
|
1067
|
-
status:
|
|
1162
|
+
z15.object({
|
|
1163
|
+
type: z15.enum(ConfirmableActions),
|
|
1164
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1068
1165
|
}).shape
|
|
1069
1166
|
);
|
|
1070
|
-
var Action =
|
|
1071
|
-
|
|
1072
|
-
// ../commons/src/events/Flag.ts
|
|
1073
|
-
var z14 = __toESM(require("zod/v4"));
|
|
1074
|
-
var InherentFlags = {
|
|
1075
|
-
INCOMPLETE: "incomplete",
|
|
1076
|
-
REJECTED: "rejected",
|
|
1077
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1078
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1079
|
-
/**
|
|
1080
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1081
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1082
|
-
*
|
|
1083
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1084
|
-
*/
|
|
1085
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1086
|
-
};
|
|
1087
|
-
var ActionFlag = z14.string().regex(
|
|
1088
|
-
new RegExp(
|
|
1089
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1090
|
-
ActionStatus
|
|
1091
|
-
).join("|").toLowerCase()})$`
|
|
1092
|
-
),
|
|
1093
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1094
|
-
);
|
|
1095
|
-
var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1096
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1097
|
-
InherentFlags
|
|
1098
|
-
).join(", ")}`
|
|
1099
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1100
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1101
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1102
|
-
var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
|
|
1103
|
-
var FlagConfig = z14.object({
|
|
1104
|
-
id: CustomFlag,
|
|
1105
|
-
requiresAction: z14.boolean().describe(
|
|
1106
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1107
|
-
),
|
|
1108
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1109
|
-
}).meta({
|
|
1110
|
-
id: "FlagConfig",
|
|
1111
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1112
|
-
});
|
|
1113
|
-
var ActionFlagConfig = z14.object({
|
|
1114
|
-
id: Flag,
|
|
1115
|
-
operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1116
|
-
conditional: Conditional.optional().describe(
|
|
1117
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1118
|
-
)
|
|
1119
|
-
}).meta({
|
|
1120
|
-
id: "ActionFlagConfig",
|
|
1121
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1122
|
-
});
|
|
1167
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1123
1168
|
|
|
1124
1169
|
// ../commons/src/events/EventMetadata.ts
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
"
|
|
1129
|
-
"
|
|
1130
|
-
"ARCHIVED"
|
|
1131
|
-
]);
|
|
1132
|
-
var ZodDate = z15.iso.date();
|
|
1133
|
-
var ZodDateTime = z15.string().datetime();
|
|
1134
|
-
var ActionCreationMetadata = z15.object({
|
|
1135
|
-
createdAt: z15.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1136
|
-
createdBy: z15.string().describe("ID of the user who created the action request."),
|
|
1170
|
+
var ZodDate = z16.iso.date();
|
|
1171
|
+
var ZodDateTime = z16.string().datetime();
|
|
1172
|
+
var ActionCreationMetadata = z16.object({
|
|
1173
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1174
|
+
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1137
1175
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1138
1176
|
createdAtLocation: UUID.nullish().describe(
|
|
1139
1177
|
"Location of the user who created the action request."
|
|
1140
1178
|
),
|
|
1141
|
-
createdByUserType:
|
|
1142
|
-
acceptedAt:
|
|
1143
|
-
createdByRole:
|
|
1179
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1180
|
+
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1181
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1144
1182
|
});
|
|
1145
1183
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1146
|
-
registrationNumber:
|
|
1184
|
+
registrationNumber: z16.string().describe(
|
|
1147
1185
|
"Registration number of the event. Always present for accepted registrations."
|
|
1148
1186
|
)
|
|
1149
1187
|
});
|
|
1150
|
-
var LegalStatuses =
|
|
1188
|
+
var LegalStatuses = z16.object({
|
|
1151
1189
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1152
1190
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1153
1191
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1154
1192
|
});
|
|
1155
|
-
var EventMetadata =
|
|
1193
|
+
var EventMetadata = z16.object({
|
|
1156
1194
|
id: UUID,
|
|
1157
|
-
type:
|
|
1195
|
+
type: z16.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1158
1196
|
status: EventStatus,
|
|
1159
1197
|
legalStatuses: LegalStatuses.describe(
|
|
1160
1198
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1161
1199
|
),
|
|
1162
|
-
createdAt:
|
|
1200
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1163
1201
|
dateOfEvent: ZodDate.nullish(),
|
|
1164
1202
|
placeOfEvent: UUID.nullish(),
|
|
1165
|
-
createdBy:
|
|
1166
|
-
createdByUserType:
|
|
1167
|
-
updatedByUserRole:
|
|
1203
|
+
createdBy: z16.string().describe("ID of the user who created the event."),
|
|
1204
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1205
|
+
updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
|
|
1168
1206
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1169
1207
|
createdAtLocation: UUID.nullish().describe(
|
|
1170
1208
|
"Location of the user who created the event."
|
|
@@ -1172,18 +1210,18 @@ var EventMetadata = z15.object({
|
|
|
1172
1210
|
updatedAtLocation: UUID.nullish().describe(
|
|
1173
1211
|
"Location of the user who last changed the status."
|
|
1174
1212
|
),
|
|
1175
|
-
updatedAt:
|
|
1213
|
+
updatedAt: z16.iso.datetime().describe(
|
|
1176
1214
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1177
1215
|
),
|
|
1178
|
-
assignedTo:
|
|
1179
|
-
updatedBy:
|
|
1180
|
-
trackingId:
|
|
1216
|
+
assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1217
|
+
updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
|
|
1218
|
+
trackingId: z16.string().describe(
|
|
1181
1219
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1182
1220
|
),
|
|
1183
|
-
potentialDuplicates:
|
|
1221
|
+
potentialDuplicates: z16.array(PotentialDuplicate).describe(
|
|
1184
1222
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1185
1223
|
),
|
|
1186
|
-
flags:
|
|
1224
|
+
flags: z16.array(Flag)
|
|
1187
1225
|
});
|
|
1188
1226
|
var EventMetadataKeysArray = [
|
|
1189
1227
|
"id",
|
|
@@ -1204,8 +1242,8 @@ var EventMetadataKeysArray = [
|
|
|
1204
1242
|
"legalStatuses",
|
|
1205
1243
|
"flags"
|
|
1206
1244
|
];
|
|
1207
|
-
var EventMetadataKeys =
|
|
1208
|
-
var EventMetadataDateFieldIdInput =
|
|
1245
|
+
var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
|
|
1246
|
+
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1209
1247
|
"createdAt",
|
|
1210
1248
|
"updatedAt",
|
|
1211
1249
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1215,7 +1253,7 @@ var EventMetadataDateFieldIdInput = z15.enum([
|
|
|
1215
1253
|
"legalStatuses.REGISTERED.createdAt",
|
|
1216
1254
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1217
1255
|
]);
|
|
1218
|
-
var EventMetadataDateFieldId =
|
|
1256
|
+
var EventMetadataDateFieldId = z16.enum([
|
|
1219
1257
|
"event.createdAt",
|
|
1220
1258
|
"event.updatedAt",
|
|
1221
1259
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1280,13 +1318,6 @@ var Range = import_v4.z.object({
|
|
|
1280
1318
|
}).meta({
|
|
1281
1319
|
id: "Range"
|
|
1282
1320
|
});
|
|
1283
|
-
var ContainsFlags = import_v4.z.object({
|
|
1284
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1285
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1286
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1287
|
-
}).meta({
|
|
1288
|
-
id: "ContainsFlags"
|
|
1289
|
-
});
|
|
1290
1321
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1291
1322
|
id: "Within"
|
|
1292
1323
|
});
|
|
@@ -1481,8 +1512,8 @@ var BaseField = import_v43.default.object({
|
|
|
1481
1512
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1482
1513
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1483
1514
|
),
|
|
1484
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1485
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1515
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1516
|
+
"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."
|
|
1486
1517
|
),
|
|
1487
1518
|
placeholder: TranslationConfig.optional(),
|
|
1488
1519
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -1880,7 +1911,16 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1880
1911
|
configuration: import_v43.default.object({
|
|
1881
1912
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1882
1913
|
type: AdministrativeAreas,
|
|
1883
|
-
allowedLocations: AllowedLocations
|
|
1914
|
+
allowedLocations: AllowedLocations,
|
|
1915
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1916
|
+
"List every historical name a location has had as a separate, selectable option."
|
|
1917
|
+
),
|
|
1918
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1919
|
+
"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."
|
|
1920
|
+
),
|
|
1921
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
1922
|
+
"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."
|
|
1923
|
+
)
|
|
1884
1924
|
}).describe("Administrative area options")
|
|
1885
1925
|
}).meta({
|
|
1886
1926
|
description: "Administrative area input field",
|
|
@@ -1891,7 +1931,16 @@ var LocationInput = BaseField.extend({
|
|
|
1891
1931
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1892
1932
|
configuration: import_v43.default.object({
|
|
1893
1933
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1894
|
-
allowedLocations: AllowedLocations
|
|
1934
|
+
allowedLocations: AllowedLocations,
|
|
1935
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1936
|
+
"List every historical name a location has had as a separate, selectable option."
|
|
1937
|
+
),
|
|
1938
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1939
|
+
"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."
|
|
1940
|
+
),
|
|
1941
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
1942
|
+
"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."
|
|
1943
|
+
)
|
|
1895
1944
|
}).optional()
|
|
1896
1945
|
}).meta({
|
|
1897
1946
|
description: "A field for selecting a location",
|
|
@@ -1917,12 +1966,22 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1917
1966
|
var Facility = BaseField.extend({
|
|
1918
1967
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1919
1968
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1920
|
-
configuration: import_v43.default.object({
|
|
1969
|
+
configuration: import_v43.default.object({
|
|
1970
|
+
allowedLocations: AllowedLocations,
|
|
1971
|
+
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
1972
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
1973
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
1974
|
+
}).optional()
|
|
1921
1975
|
}).describe("Input field for a facility");
|
|
1922
1976
|
var Office = BaseField.extend({
|
|
1923
1977
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1924
1978
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1925
|
-
configuration: import_v43.default.object({
|
|
1979
|
+
configuration: import_v43.default.object({
|
|
1980
|
+
allowedLocations: AllowedLocations,
|
|
1981
|
+
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
1982
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
1983
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
1984
|
+
}).optional()
|
|
1926
1985
|
}).describe("Input field for an office");
|
|
1927
1986
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
1928
1987
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -1955,7 +2014,16 @@ var Address = BaseField.extend({
|
|
|
1955
2014
|
parent: FieldReference.optional()
|
|
1956
2015
|
})
|
|
1957
2016
|
).optional(),
|
|
1958
|
-
allowedLocations: AllowedLocations
|
|
2017
|
+
allowedLocations: AllowedLocations,
|
|
2018
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2019
|
+
"List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2020
|
+
),
|
|
2021
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2022
|
+
"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."
|
|
2023
|
+
),
|
|
2024
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2025
|
+
"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."
|
|
2026
|
+
)
|
|
1959
2027
|
}).optional(),
|
|
1960
2028
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
1961
2029
|
}).meta({
|
|
@@ -2256,7 +2324,7 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2256
2324
|
]);
|
|
2257
2325
|
|
|
2258
2326
|
// ../commons/src/application-config.ts
|
|
2259
|
-
var SearchCriteria =
|
|
2327
|
+
var SearchCriteria = z21.enum([
|
|
2260
2328
|
"TRACKING_ID",
|
|
2261
2329
|
"REGISTRATION_NUMBER",
|
|
2262
2330
|
"NATIONAL_ID",
|
|
@@ -2264,69 +2332,69 @@ var SearchCriteria = z20.enum([
|
|
|
2264
2332
|
"PHONE_NUMBER",
|
|
2265
2333
|
"EMAIL"
|
|
2266
2334
|
]);
|
|
2267
|
-
var ApplicationConfig =
|
|
2268
|
-
APPLICATION_NAME:
|
|
2269
|
-
COUNTRY_LOGO:
|
|
2270
|
-
fileName:
|
|
2271
|
-
file:
|
|
2335
|
+
var ApplicationConfig = z21.object({
|
|
2336
|
+
APPLICATION_NAME: z21.string(),
|
|
2337
|
+
COUNTRY_LOGO: z21.object({
|
|
2338
|
+
fileName: z21.string(),
|
|
2339
|
+
file: z21.string()
|
|
2272
2340
|
}),
|
|
2273
|
-
SYSTEM_IANA_TIMEZONE:
|
|
2274
|
-
CURRENCY:
|
|
2275
|
-
languagesAndCountry:
|
|
2276
|
-
isoCode:
|
|
2341
|
+
SYSTEM_IANA_TIMEZONE: z21.string(),
|
|
2342
|
+
CURRENCY: z21.object({
|
|
2343
|
+
languagesAndCountry: z21.array(z21.string()),
|
|
2344
|
+
isoCode: z21.string()
|
|
2277
2345
|
}),
|
|
2278
|
-
ADMIN_STRUCTURE:
|
|
2279
|
-
|
|
2280
|
-
id:
|
|
2346
|
+
ADMIN_STRUCTURE: z21.array(
|
|
2347
|
+
z21.object({
|
|
2348
|
+
id: z21.string(),
|
|
2281
2349
|
label: TranslationConfig
|
|
2282
2350
|
})
|
|
2283
2351
|
),
|
|
2284
|
-
PHONE_NUMBER_PATTERN:
|
|
2285
|
-
USER_NOTIFICATION_DELIVERY_METHOD:
|
|
2286
|
-
INFORMANT_NOTIFICATION_DELIVERY_METHOD:
|
|
2352
|
+
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2353
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2354
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2287
2355
|
SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
|
|
2288
|
-
ADDITIONAL_USER_FIELDS:
|
|
2356
|
+
ADDITIONAL_USER_FIELDS: z21.array(FieldConfig).optional().default([])
|
|
2289
2357
|
});
|
|
2290
2358
|
var defineApplicationConfig = (config) => {
|
|
2291
2359
|
return ApplicationConfig.parse(config);
|
|
2292
2360
|
};
|
|
2293
|
-
var BackgroundConfig =
|
|
2294
|
-
backgroundColor:
|
|
2295
|
-
backgroundImage:
|
|
2296
|
-
imageFit:
|
|
2361
|
+
var BackgroundConfig = z21.object({
|
|
2362
|
+
backgroundColor: z21.string().optional(),
|
|
2363
|
+
backgroundImage: z21.string().optional(),
|
|
2364
|
+
imageFit: z21.string().optional()
|
|
2297
2365
|
}).refine(
|
|
2298
2366
|
(data) => !!(data.backgroundColor || data.backgroundImage),
|
|
2299
2367
|
"backgroundColor and backgroundImage cannot be empty at the same time"
|
|
2300
2368
|
);
|
|
2301
|
-
var LoginConfig =
|
|
2302
|
-
COUNTRY:
|
|
2303
|
-
LANGUAGES:
|
|
2304
|
-
USER_NOTIFICATION_DELIVERY_METHOD:
|
|
2305
|
-
INFORMANT_NOTIFICATION_DELIVERY_METHOD:
|
|
2306
|
-
PHONE_NUMBER_PATTERN:
|
|
2369
|
+
var LoginConfig = z21.object({
|
|
2370
|
+
COUNTRY: z21.string(),
|
|
2371
|
+
LANGUAGES: z21.array(z21.string()),
|
|
2372
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2373
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2374
|
+
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2307
2375
|
LOGIN_BACKGROUND: BackgroundConfig,
|
|
2308
|
-
SENTRY:
|
|
2376
|
+
SENTRY: z21.string().optional()
|
|
2309
2377
|
});
|
|
2310
2378
|
var defineLoginConfig = (config) => {
|
|
2311
2379
|
return LoginConfig.parse(config);
|
|
2312
2380
|
};
|
|
2313
|
-
var ClientConfig =
|
|
2314
|
-
COUNTRY:
|
|
2315
|
-
LANGUAGES:
|
|
2316
|
-
SENTRY:
|
|
2317
|
-
LOGIN_URL:
|
|
2381
|
+
var ClientConfig = z21.object({
|
|
2382
|
+
COUNTRY: z21.string(),
|
|
2383
|
+
LANGUAGES: z21.array(z21.string()),
|
|
2384
|
+
SENTRY: z21.string().optional(),
|
|
2385
|
+
LOGIN_URL: z21.string().optional(),
|
|
2318
2386
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2319
|
-
DASHBOARDS:
|
|
2320
|
-
|
|
2321
|
-
id:
|
|
2387
|
+
DASHBOARDS: z21.array(
|
|
2388
|
+
z21.object({
|
|
2389
|
+
id: z21.string(),
|
|
2322
2390
|
title: TranslationConfig,
|
|
2323
|
-
url:
|
|
2324
|
-
context:
|
|
2325
|
-
auth:
|
|
2391
|
+
url: z21.string(),
|
|
2392
|
+
context: z21.object({
|
|
2393
|
+
auth: z21.literal("REQUEST_AUTH_TOKEN")
|
|
2326
2394
|
}).optional()
|
|
2327
2395
|
})
|
|
2328
2396
|
),
|
|
2329
|
-
FEATURES:
|
|
2397
|
+
FEATURES: z21.object({ V2_EVENTS: z21.boolean().optional().default(true) }).optional().default({ V2_EVENTS: true })
|
|
2330
2398
|
});
|
|
2331
2399
|
var defineClientConfig = (config) => {
|
|
2332
2400
|
return ClientConfig.parse(config);
|