@opencrvs/toolkit 2.1.0-rc.ffe0b7f → 2.2.0-rc.9042a13
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 +2 -12
- package/build.sh +23 -5
- package/create-countryconfig/index.js +441 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +5 -2
- package/dist/application-config/index.js +391 -286
- package/dist/authentication/index.d.ts +66 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +778 -0
- package/dist/cli.js +2041 -1311
- package/dist/commons/api/router.d.ts +2359 -485
- package/dist/commons/application-config/index.d.ts +0 -2
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +34 -8
- package/dist/commons/events/ActionConfig.d.ts +131 -7
- package/dist/commons/events/ActionDocument.d.ts +123 -15
- package/dist/commons/events/ActionInput.d.ts +56 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +11 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +60 -12
- package/dist/commons/events/AuditLog.d.ts +152 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +132 -0
- package/dist/commons/events/Draft.d.ts +3 -21
- package/dist/commons/events/EventConfig.d.ts +29 -6
- package/dist/commons/events/EventDocument.d.ts +560 -4
- package/dist/commons/events/EventIndex.d.ts +23 -26
- package/dist/commons/events/EventMetadata.d.ts +24 -11
- package/dist/commons/events/EventStatus.d.ts +20 -0
- package/dist/commons/events/FieldConfig.d.ts +119 -63
- package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
- package/dist/commons/events/FieldValue.d.ts +3 -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 +167 -20
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/eventConfigValidation.d.ts +17 -1
- 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/scopes.d.ts +23 -1
- package/dist/commons/events/state/index.d.ts +10 -2
- package/dist/commons/events/state/utils.d.ts +11 -1
- package/dist/commons/events/test.utils.d.ts +106 -26
- package/dist/commons/events/utils.d.ts +81 -18
- 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 +362 -65
- 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 +18 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +22 -1
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +2 -1
- 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/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.d.ts +1 -1
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +610 -560
- package/dist/environment/swarm-to-k8s.js +3 -4
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +3 -8
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +4 -0
- 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 +7909 -7056
- package/dist/migrations/add-translations.d.ts +15 -0
- package/dist/migrations/add-translations.d.ts.map +1 -0
- package/dist/migrations/add-translations.js +151 -0
- 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.0/rename-api-paths.d.ts → v2.1/enable-telemetry.d.ts} +1 -1
- 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 +47 -215
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +17 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
- package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
- package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
- package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
- package/dist/migrations/v2.1/remove-sentry.js +354 -0
- package/dist/migrations/{v2.0/create-events-index.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
- package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
- package/dist/migrations/v2.1/template-files.d.ts +8 -0
- package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
- package/dist/migrations/v2.1/template-files.js +49 -0
- package/dist/migrations/v2.1/upgrade-tilt.d.ts +11 -0
- package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
- package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
- package/dist/migrations/v2.2/index.d.ts +6 -0
- package/dist/migrations/v2.2/index.d.ts.map +1 -0
- package/dist/migrations/v2.2/index.js +456 -0
- package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
- package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
- package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
- package/dist/notification/index.js +2090 -1456
- package/dist/scopes/index.d.ts +637 -36
- package/dist/scopes/index.js +364 -65
- 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 +8 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +10 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
- package/dist/templates/charts-values/traefik/values.yaml +25 -12
- package/dist/templates/countryconfig-template/.tiltignore +1 -0
- package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
- package/dist/templates/countryconfig-template/Tiltfile +112 -0
- package/dist/templates/countryconfig-template/assets/README.md +1 -0
- package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
- package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
- package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
- package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
- package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
- package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
- package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
- package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
- package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
- package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
- package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
- package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
- package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
- package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
- package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
- package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
- package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
- package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
- package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
- package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
- package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
- package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
- package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
- package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
- package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/template.d.ts +11 -0
- package/dist/translations/template.d.ts.map +1 -0
- package/dist/translations/template.js +100 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +510 -0
- package/opencrvs-toolkit-2.2.0-rc.9042a13.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/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
- package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
- package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
- package/dist/migrations/v2.0/create-events-index.js +0 -325
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
- package/dist/migrations/v2.0/index.d.ts +0 -13
- package/dist/migrations/v2.0/index.d.ts.map +0 -1
- package/dist/migrations/v2.0/index.js +0 -103
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-scopes.js +0 -305
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
- package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
- package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
- package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
- package/dist/migrations/v2.0/update-package-json.js +0 -105
- 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.ffe0b7f.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -38,23 +38,17 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
// ../commons/src/url.ts
|
|
44
|
-
function joinUrl(base, path) {
|
|
45
|
-
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
46
|
-
return new URL(path, baseWithSlash);
|
|
47
|
-
}
|
|
41
|
+
var z48 = __toESM(require("zod/v4"));
|
|
48
42
|
|
|
49
43
|
// ../commons/src/events/AuditLog.ts
|
|
50
|
-
var
|
|
44
|
+
var z9 = __toESM(require("zod/v4"));
|
|
51
45
|
|
|
52
46
|
// ../commons/src/authentication.ts
|
|
53
47
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
54
|
-
var
|
|
48
|
+
var z8 = __toESM(require("zod/v4"));
|
|
55
49
|
|
|
56
50
|
// ../commons/src/scopes.ts
|
|
57
|
-
var
|
|
51
|
+
var z7 = __toESM(require("zod/v4"));
|
|
58
52
|
var qs = __toESM(require("qs"));
|
|
59
53
|
|
|
60
54
|
// ../commons/src/uuid.ts
|
|
@@ -65,12 +59,279 @@ function getUUID() {
|
|
|
65
59
|
return (0, import_uuid.v4)();
|
|
66
60
|
}
|
|
67
61
|
|
|
62
|
+
// ../commons/src/events/ActionType.ts
|
|
63
|
+
var z2 = __toESM(require("zod/v4"));
|
|
64
|
+
var ActionType = {
|
|
65
|
+
// Pre-declaration actions
|
|
66
|
+
DELETE: "DELETE",
|
|
67
|
+
CREATE: "CREATE",
|
|
68
|
+
NOTIFY: "NOTIFY",
|
|
69
|
+
// Declaration actions
|
|
70
|
+
DECLARE: "DECLARE",
|
|
71
|
+
REGISTER: "REGISTER",
|
|
72
|
+
EDIT: "EDIT",
|
|
73
|
+
// Declaration system actions. Non-configurable.
|
|
74
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
75
|
+
REJECT: "REJECT",
|
|
76
|
+
// REJECT_DECLARATION
|
|
77
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
78
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
79
|
+
ARCHIVE: "ARCHIVE",
|
|
80
|
+
UNARCHIVE: "UNARCHIVE",
|
|
81
|
+
// Record actions
|
|
82
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
83
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
84
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
85
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
86
|
+
REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
|
|
87
|
+
REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
|
|
88
|
+
// General actions
|
|
89
|
+
READ: "READ",
|
|
90
|
+
ASSIGN: "ASSIGN",
|
|
91
|
+
UNASSIGN: "UNASSIGN",
|
|
92
|
+
// Custom action
|
|
93
|
+
CUSTOM: "CUSTOM"
|
|
94
|
+
};
|
|
95
|
+
var ConfirmableActions = [
|
|
96
|
+
ActionType.NOTIFY,
|
|
97
|
+
ActionType.DECLARE,
|
|
98
|
+
ActionType.EDIT,
|
|
99
|
+
ActionType.REGISTER,
|
|
100
|
+
ActionType.REJECT,
|
|
101
|
+
ActionType.ARCHIVE,
|
|
102
|
+
ActionType.UNARCHIVE,
|
|
103
|
+
ActionType.PRINT_CERTIFICATE,
|
|
104
|
+
ActionType.REQUEST_CORRECTION,
|
|
105
|
+
ActionType.APPROVE_CORRECTION,
|
|
106
|
+
ActionType.REJECT_CORRECTION,
|
|
107
|
+
ActionType.REVOKE_REGISTRATION,
|
|
108
|
+
ActionType.REINSTATE_REGISTRATION,
|
|
109
|
+
ActionType.CUSTOM
|
|
110
|
+
];
|
|
111
|
+
var ActionTypes = z2.enum([
|
|
112
|
+
"DELETE",
|
|
113
|
+
"CREATE",
|
|
114
|
+
"NOTIFY",
|
|
115
|
+
"DECLARE",
|
|
116
|
+
"EDIT",
|
|
117
|
+
"REGISTER",
|
|
118
|
+
"DUPLICATE_DETECTED",
|
|
119
|
+
"REJECT",
|
|
120
|
+
"MARK_AS_DUPLICATE",
|
|
121
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
122
|
+
"ARCHIVE",
|
|
123
|
+
"UNARCHIVE",
|
|
124
|
+
"PRINT_CERTIFICATE",
|
|
125
|
+
"REQUEST_CORRECTION",
|
|
126
|
+
"REJECT_CORRECTION",
|
|
127
|
+
"APPROVE_CORRECTION",
|
|
128
|
+
"REVOKE_REGISTRATION",
|
|
129
|
+
"REINSTATE_REGISTRATION",
|
|
130
|
+
"READ",
|
|
131
|
+
"ASSIGN",
|
|
132
|
+
"UNASSIGN",
|
|
133
|
+
"CUSTOM"
|
|
134
|
+
]);
|
|
135
|
+
var ClientSpecificAction = {
|
|
136
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
137
|
+
};
|
|
138
|
+
var declarationActionValues = [
|
|
139
|
+
ActionTypes.enum.DECLARE,
|
|
140
|
+
ActionTypes.enum.EDIT,
|
|
141
|
+
ActionTypes.enum.REGISTER,
|
|
142
|
+
ActionTypes.enum.NOTIFY,
|
|
143
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
144
|
+
];
|
|
145
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
146
|
+
var declarationUpdateActionValues = [
|
|
147
|
+
...declarationActionValues,
|
|
148
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
149
|
+
];
|
|
150
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
151
|
+
declarationUpdateActionValues
|
|
152
|
+
);
|
|
153
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
154
|
+
var writeActions = ActionTypes.exclude([
|
|
155
|
+
ActionType.CREATE,
|
|
156
|
+
ActionType.READ,
|
|
157
|
+
ActionType.ASSIGN,
|
|
158
|
+
ActionType.UNASSIGN
|
|
159
|
+
]);
|
|
160
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
161
|
+
ActionType.READ,
|
|
162
|
+
ActionType.DELETE,
|
|
163
|
+
ActionType.DECLARE,
|
|
164
|
+
ActionType.REGISTER,
|
|
165
|
+
ActionType.EDIT,
|
|
166
|
+
ActionType.REJECT,
|
|
167
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
168
|
+
ActionType.ARCHIVE,
|
|
169
|
+
ActionType.UNARCHIVE,
|
|
170
|
+
ActionType.PRINT_CERTIFICATE,
|
|
171
|
+
ActionType.REQUEST_CORRECTION,
|
|
172
|
+
ActionType.REVOKE_REGISTRATION,
|
|
173
|
+
ActionType.REINSTATE_REGISTRATION
|
|
174
|
+
]);
|
|
175
|
+
var META_ACTIONS = [
|
|
176
|
+
ActionType.ASSIGN,
|
|
177
|
+
ActionType.UNASSIGN,
|
|
178
|
+
ActionType.READ
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
// ../commons/src/events/ActionStatus.ts
|
|
182
|
+
var ActionStatus = {
|
|
183
|
+
Requested: "Requested",
|
|
184
|
+
Accepted: "Accepted",
|
|
185
|
+
Rejected: "Rejected"
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// ../commons/src/events/Flag.ts
|
|
189
|
+
var z5 = __toESM(require("zod/v4"));
|
|
190
|
+
|
|
191
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
192
|
+
var z3 = __toESM(require("zod/v4"));
|
|
193
|
+
var TranslationConfig = z3.object({
|
|
194
|
+
id: z3.string().describe(
|
|
195
|
+
"The identifier of the translation referred in translation CSV files"
|
|
196
|
+
),
|
|
197
|
+
defaultMessage: z3.string().describe("Default translation message"),
|
|
198
|
+
description: z3.string().describe(
|
|
199
|
+
"Describe the translation for a translator to be able to identify it."
|
|
200
|
+
)
|
|
201
|
+
}).meta({
|
|
202
|
+
description: "Translation configuration",
|
|
203
|
+
id: "TranslationConfig"
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// ../commons/src/events/Conditional.ts
|
|
207
|
+
var z4 = __toESM(require("zod/v4"));
|
|
208
|
+
var Conditional = z4.any().describe("JSONSchema").meta({
|
|
209
|
+
description: "JSON schema conditional configuration",
|
|
210
|
+
id: "Conditional"
|
|
211
|
+
});
|
|
212
|
+
var ConditionalType = {
|
|
213
|
+
SHOW: "SHOW",
|
|
214
|
+
ENABLE: "ENABLE",
|
|
215
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
216
|
+
};
|
|
217
|
+
var ShowConditional = z4.object({
|
|
218
|
+
type: z4.literal(ConditionalType.SHOW),
|
|
219
|
+
conditional: Conditional
|
|
220
|
+
}).describe(
|
|
221
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
222
|
+
);
|
|
223
|
+
var EnableConditional = z4.object({
|
|
224
|
+
type: z4.literal(ConditionalType.ENABLE),
|
|
225
|
+
conditional: Conditional
|
|
226
|
+
}).describe(
|
|
227
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
228
|
+
);
|
|
229
|
+
var ActionConditional = z4.discriminatedUnion("type", [
|
|
230
|
+
// Action can be shown / hidden
|
|
231
|
+
ShowConditional,
|
|
232
|
+
// Action can be shown to the user in the list but as disabled
|
|
233
|
+
EnableConditional
|
|
234
|
+
]).meta({
|
|
235
|
+
id: "ActionConditional",
|
|
236
|
+
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
237
|
+
});
|
|
238
|
+
var DisplayOnReviewConditional = z4.object({
|
|
239
|
+
type: z4.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
240
|
+
conditional: Conditional
|
|
241
|
+
}).describe(
|
|
242
|
+
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
243
|
+
);
|
|
244
|
+
var FieldConditional = z4.discriminatedUnion("type", [
|
|
245
|
+
// Field input can be shown / hidden
|
|
246
|
+
ShowConditional,
|
|
247
|
+
// Field input can be shown to the user but as disabled
|
|
248
|
+
EnableConditional,
|
|
249
|
+
// Field output can be shown / hidden on the review page
|
|
250
|
+
DisplayOnReviewConditional
|
|
251
|
+
]).meta({
|
|
252
|
+
id: "FieldConditional",
|
|
253
|
+
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// ../commons/src/events/Flag.ts
|
|
257
|
+
var InherentFlags = {
|
|
258
|
+
INCOMPLETE: "incomplete",
|
|
259
|
+
REJECTED: "rejected",
|
|
260
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
261
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
262
|
+
/**
|
|
263
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
264
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
265
|
+
*
|
|
266
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
267
|
+
*/
|
|
268
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
269
|
+
};
|
|
270
|
+
var actionFlagPattern;
|
|
271
|
+
function getActionFlagPattern() {
|
|
272
|
+
actionFlagPattern ??= new RegExp(
|
|
273
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
274
|
+
ActionStatus
|
|
275
|
+
).join("|").toLowerCase()})$`
|
|
276
|
+
);
|
|
277
|
+
return actionFlagPattern;
|
|
278
|
+
}
|
|
279
|
+
var ActionFlag = z5.string().refine((value) => getActionFlagPattern().test(value), {
|
|
280
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
281
|
+
});
|
|
282
|
+
var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
283
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
284
|
+
InherentFlags
|
|
285
|
+
).join(", ")}`
|
|
286
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
287
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
288
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
289
|
+
var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
|
|
290
|
+
var ContainsFlags = z5.object({
|
|
291
|
+
anyOf: z5.array(Flag).optional(),
|
|
292
|
+
noneOf: z5.array(Flag).optional(),
|
|
293
|
+
allOf: z5.array(Flag).optional()
|
|
294
|
+
}).meta({
|
|
295
|
+
id: "ContainsFlags"
|
|
296
|
+
});
|
|
297
|
+
var FlagConfig = z5.object({
|
|
298
|
+
id: CustomFlag,
|
|
299
|
+
requiresAction: z5.boolean().describe(
|
|
300
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
301
|
+
),
|
|
302
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
303
|
+
}).meta({
|
|
304
|
+
id: "FlagConfig",
|
|
305
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
306
|
+
});
|
|
307
|
+
var ActionFlagConfig = z5.object({
|
|
308
|
+
id: Flag,
|
|
309
|
+
operation: z5.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
310
|
+
conditional: Conditional.optional().describe(
|
|
311
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
312
|
+
)
|
|
313
|
+
}).meta({
|
|
314
|
+
id: "ActionFlagConfig",
|
|
315
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// ../commons/src/events/EventStatus.ts
|
|
319
|
+
var z6 = __toESM(require("zod/v4"));
|
|
320
|
+
var EventStatus = z6.enum([
|
|
321
|
+
"CREATED",
|
|
322
|
+
"NOTIFIED",
|
|
323
|
+
"DECLARED",
|
|
324
|
+
"REGISTERED",
|
|
325
|
+
"REVOKED",
|
|
326
|
+
"ARCHIVED"
|
|
327
|
+
]);
|
|
328
|
+
|
|
68
329
|
// ../commons/src/scopes.ts
|
|
69
|
-
var JurisdictionFilter =
|
|
330
|
+
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
70
331
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
71
332
|
);
|
|
72
|
-
var UserFilter =
|
|
73
|
-
var RecordScopeTypeV2 =
|
|
333
|
+
var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
334
|
+
var RecordScopeTypeV2 = z7.enum([
|
|
74
335
|
"record.search",
|
|
75
336
|
"record.create",
|
|
76
337
|
"record.read",
|
|
@@ -85,94 +346,114 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
85
346
|
"record.print-certified-copies",
|
|
86
347
|
"record.request-correction",
|
|
87
348
|
"record.correct",
|
|
349
|
+
"record.revoke-registration",
|
|
350
|
+
"record.reinstate-registration",
|
|
88
351
|
"record.unassign-others",
|
|
89
|
-
"record.custom-action"
|
|
352
|
+
"record.custom-action",
|
|
353
|
+
"record.action.accept",
|
|
354
|
+
"record.action.reject"
|
|
90
355
|
]);
|
|
91
|
-
var PlainScopeType =
|
|
356
|
+
var PlainScopeType = z7.enum([
|
|
92
357
|
// Misc. system scopes
|
|
93
358
|
"bypassratelimit",
|
|
94
359
|
"record.reindex",
|
|
95
360
|
"user.data-seeding",
|
|
96
361
|
"integration.create",
|
|
362
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
363
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
364
|
+
// deliberately option-less: system clients have no office and no
|
|
365
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
366
|
+
"integration.audit.read",
|
|
97
367
|
"record.import",
|
|
98
368
|
"config.update-all",
|
|
369
|
+
"location.edit",
|
|
99
370
|
"attachment.upload",
|
|
100
371
|
"profile.electronic-signature",
|
|
101
372
|
"user.read-only-my-audit",
|
|
102
373
|
// Performance dashboard
|
|
103
374
|
"performance.read",
|
|
104
375
|
"performance.read-dashboards",
|
|
105
|
-
"performance.vital-statistics-export"
|
|
106
|
-
// Scopes used exclusively by countryconfig integration token
|
|
107
|
-
"record.confirm-registration",
|
|
108
|
-
"record.reject-registration"
|
|
376
|
+
"performance.vital-statistics-export"
|
|
109
377
|
]);
|
|
110
|
-
var scopeByEvent =
|
|
378
|
+
var scopeByEvent = z7.preprocess(
|
|
111
379
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
112
|
-
|
|
380
|
+
z7.array(z7.string()).optional()
|
|
113
381
|
).describe("Event type, e.g. birth, death");
|
|
114
|
-
var
|
|
382
|
+
var scopeByStatus = z7.preprocess(
|
|
383
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
384
|
+
z7.array(EventStatus).optional()
|
|
385
|
+
).describe(
|
|
386
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
387
|
+
);
|
|
388
|
+
var userRole = z7.preprocess(
|
|
115
389
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
116
|
-
|
|
390
|
+
z7.array(z7.string()).optional()
|
|
117
391
|
).describe("User role, e.g. admin, field agent");
|
|
118
|
-
var scopeOptionsPlaceEvent =
|
|
392
|
+
var scopeOptionsPlaceEvent = z7.object({
|
|
119
393
|
event: scopeByEvent,
|
|
120
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
394
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
395
|
+
createdBy: UserFilter.optional(),
|
|
396
|
+
createdIn: JurisdictionFilter.optional()
|
|
121
397
|
}).describe("Options applicable to all record scopes.");
|
|
122
398
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
123
399
|
notifiedIn: JurisdictionFilter.optional(),
|
|
124
400
|
notifiedBy: UserFilter.optional(),
|
|
125
401
|
declaredIn: JurisdictionFilter.optional(),
|
|
126
|
-
declaredBy: UserFilter.optional()
|
|
402
|
+
declaredBy: UserFilter.optional(),
|
|
403
|
+
status: scopeByStatus
|
|
127
404
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
128
405
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
129
406
|
registeredIn: JurisdictionFilter.optional(),
|
|
130
|
-
registeredBy: UserFilter.optional()
|
|
407
|
+
registeredBy: UserFilter.optional(),
|
|
408
|
+
flags: ContainsFlags.optional()
|
|
131
409
|
}).describe(
|
|
132
410
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
133
411
|
);
|
|
134
412
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
135
|
-
customActionTypes:
|
|
413
|
+
customActionTypes: z7.preprocess(
|
|
136
414
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
137
|
-
|
|
415
|
+
z7.array(z7.string()).optional()
|
|
138
416
|
).describe("Allowed custom action types")
|
|
139
417
|
});
|
|
140
|
-
var AccessLevelOptions =
|
|
418
|
+
var AccessLevelOptions = z7.object({
|
|
141
419
|
accessLevel: JurisdictionFilter.optional()
|
|
142
420
|
});
|
|
143
421
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
144
422
|
role: userRole.optional()
|
|
145
423
|
});
|
|
146
|
-
var WorkqueueOrDashboardOptions =
|
|
147
|
-
ids:
|
|
424
|
+
var WorkqueueOrDashboardOptions = z7.object({
|
|
425
|
+
ids: z7.preprocess(
|
|
148
426
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
149
|
-
|
|
427
|
+
z7.array(z7.string())
|
|
150
428
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
151
429
|
});
|
|
152
|
-
var AllScopeOptions =
|
|
430
|
+
var AllScopeOptions = z7.object({
|
|
153
431
|
...AllRecordScopeOptions.shape,
|
|
154
432
|
...AccessLevelOptions.shape,
|
|
155
433
|
...AllUserScopeOptions.shape,
|
|
156
434
|
...WorkqueueOrDashboardOptions.shape
|
|
157
435
|
});
|
|
158
436
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
159
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
437
|
+
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
160
438
|
event: scopeByEvent,
|
|
161
|
-
placeOfEvent: UUID.nullish()
|
|
439
|
+
placeOfEvent: UUID.nullish(),
|
|
440
|
+
createdBy: z7.string().optional(),
|
|
441
|
+
createdIn: UUID.nullish()
|
|
162
442
|
}).describe(
|
|
163
443
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
164
444
|
);
|
|
165
445
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
166
446
|
notifiedIn: UUID.nullish(),
|
|
167
|
-
notifiedBy:
|
|
447
|
+
notifiedBy: z7.string().optional(),
|
|
168
448
|
declaredIn: UUID.nullish(),
|
|
169
|
-
declaredBy:
|
|
449
|
+
declaredBy: z7.string().optional()
|
|
170
450
|
}).describe(
|
|
171
451
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
172
452
|
);
|
|
173
453
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
174
454
|
registeredIn: UUID.nullish(),
|
|
175
|
-
registeredBy:
|
|
455
|
+
registeredBy: z7.string().optional(),
|
|
456
|
+
flags: ContainsFlags.optional()
|
|
176
457
|
}).describe(
|
|
177
458
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
178
459
|
);
|
|
@@ -186,7 +467,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
186
467
|
"record.reject",
|
|
187
468
|
"record.archive",
|
|
188
469
|
"record.unarchive",
|
|
189
|
-
"record.review-duplicates",
|
|
190
470
|
"record.register"
|
|
191
471
|
]);
|
|
192
472
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -194,41 +474,55 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
194
474
|
"record.read",
|
|
195
475
|
"record.request-correction",
|
|
196
476
|
"record.correct",
|
|
197
|
-
"record.
|
|
477
|
+
"record.revoke-registration",
|
|
478
|
+
"record.reinstate-registration",
|
|
479
|
+
"record.unassign-others",
|
|
480
|
+
"record.review-duplicates"
|
|
198
481
|
]);
|
|
199
482
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
200
|
-
templates:
|
|
483
|
+
templates: z7.preprocess(
|
|
201
484
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
202
|
-
|
|
485
|
+
z7.array(z7.string()).optional()
|
|
203
486
|
).describe(
|
|
204
487
|
"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."
|
|
205
488
|
)
|
|
206
489
|
});
|
|
207
|
-
var
|
|
208
|
-
|
|
490
|
+
var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
|
|
491
|
+
"record.action.accept",
|
|
492
|
+
"record.action.reject"
|
|
493
|
+
]);
|
|
494
|
+
var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
|
|
495
|
+
"Options for confirming (accepting or rejecting) an action."
|
|
496
|
+
);
|
|
497
|
+
var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
498
|
+
z7.object({
|
|
209
499
|
type: ScopesWithPlaceEventOptions,
|
|
210
500
|
options: scopeOptionsPlaceEvent.optional()
|
|
211
501
|
}),
|
|
212
|
-
|
|
502
|
+
z7.object({
|
|
213
503
|
type: ScopesWithDeclaredOptions,
|
|
214
504
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
215
505
|
}),
|
|
216
|
-
|
|
506
|
+
z7.object({
|
|
217
507
|
type: ScopesWithFullOptions,
|
|
218
508
|
options: AllRecordScopeOptions.optional()
|
|
219
509
|
}),
|
|
220
|
-
|
|
221
|
-
type:
|
|
510
|
+
z7.object({
|
|
511
|
+
type: z7.literal("record.custom-action"),
|
|
222
512
|
options: CustomActionScopeOptions.optional()
|
|
223
513
|
}),
|
|
224
|
-
|
|
225
|
-
type:
|
|
514
|
+
z7.object({
|
|
515
|
+
type: z7.literal("record.print-certified-copies"),
|
|
226
516
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
517
|
+
}),
|
|
518
|
+
z7.object({
|
|
519
|
+
type: ActionConfirmationScopeType,
|
|
520
|
+
options: ActionConfirmationScopeOptions.optional()
|
|
227
521
|
})
|
|
228
522
|
]).describe(
|
|
229
523
|
"Scopes used to check user's permission to perform actions on a record."
|
|
230
524
|
);
|
|
231
|
-
var SystemScopeType =
|
|
525
|
+
var SystemScopeType = z7.enum([
|
|
232
526
|
"organisation.read-locations",
|
|
233
527
|
"user.read",
|
|
234
528
|
"user.create",
|
|
@@ -242,61 +536,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
242
536
|
"user.search"
|
|
243
537
|
]);
|
|
244
538
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
245
|
-
var UserScopeV2 =
|
|
246
|
-
|
|
539
|
+
var UserScopeV2 = z7.discriminatedUnion("type", [
|
|
540
|
+
z7.object({
|
|
247
541
|
type: ScopesWithRoleOption,
|
|
248
542
|
options: AllUserScopeOptions.optional()
|
|
249
543
|
}),
|
|
250
|
-
|
|
544
|
+
z7.object({
|
|
251
545
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
252
546
|
options: AccessLevelOptions.optional()
|
|
253
547
|
})
|
|
254
548
|
]);
|
|
255
|
-
var ResolvedRecordScopeV2 =
|
|
256
|
-
|
|
549
|
+
var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
|
|
550
|
+
z7.object({
|
|
257
551
|
type: ScopesWithPlaceEventOptions,
|
|
258
552
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
259
553
|
}),
|
|
260
|
-
|
|
554
|
+
z7.object({
|
|
261
555
|
type: ScopesWithDeclaredOptions,
|
|
262
556
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
263
557
|
}),
|
|
264
|
-
|
|
558
|
+
z7.object({
|
|
265
559
|
type: ScopesWithFullOptions,
|
|
266
560
|
options: ResolvedScopeOptionsFull.optional()
|
|
267
561
|
}),
|
|
268
|
-
|
|
269
|
-
type:
|
|
562
|
+
z7.object({
|
|
563
|
+
type: z7.literal("record.print-certified-copies"),
|
|
270
564
|
options: ResolvedScopeOptionsFull.extend({
|
|
271
|
-
templates:
|
|
565
|
+
templates: z7.array(z7.string()).optional()
|
|
272
566
|
}).optional()
|
|
273
567
|
})
|
|
274
568
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
275
|
-
var Scope =
|
|
276
|
-
|
|
569
|
+
var Scope = z7.discriminatedUnion("type", [
|
|
570
|
+
z7.object({ type: PlainScopeType }),
|
|
277
571
|
...RecordScopeV2.options,
|
|
278
572
|
...UserScopeV2.options,
|
|
279
|
-
|
|
280
|
-
type:
|
|
573
|
+
z7.object({
|
|
574
|
+
type: z7.literal("organisation.read-locations"),
|
|
281
575
|
options: AccessLevelOptions.optional()
|
|
282
576
|
}),
|
|
283
|
-
|
|
284
|
-
type:
|
|
577
|
+
z7.object({
|
|
578
|
+
type: z7.literal("workqueue"),
|
|
285
579
|
options: WorkqueueOrDashboardOptions
|
|
286
580
|
}),
|
|
287
|
-
|
|
288
|
-
type:
|
|
581
|
+
z7.object({
|
|
582
|
+
type: z7.literal("dashboard.view"),
|
|
289
583
|
options: WorkqueueOrDashboardOptions
|
|
290
584
|
})
|
|
291
585
|
]);
|
|
292
|
-
var ScopeType =
|
|
586
|
+
var ScopeType = z7.enum([
|
|
293
587
|
...SystemScopeType.options,
|
|
294
588
|
...RecordScopeTypeV2.options,
|
|
295
589
|
...PlainScopeType.options,
|
|
296
590
|
"workqueue",
|
|
297
591
|
"dashboard.view"
|
|
298
592
|
]);
|
|
299
|
-
var EncodedScope =
|
|
593
|
+
var EncodedScope = z7.string().brand("EncodedScope");
|
|
300
594
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
301
595
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
302
596
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -306,162 +600,51 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
306
600
|
};
|
|
307
601
|
|
|
308
602
|
// ../commons/src/authentication.ts
|
|
309
|
-
var TokenUserType =
|
|
310
|
-
var TokenWithBearer =
|
|
311
|
-
|
|
312
|
-
// ../commons/src/events/ActionType.ts
|
|
313
|
-
var z4 = __toESM(require("zod/v4"));
|
|
314
|
-
var ActionType = {
|
|
315
|
-
// Pre-declaration actions
|
|
316
|
-
DELETE: "DELETE",
|
|
317
|
-
CREATE: "CREATE",
|
|
318
|
-
NOTIFY: "NOTIFY",
|
|
319
|
-
// Declaration actions
|
|
320
|
-
DECLARE: "DECLARE",
|
|
321
|
-
REGISTER: "REGISTER",
|
|
322
|
-
EDIT: "EDIT",
|
|
323
|
-
// Declaration system actions. Non-configurable.
|
|
324
|
-
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
325
|
-
REJECT: "REJECT",
|
|
326
|
-
// REJECT_DECLARATION
|
|
327
|
-
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
328
|
-
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
329
|
-
ARCHIVE: "ARCHIVE",
|
|
330
|
-
UNARCHIVE: "UNARCHIVE",
|
|
331
|
-
// Record actions
|
|
332
|
-
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
333
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
334
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
335
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
336
|
-
// General actions
|
|
337
|
-
READ: "READ",
|
|
338
|
-
ASSIGN: "ASSIGN",
|
|
339
|
-
UNASSIGN: "UNASSIGN",
|
|
340
|
-
// Custom action
|
|
341
|
-
CUSTOM: "CUSTOM"
|
|
342
|
-
};
|
|
343
|
-
var ConfirmableActions = [
|
|
344
|
-
ActionType.NOTIFY,
|
|
345
|
-
ActionType.DECLARE,
|
|
346
|
-
ActionType.EDIT,
|
|
347
|
-
ActionType.REGISTER,
|
|
348
|
-
ActionType.REJECT,
|
|
349
|
-
ActionType.ARCHIVE,
|
|
350
|
-
ActionType.UNARCHIVE,
|
|
351
|
-
ActionType.PRINT_CERTIFICATE,
|
|
352
|
-
ActionType.REQUEST_CORRECTION,
|
|
353
|
-
ActionType.APPROVE_CORRECTION,
|
|
354
|
-
ActionType.REJECT_CORRECTION,
|
|
355
|
-
ActionType.CUSTOM
|
|
356
|
-
];
|
|
357
|
-
var ActionTypes = z4.enum([
|
|
358
|
-
"DELETE",
|
|
359
|
-
"CREATE",
|
|
360
|
-
"NOTIFY",
|
|
361
|
-
"DECLARE",
|
|
362
|
-
"EDIT",
|
|
363
|
-
"REGISTER",
|
|
364
|
-
"DUPLICATE_DETECTED",
|
|
365
|
-
"REJECT",
|
|
366
|
-
"MARK_AS_DUPLICATE",
|
|
367
|
-
"MARK_AS_NOT_DUPLICATE",
|
|
368
|
-
"ARCHIVE",
|
|
369
|
-
"UNARCHIVE",
|
|
370
|
-
"PRINT_CERTIFICATE",
|
|
371
|
-
"REQUEST_CORRECTION",
|
|
372
|
-
"REJECT_CORRECTION",
|
|
373
|
-
"APPROVE_CORRECTION",
|
|
374
|
-
"READ",
|
|
375
|
-
"ASSIGN",
|
|
376
|
-
"UNASSIGN",
|
|
377
|
-
"CUSTOM"
|
|
378
|
-
]);
|
|
379
|
-
var ClientSpecificAction = {
|
|
380
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
381
|
-
};
|
|
382
|
-
var declarationActionValues = [
|
|
383
|
-
ActionTypes.enum.DECLARE,
|
|
384
|
-
ActionTypes.enum.EDIT,
|
|
385
|
-
ActionTypes.enum.REGISTER,
|
|
386
|
-
ActionTypes.enum.NOTIFY,
|
|
387
|
-
ActionTypes.enum.DUPLICATE_DETECTED
|
|
388
|
-
];
|
|
389
|
-
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
390
|
-
var declarationUpdateActionValues = [
|
|
391
|
-
...declarationActionValues,
|
|
392
|
-
ActionTypes.enum.REQUEST_CORRECTION
|
|
393
|
-
];
|
|
394
|
-
var DeclarationUpdateActions = ActionTypes.extract(
|
|
395
|
-
declarationUpdateActionValues
|
|
396
|
-
);
|
|
397
|
-
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
398
|
-
var writeActions = ActionTypes.exclude([
|
|
399
|
-
ActionType.CREATE,
|
|
400
|
-
ActionType.READ,
|
|
401
|
-
ActionType.ASSIGN,
|
|
402
|
-
ActionType.UNASSIGN
|
|
403
|
-
]);
|
|
404
|
-
var WorkqueueActionType = ActionTypes.extract([
|
|
405
|
-
ActionType.READ,
|
|
406
|
-
ActionType.DELETE,
|
|
407
|
-
ActionType.DECLARE,
|
|
408
|
-
ActionType.REGISTER,
|
|
409
|
-
ActionType.EDIT,
|
|
410
|
-
ActionType.REJECT,
|
|
411
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
412
|
-
ActionType.ARCHIVE,
|
|
413
|
-
ActionType.UNARCHIVE,
|
|
414
|
-
ActionType.PRINT_CERTIFICATE,
|
|
415
|
-
ActionType.REQUEST_CORRECTION
|
|
416
|
-
]);
|
|
417
|
-
var META_ACTIONS = [
|
|
418
|
-
ActionType.ASSIGN,
|
|
419
|
-
ActionType.UNASSIGN,
|
|
420
|
-
ActionType.READ
|
|
421
|
-
];
|
|
603
|
+
var TokenUserType = z8.enum(["user", "system"]);
|
|
604
|
+
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
422
605
|
|
|
423
606
|
// ../commons/src/events/AuditLog.ts
|
|
424
|
-
var AuditLogEntryBase =
|
|
425
|
-
id:
|
|
426
|
-
clientId:
|
|
607
|
+
var AuditLogEntryBase = z9.object({
|
|
608
|
+
id: z9.string(),
|
|
609
|
+
clientId: z9.string(),
|
|
427
610
|
clientType: TokenUserType,
|
|
428
|
-
createdAt:
|
|
611
|
+
createdAt: z9.string()
|
|
429
612
|
});
|
|
430
613
|
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
431
|
-
operation:
|
|
432
|
-
requestData:
|
|
433
|
-
transactionId:
|
|
434
|
-
type:
|
|
435
|
-
createdAtLocation:
|
|
614
|
+
operation: z9.literal("event.create"),
|
|
615
|
+
requestData: z9.object({
|
|
616
|
+
transactionId: z9.string(),
|
|
617
|
+
type: z9.string(),
|
|
618
|
+
createdAtLocation: z9.string().nullable()
|
|
436
619
|
}),
|
|
437
|
-
responseSummary:
|
|
438
|
-
eventId:
|
|
439
|
-
trackingId:
|
|
620
|
+
responseSummary: z9.object({
|
|
621
|
+
eventId: z9.string(),
|
|
622
|
+
trackingId: z9.string()
|
|
440
623
|
})
|
|
441
624
|
});
|
|
442
625
|
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
443
|
-
operation:
|
|
444
|
-
requestData:
|
|
445
|
-
responseSummary:
|
|
446
|
-
eventType:
|
|
447
|
-
trackingId:
|
|
626
|
+
operation: z9.literal("event.get"),
|
|
627
|
+
requestData: z9.object({ eventId: z9.string() }),
|
|
628
|
+
responseSummary: z9.object({
|
|
629
|
+
eventType: z9.string(),
|
|
630
|
+
trackingId: z9.string()
|
|
448
631
|
})
|
|
449
632
|
});
|
|
450
633
|
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
451
|
-
operation:
|
|
452
|
-
clientType:
|
|
453
|
-
requestData:
|
|
454
|
-
query:
|
|
455
|
-
limit:
|
|
456
|
-
offset:
|
|
634
|
+
operation: z9.literal("event.search"),
|
|
635
|
+
clientType: z9.literal("system"),
|
|
636
|
+
requestData: z9.object({
|
|
637
|
+
query: z9.record(z9.string(), z9.unknown()).nullable(),
|
|
638
|
+
limit: z9.number().nullable(),
|
|
639
|
+
offset: z9.number().nullable()
|
|
457
640
|
}),
|
|
458
|
-
responseSummary:
|
|
459
|
-
total:
|
|
460
|
-
eventIds:
|
|
641
|
+
responseSummary: z9.object({
|
|
642
|
+
total: z9.number(),
|
|
643
|
+
eventIds: z9.array(z9.string())
|
|
461
644
|
})
|
|
462
645
|
});
|
|
463
646
|
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
464
|
-
operation:
|
|
647
|
+
operation: z9.enum([
|
|
465
648
|
"event.actions.notify.request",
|
|
466
649
|
"event.actions.declare.request",
|
|
467
650
|
"event.actions.register.request",
|
|
@@ -478,86 +661,165 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
478
661
|
"event.actions.correction.request.request",
|
|
479
662
|
"event.actions.correction.approve.request",
|
|
480
663
|
"event.actions.correction.reject.request",
|
|
664
|
+
"event.actions.revoke_registration.request",
|
|
665
|
+
"event.actions.reinstate_registration.request",
|
|
481
666
|
"event.actions.mark_as_duplicate.request",
|
|
482
667
|
"event.actions.mark_as_not_duplicate.request"
|
|
483
668
|
]),
|
|
484
|
-
requestData:
|
|
485
|
-
eventId:
|
|
486
|
-
actionType:
|
|
487
|
-
eventType:
|
|
488
|
-
trackingId:
|
|
489
|
-
transactionId:
|
|
669
|
+
requestData: z9.object({
|
|
670
|
+
eventId: z9.string(),
|
|
671
|
+
actionType: z9.string(),
|
|
672
|
+
eventType: z9.string(),
|
|
673
|
+
trackingId: z9.string(),
|
|
674
|
+
transactionId: z9.string()
|
|
490
675
|
})
|
|
491
676
|
});
|
|
492
677
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
493
|
-
operation:
|
|
494
|
-
requestData:
|
|
495
|
-
eventId:
|
|
496
|
-
actionType:
|
|
497
|
-
customAction:
|
|
498
|
-
eventType:
|
|
499
|
-
trackingId:
|
|
500
|
-
transactionId:
|
|
678
|
+
operation: z9.literal("event.actions.custom.request"),
|
|
679
|
+
requestData: z9.object({
|
|
680
|
+
eventId: z9.string(),
|
|
681
|
+
actionType: z9.literal(ActionType.CUSTOM),
|
|
682
|
+
customAction: z9.string(),
|
|
683
|
+
eventType: z9.string(),
|
|
684
|
+
trackingId: z9.string(),
|
|
685
|
+
transactionId: z9.string()
|
|
501
686
|
})
|
|
502
687
|
});
|
|
503
688
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
504
|
-
operation:
|
|
505
|
-
requestData:
|
|
506
|
-
responseSummary:
|
|
689
|
+
operation: z9.literal("integrations.create"),
|
|
690
|
+
requestData: z9.object({ name: z9.string(), scopes: z9.array(z9.string()) }),
|
|
691
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
507
692
|
});
|
|
508
693
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
509
|
-
operation:
|
|
510
|
-
requestData:
|
|
511
|
-
responseSummary:
|
|
694
|
+
operation: z9.literal("integrations.refreshToken"),
|
|
695
|
+
requestData: z9.object({ clientId: z9.string() }),
|
|
696
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
512
697
|
});
|
|
513
698
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
514
|
-
operation:
|
|
515
|
-
requestData:
|
|
516
|
-
responseSummary:
|
|
699
|
+
operation: z9.literal("integrations.deactivate"),
|
|
700
|
+
requestData: z9.object({ id: z9.string() }),
|
|
701
|
+
responseSummary: z9.object({ id: z9.string(), status: z9.string() })
|
|
517
702
|
});
|
|
518
703
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
519
|
-
operation:
|
|
520
|
-
requestData:
|
|
521
|
-
responseSummary:
|
|
704
|
+
operation: z9.literal("integrations.activate"),
|
|
705
|
+
requestData: z9.object({ id: z9.string() }),
|
|
706
|
+
responseSummary: z9.object({ id: z9.string(), status: z9.string() })
|
|
522
707
|
});
|
|
523
708
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
524
|
-
operation:
|
|
525
|
-
requestData:
|
|
526
|
-
responseSummary:
|
|
709
|
+
operation: z9.literal("integrations.delete"),
|
|
710
|
+
requestData: z9.object({ id: z9.string() }),
|
|
711
|
+
responseSummary: z9.object({ id: z9.string(), name: z9.string() })
|
|
527
712
|
});
|
|
528
713
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
529
|
-
operation:
|
|
530
|
-
requestData:
|
|
531
|
-
responseSummary:
|
|
714
|
+
operation: z9.literal("integrations.refreshSecret"),
|
|
715
|
+
requestData: z9.object({ id: z9.string() }),
|
|
716
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
717
|
+
});
|
|
718
|
+
var createdVersionFields = {
|
|
719
|
+
id: z9.string(),
|
|
720
|
+
versionId: z9.string(),
|
|
721
|
+
name: z9.string(),
|
|
722
|
+
externalId: z9.string().nullish(),
|
|
723
|
+
effectiveFrom: z9.string(),
|
|
724
|
+
status: z9.string()
|
|
725
|
+
};
|
|
726
|
+
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
727
|
+
operation: z9.literal("locations.create"),
|
|
728
|
+
requestData: z9.object({
|
|
729
|
+
...createdVersionFields,
|
|
730
|
+
administrativeAreaId: z9.string().nullish(),
|
|
731
|
+
locationType: z9.string().nullish()
|
|
732
|
+
})
|
|
733
|
+
});
|
|
734
|
+
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
735
|
+
operation: z9.literal("administrativeAreas.create"),
|
|
736
|
+
requestData: z9.object({
|
|
737
|
+
...createdVersionFields,
|
|
738
|
+
parentId: z9.string().nullish()
|
|
739
|
+
})
|
|
740
|
+
});
|
|
741
|
+
var ChangedStringField = z9.object({ from: z9.string(), to: z9.string() });
|
|
742
|
+
var ChangedNullableStringField = z9.object({
|
|
743
|
+
from: z9.string().nullable(),
|
|
744
|
+
to: z9.string().nullable()
|
|
745
|
+
});
|
|
746
|
+
var updatedVersionRequestData = z9.object({
|
|
747
|
+
id: z9.string(),
|
|
748
|
+
versionId: z9.string(),
|
|
749
|
+
name: z9.string(),
|
|
750
|
+
externalId: z9.string().nullish(),
|
|
751
|
+
status: z9.string(),
|
|
752
|
+
effectiveFrom: z9.string(),
|
|
753
|
+
lastVersionId: z9.string()
|
|
754
|
+
});
|
|
755
|
+
var updatedVersionResponseSummary = z9.object({
|
|
756
|
+
previousVersionId: z9.string(),
|
|
757
|
+
versionId: z9.string(),
|
|
758
|
+
changed: z9.object({
|
|
759
|
+
name: ChangedStringField.optional(),
|
|
760
|
+
externalId: ChangedNullableStringField.optional(),
|
|
761
|
+
status: ChangedStringField.optional()
|
|
762
|
+
})
|
|
763
|
+
});
|
|
764
|
+
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
765
|
+
operation: z9.literal("locations.update"),
|
|
766
|
+
requestData: updatedVersionRequestData,
|
|
767
|
+
responseSummary: updatedVersionResponseSummary
|
|
768
|
+
});
|
|
769
|
+
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
770
|
+
operation: z9.literal("administrativeAreas.update"),
|
|
771
|
+
requestData: updatedVersionRequestData,
|
|
772
|
+
responseSummary: updatedVersionResponseSummary
|
|
773
|
+
});
|
|
774
|
+
var withdrawVersionRequestData = z9.object({
|
|
775
|
+
id: z9.string(),
|
|
776
|
+
versionId: z9.string()
|
|
777
|
+
});
|
|
778
|
+
var withdrawVersionResponseSummary = z9.object({
|
|
779
|
+
effectiveFrom: z9.string(),
|
|
780
|
+
name: z9.string(),
|
|
781
|
+
externalId: z9.string().nullish(),
|
|
782
|
+
status: z9.string()
|
|
783
|
+
});
|
|
784
|
+
var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
785
|
+
operation: z9.literal("locations.withdrawVersion"),
|
|
786
|
+
requestData: withdrawVersionRequestData,
|
|
787
|
+
responseSummary: withdrawVersionResponseSummary
|
|
788
|
+
});
|
|
789
|
+
var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
790
|
+
operation: z9.literal("administrativeAreas.withdrawVersion"),
|
|
791
|
+
requestData: withdrawVersionRequestData,
|
|
792
|
+
responseSummary: withdrawVersionResponseSummary
|
|
532
793
|
});
|
|
533
794
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
534
|
-
operation:
|
|
535
|
-
requestData:
|
|
536
|
-
transactionId:
|
|
537
|
-
|
|
795
|
+
operation: z9.literal("attachments.upload"),
|
|
796
|
+
requestData: z9.object({
|
|
797
|
+
transactionId: z9.string(),
|
|
798
|
+
eventId: z9.string().optional(),
|
|
799
|
+
path: z9.string().nullable()
|
|
538
800
|
}),
|
|
539
|
-
responseSummary:
|
|
801
|
+
responseSummary: z9.object({ fileUrl: z9.string() })
|
|
540
802
|
});
|
|
541
|
-
var subjectOnly =
|
|
542
|
-
var subjectWithReason =
|
|
543
|
-
subjectId:
|
|
544
|
-
reason:
|
|
545
|
-
comment:
|
|
803
|
+
var subjectOnly = z9.object({ subjectId: z9.string() });
|
|
804
|
+
var subjectWithReason = z9.object({
|
|
805
|
+
subjectId: z9.string(),
|
|
806
|
+
reason: z9.string(),
|
|
807
|
+
comment: z9.string().optional()
|
|
546
808
|
});
|
|
547
809
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
548
|
-
operation:
|
|
549
|
-
requestData:
|
|
550
|
-
subjectId:
|
|
551
|
-
role:
|
|
552
|
-
primaryOfficeId:
|
|
810
|
+
operation: z9.literal("user.create_user"),
|
|
811
|
+
requestData: z9.object({
|
|
812
|
+
subjectId: z9.string(),
|
|
813
|
+
role: z9.string(),
|
|
814
|
+
primaryOfficeId: z9.string()
|
|
553
815
|
})
|
|
554
816
|
});
|
|
555
817
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
556
|
-
operation:
|
|
818
|
+
operation: z9.enum(["user.deactivate", "user.reactivate"]),
|
|
557
819
|
requestData: subjectWithReason
|
|
558
820
|
});
|
|
559
821
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
560
|
-
operation:
|
|
822
|
+
operation: z9.enum([
|
|
561
823
|
"user.edit_user",
|
|
562
824
|
"user.logged_in",
|
|
563
825
|
"user.logged_out",
|
|
@@ -571,14 +833,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
571
833
|
requestData: subjectOnly
|
|
572
834
|
});
|
|
573
835
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
574
|
-
operation:
|
|
836
|
+
operation: z9.literal("user.email_address_changed"),
|
|
575
837
|
requestData: subjectOnly,
|
|
576
|
-
responseSummary:
|
|
838
|
+
responseSummary: z9.object({ email: z9.string() })
|
|
577
839
|
});
|
|
578
840
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
579
|
-
operation:
|
|
841
|
+
operation: z9.literal("user.phone_number_changed"),
|
|
580
842
|
requestData: subjectOnly,
|
|
581
|
-
responseSummary:
|
|
843
|
+
responseSummary: z9.object({ phoneNumber: z9.string() })
|
|
582
844
|
});
|
|
583
845
|
var userBaseOmit = {
|
|
584
846
|
id: true,
|
|
@@ -586,14 +848,14 @@ var userBaseOmit = {
|
|
|
586
848
|
clientType: true,
|
|
587
849
|
createdAt: true
|
|
588
850
|
};
|
|
589
|
-
var UserAuditRecordInput =
|
|
851
|
+
var UserAuditRecordInput = z9.discriminatedUnion("operation", [
|
|
590
852
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
591
853
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
592
854
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
593
855
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
594
856
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
595
857
|
]);
|
|
596
|
-
var AuditLogEntrySchema =
|
|
858
|
+
var AuditLogEntrySchema = z9.discriminatedUnion("operation", [
|
|
597
859
|
EventCreateEntrySchema,
|
|
598
860
|
EventGetEntrySchema,
|
|
599
861
|
EventSearchEntrySchema,
|
|
@@ -605,6 +867,12 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
605
867
|
IntegrationActivateEntrySchema,
|
|
606
868
|
IntegrationDeleteEntrySchema,
|
|
607
869
|
IntegrationRefreshSecretEntrySchema,
|
|
870
|
+
LocationCreateEntrySchema,
|
|
871
|
+
LocationUpdateEntrySchema,
|
|
872
|
+
AdministrativeAreaUpdateEntrySchema,
|
|
873
|
+
LocationWithdrawEntrySchema,
|
|
874
|
+
AdministrativeAreaWithdrawEntrySchema,
|
|
875
|
+
AdministrativeAreaCreateEntrySchema,
|
|
608
876
|
AttachmentUploadEntrySchema,
|
|
609
877
|
UserCreateEntrySchema,
|
|
610
878
|
UserReasonEntrySchema,
|
|
@@ -618,78 +886,13 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
|
618
886
|
var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
619
887
|
|
|
620
888
|
// ../commons/src/events/ActionConfig.ts
|
|
621
|
-
var
|
|
622
|
-
|
|
623
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
624
|
-
var z6 = __toESM(require("zod/v4"));
|
|
625
|
-
var TranslationConfig = z6.object({
|
|
626
|
-
id: z6.string().describe(
|
|
627
|
-
"The identifier of the translation referred in translation CSV files"
|
|
628
|
-
),
|
|
629
|
-
defaultMessage: z6.string().describe("Default translation message"),
|
|
630
|
-
description: z6.string().describe(
|
|
631
|
-
"Describe the translation for a translator to be able to identify it."
|
|
632
|
-
)
|
|
633
|
-
}).meta({
|
|
634
|
-
description: "Translation configuration",
|
|
635
|
-
id: "TranslationConfig"
|
|
636
|
-
});
|
|
889
|
+
var z25 = __toESM(require("zod/v4"));
|
|
637
890
|
|
|
638
891
|
// ../commons/src/events/FieldConfig.ts
|
|
639
892
|
var import_v43 = __toESM(require("zod/v4"));
|
|
640
893
|
|
|
641
|
-
// ../commons/src/events/Conditional.ts
|
|
642
|
-
var z7 = __toESM(require("zod/v4"));
|
|
643
|
-
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
644
|
-
description: "JSON schema conditional configuration",
|
|
645
|
-
id: "Conditional"
|
|
646
|
-
});
|
|
647
|
-
var ConditionalType = {
|
|
648
|
-
SHOW: "SHOW",
|
|
649
|
-
ENABLE: "ENABLE",
|
|
650
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
651
|
-
};
|
|
652
|
-
var ShowConditional = z7.object({
|
|
653
|
-
type: z7.literal(ConditionalType.SHOW),
|
|
654
|
-
conditional: Conditional
|
|
655
|
-
}).describe(
|
|
656
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
657
|
-
);
|
|
658
|
-
var EnableConditional = z7.object({
|
|
659
|
-
type: z7.literal(ConditionalType.ENABLE),
|
|
660
|
-
conditional: Conditional
|
|
661
|
-
}).describe(
|
|
662
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
663
|
-
);
|
|
664
|
-
var ActionConditional = z7.discriminatedUnion("type", [
|
|
665
|
-
// Action can be shown / hidden
|
|
666
|
-
ShowConditional,
|
|
667
|
-
// Action can be shown to the user in the list but as disabled
|
|
668
|
-
EnableConditional
|
|
669
|
-
]).meta({
|
|
670
|
-
id: "ActionConditional",
|
|
671
|
-
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
672
|
-
});
|
|
673
|
-
var DisplayOnReviewConditional = z7.object({
|
|
674
|
-
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
675
|
-
conditional: Conditional
|
|
676
|
-
}).describe(
|
|
677
|
-
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
678
|
-
);
|
|
679
|
-
var FieldConditional = z7.discriminatedUnion("type", [
|
|
680
|
-
// Field input can be shown / hidden
|
|
681
|
-
ShowConditional,
|
|
682
|
-
// Field input can be shown to the user but as disabled
|
|
683
|
-
EnableConditional,
|
|
684
|
-
// Field output can be shown / hidden on the review page
|
|
685
|
-
DisplayOnReviewConditional
|
|
686
|
-
]).meta({
|
|
687
|
-
id: "FieldConditional",
|
|
688
|
-
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
689
|
-
});
|
|
690
|
-
|
|
691
894
|
// ../commons/src/events/FieldType.ts
|
|
692
|
-
var
|
|
895
|
+
var z10 = __toESM(require("zod/v4"));
|
|
693
896
|
var FieldType = {
|
|
694
897
|
NAME: "NAME",
|
|
695
898
|
PHONE: "PHONE",
|
|
@@ -753,7 +956,7 @@ var FieldType = {
|
|
|
753
956
|
*/
|
|
754
957
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
755
958
|
};
|
|
756
|
-
var FileFieldType =
|
|
959
|
+
var FileFieldType = z10.enum([
|
|
757
960
|
FieldType.FILE,
|
|
758
961
|
FieldType.FILE_WITH_OPTIONS,
|
|
759
962
|
FieldType.SIGNATURE
|
|
@@ -789,160 +992,161 @@ var HiddenFieldTypes = [
|
|
|
789
992
|
];
|
|
790
993
|
|
|
791
994
|
// ../commons/src/events/FieldValue.ts
|
|
792
|
-
var
|
|
995
|
+
var z14 = __toESM(require("zod/v4"));
|
|
793
996
|
|
|
794
997
|
// ../commons/src/documents.ts
|
|
795
|
-
var
|
|
796
|
-
var FullDocumentUrl =
|
|
998
|
+
var z11 = __toESM(require("zod/v4"));
|
|
999
|
+
var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
|
|
797
1000
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
|
|
798
1001
|
);
|
|
799
|
-
var FullDocumentPath =
|
|
1002
|
+
var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
800
1003
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
801
1004
|
);
|
|
802
|
-
var DocumentPath =
|
|
1005
|
+
var DocumentPath = z11.string().brand("DocumentPath").describe(
|
|
803
1006
|
"A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
|
|
804
1007
|
);
|
|
805
1008
|
|
|
806
1009
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
807
|
-
var
|
|
1010
|
+
var z12 = __toESM(require("zod/v4"));
|
|
808
1011
|
var AddressType = {
|
|
809
1012
|
DOMESTIC: "DOMESTIC",
|
|
810
1013
|
INTERNATIONAL: "INTERNATIONAL"
|
|
811
1014
|
};
|
|
812
|
-
var FileFieldValue =
|
|
1015
|
+
var FileFieldValue = z12.object({
|
|
813
1016
|
path: DocumentPath,
|
|
814
|
-
originalFilename:
|
|
815
|
-
type:
|
|
816
|
-
});
|
|
817
|
-
var NameFieldValue =
|
|
818
|
-
firstname:
|
|
819
|
-
surname:
|
|
820
|
-
middlename:
|
|
821
|
-
});
|
|
822
|
-
var NameFieldUpdateValue =
|
|
823
|
-
firstname:
|
|
824
|
-
surname:
|
|
825
|
-
middlename:
|
|
826
|
-
}).or(
|
|
827
|
-
var StreetLevelDetailsValue =
|
|
828
|
-
var StreetLevelDetailsUpdateValue =
|
|
829
|
-
var BaseAddressFieldValue =
|
|
830
|
-
country:
|
|
1017
|
+
originalFilename: z12.string(),
|
|
1018
|
+
type: z12.string()
|
|
1019
|
+
});
|
|
1020
|
+
var NameFieldValue = z12.object({
|
|
1021
|
+
firstname: z12.string(),
|
|
1022
|
+
surname: z12.string(),
|
|
1023
|
+
middlename: z12.string().optional()
|
|
1024
|
+
});
|
|
1025
|
+
var NameFieldUpdateValue = z12.object({
|
|
1026
|
+
firstname: z12.string().nullish(),
|
|
1027
|
+
surname: z12.string().nullish(),
|
|
1028
|
+
middlename: z12.string().nullish()
|
|
1029
|
+
}).or(z12.null()).or(z12.undefined());
|
|
1030
|
+
var StreetLevelDetailsValue = z12.record(z12.string(), z12.string()).optional();
|
|
1031
|
+
var StreetLevelDetailsUpdateValue = z12.record(z12.string(), z12.string().nullable()).nullish();
|
|
1032
|
+
var BaseAddressFieldValue = z12.object({
|
|
1033
|
+
country: z12.string(),
|
|
831
1034
|
streetLevelDetails: StreetLevelDetailsValue
|
|
832
1035
|
});
|
|
833
|
-
var BaseAddressFieldUpdateValue =
|
|
834
|
-
country:
|
|
1036
|
+
var BaseAddressFieldUpdateValue = z12.object({
|
|
1037
|
+
country: z12.string().nullish(),
|
|
835
1038
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
836
1039
|
});
|
|
837
1040
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
838
|
-
addressType:
|
|
839
|
-
administrativeArea:
|
|
1041
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1042
|
+
administrativeArea: z12.string().uuid()
|
|
840
1043
|
});
|
|
841
1044
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
842
|
-
addressType:
|
|
1045
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
843
1046
|
});
|
|
844
|
-
var AddressFieldValue =
|
|
1047
|
+
var AddressFieldValue = z12.discriminatedUnion("addressType", [
|
|
845
1048
|
DomesticAddressFieldValue,
|
|
846
1049
|
InternationalAddressFieldValue
|
|
847
1050
|
]);
|
|
848
1051
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
849
|
-
addressType:
|
|
850
|
-
administrativeArea:
|
|
1052
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1053
|
+
administrativeArea: z12.string().uuid().nullish()
|
|
851
1054
|
/* Leaf level admin structure */
|
|
852
1055
|
});
|
|
853
1056
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
854
1057
|
{
|
|
855
|
-
addressType:
|
|
1058
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
856
1059
|
}
|
|
857
1060
|
);
|
|
858
|
-
var AddressFieldUpdateValue =
|
|
1061
|
+
var AddressFieldUpdateValue = z12.discriminatedUnion("addressType", [
|
|
859
1062
|
DomesticAddressUpdateFieldValue,
|
|
860
1063
|
InternationalAddressUpdateFieldValue
|
|
861
1064
|
]).nullish();
|
|
862
|
-
var FileFieldValueWithOption =
|
|
1065
|
+
var FileFieldValueWithOption = z12.object({
|
|
863
1066
|
path: DocumentPath,
|
|
864
|
-
originalFilename:
|
|
865
|
-
type:
|
|
866
|
-
option:
|
|
867
|
-
});
|
|
868
|
-
var FileFieldWithOptionValue =
|
|
869
|
-
var HttpFieldValue =
|
|
870
|
-
loading:
|
|
871
|
-
error:
|
|
872
|
-
data:
|
|
873
|
-
});
|
|
874
|
-
var HttpFieldUpdateValue =
|
|
875
|
-
loading:
|
|
876
|
-
error:
|
|
877
|
-
data:
|
|
878
|
-
}).or(
|
|
879
|
-
var QueryParamReaderFieldValue =
|
|
880
|
-
data:
|
|
881
|
-
updatedAt:
|
|
1067
|
+
originalFilename: z12.string(),
|
|
1068
|
+
type: z12.string(),
|
|
1069
|
+
option: z12.string()
|
|
1070
|
+
});
|
|
1071
|
+
var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
|
|
1072
|
+
var HttpFieldValue = z12.object({
|
|
1073
|
+
loading: z12.boolean(),
|
|
1074
|
+
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
1075
|
+
data: z12.any()
|
|
1076
|
+
});
|
|
1077
|
+
var HttpFieldUpdateValue = z12.object({
|
|
1078
|
+
loading: z12.boolean().nullish(),
|
|
1079
|
+
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
1080
|
+
data: z12.any().nullish()
|
|
1081
|
+
}).or(z12.null()).or(z12.undefined());
|
|
1082
|
+
var QueryParamReaderFieldValue = z12.object({
|
|
1083
|
+
data: z12.record(z12.string(), z12.string()),
|
|
1084
|
+
updatedAt: z12.iso.datetime()
|
|
882
1085
|
}).nullish();
|
|
883
|
-
var QueryParamReaderFieldUpdateValue =
|
|
884
|
-
data:
|
|
1086
|
+
var QueryParamReaderFieldUpdateValue = z12.object({
|
|
1087
|
+
data: z12.record(z12.string(), z12.string())
|
|
885
1088
|
});
|
|
886
|
-
var ReadDataValue =
|
|
887
|
-
data:
|
|
1089
|
+
var ReadDataValue = z12.object({
|
|
1090
|
+
data: z12.any()
|
|
888
1091
|
});
|
|
889
1092
|
var QrReaderFieldValue = ReadDataValue;
|
|
890
1093
|
var IdReaderFieldValue = ReadDataValue;
|
|
891
|
-
var NumberWithUnitFieldValue =
|
|
892
|
-
numericValue:
|
|
893
|
-
unit:
|
|
1094
|
+
var NumberWithUnitFieldValue = z12.object({
|
|
1095
|
+
numericValue: z12.number(),
|
|
1096
|
+
unit: z12.string()
|
|
894
1097
|
});
|
|
895
|
-
var NumberWithUnitFieldUpdateValue =
|
|
896
|
-
numericValue:
|
|
897
|
-
unit:
|
|
1098
|
+
var NumberWithUnitFieldUpdateValue = z12.object({
|
|
1099
|
+
numericValue: z12.number().optional(),
|
|
1100
|
+
unit: z12.string().optional()
|
|
898
1101
|
});
|
|
899
|
-
var CustomFieldValue =
|
|
1102
|
+
var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
900
1103
|
|
|
901
1104
|
// ../commons/src/events/PlainDate.ts
|
|
902
1105
|
var import_zod = require("zod");
|
|
903
1106
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
904
1107
|
|
|
905
1108
|
// ../commons/src/events/FieldValue.ts
|
|
906
|
-
var TextValue =
|
|
907
|
-
var HiddenFieldValue =
|
|
908
|
-
var NonEmptyTextValue =
|
|
909
|
-
var DateValue =
|
|
910
|
-
var
|
|
911
|
-
|
|
912
|
-
|
|
1109
|
+
var TextValue = z14.string();
|
|
1110
|
+
var HiddenFieldValue = z14.string();
|
|
1111
|
+
var NonEmptyTextValue = z14.string().trim().min(1);
|
|
1112
|
+
var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1113
|
+
var AGE_MAX_VALUE = 999;
|
|
1114
|
+
var AgeValue = z14.object({
|
|
1115
|
+
age: z14.number().int().min(0).max(AGE_MAX_VALUE),
|
|
1116
|
+
asOfDateRef: z14.string()
|
|
913
1117
|
});
|
|
914
1118
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
915
|
-
var AutocompleteValue =
|
|
916
|
-
label:
|
|
917
|
-
value:
|
|
1119
|
+
var AutocompleteValue = z14.object({
|
|
1120
|
+
label: z14.string(),
|
|
1121
|
+
value: z14.string()
|
|
918
1122
|
});
|
|
919
1123
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
920
|
-
var TimeValue =
|
|
921
|
-
var DatetimeValue =
|
|
922
|
-
var SelectDateRangeValue =
|
|
1124
|
+
var TimeValue = z14.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1125
|
+
var DatetimeValue = z14.iso.datetime();
|
|
1126
|
+
var SelectDateRangeValue = z14.enum([
|
|
923
1127
|
"last7Days",
|
|
924
1128
|
"last30Days",
|
|
925
1129
|
"last90Days",
|
|
926
1130
|
"last365Days"
|
|
927
1131
|
]);
|
|
928
|
-
var DateRangeFieldValue =
|
|
1132
|
+
var DateRangeFieldValue = z14.object({
|
|
929
1133
|
start: PlainDate,
|
|
930
1134
|
end: PlainDate
|
|
931
1135
|
}).or(PlainDate).describe(
|
|
932
1136
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
933
1137
|
);
|
|
934
|
-
var EmailValue =
|
|
935
|
-
var CheckboxFieldValue =
|
|
936
|
-
var NumberFieldValue =
|
|
1138
|
+
var EmailValue = z14.email();
|
|
1139
|
+
var CheckboxFieldValue = z14.boolean();
|
|
1140
|
+
var NumberFieldValue = z14.number();
|
|
937
1141
|
var SignatureFieldValue = FileFieldValue;
|
|
938
|
-
var ButtonFieldValue =
|
|
939
|
-
var VerificationStatusValue =
|
|
1142
|
+
var ButtonFieldValue = z14.number();
|
|
1143
|
+
var VerificationStatusValue = z14.enum([
|
|
940
1144
|
"verified",
|
|
941
1145
|
"authenticated",
|
|
942
1146
|
"failed",
|
|
943
1147
|
"pending"
|
|
944
1148
|
]);
|
|
945
|
-
var LeafFieldValues =
|
|
1149
|
+
var LeafFieldValues = z14.union([
|
|
946
1150
|
AddressFieldValue,
|
|
947
1151
|
TextValue,
|
|
948
1152
|
PlainDate,
|
|
@@ -968,11 +1172,11 @@ var LeafFieldValues = z12.union([
|
|
|
968
1172
|
AutocompleteValue,
|
|
969
1173
|
AutocompleteUpdateValue
|
|
970
1174
|
]);
|
|
971
|
-
var FieldGroupValue =
|
|
972
|
-
var DataFieldValue =
|
|
973
|
-
data:
|
|
1175
|
+
var FieldGroupValue = z14.record(z14.string(), LeafFieldValues);
|
|
1176
|
+
var DataFieldValue = z14.object({
|
|
1177
|
+
data: z14.record(z14.string(), LeafFieldValues)
|
|
974
1178
|
}).nullish();
|
|
975
|
-
var FieldValue =
|
|
1179
|
+
var FieldValue = z14.union([
|
|
976
1180
|
LeafFieldValues,
|
|
977
1181
|
DataFieldValue,
|
|
978
1182
|
FieldGroupValue
|
|
@@ -1006,7 +1210,7 @@ function safeUnion(schemas) {
|
|
|
1006
1210
|
const sortedSchemas = [...schemas].sort(
|
|
1007
1211
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1008
1212
|
);
|
|
1009
|
-
return
|
|
1213
|
+
return z14.any().superRefine((val, ctx) => {
|
|
1010
1214
|
for (const schema of sortedSchemas) {
|
|
1011
1215
|
if (schema.safeParse(val).success) {
|
|
1012
1216
|
return;
|
|
@@ -1045,9 +1249,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1045
1249
|
]);
|
|
1046
1250
|
|
|
1047
1251
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1048
|
-
var
|
|
1049
|
-
var SerializedUserField =
|
|
1050
|
-
$userField:
|
|
1252
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1253
|
+
var SerializedUserField = z15.object({
|
|
1254
|
+
$userField: z15.enum([
|
|
1051
1255
|
"id",
|
|
1052
1256
|
"name",
|
|
1053
1257
|
"role",
|
|
@@ -1061,7 +1265,7 @@ var SerializedUserField = z13.object({
|
|
|
1061
1265
|
"primaryOfficeId",
|
|
1062
1266
|
"administrativeAreaId"
|
|
1063
1267
|
]),
|
|
1064
|
-
$location:
|
|
1268
|
+
$location: z15.string().optional()
|
|
1065
1269
|
});
|
|
1066
1270
|
function userSerializer(userField) {
|
|
1067
1271
|
return {
|
|
@@ -1084,30 +1288,25 @@ function userSerializer(userField) {
|
|
|
1084
1288
|
var import_v4 = require("zod/v4");
|
|
1085
1289
|
|
|
1086
1290
|
// ../commons/src/events/EventMetadata.ts
|
|
1087
|
-
var
|
|
1291
|
+
var z17 = __toESM(require("zod/v4"));
|
|
1088
1292
|
|
|
1089
1293
|
// ../commons/src/events/ActionDocument.ts
|
|
1090
|
-
var
|
|
1091
|
-
var ActionUpdate =
|
|
1294
|
+
var z16 = __toESM(require("zod/v4"));
|
|
1295
|
+
var ActionUpdate = z16.record(z16.string(), FieldUpdateValue).describe(
|
|
1092
1296
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1093
1297
|
);
|
|
1094
|
-
var EventState =
|
|
1298
|
+
var EventState = z16.record(z16.string(), FieldValue).describe(
|
|
1095
1299
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1096
1300
|
);
|
|
1097
|
-
var
|
|
1098
|
-
Requested: "Requested",
|
|
1099
|
-
Accepted: "Accepted",
|
|
1100
|
-
Rejected: "Rejected"
|
|
1101
|
-
};
|
|
1102
|
-
var ActionBase = z14.object({
|
|
1301
|
+
var ActionBase = z16.object({
|
|
1103
1302
|
id: UUID.describe("Unique identifier of the action."),
|
|
1104
|
-
transactionId:
|
|
1303
|
+
transactionId: z16.string().describe("Unique identifier of the transaction."),
|
|
1105
1304
|
createdByUserType: TokenUserType.describe(
|
|
1106
1305
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1107
1306
|
),
|
|
1108
|
-
createdAt:
|
|
1109
|
-
createdBy:
|
|
1110
|
-
createdByRole:
|
|
1307
|
+
createdAt: z16.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1308
|
+
createdBy: z16.string().describe("Identifier of the user who created the action."),
|
|
1309
|
+
createdByRole: z16.string().optional().describe("Role of the user who created the action."),
|
|
1111
1310
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1112
1311
|
"Reference to the signature of the user who created the action."
|
|
1113
1312
|
),
|
|
@@ -1119,7 +1318,7 @@ var ActionBase = z14.object({
|
|
|
1119
1318
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1120
1319
|
),
|
|
1121
1320
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1122
|
-
status:
|
|
1321
|
+
status: z16.enum([
|
|
1123
1322
|
ActionStatus.Requested,
|
|
1124
1323
|
ActionStatus.Accepted,
|
|
1125
1324
|
ActionStatus.Rejected
|
|
@@ -1131,139 +1330,153 @@ var ActionBase = z14.object({
|
|
|
1131
1330
|
)
|
|
1132
1331
|
});
|
|
1133
1332
|
var AssignedAction = ActionBase.extend(
|
|
1134
|
-
|
|
1135
|
-
type:
|
|
1136
|
-
assignedTo:
|
|
1333
|
+
z16.object({
|
|
1334
|
+
type: z16.literal(ActionType.ASSIGN),
|
|
1335
|
+
assignedTo: z16.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1137
1336
|
// TODO move into 'content' property
|
|
1138
1337
|
}).shape
|
|
1139
1338
|
);
|
|
1140
1339
|
var UnassignedAction = ActionBase.extend(
|
|
1141
|
-
|
|
1142
|
-
type:
|
|
1340
|
+
z16.object({
|
|
1341
|
+
type: z16.literal(ActionType.UNASSIGN)
|
|
1143
1342
|
}).shape
|
|
1144
1343
|
);
|
|
1145
1344
|
var RegisterAction = ActionBase.extend(
|
|
1146
|
-
|
|
1147
|
-
type:
|
|
1148
|
-
registrationNumber:
|
|
1345
|
+
z16.object({
|
|
1346
|
+
type: z16.literal(ActionType.REGISTER),
|
|
1347
|
+
registrationNumber: z16.string().optional().describe(
|
|
1149
1348
|
"Registration number of the event. Always present for accepted registrations."
|
|
1150
1349
|
)
|
|
1151
1350
|
// TODO move into 'content' property
|
|
1152
1351
|
}).shape
|
|
1153
1352
|
);
|
|
1154
1353
|
var DeclareAction = ActionBase.extend(
|
|
1155
|
-
|
|
1156
|
-
type:
|
|
1354
|
+
z16.object({
|
|
1355
|
+
type: z16.literal(ActionType.DECLARE)
|
|
1157
1356
|
}).shape
|
|
1158
1357
|
);
|
|
1159
|
-
var ReasonContent =
|
|
1160
|
-
reason:
|
|
1358
|
+
var ReasonContent = z16.object({
|
|
1359
|
+
reason: z16.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1161
1360
|
"Message describing the reason for rejecting or archiving the event."
|
|
1162
1361
|
)
|
|
1163
1362
|
});
|
|
1164
1363
|
var RejectAction = ActionBase.extend(
|
|
1165
|
-
|
|
1166
|
-
type:
|
|
1364
|
+
z16.object({
|
|
1365
|
+
type: z16.literal(ActionType.REJECT),
|
|
1167
1366
|
content: ReasonContent
|
|
1168
1367
|
}).shape
|
|
1169
1368
|
);
|
|
1170
|
-
var PotentialDuplicate =
|
|
1369
|
+
var PotentialDuplicate = z16.object({
|
|
1171
1370
|
id: UUID,
|
|
1172
|
-
trackingId:
|
|
1371
|
+
trackingId: z16.string()
|
|
1173
1372
|
});
|
|
1174
1373
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1175
|
-
|
|
1176
|
-
type:
|
|
1177
|
-
content:
|
|
1178
|
-
duplicates:
|
|
1374
|
+
z16.object({
|
|
1375
|
+
type: z16.literal(ActionType.DUPLICATE_DETECTED),
|
|
1376
|
+
content: z16.object({
|
|
1377
|
+
duplicates: z16.array(PotentialDuplicate)
|
|
1179
1378
|
})
|
|
1180
1379
|
}).shape
|
|
1181
1380
|
);
|
|
1182
1381
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1183
|
-
|
|
1184
|
-
type:
|
|
1382
|
+
z16.object({
|
|
1383
|
+
type: z16.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1185
1384
|
}).shape
|
|
1186
1385
|
);
|
|
1187
1386
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1188
|
-
|
|
1189
|
-
type:
|
|
1190
|
-
content:
|
|
1387
|
+
z16.object({
|
|
1388
|
+
type: z16.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1389
|
+
content: z16.object({
|
|
1191
1390
|
duplicateOf: UUID
|
|
1192
1391
|
}).optional()
|
|
1193
1392
|
}).shape
|
|
1194
1393
|
);
|
|
1195
1394
|
var ArchiveAction = ActionBase.extend(
|
|
1196
|
-
|
|
1197
|
-
type:
|
|
1198
|
-
|
|
1395
|
+
z16.object({
|
|
1396
|
+
type: z16.literal(ActionType.ARCHIVE),
|
|
1397
|
+
/**
|
|
1398
|
+
* Archiving does not collect a reason on its own. Only the
|
|
1399
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
1400
|
+
*/
|
|
1401
|
+
content: ReasonContent.optional()
|
|
1199
1402
|
}).shape
|
|
1200
1403
|
);
|
|
1201
1404
|
var UnarchiveAction = ActionBase.extend(
|
|
1202
|
-
|
|
1203
|
-
type:
|
|
1405
|
+
z16.object({
|
|
1406
|
+
type: z16.literal(ActionType.UNARCHIVE)
|
|
1407
|
+
}).shape
|
|
1408
|
+
);
|
|
1409
|
+
var RevokeRegistrationAction = ActionBase.extend(
|
|
1410
|
+
z16.object({
|
|
1411
|
+
type: z16.literal(ActionType.REVOKE_REGISTRATION)
|
|
1412
|
+
}).shape
|
|
1413
|
+
);
|
|
1414
|
+
var ReinstateRegistrationAction = ActionBase.extend(
|
|
1415
|
+
z16.object({
|
|
1416
|
+
type: z16.literal(ActionType.REINSTATE_REGISTRATION)
|
|
1204
1417
|
}).shape
|
|
1205
1418
|
);
|
|
1206
1419
|
var CreatedAction = ActionBase.extend(
|
|
1207
|
-
|
|
1208
|
-
type:
|
|
1420
|
+
z16.object({
|
|
1421
|
+
type: z16.literal(ActionType.CREATE)
|
|
1209
1422
|
}).shape
|
|
1210
1423
|
);
|
|
1211
1424
|
var NotifiedAction = ActionBase.extend(
|
|
1212
|
-
|
|
1213
|
-
type:
|
|
1425
|
+
z16.object({
|
|
1426
|
+
type: z16.literal(ActionType.NOTIFY)
|
|
1214
1427
|
}).shape
|
|
1215
1428
|
);
|
|
1216
1429
|
var EditAction = ActionBase.extend(
|
|
1217
|
-
|
|
1218
|
-
type:
|
|
1430
|
+
z16.object({
|
|
1431
|
+
type: z16.literal(ActionType.EDIT),
|
|
1219
1432
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1220
|
-
content:
|
|
1221
|
-
comment:
|
|
1433
|
+
content: z16.object({
|
|
1434
|
+
comment: z16.string().describe("Comment for the edit action.").optional()
|
|
1222
1435
|
}).optional()
|
|
1223
1436
|
}).shape
|
|
1224
1437
|
);
|
|
1225
|
-
var PrintContent =
|
|
1226
|
-
templateId:
|
|
1438
|
+
var PrintContent = z16.object({
|
|
1439
|
+
templateId: z16.string().optional()
|
|
1227
1440
|
});
|
|
1228
1441
|
var PrintCertificateAction = ActionBase.extend(
|
|
1229
|
-
|
|
1230
|
-
type:
|
|
1442
|
+
z16.object({
|
|
1443
|
+
type: z16.literal(ActionType.PRINT_CERTIFICATE),
|
|
1231
1444
|
content: PrintContent.optional().nullable()
|
|
1232
1445
|
}).shape
|
|
1233
1446
|
);
|
|
1234
1447
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1235
|
-
|
|
1236
|
-
type:
|
|
1448
|
+
z16.object({
|
|
1449
|
+
type: z16.literal(ActionType.REQUEST_CORRECTION)
|
|
1237
1450
|
}).shape
|
|
1238
1451
|
);
|
|
1239
1452
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1240
|
-
|
|
1241
|
-
type:
|
|
1242
|
-
requestId:
|
|
1453
|
+
z16.object({
|
|
1454
|
+
type: z16.literal(ActionType.APPROVE_CORRECTION),
|
|
1455
|
+
requestId: UUID,
|
|
1243
1456
|
// TODO move into 'content' property
|
|
1244
|
-
content:
|
|
1457
|
+
content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
|
|
1245
1458
|
}).shape
|
|
1246
1459
|
);
|
|
1247
1460
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1248
|
-
|
|
1249
|
-
type:
|
|
1250
|
-
requestId:
|
|
1461
|
+
z16.object({
|
|
1462
|
+
type: z16.literal(ActionType.REJECT_CORRECTION),
|
|
1463
|
+
requestId: UUID,
|
|
1251
1464
|
// TODO move into 'content' property
|
|
1252
1465
|
content: ReasonContent
|
|
1253
1466
|
}).shape
|
|
1254
1467
|
);
|
|
1255
1468
|
var ReadAction = ActionBase.extend(
|
|
1256
|
-
|
|
1257
|
-
type:
|
|
1469
|
+
z16.object({
|
|
1470
|
+
type: z16.literal(ActionType.READ)
|
|
1258
1471
|
}).shape
|
|
1259
1472
|
);
|
|
1260
1473
|
var CustomAction = ActionBase.merge(
|
|
1261
|
-
|
|
1262
|
-
type:
|
|
1263
|
-
customActionType:
|
|
1474
|
+
z16.object({
|
|
1475
|
+
type: z16.literal(ActionType.CUSTOM),
|
|
1476
|
+
customActionType: z16.string()
|
|
1264
1477
|
})
|
|
1265
1478
|
);
|
|
1266
|
-
var ActionDocument =
|
|
1479
|
+
var ActionDocument = z16.discriminatedUnion("type", [
|
|
1267
1480
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1268
1481
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1269
1482
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1271,6 +1484,8 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1271
1484
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1272
1485
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1273
1486
|
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1487
|
+
RevokeRegistrationAction.meta({ id: "RevokeRegistrationAction" }),
|
|
1488
|
+
ReinstateRegistrationAction.meta({ id: "ReinstateRegistrationAction" }),
|
|
1274
1489
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1275
1490
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1276
1491
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1290,109 +1505,51 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1290
1505
|
declaration: true,
|
|
1291
1506
|
annotation: true
|
|
1292
1507
|
}).extend(
|
|
1293
|
-
|
|
1294
|
-
type:
|
|
1295
|
-
status:
|
|
1508
|
+
z16.object({
|
|
1509
|
+
type: z16.enum(ConfirmableActions),
|
|
1510
|
+
status: z16.literal(ActionStatus.Rejected)
|
|
1296
1511
|
}).shape
|
|
1297
1512
|
);
|
|
1298
|
-
var Action =
|
|
1299
|
-
|
|
1300
|
-
// ../commons/src/events/Flag.ts
|
|
1301
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1302
|
-
var InherentFlags = {
|
|
1303
|
-
INCOMPLETE: "incomplete",
|
|
1304
|
-
REJECTED: "rejected",
|
|
1305
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1306
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1307
|
-
/**
|
|
1308
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1309
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1310
|
-
*
|
|
1311
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1312
|
-
*/
|
|
1313
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1314
|
-
};
|
|
1315
|
-
var ActionFlag = z15.string().regex(
|
|
1316
|
-
new RegExp(
|
|
1317
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1318
|
-
ActionStatus
|
|
1319
|
-
).join("|").toLowerCase()})$`
|
|
1320
|
-
),
|
|
1321
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1322
|
-
);
|
|
1323
|
-
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1324
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1325
|
-
InherentFlags
|
|
1326
|
-
).join(", ")}`
|
|
1327
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1328
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1329
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1330
|
-
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1331
|
-
var FlagConfig = z15.object({
|
|
1332
|
-
id: CustomFlag,
|
|
1333
|
-
requiresAction: z15.boolean().describe(
|
|
1334
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1335
|
-
),
|
|
1336
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1337
|
-
}).meta({
|
|
1338
|
-
id: "FlagConfig",
|
|
1339
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1340
|
-
});
|
|
1341
|
-
var ActionFlagConfig = z15.object({
|
|
1342
|
-
id: Flag,
|
|
1343
|
-
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1344
|
-
conditional: Conditional.optional().describe(
|
|
1345
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1346
|
-
)
|
|
1347
|
-
}).meta({
|
|
1348
|
-
id: "ActionFlagConfig",
|
|
1349
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1350
|
-
});
|
|
1513
|
+
var Action = z16.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1351
1514
|
|
|
1352
1515
|
// ../commons/src/events/EventMetadata.ts
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
"
|
|
1357
|
-
"
|
|
1358
|
-
"ARCHIVED"
|
|
1359
|
-
]);
|
|
1360
|
-
var ZodDate = z16.iso.date();
|
|
1361
|
-
var ZodDateTime = z16.string().datetime();
|
|
1362
|
-
var ActionCreationMetadata = z16.object({
|
|
1363
|
-
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1364
|
-
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1516
|
+
var ZodDate = z17.iso.date();
|
|
1517
|
+
var ZodDateTime = z17.string().datetime();
|
|
1518
|
+
var ActionCreationMetadata = z17.object({
|
|
1519
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1520
|
+
createdBy: z17.string().describe("ID of the user who created the action request."),
|
|
1365
1521
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1366
1522
|
createdAtLocation: UUID.nullish().describe(
|
|
1367
1523
|
"Location of the user who created the action request."
|
|
1368
1524
|
),
|
|
1369
|
-
createdByUserType:
|
|
1370
|
-
acceptedAt:
|
|
1371
|
-
createdByRole:
|
|
1525
|
+
createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1526
|
+
acceptedAt: z17.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1527
|
+
createdByRole: z17.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1372
1528
|
});
|
|
1373
1529
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1374
|
-
registrationNumber:
|
|
1530
|
+
registrationNumber: z17.string().describe(
|
|
1375
1531
|
"Registration number of the event. Always present for accepted registrations."
|
|
1376
1532
|
)
|
|
1377
1533
|
});
|
|
1378
|
-
var LegalStatuses =
|
|
1534
|
+
var LegalStatuses = z17.object({
|
|
1379
1535
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1380
1536
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1381
|
-
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1537
|
+
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish(),
|
|
1538
|
+
[EventStatus.enum.REVOKED]: ActionCreationMetadata.nullish()
|
|
1382
1539
|
});
|
|
1383
|
-
var EventMetadata =
|
|
1540
|
+
var EventMetadata = z17.object({
|
|
1384
1541
|
id: UUID,
|
|
1385
|
-
type:
|
|
1542
|
+
type: z17.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1386
1543
|
status: EventStatus,
|
|
1387
1544
|
legalStatuses: LegalStatuses.describe(
|
|
1388
1545
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1389
1546
|
),
|
|
1390
|
-
createdAt:
|
|
1547
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1391
1548
|
dateOfEvent: ZodDate.nullish(),
|
|
1392
1549
|
placeOfEvent: UUID.nullish(),
|
|
1393
|
-
createdBy:
|
|
1394
|
-
createdByUserType:
|
|
1395
|
-
updatedByUserRole:
|
|
1550
|
+
createdBy: z17.string().describe("ID of the user who created the event."),
|
|
1551
|
+
createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1552
|
+
updatedByUserRole: z17.string().nullish().describe("Role of the user who last changed the status."),
|
|
1396
1553
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1397
1554
|
createdAtLocation: UUID.nullish().describe(
|
|
1398
1555
|
"Location of the user who created the event."
|
|
@@ -1400,18 +1557,18 @@ var EventMetadata = z16.object({
|
|
|
1400
1557
|
updatedAtLocation: UUID.nullish().describe(
|
|
1401
1558
|
"Location of the user who last changed the status."
|
|
1402
1559
|
),
|
|
1403
|
-
updatedAt:
|
|
1560
|
+
updatedAt: z17.iso.datetime().describe(
|
|
1404
1561
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1405
1562
|
),
|
|
1406
|
-
assignedTo:
|
|
1407
|
-
updatedBy:
|
|
1408
|
-
trackingId:
|
|
1563
|
+
assignedTo: z17.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1564
|
+
updatedBy: z17.string().nullish().describe("ID of the user who last changed the status."),
|
|
1565
|
+
trackingId: z17.string().describe(
|
|
1409
1566
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1410
1567
|
),
|
|
1411
|
-
potentialDuplicates:
|
|
1568
|
+
potentialDuplicates: z17.array(PotentialDuplicate).describe(
|
|
1412
1569
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1413
1570
|
),
|
|
1414
|
-
flags:
|
|
1571
|
+
flags: z17.array(Flag)
|
|
1415
1572
|
});
|
|
1416
1573
|
var EventMetadataKeysArray = [
|
|
1417
1574
|
"id",
|
|
@@ -1432,8 +1589,8 @@ var EventMetadataKeysArray = [
|
|
|
1432
1589
|
"legalStatuses",
|
|
1433
1590
|
"flags"
|
|
1434
1591
|
];
|
|
1435
|
-
var EventMetadataKeys =
|
|
1436
|
-
var EventMetadataDateFieldIdInput =
|
|
1592
|
+
var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
|
|
1593
|
+
var EventMetadataDateFieldIdInput = z17.enum([
|
|
1437
1594
|
"createdAt",
|
|
1438
1595
|
"updatedAt",
|
|
1439
1596
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1443,7 +1600,7 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1443
1600
|
"legalStatuses.REGISTERED.createdAt",
|
|
1444
1601
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1445
1602
|
]);
|
|
1446
|
-
var EventMetadataDateFieldId =
|
|
1603
|
+
var EventMetadataDateFieldId = z17.enum([
|
|
1447
1604
|
"event.createdAt",
|
|
1448
1605
|
"event.updatedAt",
|
|
1449
1606
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1505,13 +1662,6 @@ var Range = import_v4.z.object({
|
|
|
1505
1662
|
}).meta({
|
|
1506
1663
|
id: "Range"
|
|
1507
1664
|
});
|
|
1508
|
-
var ContainsFlags = import_v4.z.object({
|
|
1509
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1510
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1511
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1512
|
-
}).meta({
|
|
1513
|
-
id: "ContainsFlags"
|
|
1514
|
-
});
|
|
1515
1665
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1516
1666
|
id: "Within"
|
|
1517
1667
|
});
|
|
@@ -1554,6 +1704,7 @@ var QueryExpression = import_v4.z.object({
|
|
|
1554
1704
|
"legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1555
1705
|
"legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
|
|
1556
1706
|
"legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
|
|
1707
|
+
"legalStatuses.REVOKED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1557
1708
|
createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1558
1709
|
updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1559
1710
|
assignedTo: import_v4.z.optional(Exact),
|
|
@@ -1738,8 +1889,8 @@ var BaseField = import_v43.default.object({
|
|
|
1738
1889
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1739
1890
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1740
1891
|
),
|
|
1741
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1742
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1892
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1893
|
+
"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."
|
|
1743
1894
|
),
|
|
1744
1895
|
placeholder: TranslationConfig.optional(),
|
|
1745
1896
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -2137,7 +2288,13 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2137
2288
|
configuration: import_v43.default.object({
|
|
2138
2289
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2139
2290
|
type: AdministrativeAreas,
|
|
2140
|
-
allowedLocations: AllowedLocations
|
|
2291
|
+
allowedLocations: AllowedLocations,
|
|
2292
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2293
|
+
"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."
|
|
2294
|
+
),
|
|
2295
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2296
|
+
"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."
|
|
2297
|
+
)
|
|
2141
2298
|
}).describe("Administrative area options")
|
|
2142
2299
|
}).meta({
|
|
2143
2300
|
description: "Administrative area input field",
|
|
@@ -2148,7 +2305,13 @@ var LocationInput = BaseField.extend({
|
|
|
2148
2305
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2149
2306
|
configuration: import_v43.default.object({
|
|
2150
2307
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2151
|
-
allowedLocations: AllowedLocations
|
|
2308
|
+
allowedLocations: AllowedLocations,
|
|
2309
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2310
|
+
"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."
|
|
2311
|
+
),
|
|
2312
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2313
|
+
"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."
|
|
2314
|
+
)
|
|
2152
2315
|
}).optional()
|
|
2153
2316
|
}).meta({
|
|
2154
2317
|
description: "A field for selecting a location",
|
|
@@ -2174,12 +2337,20 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2174
2337
|
var Facility = BaseField.extend({
|
|
2175
2338
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2176
2339
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2177
|
-
configuration: import_v43.default.object({
|
|
2340
|
+
configuration: import_v43.default.object({
|
|
2341
|
+
allowedLocations: AllowedLocations,
|
|
2342
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2343
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2344
|
+
}).optional()
|
|
2178
2345
|
}).describe("Input field for a facility");
|
|
2179
2346
|
var Office = BaseField.extend({
|
|
2180
2347
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2181
2348
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2182
|
-
configuration: import_v43.default.object({
|
|
2349
|
+
configuration: import_v43.default.object({
|
|
2350
|
+
allowedLocations: AllowedLocations,
|
|
2351
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2352
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2353
|
+
}).optional()
|
|
2183
2354
|
}).describe("Input field for an office");
|
|
2184
2355
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2185
2356
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -2212,7 +2383,13 @@ var Address = BaseField.extend({
|
|
|
2212
2383
|
parent: FieldReference.optional()
|
|
2213
2384
|
})
|
|
2214
2385
|
).optional(),
|
|
2215
|
-
allowedLocations: AllowedLocations
|
|
2386
|
+
allowedLocations: AllowedLocations,
|
|
2387
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2388
|
+
"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."
|
|
2389
|
+
),
|
|
2390
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2391
|
+
"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."
|
|
2392
|
+
)
|
|
2216
2393
|
}).optional(),
|
|
2217
2394
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2218
2395
|
}).meta({
|
|
@@ -2267,10 +2444,19 @@ var ButtonField = BaseField.extend({
|
|
|
2267
2444
|
description: "A generic button that can be used to trigger an action",
|
|
2268
2445
|
id: "ButtonField"
|
|
2269
2446
|
});
|
|
2447
|
+
var FieldGroupConfiguration = import_v43.default.object({
|
|
2448
|
+
separator: import_v43.default.string().optional().describe(
|
|
2449
|
+
'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
|
|
2450
|
+
),
|
|
2451
|
+
hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
|
|
2452
|
+
"Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
|
|
2453
|
+
)
|
|
2454
|
+
});
|
|
2270
2455
|
var FieldGroup = BaseField.extend({
|
|
2271
2456
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2272
2457
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2273
|
-
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2458
|
+
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
|
|
2459
|
+
configuration: FieldGroupConfiguration.optional()
|
|
2274
2460
|
}).meta({
|
|
2275
2461
|
description: "A group of fields that are displayed together",
|
|
2276
2462
|
id: "FieldGroup"
|
|
@@ -2513,18 +2699,21 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2513
2699
|
]);
|
|
2514
2700
|
|
|
2515
2701
|
// ../commons/src/events/FormConfig.ts
|
|
2516
|
-
var
|
|
2702
|
+
var z23 = __toESM(require("zod/v4"));
|
|
2517
2703
|
|
|
2518
2704
|
// ../commons/src/events/PageConfig.ts
|
|
2519
|
-
var
|
|
2520
|
-
var PageTypes =
|
|
2521
|
-
var PageConfigBase =
|
|
2522
|
-
id:
|
|
2705
|
+
var z22 = __toESM(require("zod/v4"));
|
|
2706
|
+
var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
|
|
2707
|
+
var PageConfigBase = z22.object({
|
|
2708
|
+
id: z22.string().describe("Unique identifier for the page"),
|
|
2523
2709
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2524
|
-
requireCompletionToContinue:
|
|
2710
|
+
requireCompletionToContinue: z22.boolean().default(false).describe(
|
|
2525
2711
|
"If true, all required fields must be filled before continuing to the next page"
|
|
2526
2712
|
),
|
|
2527
|
-
|
|
2713
|
+
showClearButton: z22.boolean().optional().describe(
|
|
2714
|
+
'If true, a "Clear" button is shown at the top of the page allowing the user to reset all fields on the page to their default state'
|
|
2715
|
+
),
|
|
2716
|
+
fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2528
2717
|
conditional: Conditional.optional().describe(
|
|
2529
2718
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2530
2719
|
)
|
|
@@ -2533,13 +2722,13 @@ var PageConfigBase = z21.object({
|
|
|
2533
2722
|
id: "FormPageConfig"
|
|
2534
2723
|
});
|
|
2535
2724
|
var FormPageConfig = PageConfigBase.extend({
|
|
2536
|
-
type:
|
|
2725
|
+
type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2537
2726
|
});
|
|
2538
|
-
var VerificationActionConfig =
|
|
2539
|
-
verify:
|
|
2540
|
-
cancel:
|
|
2727
|
+
var VerificationActionConfig = z22.object({
|
|
2728
|
+
verify: z22.object({ label: TranslationConfig }),
|
|
2729
|
+
cancel: z22.object({
|
|
2541
2730
|
label: TranslationConfig,
|
|
2542
|
-
confirmation:
|
|
2731
|
+
confirmation: z22.object({
|
|
2543
2732
|
title: TranslationConfig,
|
|
2544
2733
|
body: TranslationConfig
|
|
2545
2734
|
})
|
|
@@ -2549,34 +2738,34 @@ var VerificationActionConfig = z21.object({
|
|
|
2549
2738
|
id: "VerificationActionConfig"
|
|
2550
2739
|
});
|
|
2551
2740
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2552
|
-
type:
|
|
2741
|
+
type: z22.literal(PageTypes.enum.VERIFICATION),
|
|
2553
2742
|
actions: VerificationActionConfig
|
|
2554
2743
|
});
|
|
2555
|
-
var PageConfig =
|
|
2744
|
+
var PageConfig = z22.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
2556
2745
|
id: "PageConfig",
|
|
2557
2746
|
description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
|
|
2558
2747
|
});
|
|
2559
2748
|
|
|
2560
2749
|
// ../commons/src/events/FormConfig.ts
|
|
2561
|
-
var DeclarationFormConfig =
|
|
2750
|
+
var DeclarationFormConfig = z23.object({
|
|
2562
2751
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2563
|
-
pages:
|
|
2752
|
+
pages: z23.array(FormPageConfig)
|
|
2564
2753
|
}).meta({
|
|
2565
2754
|
id: "DeclarationFormConfig",
|
|
2566
2755
|
description: "Configuration of the declaration form."
|
|
2567
2756
|
});
|
|
2568
|
-
var ActionFormConfig =
|
|
2757
|
+
var ActionFormConfig = z23.object({
|
|
2569
2758
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2570
|
-
pages:
|
|
2759
|
+
pages: z23.array(PageConfig)
|
|
2571
2760
|
}).describe(
|
|
2572
2761
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
2573
2762
|
);
|
|
2574
|
-
var FormConfig =
|
|
2763
|
+
var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
|
|
2575
2764
|
|
|
2576
2765
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
2577
|
-
var
|
|
2578
|
-
var FieldReference2 =
|
|
2579
|
-
var Matcher =
|
|
2766
|
+
var z24 = __toESM(require("zod/v4"));
|
|
2767
|
+
var FieldReference2 = z24.string();
|
|
2768
|
+
var Matcher = z24.object({
|
|
2580
2769
|
/**
|
|
2581
2770
|
* Reference to the field used in matching.
|
|
2582
2771
|
*
|
|
@@ -2584,23 +2773,23 @@ var Matcher = z23.object({
|
|
|
2584
2773
|
* be used as the origin date to calculate the distance from.
|
|
2585
2774
|
*/
|
|
2586
2775
|
fieldId: FieldReference2,
|
|
2587
|
-
options:
|
|
2588
|
-
boost:
|
|
2776
|
+
options: z24.object({
|
|
2777
|
+
boost: z24.number().optional(),
|
|
2589
2778
|
matchAgainst: FieldReference2.optional()
|
|
2590
2779
|
}).optional().default({
|
|
2591
2780
|
boost: 1
|
|
2592
2781
|
})
|
|
2593
2782
|
});
|
|
2594
2783
|
var FuzzyMatcher = Matcher.extend({
|
|
2595
|
-
type:
|
|
2596
|
-
options:
|
|
2784
|
+
type: z24.literal("fuzzy"),
|
|
2785
|
+
options: z24.object({
|
|
2597
2786
|
/**
|
|
2598
2787
|
* Names of length 3 or less characters = 0 edits allowed
|
|
2599
2788
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
2600
2789
|
* Names of length >7 characters = 2 edits allowed
|
|
2601
2790
|
*/
|
|
2602
|
-
fuzziness:
|
|
2603
|
-
boost:
|
|
2791
|
+
fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
|
|
2792
|
+
boost: z24.number().optional().default(1),
|
|
2604
2793
|
matchAgainst: FieldReference2.optional()
|
|
2605
2794
|
}).optional().default({
|
|
2606
2795
|
fuzziness: "AUTO:4,7",
|
|
@@ -2608,48 +2797,48 @@ var FuzzyMatcher = Matcher.extend({
|
|
|
2608
2797
|
})
|
|
2609
2798
|
});
|
|
2610
2799
|
var StrictMatcher = Matcher.extend({
|
|
2611
|
-
type:
|
|
2612
|
-
options:
|
|
2613
|
-
boost:
|
|
2800
|
+
type: z24.literal("strict"),
|
|
2801
|
+
options: z24.object({
|
|
2802
|
+
boost: z24.number().optional().default(1),
|
|
2614
2803
|
/**
|
|
2615
2804
|
* The constant value to be present in the field for both records
|
|
2616
2805
|
*/
|
|
2617
|
-
value:
|
|
2806
|
+
value: z24.string().optional(),
|
|
2618
2807
|
matchAgainst: FieldReference2.optional()
|
|
2619
2808
|
}).optional().default({
|
|
2620
2809
|
boost: 1
|
|
2621
2810
|
})
|
|
2622
2811
|
});
|
|
2623
2812
|
var DateRangeMatcher = Matcher.extend({
|
|
2624
|
-
type:
|
|
2625
|
-
options:
|
|
2813
|
+
type: z24.literal("dateRange"),
|
|
2814
|
+
options: z24.object({
|
|
2626
2815
|
/**
|
|
2627
2816
|
* The distance pivot in days. Distance from the origin (the value of
|
|
2628
2817
|
* fieldId) at which relevance scores receive half of the boost value
|
|
2629
2818
|
*/
|
|
2630
|
-
pivot:
|
|
2631
|
-
days:
|
|
2632
|
-
boost:
|
|
2819
|
+
pivot: z24.number().optional(),
|
|
2820
|
+
days: z24.number(),
|
|
2821
|
+
boost: z24.number().optional().default(1),
|
|
2633
2822
|
matchAgainst: FieldReference2.optional()
|
|
2634
2823
|
})
|
|
2635
2824
|
});
|
|
2636
|
-
var Not =
|
|
2637
|
-
type:
|
|
2825
|
+
var Not = z24.object({
|
|
2826
|
+
type: z24.literal("not"),
|
|
2638
2827
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2639
|
-
clause:
|
|
2828
|
+
clause: z24.lazy(() => Clause)
|
|
2640
2829
|
});
|
|
2641
|
-
var And =
|
|
2642
|
-
type:
|
|
2830
|
+
var And = z24.object({
|
|
2831
|
+
type: z24.literal("and"),
|
|
2643
2832
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2644
|
-
clauses:
|
|
2833
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2645
2834
|
});
|
|
2646
|
-
var Or =
|
|
2647
|
-
type:
|
|
2835
|
+
var Or = z24.object({
|
|
2836
|
+
type: z24.literal("or"),
|
|
2648
2837
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2649
|
-
clauses:
|
|
2838
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2650
2839
|
});
|
|
2651
|
-
var Clause =
|
|
2652
|
-
() =>
|
|
2840
|
+
var Clause = z24.lazy(
|
|
2841
|
+
() => z24.discriminatedUnion("type", [
|
|
2653
2842
|
Not,
|
|
2654
2843
|
And,
|
|
2655
2844
|
Or,
|
|
@@ -2660,8 +2849,8 @@ var Clause = z23.lazy(
|
|
|
2660
2849
|
).meta({
|
|
2661
2850
|
id: "Clause"
|
|
2662
2851
|
});
|
|
2663
|
-
var DeduplicationConfig =
|
|
2664
|
-
id:
|
|
2852
|
+
var DeduplicationConfig = z24.object({
|
|
2853
|
+
id: z24.string(),
|
|
2665
2854
|
label: TranslationConfig,
|
|
2666
2855
|
query: Clause
|
|
2667
2856
|
}).meta({
|
|
@@ -2670,15 +2859,15 @@ var DeduplicationConfig = z23.object({
|
|
|
2670
2859
|
});
|
|
2671
2860
|
|
|
2672
2861
|
// ../commons/src/events/ActionConfig.ts
|
|
2673
|
-
var DeclarationReviewConfig =
|
|
2862
|
+
var DeclarationReviewConfig = z25.object({
|
|
2674
2863
|
title: TranslationConfig.describe("Title of the review page"),
|
|
2675
|
-
fields:
|
|
2864
|
+
fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
2676
2865
|
}).describe(
|
|
2677
2866
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
2678
2867
|
);
|
|
2679
|
-
var ActionConfigBase =
|
|
2868
|
+
var ActionConfigBase = z25.object({
|
|
2680
2869
|
label: TranslationConfig.describe("Human readable description of the action"),
|
|
2681
|
-
flags:
|
|
2870
|
+
flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
2682
2871
|
supportingCopy: TranslationConfig.optional().describe(
|
|
2683
2872
|
"Text displayed on the confirmation dialog"
|
|
2684
2873
|
),
|
|
@@ -2689,84 +2878,90 @@ var ActionConfigBase = z24.object({
|
|
|
2689
2878
|
* "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
|
|
2690
2879
|
* for EventConfig.d.ts.
|
|
2691
2880
|
*/
|
|
2692
|
-
icon:
|
|
2693
|
-
conditionals:
|
|
2881
|
+
icon: z25.string().describe("Icon representing the action").optional(),
|
|
2882
|
+
conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
2694
2883
|
});
|
|
2695
2884
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2696
2885
|
deduplication: DeduplicationConfig.optional()
|
|
2697
2886
|
});
|
|
2698
|
-
var actionConfirmationForm =
|
|
2887
|
+
var actionConfirmationForm = z25.array(FieldConfig).optional().describe(
|
|
2699
2888
|
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
2700
2889
|
);
|
|
2701
2890
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
2702
|
-
|
|
2703
|
-
type:
|
|
2891
|
+
z25.object({
|
|
2892
|
+
type: z25.literal(ActionType.READ),
|
|
2704
2893
|
review: DeclarationReviewConfig.describe(
|
|
2705
2894
|
"Configuration of the review page for read-only view."
|
|
2706
2895
|
),
|
|
2707
|
-
conditionals:
|
|
2896
|
+
conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals."),
|
|
2897
|
+
flags: z25.never().optional().describe(
|
|
2898
|
+
"READ is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2899
|
+
)
|
|
2708
2900
|
}).shape
|
|
2709
2901
|
);
|
|
2710
2902
|
var NotifyConfig = ActionConfigBase.extend(
|
|
2711
|
-
|
|
2712
|
-
type:
|
|
2903
|
+
z25.object({
|
|
2904
|
+
type: z25.literal(ActionType.NOTIFY),
|
|
2713
2905
|
form: actionConfirmationForm
|
|
2714
2906
|
}).shape
|
|
2715
2907
|
);
|
|
2716
2908
|
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2717
|
-
|
|
2718
|
-
type:
|
|
2719
|
-
label:
|
|
2909
|
+
z25.object({
|
|
2910
|
+
type: z25.literal(ActionType.DUPLICATE_DETECTED),
|
|
2911
|
+
label: z25.never().optional().describe(
|
|
2720
2912
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2721
2913
|
),
|
|
2722
|
-
supportingCopy:
|
|
2723
|
-
icon:
|
|
2914
|
+
supportingCopy: z25.never().optional(),
|
|
2915
|
+
icon: z25.never().optional().describe(
|
|
2724
2916
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2725
2917
|
),
|
|
2726
|
-
conditionals:
|
|
2918
|
+
conditionals: z25.never().optional().describe(
|
|
2727
2919
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2728
2920
|
)
|
|
2729
2921
|
}).shape
|
|
2730
2922
|
);
|
|
2731
2923
|
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2732
|
-
|
|
2733
|
-
type:
|
|
2924
|
+
z25.object({
|
|
2925
|
+
type: z25.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2734
2926
|
}).shape
|
|
2735
2927
|
);
|
|
2736
2928
|
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2737
|
-
|
|
2738
|
-
type:
|
|
2929
|
+
z25.object({
|
|
2930
|
+
type: z25.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2739
2931
|
}).shape
|
|
2740
2932
|
);
|
|
2741
2933
|
var AssignConfig = ActionConfigBase.extend(
|
|
2742
|
-
|
|
2743
|
-
type:
|
|
2744
|
-
flags:
|
|
2934
|
+
z25.object({
|
|
2935
|
+
type: z25.literal(ActionType.ASSIGN),
|
|
2936
|
+
flags: z25.never().optional().describe(
|
|
2745
2937
|
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2746
2938
|
)
|
|
2747
2939
|
}).shape
|
|
2748
2940
|
);
|
|
2749
2941
|
var UnassignConfig = ActionConfigBase.extend(
|
|
2750
|
-
|
|
2751
|
-
type:
|
|
2752
|
-
flags:
|
|
2942
|
+
z25.object({
|
|
2943
|
+
type: z25.literal(ActionType.UNASSIGN),
|
|
2944
|
+
flags: z25.never().optional().describe(
|
|
2753
2945
|
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2754
2946
|
)
|
|
2755
2947
|
}).shape
|
|
2756
2948
|
);
|
|
2757
2949
|
var DeleteConfig = ActionConfigBase.extend(
|
|
2758
|
-
|
|
2759
|
-
type:
|
|
2950
|
+
z25.object({
|
|
2951
|
+
type: z25.literal(ActionType.DELETE)
|
|
2760
2952
|
}).shape
|
|
2761
2953
|
);
|
|
2762
2954
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2763
|
-
|
|
2764
|
-
type:
|
|
2955
|
+
z25.object({
|
|
2956
|
+
type: z25.literal(ActionType.DECLARE),
|
|
2957
|
+
declaration: DeclarationFormConfig.describe(
|
|
2958
|
+
"Configuration of the form used to gather event data."
|
|
2959
|
+
),
|
|
2765
2960
|
review: DeclarationReviewConfig.describe(
|
|
2766
2961
|
"Configuration of the review page fields."
|
|
2767
2962
|
),
|
|
2768
2963
|
form: actionConfirmationForm,
|
|
2769
|
-
dialogCopy:
|
|
2964
|
+
dialogCopy: z25.object({
|
|
2770
2965
|
notify: TranslationConfig.describe(
|
|
2771
2966
|
"Confirmation text for the notify action"
|
|
2772
2967
|
),
|
|
@@ -2780,20 +2975,32 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2780
2975
|
}).shape
|
|
2781
2976
|
);
|
|
2782
2977
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
2783
|
-
|
|
2784
|
-
type:
|
|
2978
|
+
z25.object({
|
|
2979
|
+
type: z25.literal(ActionType.ARCHIVE),
|
|
2785
2980
|
form: actionConfirmationForm
|
|
2786
2981
|
}).shape
|
|
2787
2982
|
);
|
|
2788
2983
|
var UnarchiveConfig = ActionConfigBase.extend(
|
|
2789
|
-
|
|
2790
|
-
type:
|
|
2984
|
+
z25.object({
|
|
2985
|
+
type: z25.literal(ActionType.UNARCHIVE)
|
|
2986
|
+
}).shape
|
|
2987
|
+
);
|
|
2988
|
+
var RevokeRegistrationConfig = ActionConfigBase.extend(
|
|
2989
|
+
z25.object({
|
|
2990
|
+
type: z25.literal(ActionType.REVOKE_REGISTRATION),
|
|
2991
|
+
form: actionConfirmationForm
|
|
2992
|
+
}).shape
|
|
2993
|
+
);
|
|
2994
|
+
var ReinstateRegistrationConfig = ActionConfigBase.extend(
|
|
2995
|
+
z25.object({
|
|
2996
|
+
type: z25.literal(ActionType.REINSTATE_REGISTRATION),
|
|
2997
|
+
form: actionConfirmationForm
|
|
2791
2998
|
}).shape
|
|
2792
2999
|
);
|
|
2793
3000
|
var EditActionConfig = ActionConfigBase.extend(
|
|
2794
|
-
|
|
2795
|
-
type:
|
|
2796
|
-
dialogCopy:
|
|
3001
|
+
z25.object({
|
|
3002
|
+
type: z25.literal(ActionType.EDIT),
|
|
3003
|
+
dialogCopy: z25.object({
|
|
2797
3004
|
notify: TranslationConfig.describe(
|
|
2798
3005
|
"Confirmation text for the notify with edits action"
|
|
2799
3006
|
),
|
|
@@ -2807,45 +3014,45 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
2807
3014
|
}).shape
|
|
2808
3015
|
);
|
|
2809
3016
|
var RejectConfig = ActionConfigBase.extend(
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
3017
|
+
z25.object({
|
|
3018
|
+
type: z25.literal(ActionType.REJECT),
|
|
2812
3019
|
form: actionConfirmationForm
|
|
2813
3020
|
}).shape
|
|
2814
3021
|
);
|
|
2815
3022
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2816
|
-
|
|
2817
|
-
type:
|
|
3023
|
+
z25.object({
|
|
3024
|
+
type: z25.literal(ActionType.REGISTER),
|
|
2818
3025
|
form: actionConfirmationForm
|
|
2819
3026
|
}).shape
|
|
2820
3027
|
);
|
|
2821
3028
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
2822
|
-
|
|
2823
|
-
type:
|
|
3029
|
+
z25.object({
|
|
3030
|
+
type: z25.literal(ActionType.PRINT_CERTIFICATE),
|
|
2824
3031
|
printForm: ActionFormConfig
|
|
2825
3032
|
}).shape
|
|
2826
3033
|
);
|
|
2827
3034
|
var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
2828
|
-
|
|
2829
|
-
type:
|
|
3035
|
+
z25.object({
|
|
3036
|
+
type: z25.literal(ActionType.REQUEST_CORRECTION),
|
|
2830
3037
|
correctionForm: ActionFormConfig
|
|
2831
3038
|
}).shape
|
|
2832
3039
|
);
|
|
2833
3040
|
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2834
|
-
|
|
2835
|
-
type:
|
|
3041
|
+
z25.object({
|
|
3042
|
+
type: z25.literal(ActionType.APPROVE_CORRECTION)
|
|
2836
3043
|
}).shape
|
|
2837
3044
|
);
|
|
2838
3045
|
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2839
|
-
|
|
2840
|
-
type:
|
|
3046
|
+
z25.object({
|
|
3047
|
+
type: z25.literal(ActionType.REJECT_CORRECTION)
|
|
2841
3048
|
}).shape
|
|
2842
3049
|
);
|
|
2843
3050
|
var CustomActionConfig = ActionConfigBase.extend(
|
|
2844
|
-
|
|
2845
|
-
type:
|
|
2846
|
-
customActionType:
|
|
3051
|
+
z25.object({
|
|
3052
|
+
type: z25.literal(ActionType.CUSTOM),
|
|
3053
|
+
customActionType: z25.string().describe("Type identifier of the custom action."),
|
|
2847
3054
|
/** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
|
|
2848
|
-
form:
|
|
3055
|
+
form: z25.array(FieldConfig).describe(
|
|
2849
3056
|
"Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
|
|
2850
3057
|
),
|
|
2851
3058
|
auditHistoryLabel: TranslationConfig.describe(
|
|
@@ -2853,7 +3060,7 @@ var CustomActionConfig = ActionConfigBase.extend(
|
|
|
2853
3060
|
)
|
|
2854
3061
|
}).shape
|
|
2855
3062
|
);
|
|
2856
|
-
var ActionConfig =
|
|
3063
|
+
var ActionConfig = z25.discriminatedUnion("type", [
|
|
2857
3064
|
/*
|
|
2858
3065
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2859
3066
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
@@ -2930,6 +3137,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2930
3137
|
id: "UnarchiveActionConfig",
|
|
2931
3138
|
description: "Configuration for unarchiving a record."
|
|
2932
3139
|
}),
|
|
3140
|
+
RevokeRegistrationConfig.meta({
|
|
3141
|
+
id: "RevokeRegistrationActionConfig",
|
|
3142
|
+
description: "Configuration for revoking a registered record."
|
|
3143
|
+
}),
|
|
3144
|
+
ReinstateRegistrationConfig.meta({
|
|
3145
|
+
id: "ReinstateRegistrationActionConfig",
|
|
3146
|
+
description: "Configuration for reinstating a revoked record back to registered."
|
|
3147
|
+
}),
|
|
2933
3148
|
CustomActionConfig.meta({
|
|
2934
3149
|
id: "CustomActionConfig",
|
|
2935
3150
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -2940,89 +3155,225 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2940
3155
|
var actionConfigTypes = new Set(
|
|
2941
3156
|
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
2942
3157
|
);
|
|
2943
|
-
var DeclarationActionConfig =
|
|
3158
|
+
var DeclarationActionConfig = z25.discriminatedUnion("type", [
|
|
2944
3159
|
DeclareConfig,
|
|
2945
3160
|
RegisterConfig
|
|
2946
3161
|
]);
|
|
2947
3162
|
|
|
2948
3163
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
2949
|
-
var
|
|
2950
|
-
var FontFamily =
|
|
2951
|
-
normal:
|
|
2952
|
-
bold:
|
|
2953
|
-
italics:
|
|
2954
|
-
bolditalics:
|
|
2955
|
-
});
|
|
2956
|
-
var CertificateConfig =
|
|
2957
|
-
id:
|
|
2958
|
-
event:
|
|
2959
|
-
isV2Template:
|
|
3164
|
+
var z26 = __toESM(require("zod/v4"));
|
|
3165
|
+
var FontFamily = z26.object({
|
|
3166
|
+
normal: z26.string(),
|
|
3167
|
+
bold: z26.string(),
|
|
3168
|
+
italics: z26.string(),
|
|
3169
|
+
bolditalics: z26.string()
|
|
3170
|
+
});
|
|
3171
|
+
var CertificateConfig = z26.object({
|
|
3172
|
+
id: z26.string(),
|
|
3173
|
+
event: z26.string(),
|
|
3174
|
+
isV2Template: z26.boolean().optional(),
|
|
2960
3175
|
label: TranslationConfig,
|
|
2961
|
-
isDefault:
|
|
2962
|
-
fee:
|
|
2963
|
-
onTime:
|
|
2964
|
-
late:
|
|
2965
|
-
delayed:
|
|
3176
|
+
isDefault: z26.boolean(),
|
|
3177
|
+
fee: z26.object({
|
|
3178
|
+
onTime: z26.number(),
|
|
3179
|
+
late: z26.number(),
|
|
3180
|
+
delayed: z26.number()
|
|
2966
3181
|
}),
|
|
2967
|
-
svgUrl:
|
|
2968
|
-
fonts:
|
|
2969
|
-
conditionals:
|
|
3182
|
+
svgUrl: z26.string(),
|
|
3183
|
+
fonts: z26.record(z26.string(), FontFamily).optional(),
|
|
3184
|
+
conditionals: z26.array(ShowConditional).optional()
|
|
2970
3185
|
});
|
|
2971
3186
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
2972
|
-
hash:
|
|
2973
|
-
svg:
|
|
3187
|
+
hash: z26.string().optional(),
|
|
3188
|
+
svg: z26.string()
|
|
2974
3189
|
});
|
|
2975
3190
|
|
|
2976
3191
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
2977
|
-
var
|
|
2978
|
-
var LanguageConfig =
|
|
2979
|
-
lang:
|
|
3192
|
+
var z27 = __toESM(require("zod/v4"));
|
|
3193
|
+
var LanguageConfig = z27.object({
|
|
3194
|
+
lang: z27.string(),
|
|
2980
3195
|
/**
|
|
2981
3196
|
* client.csv contents
|
|
2982
3197
|
*/
|
|
2983
|
-
messages:
|
|
3198
|
+
messages: z27.record(z27.string(), z27.string())
|
|
2984
3199
|
});
|
|
2985
3200
|
|
|
2986
3201
|
// ../commons/src/events/EventConfig.ts
|
|
2987
|
-
var
|
|
3202
|
+
var z35 = __toESM(require("zod/v4"));
|
|
2988
3203
|
|
|
2989
3204
|
// ../commons/src/events/SummaryConfig.ts
|
|
2990
|
-
var
|
|
2991
|
-
|
|
3205
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3206
|
+
|
|
3207
|
+
// ../commons/src/icons.ts
|
|
3208
|
+
var z28 = __toESM(require("zod/v4"));
|
|
3209
|
+
var AvailableIcons = z28.enum([
|
|
3210
|
+
"Archived",
|
|
3211
|
+
"Assigned",
|
|
3212
|
+
"Briefcase",
|
|
3213
|
+
"Certified",
|
|
3214
|
+
"Close",
|
|
3215
|
+
"Collapse",
|
|
3216
|
+
"Draft",
|
|
3217
|
+
"DuplicateYellow",
|
|
3218
|
+
"Expand",
|
|
3219
|
+
"ExternalValidate",
|
|
3220
|
+
"FilledCheck",
|
|
3221
|
+
"InReview",
|
|
3222
|
+
"Offline",
|
|
3223
|
+
"Registered",
|
|
3224
|
+
"RequiresUpdates",
|
|
3225
|
+
"Sent",
|
|
3226
|
+
"Validated",
|
|
3227
|
+
"WaitingApproval",
|
|
3228
|
+
"ChartActivity",
|
|
3229
|
+
"Activity",
|
|
3230
|
+
"Archive",
|
|
3231
|
+
"ArchiveTray",
|
|
3232
|
+
"ArrowLeft",
|
|
3233
|
+
"ArrowRight",
|
|
3234
|
+
"Buildings",
|
|
3235
|
+
"Circle",
|
|
3236
|
+
"CaretDown",
|
|
3237
|
+
"CaretLeft",
|
|
3238
|
+
"CaretRight",
|
|
3239
|
+
"ChartBar",
|
|
3240
|
+
"ChartLine",
|
|
3241
|
+
"ChatCircle",
|
|
3242
|
+
"CheckSquare",
|
|
3243
|
+
"Compass",
|
|
3244
|
+
"Check",
|
|
3245
|
+
"Copy",
|
|
3246
|
+
"Database",
|
|
3247
|
+
"DotsThreeVertical",
|
|
3248
|
+
"ArrowCounterClockwise",
|
|
3249
|
+
"MagnifyingGlassMinus",
|
|
3250
|
+
"MagnifyingGlassPlus",
|
|
3251
|
+
"Export",
|
|
3252
|
+
"Eye",
|
|
3253
|
+
"EyeSlash",
|
|
3254
|
+
"Envelope",
|
|
3255
|
+
"File",
|
|
3256
|
+
"FileLock",
|
|
3257
|
+
"FileSearch",
|
|
3258
|
+
"FileMinus",
|
|
3259
|
+
"FilePlus",
|
|
3260
|
+
"FileText",
|
|
3261
|
+
"FileX",
|
|
3262
|
+
"Handshake",
|
|
3263
|
+
"Gear",
|
|
3264
|
+
"GitBranch",
|
|
3265
|
+
"IdentificationCard",
|
|
3266
|
+
"List",
|
|
3267
|
+
"ListBullets",
|
|
3268
|
+
"Lock",
|
|
3269
|
+
"MagnifyingGlass",
|
|
3270
|
+
"MapPin",
|
|
3271
|
+
"Medal",
|
|
3272
|
+
"NotePencil",
|
|
3273
|
+
"Paperclip",
|
|
3274
|
+
"PaperPlaneTilt",
|
|
3275
|
+
"Pen",
|
|
3276
|
+
"PenNib",
|
|
3277
|
+
"Pencil",
|
|
3278
|
+
"PencilSimpleLine",
|
|
3279
|
+
"Phone",
|
|
3280
|
+
"Plus",
|
|
3281
|
+
"Printer",
|
|
3282
|
+
"SignOut",
|
|
3283
|
+
"Stamp",
|
|
3284
|
+
"Star",
|
|
3285
|
+
"Target",
|
|
3286
|
+
"TextT",
|
|
3287
|
+
"Trash",
|
|
3288
|
+
"UploadSimple",
|
|
3289
|
+
"User",
|
|
3290
|
+
"UserPlus",
|
|
3291
|
+
"Users",
|
|
3292
|
+
"WarningCircle",
|
|
3293
|
+
"X",
|
|
3294
|
+
"ChatText",
|
|
3295
|
+
"CircleWavyCheck",
|
|
3296
|
+
"CircleWavyQuestion",
|
|
3297
|
+
"ArchiveBox",
|
|
3298
|
+
"ArrowCircleDown",
|
|
3299
|
+
"FileArrowUp",
|
|
3300
|
+
"FileDotted",
|
|
3301
|
+
"Files",
|
|
3302
|
+
"PencilLine",
|
|
3303
|
+
"PencilCircle",
|
|
3304
|
+
"UserCircle",
|
|
3305
|
+
"Clock",
|
|
3306
|
+
"QrCode",
|
|
3307
|
+
"Webcam",
|
|
3308
|
+
"Sun",
|
|
3309
|
+
"DeviceTabletCamera",
|
|
3310
|
+
"Globe",
|
|
3311
|
+
"Fingerprint",
|
|
3312
|
+
"PushPin",
|
|
3313
|
+
"Timer"
|
|
3314
|
+
]);
|
|
3315
|
+
|
|
3316
|
+
// ../commons/src/events/SummaryConfig.ts
|
|
3317
|
+
var InfoBox = z29.object({
|
|
3318
|
+
type: z29.enum(["info", "positive", "warning", "negative"]).describe(
|
|
3319
|
+
"Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
|
|
3320
|
+
),
|
|
3321
|
+
background: z29.enum(["tinted", "white"]).default("tinted").optional().describe(
|
|
3322
|
+
"tinted reads as a recessed empty state; white reads as a standalone card."
|
|
3323
|
+
),
|
|
3324
|
+
icon: AvailableIcons.optional().describe(
|
|
3325
|
+
"Icon displayed inside the icon block. Defaults to FileSearch."
|
|
3326
|
+
),
|
|
3327
|
+
heading: TranslationConfig.describe(
|
|
3328
|
+
"Primary message. Short, sentence-case."
|
|
3329
|
+
),
|
|
3330
|
+
description: TranslationConfig.optional().describe(
|
|
3331
|
+
"Secondary copy displayed below the heading, typically a suggested next step."
|
|
3332
|
+
),
|
|
3333
|
+
conditionals: z29.array(ShowConditional).default([]).optional().describe(
|
|
3334
|
+
"Conditions under which the info box is shown. When omitted, it is always shown."
|
|
3335
|
+
)
|
|
3336
|
+
}).describe(
|
|
3337
|
+
"A compact icon-block + heading + description block displayed above the summary fields in the event overview."
|
|
3338
|
+
);
|
|
3339
|
+
var BaseField2 = z29.object({
|
|
2992
3340
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
2993
3341
|
"Default message displayed when the field value is empty."
|
|
2994
3342
|
),
|
|
2995
|
-
conditionals:
|
|
3343
|
+
conditionals: z29.array(ShowConditional).default([]).optional()
|
|
2996
3344
|
});
|
|
2997
3345
|
var ReferenceField = BaseField2.extend({
|
|
2998
|
-
fieldId:
|
|
3346
|
+
fieldId: z29.string(),
|
|
2999
3347
|
label: TranslationConfig.optional().describe(
|
|
3000
3348
|
"Overrides the default label from the referenced field when provided."
|
|
3001
3349
|
)
|
|
3002
3350
|
}).describe("Field referencing existing event data by field ID.");
|
|
3003
3351
|
var Field = BaseField2.extend({
|
|
3004
|
-
id:
|
|
3352
|
+
id: z29.string().describe("Identifier of the summary field."),
|
|
3005
3353
|
value: TranslationConfig.describe(
|
|
3006
|
-
'Field value template
|
|
3354
|
+
'Field value template supports variables from configuration (e.g. "{informant.phoneNo} {informant.email}") and EventMetadata (e.g. "{event.legalStatuses.REGISTERED.acceptedAt, date, ::dd MMMM yyyy}").'
|
|
3007
3355
|
),
|
|
3008
3356
|
label: TranslationConfig
|
|
3009
3357
|
}).describe("Custom field defined for the summary view.");
|
|
3010
|
-
var SummaryConfig =
|
|
3011
|
-
|
|
3358
|
+
var SummaryConfig = z29.object({
|
|
3359
|
+
banners: z29.array(InfoBox).default([]).optional().describe(
|
|
3360
|
+
"Info boxes displayed above the summary fields in the event overview."
|
|
3361
|
+
),
|
|
3362
|
+
fields: z29.array(z29.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3012
3363
|
}).meta({
|
|
3013
3364
|
id: "SummaryConfig",
|
|
3014
3365
|
description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
|
|
3015
3366
|
});
|
|
3016
3367
|
|
|
3017
3368
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3018
|
-
var
|
|
3019
|
-
var MatchType =
|
|
3020
|
-
var BaseField3 =
|
|
3021
|
-
config:
|
|
3369
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3370
|
+
var MatchType = z30.enum(["fuzzy", "exact", "range", "within"]);
|
|
3371
|
+
var BaseField3 = z30.object({
|
|
3372
|
+
config: z30.object({
|
|
3022
3373
|
type: MatchType.describe(
|
|
3023
3374
|
"Determines the search type of field. How to match value."
|
|
3024
3375
|
),
|
|
3025
|
-
searchFields:
|
|
3376
|
+
searchFields: z30.array(z30.string()).optional().describe(
|
|
3026
3377
|
`
|
|
3027
3378
|
Defines multiple form fields that should be searched when this field has a value.
|
|
3028
3379
|
All specified fields will be combined using OR logic.
|
|
@@ -3032,7 +3383,7 @@ var BaseField3 = z28.object({
|
|
|
3032
3383
|
`
|
|
3033
3384
|
)
|
|
3034
3385
|
}),
|
|
3035
|
-
type:
|
|
3386
|
+
type: z30.nativeEnum(FieldType).optional().describe(
|
|
3036
3387
|
`
|
|
3037
3388
|
Explicitly specify the field type for searchFields.
|
|
3038
3389
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -3046,7 +3397,7 @@ var BaseField3 = z28.object({
|
|
|
3046
3397
|
This is required when searchFields is defined.
|
|
3047
3398
|
`
|
|
3048
3399
|
),
|
|
3049
|
-
options:
|
|
3400
|
+
options: z30.array(SelectOption).optional(),
|
|
3050
3401
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3051
3402
|
`
|
|
3052
3403
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -3067,7 +3418,7 @@ var BaseField3 = z28.object({
|
|
|
3067
3418
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3068
3419
|
`
|
|
3069
3420
|
),
|
|
3070
|
-
conditionals:
|
|
3421
|
+
conditionals: z30.array(FieldConditional).optional().describe(
|
|
3071
3422
|
`
|
|
3072
3423
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3073
3424
|
|
|
@@ -3081,23 +3432,23 @@ var BaseField3 = z28.object({
|
|
|
3081
3432
|
are always rendered in the advanced search form.
|
|
3082
3433
|
`
|
|
3083
3434
|
),
|
|
3084
|
-
validations:
|
|
3435
|
+
validations: z30.array(ValidationConfig).optional().describe(
|
|
3085
3436
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3086
3437
|
),
|
|
3087
3438
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
3088
3439
|
`Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
|
|
3089
3440
|
)
|
|
3090
3441
|
});
|
|
3091
|
-
var SearchQueryParams =
|
|
3092
|
-
eventType:
|
|
3442
|
+
var SearchQueryParams = z30.object({
|
|
3443
|
+
eventType: z30.string().optional().describe(
|
|
3093
3444
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3094
3445
|
)
|
|
3095
3446
|
}).catchall(FieldValue);
|
|
3096
3447
|
var FieldConfigSchema = BaseField3.extend({
|
|
3097
|
-
fieldId:
|
|
3098
|
-
fieldType:
|
|
3448
|
+
fieldId: z30.string(),
|
|
3449
|
+
fieldType: z30.literal("field")
|
|
3099
3450
|
});
|
|
3100
|
-
var EventFieldIdInput =
|
|
3451
|
+
var EventFieldIdInput = z30.enum([
|
|
3101
3452
|
"trackingId",
|
|
3102
3453
|
"status",
|
|
3103
3454
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3106,7 +3457,7 @@ var EventFieldIdInput = z28.enum([
|
|
|
3106
3457
|
"updatedAt"
|
|
3107
3458
|
]);
|
|
3108
3459
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3109
|
-
var EventFieldId =
|
|
3460
|
+
var EventFieldId = z30.enum([
|
|
3110
3461
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3111
3462
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3112
3463
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3116,195 +3467,60 @@ var EventFieldId = z28.enum([
|
|
|
3116
3467
|
]);
|
|
3117
3468
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3118
3469
|
fieldId: EventFieldId,
|
|
3119
|
-
fieldType:
|
|
3470
|
+
fieldType: z30.literal("event")
|
|
3120
3471
|
});
|
|
3121
|
-
var AdvancedSearchField =
|
|
3472
|
+
var AdvancedSearchField = z30.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3122
3473
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3123
3474
|
if (!data.label) {
|
|
3124
3475
|
ctx.addIssue({
|
|
3125
|
-
code:
|
|
3476
|
+
code: z30.ZodIssueCode.custom,
|
|
3126
3477
|
message: "label is required when config.searchFields is defined.",
|
|
3127
3478
|
path: ["label"]
|
|
3128
3479
|
});
|
|
3129
3480
|
}
|
|
3130
3481
|
if (!data.type) {
|
|
3131
3482
|
ctx.addIssue({
|
|
3132
|
-
code:
|
|
3483
|
+
code: z30.ZodIssueCode.custom,
|
|
3133
3484
|
message: "type is required when config.searchFields is defined.",
|
|
3134
3485
|
path: ["type"]
|
|
3135
3486
|
});
|
|
3136
3487
|
}
|
|
3137
3488
|
}
|
|
3138
3489
|
});
|
|
3139
|
-
var AdvancedSearchConfig =
|
|
3490
|
+
var AdvancedSearchConfig = z30.object({
|
|
3140
3491
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3141
|
-
fields:
|
|
3492
|
+
fields: z30.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3142
3493
|
}).meta({
|
|
3143
3494
|
id: "AdvancedSearchConfig",
|
|
3144
3495
|
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3145
3496
|
});
|
|
3146
3497
|
|
|
3147
3498
|
// ../commons/src/events/utils.ts
|
|
3148
|
-
var
|
|
3499
|
+
var import_lodash4 = require("lodash");
|
|
3149
3500
|
|
|
3150
3501
|
// ../commons/src/conditionals/validate.ts
|
|
3151
3502
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3152
3503
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3153
|
-
var
|
|
3154
|
-
var
|
|
3504
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3505
|
+
var import_date_fns2 = require("date-fns");
|
|
3155
3506
|
|
|
3156
3507
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3157
|
-
var
|
|
3508
|
+
var z32 = __toESM(require("zod/v4"));
|
|
3158
3509
|
|
|
3159
3510
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3160
|
-
var
|
|
3511
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3161
3512
|
|
|
3162
|
-
// ../commons/src/
|
|
3163
|
-
var
|
|
3164
|
-
$data: true,
|
|
3165
|
-
allowUnionTypes: true,
|
|
3166
|
-
strict: false
|
|
3167
|
-
// Allow minContains and other newer features
|
|
3168
|
-
});
|
|
3169
|
-
var DataContext = z31.object({
|
|
3170
|
-
rootData: z31.object({
|
|
3171
|
-
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3172
|
-
})
|
|
3173
|
-
});
|
|
3174
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3175
|
-
const pathParts = dataPath.split("/");
|
|
3176
|
-
const levels = parseInt(pathParts[0], 10);
|
|
3177
|
-
const referencePath = pathParts.slice(1);
|
|
3178
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3179
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
3180
|
-
let current = rootData;
|
|
3181
|
-
for (const part of traversedParts) {
|
|
3182
|
-
if (current === null || current === void 0) {
|
|
3183
|
-
return void 0;
|
|
3184
|
-
}
|
|
3185
|
-
current = current[part];
|
|
3186
|
-
}
|
|
3187
|
-
for (const part of referencePath) {
|
|
3188
|
-
if (current === null || current === void 0) {
|
|
3189
|
-
return void 0;
|
|
3190
|
-
}
|
|
3191
|
-
current = current[part];
|
|
3192
|
-
}
|
|
3193
|
-
return current;
|
|
3194
|
-
}
|
|
3195
|
-
function todayISO() {
|
|
3196
|
-
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3197
|
-
}
|
|
3198
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3199
|
-
function compileClientFunction(code) {
|
|
3200
|
-
let fn = compiledFunctionCache.get(code);
|
|
3201
|
-
if (!fn) {
|
|
3202
|
-
fn = new Function(`return (${code})`)();
|
|
3203
|
-
compiledFunctionCache.set(code, fn);
|
|
3204
|
-
}
|
|
3205
|
-
return fn;
|
|
3206
|
-
}
|
|
3207
|
-
(0, import_ajv_formats.default)(ajv);
|
|
3208
|
-
function buildClientFunctionContext(input) {
|
|
3209
|
-
return {
|
|
3210
|
-
$form: input.form,
|
|
3211
|
-
$now: todayISO(),
|
|
3212
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3213
|
-
$online: isOnline(),
|
|
3214
|
-
$user: input.validatorContext?.user,
|
|
3215
|
-
$event: input.validatorContext?.event,
|
|
3216
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3217
|
-
user: input.systemVariables?.user,
|
|
3218
|
-
$window: input.systemVariables?.$window,
|
|
3219
|
-
locations: input.locations,
|
|
3220
|
-
adminLevelIds: input.adminLevelIds
|
|
3221
|
-
};
|
|
3222
|
-
}
|
|
3223
|
-
function runClientFunction(code, data, context) {
|
|
3224
|
-
return compileClientFunction(code)(data, context);
|
|
3225
|
-
}
|
|
3226
|
-
ajv.addKeyword({
|
|
3227
|
-
keyword: "daysFromDate",
|
|
3228
|
-
type: "string",
|
|
3229
|
-
schemaType: "object",
|
|
3230
|
-
$data: true,
|
|
3231
|
-
errors: true,
|
|
3232
|
-
validate(schema, data, _2, dataContext) {
|
|
3233
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3234
|
-
throw new Error("Validation context must contain $now");
|
|
3235
|
-
}
|
|
3236
|
-
const { days, clause } = schema;
|
|
3237
|
-
if (typeof data !== "string") {
|
|
3238
|
-
return false;
|
|
3239
|
-
}
|
|
3240
|
-
const date = new Date(data);
|
|
3241
|
-
if (isNaN(date.getTime())) {
|
|
3242
|
-
return false;
|
|
3243
|
-
}
|
|
3244
|
-
let referenceDate = schema.referenceDate;
|
|
3245
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3246
|
-
referenceDate = resolveDataPath(
|
|
3247
|
-
dataContext.rootData,
|
|
3248
|
-
referenceDate.$data,
|
|
3249
|
-
dataContext.instancePath
|
|
3250
|
-
);
|
|
3251
|
-
}
|
|
3252
|
-
if (!referenceDate) {
|
|
3253
|
-
referenceDate = dataContext.rootData.$now;
|
|
3254
|
-
}
|
|
3255
|
-
const baseDate = new Date(referenceDate);
|
|
3256
|
-
if (isNaN(baseDate.getTime())) {
|
|
3257
|
-
return false;
|
|
3258
|
-
}
|
|
3259
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3260
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3261
|
-
}
|
|
3262
|
-
});
|
|
3263
|
-
ajv.addKeyword({
|
|
3264
|
-
keyword: "isLeafLevelLocation",
|
|
3265
|
-
type: "string",
|
|
3266
|
-
schemaType: "boolean",
|
|
3267
|
-
$data: true,
|
|
3268
|
-
errors: true,
|
|
3269
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3270
|
-
validate(_schema, data, _2, dataContext) {
|
|
3271
|
-
const locationIdInput = data;
|
|
3272
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3273
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
3274
|
-
}
|
|
3275
|
-
});
|
|
3276
|
-
ajv.addKeyword({
|
|
3277
|
-
keyword: "customClientValidator",
|
|
3278
|
-
schemaType: "object",
|
|
3279
|
-
errors: true,
|
|
3280
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3281
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3282
|
-
// so the cast holds.
|
|
3283
|
-
validate(schema, data, _2, dataContext) {
|
|
3284
|
-
return Boolean(
|
|
3285
|
-
runClientFunction(
|
|
3286
|
-
schema.code,
|
|
3287
|
-
data,
|
|
3288
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3289
|
-
)
|
|
3290
|
-
);
|
|
3291
|
-
}
|
|
3292
|
-
});
|
|
3293
|
-
function isOnline() {
|
|
3294
|
-
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3295
|
-
return navigator.onLine;
|
|
3296
|
-
}
|
|
3297
|
-
return true;
|
|
3298
|
-
}
|
|
3513
|
+
// ../commons/src/events/state/index.ts
|
|
3514
|
+
var import_lodash3 = require("lodash");
|
|
3299
3515
|
|
|
3300
3516
|
// ../commons/src/utils.ts
|
|
3301
|
-
var
|
|
3517
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3302
3518
|
var _ = __toESM(require("lodash"));
|
|
3303
|
-
var FullNameV1 =
|
|
3304
|
-
|
|
3305
|
-
use:
|
|
3306
|
-
family:
|
|
3307
|
-
given:
|
|
3519
|
+
var FullNameV1 = z33.array(
|
|
3520
|
+
z33.object({
|
|
3521
|
+
use: z33.string(),
|
|
3522
|
+
family: z33.string(),
|
|
3523
|
+
given: z33.array(z33.string())
|
|
3308
3524
|
})
|
|
3309
3525
|
);
|
|
3310
3526
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -3323,35 +3539,66 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3323
3539
|
return newObj;
|
|
3324
3540
|
}
|
|
3325
3541
|
|
|
3326
|
-
// ../commons/src/events/utils.ts
|
|
3327
|
-
var
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3542
|
+
// ../commons/src/events/state/utils.ts
|
|
3543
|
+
var import_lodash = require("lodash");
|
|
3544
|
+
var updateActions = new Set(
|
|
3545
|
+
ActionTypes.extract([
|
|
3546
|
+
ActionType.CREATE,
|
|
3547
|
+
ActionType.NOTIFY,
|
|
3548
|
+
ActionType.EDIT,
|
|
3549
|
+
ActionType.DECLARE,
|
|
3550
|
+
ActionType.REGISTER,
|
|
3551
|
+
ActionType.REJECT,
|
|
3552
|
+
ActionType.ARCHIVE,
|
|
3553
|
+
ActionType.UNARCHIVE,
|
|
3554
|
+
ActionType.PRINT_CERTIFICATE,
|
|
3555
|
+
ActionType.REQUEST_CORRECTION,
|
|
3556
|
+
ActionType.APPROVE_CORRECTION,
|
|
3557
|
+
ActionType.REJECT_CORRECTION,
|
|
3558
|
+
ActionType.REVOKE_REGISTRATION,
|
|
3559
|
+
ActionType.REINSTATE_REGISTRATION,
|
|
3560
|
+
ActionType.CUSTOM
|
|
3561
|
+
]).options
|
|
3562
|
+
);
|
|
3563
|
+
|
|
3564
|
+
// ../commons/src/events/state/flags.ts
|
|
3565
|
+
var import_lodash2 = require("lodash");
|
|
3566
|
+
var import_date_fns = require("date-fns");
|
|
3567
|
+
var INHERENT_FLAG_RULES = [
|
|
3568
|
+
{
|
|
3569
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
3570
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
3571
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
3572
|
+
},
|
|
3573
|
+
{
|
|
3574
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
3575
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
3576
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
3577
|
+
// round trip and comes back exactly as it was.
|
|
3578
|
+
flag: InherentFlags.INCOMPLETE,
|
|
3579
|
+
setOn: [ActionType.NOTIFY],
|
|
3580
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
3581
|
+
},
|
|
3582
|
+
{
|
|
3583
|
+
flag: InherentFlags.REJECTED,
|
|
3584
|
+
setOn: [ActionType.REJECT],
|
|
3585
|
+
resetOn: [
|
|
3586
|
+
ActionType.NOTIFY,
|
|
3587
|
+
ActionType.DECLARE,
|
|
3588
|
+
ActionType.EDIT,
|
|
3589
|
+
ActionType.REGISTER
|
|
3590
|
+
]
|
|
3591
|
+
},
|
|
3592
|
+
{
|
|
3593
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3594
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3595
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3599
|
+
setOn: [ActionType.EDIT],
|
|
3600
|
+
resetOnAnyOtherAction: true
|
|
3337
3601
|
}
|
|
3338
|
-
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
3339
|
-
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
3340
|
-
return [...reviewFields, ...formFields];
|
|
3341
|
-
};
|
|
3342
|
-
function getAllAnnotationFields(config) {
|
|
3343
|
-
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
3344
|
-
}
|
|
3345
|
-
var findAllFields = (config) => {
|
|
3346
|
-
return (0, import_lodash.flattenDeep)([
|
|
3347
|
-
...getDeclarationFields(config),
|
|
3348
|
-
...getAllAnnotationFields(config)
|
|
3349
|
-
]);
|
|
3350
|
-
};
|
|
3351
|
-
var EXCLUDED_ACTIONS = [
|
|
3352
|
-
ActionType.REQUEST_CORRECTION,
|
|
3353
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3354
|
-
ActionType.REJECT_CORRECTION
|
|
3355
3602
|
];
|
|
3356
3603
|
|
|
3357
3604
|
// ../commons/src/conditionals/conditionals.ts
|
|
@@ -3560,6 +3807,33 @@ function defineComparison(field3, value, keyword) {
|
|
|
3560
3807
|
required: [field3.$$field]
|
|
3561
3808
|
});
|
|
3562
3809
|
}
|
|
3810
|
+
function flag(flagvalue) {
|
|
3811
|
+
return defineConditional({
|
|
3812
|
+
type: "object",
|
|
3813
|
+
properties: {
|
|
3814
|
+
$flags: {
|
|
3815
|
+
type: "array",
|
|
3816
|
+
contains: {
|
|
3817
|
+
type: "string",
|
|
3818
|
+
const: flagvalue
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
},
|
|
3822
|
+
required: ["$flags"]
|
|
3823
|
+
});
|
|
3824
|
+
}
|
|
3825
|
+
function status(statusValue) {
|
|
3826
|
+
return defineConditional({
|
|
3827
|
+
type: "object",
|
|
3828
|
+
properties: {
|
|
3829
|
+
$status: {
|
|
3830
|
+
type: "string",
|
|
3831
|
+
const: statusValue
|
|
3832
|
+
}
|
|
3833
|
+
},
|
|
3834
|
+
required: ["$status"]
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3563
3837
|
function createFieldConditionals(fieldId) {
|
|
3564
3838
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3565
3839
|
type: "object",
|
|
@@ -3961,6 +4235,190 @@ function createFieldConditionals(fieldId) {
|
|
|
3961
4235
|
};
|
|
3962
4236
|
}
|
|
3963
4237
|
|
|
4238
|
+
// ../commons/src/conditionals/validate.ts
|
|
4239
|
+
var ajv = new import__.default({
|
|
4240
|
+
$data: true,
|
|
4241
|
+
allowUnionTypes: true,
|
|
4242
|
+
strict: false
|
|
4243
|
+
// Allow minContains and other newer features
|
|
4244
|
+
});
|
|
4245
|
+
var DataContext = z34.object({
|
|
4246
|
+
rootData: z34.object({
|
|
4247
|
+
$leafAdminStructureLocationIds: z34.array(z34.object({ id: UUID }))
|
|
4248
|
+
})
|
|
4249
|
+
});
|
|
4250
|
+
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
4251
|
+
const pathParts = dataPath.split("/");
|
|
4252
|
+
const levels = parseInt(pathParts[0], 10);
|
|
4253
|
+
const referencePath = pathParts.slice(1);
|
|
4254
|
+
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
4255
|
+
const traversedParts = instanceParts.slice(0, -levels);
|
|
4256
|
+
let current = rootData;
|
|
4257
|
+
for (const part of traversedParts) {
|
|
4258
|
+
if (current === null || current === void 0) {
|
|
4259
|
+
return void 0;
|
|
4260
|
+
}
|
|
4261
|
+
current = current[part];
|
|
4262
|
+
}
|
|
4263
|
+
for (const part of referencePath) {
|
|
4264
|
+
if (current === null || current === void 0) {
|
|
4265
|
+
return void 0;
|
|
4266
|
+
}
|
|
4267
|
+
current = current[part];
|
|
4268
|
+
}
|
|
4269
|
+
return current;
|
|
4270
|
+
}
|
|
4271
|
+
function todayISO() {
|
|
4272
|
+
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4273
|
+
}
|
|
4274
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4275
|
+
function compileClientFunction(code) {
|
|
4276
|
+
let fn = compiledFunctionCache.get(code);
|
|
4277
|
+
if (!fn) {
|
|
4278
|
+
fn = new Function(`return (${code})`)();
|
|
4279
|
+
compiledFunctionCache.set(code, fn);
|
|
4280
|
+
}
|
|
4281
|
+
return fn;
|
|
4282
|
+
}
|
|
4283
|
+
(0, import_ajv_formats.default)(ajv);
|
|
4284
|
+
function buildClientFunctionContext(input) {
|
|
4285
|
+
return {
|
|
4286
|
+
$form: input.form,
|
|
4287
|
+
$flags: input.validatorContext?.event?.state.flags ?? [],
|
|
4288
|
+
$now: todayISO(),
|
|
4289
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4290
|
+
$online: isOnline(),
|
|
4291
|
+
$user: input.validatorContext?.user,
|
|
4292
|
+
$event: input.validatorContext?.event?.document,
|
|
4293
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4294
|
+
user: input.systemVariables?.user,
|
|
4295
|
+
$window: input.systemVariables?.$window,
|
|
4296
|
+
locations: input.locations,
|
|
4297
|
+
adminLevelIds: input.adminLevelIds
|
|
4298
|
+
};
|
|
4299
|
+
}
|
|
4300
|
+
function runClientFunction(code, data, context) {
|
|
4301
|
+
return compileClientFunction(code)(data, context);
|
|
4302
|
+
}
|
|
4303
|
+
ajv.addKeyword({
|
|
4304
|
+
keyword: "daysFromDate",
|
|
4305
|
+
type: "string",
|
|
4306
|
+
schemaType: "object",
|
|
4307
|
+
$data: true,
|
|
4308
|
+
errors: true,
|
|
4309
|
+
validate(schema, data, _2, dataContext) {
|
|
4310
|
+
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
4311
|
+
throw new Error("Validation context must contain $now");
|
|
4312
|
+
}
|
|
4313
|
+
const { days, clause } = schema;
|
|
4314
|
+
if (typeof data !== "string") {
|
|
4315
|
+
return false;
|
|
4316
|
+
}
|
|
4317
|
+
const date = new Date(data);
|
|
4318
|
+
if (isNaN(date.getTime())) {
|
|
4319
|
+
return false;
|
|
4320
|
+
}
|
|
4321
|
+
let referenceDate = schema.referenceDate;
|
|
4322
|
+
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4323
|
+
referenceDate = resolveDataPath(
|
|
4324
|
+
dataContext.rootData,
|
|
4325
|
+
referenceDate.$data,
|
|
4326
|
+
dataContext.instancePath
|
|
4327
|
+
);
|
|
4328
|
+
}
|
|
4329
|
+
if (!referenceDate) {
|
|
4330
|
+
referenceDate = dataContext.rootData.$now;
|
|
4331
|
+
}
|
|
4332
|
+
const baseDate = new Date(referenceDate);
|
|
4333
|
+
if (isNaN(baseDate.getTime())) {
|
|
4334
|
+
return false;
|
|
4335
|
+
}
|
|
4336
|
+
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
4337
|
+
return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
|
|
4338
|
+
}
|
|
4339
|
+
});
|
|
4340
|
+
ajv.addKeyword({
|
|
4341
|
+
keyword: "isLeafLevelLocation",
|
|
4342
|
+
type: "string",
|
|
4343
|
+
schemaType: "boolean",
|
|
4344
|
+
$data: true,
|
|
4345
|
+
errors: true,
|
|
4346
|
+
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
4347
|
+
validate(_schema, data, _2, dataContext) {
|
|
4348
|
+
const locationIdInput = data;
|
|
4349
|
+
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
4350
|
+
return locations.some((location) => location.id === locationIdInput);
|
|
4351
|
+
}
|
|
4352
|
+
});
|
|
4353
|
+
ajv.addKeyword({
|
|
4354
|
+
keyword: "customClientValidator",
|
|
4355
|
+
schemaType: "object",
|
|
4356
|
+
errors: true,
|
|
4357
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4358
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4359
|
+
// so the cast holds.
|
|
4360
|
+
validate(schema, data, _2, dataContext) {
|
|
4361
|
+
return Boolean(
|
|
4362
|
+
runClientFunction(
|
|
4363
|
+
schema.code,
|
|
4364
|
+
data,
|
|
4365
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4366
|
+
)
|
|
4367
|
+
);
|
|
4368
|
+
}
|
|
4369
|
+
});
|
|
4370
|
+
function isOnline() {
|
|
4371
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4372
|
+
return navigator.onLine;
|
|
4373
|
+
}
|
|
4374
|
+
return true;
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
// ../commons/src/events/utils.ts
|
|
4378
|
+
var import_date_fns3 = require("date-fns");
|
|
4379
|
+
function getDeclaration(configuration) {
|
|
4380
|
+
const declareAction = configuration.actions.find(
|
|
4381
|
+
(action) => action.type === ActionType.DECLARE
|
|
4382
|
+
);
|
|
4383
|
+
if (!declareAction) {
|
|
4384
|
+
throw new Error(
|
|
4385
|
+
`Event '${configuration.id}' has no ${ActionType.DECLARE} action to read the declaration from`
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4388
|
+
return declareAction.declaration;
|
|
4389
|
+
}
|
|
4390
|
+
function getDeclarationPages(configuration) {
|
|
4391
|
+
return getDeclaration(configuration).pages;
|
|
4392
|
+
}
|
|
4393
|
+
function getDeclarationFields(configuration) {
|
|
4394
|
+
return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
|
|
4395
|
+
}
|
|
4396
|
+
var getActionAnnotationFields = (actionConfig) => {
|
|
4397
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4398
|
+
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
4399
|
+
}
|
|
4400
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4401
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4402
|
+
}
|
|
4403
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4404
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4405
|
+
return [...reviewFields, ...formFields];
|
|
4406
|
+
};
|
|
4407
|
+
function getAllAnnotationFields(config) {
|
|
4408
|
+
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4409
|
+
}
|
|
4410
|
+
var findAllFields = (config) => {
|
|
4411
|
+
return (0, import_lodash4.flattenDeep)([
|
|
4412
|
+
...getDeclarationFields(config),
|
|
4413
|
+
...getAllAnnotationFields(config)
|
|
4414
|
+
]);
|
|
4415
|
+
};
|
|
4416
|
+
var EXCLUDED_ACTIONS = [
|
|
4417
|
+
ActionType.REQUEST_CORRECTION,
|
|
4418
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4419
|
+
ActionType.REJECT_CORRECTION
|
|
4420
|
+
];
|
|
4421
|
+
|
|
3964
4422
|
// ../commons/src/events/eventConfigValidation.ts
|
|
3965
4423
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
3966
4424
|
const allFields = findAllFields(event2);
|
|
@@ -4043,9 +4501,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
4043
4501
|
}
|
|
4044
4502
|
function validateActionFlags(event2, ctx) {
|
|
4045
4503
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4046
|
-
const configuredFlagIds = event2.flags.map((
|
|
4504
|
+
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4047
4505
|
const actionFlagIds = event2.actions.flatMap(
|
|
4048
|
-
(action) => (action.flags ?? []).map((
|
|
4506
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
4049
4507
|
);
|
|
4050
4508
|
for (const actionFlagId of actionFlagIds) {
|
|
4051
4509
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4079,13 +4537,50 @@ function validateActionOrder(event2, ctx) {
|
|
|
4079
4537
|
}
|
|
4080
4538
|
}
|
|
4081
4539
|
}
|
|
4540
|
+
function validateExactlyOneDeclareAction(event2, ctx) {
|
|
4541
|
+
const declareActionCount = event2.actions.filter(
|
|
4542
|
+
(action) => action.type === ActionType.DECLARE
|
|
4543
|
+
).length;
|
|
4544
|
+
if (declareActionCount !== 1) {
|
|
4545
|
+
ctx.addIssue({
|
|
4546
|
+
code: "custom",
|
|
4547
|
+
message: `Event must have exactly one ${ActionType.DECLARE} action. Found ${declareActionCount} for event ${event2.id}`,
|
|
4548
|
+
path: ["actions"]
|
|
4549
|
+
});
|
|
4550
|
+
return false;
|
|
4551
|
+
}
|
|
4552
|
+
return true;
|
|
4553
|
+
}
|
|
4554
|
+
function validateDeclarationGivenExactlyOnce(config, ctx) {
|
|
4555
|
+
const declareActionIndex = config.actions.findIndex(
|
|
4556
|
+
(action) => action.type === ActionType.DECLARE
|
|
4557
|
+
);
|
|
4558
|
+
const declareAction = config.actions[declareActionIndex];
|
|
4559
|
+
const onDeclareAction = declareAction.type === ActionType.DECLARE && !!declareAction.declaration;
|
|
4560
|
+
const onTopLevel = !!config.declaration;
|
|
4561
|
+
const declareActionPath = `actions[${declareActionIndex}].declaration`;
|
|
4562
|
+
if (onTopLevel && onDeclareAction) {
|
|
4563
|
+
ctx.addIssue({
|
|
4564
|
+
code: "custom",
|
|
4565
|
+
message: `Event '${config.id}' defines \`declaration\` both at the top level and on the ${ActionType.DECLARE} action (\`${declareActionPath}\`). Define it in only one of these places.`,
|
|
4566
|
+
path: ["declaration"]
|
|
4567
|
+
});
|
|
4568
|
+
}
|
|
4569
|
+
if (!onTopLevel && !onDeclareAction) {
|
|
4570
|
+
ctx.addIssue({
|
|
4571
|
+
code: "custom",
|
|
4572
|
+
message: `Event '${config.id}' does not define \`declaration\`. Define it either at the top level or on the ${ActionType.DECLARE} action (\`${declareActionPath}\`).`,
|
|
4573
|
+
path: ["declaration"]
|
|
4574
|
+
});
|
|
4575
|
+
}
|
|
4576
|
+
}
|
|
4082
4577
|
|
|
4083
4578
|
// ../commons/src/events/EventConfig.ts
|
|
4084
|
-
var EventFieldReference =
|
|
4579
|
+
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4085
4580
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4086
4581
|
);
|
|
4087
|
-
var _EventConfigBase =
|
|
4088
|
-
id:
|
|
4582
|
+
var _EventConfigBase = z35.object({
|
|
4583
|
+
id: z35.string().describe(
|
|
4089
4584
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4090
4585
|
),
|
|
4091
4586
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4103,27 +4598,32 @@ var _EventConfigBase = z33.object({
|
|
|
4103
4598
|
summary: SummaryConfig.describe(
|
|
4104
4599
|
"Summary information displayed in the event overview."
|
|
4105
4600
|
),
|
|
4106
|
-
label: TranslationConfig.describe(
|
|
4107
|
-
|
|
4601
|
+
label: TranslationConfig.describe(
|
|
4602
|
+
"Human-readable label for the event type."
|
|
4603
|
+
),
|
|
4604
|
+
actions: z35.array(ActionConfig).describe(
|
|
4108
4605
|
"Configuration of core and custom actions associated with the event."
|
|
4109
4606
|
),
|
|
4110
|
-
actionOrder:
|
|
4607
|
+
actionOrder: z35.array(z35.string()).optional().describe(
|
|
4111
4608
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4112
4609
|
),
|
|
4113
|
-
|
|
4114
|
-
"Configuration of the form used to gather event data."
|
|
4115
|
-
),
|
|
4116
|
-
advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4610
|
+
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4117
4611
|
"Configuration of fields available in the advanced search feature."
|
|
4118
4612
|
),
|
|
4119
|
-
flags:
|
|
4613
|
+
flags: z35.array(FlagConfig).optional().default([]).describe(
|
|
4120
4614
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4121
4615
|
),
|
|
4122
|
-
analytics:
|
|
4616
|
+
analytics: z35.boolean().optional().default(true).describe(
|
|
4123
4617
|
"Indicates whether the records of this event type are included in analytics"
|
|
4618
|
+
),
|
|
4619
|
+
icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
4620
|
+
'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
|
|
4124
4621
|
)
|
|
4125
4622
|
});
|
|
4126
4623
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
4624
|
+
if (!validateExactlyOneDeclareAction(event2, ctx)) {
|
|
4625
|
+
return;
|
|
4626
|
+
}
|
|
4127
4627
|
validateAdvancedSearchConfig(event2, ctx);
|
|
4128
4628
|
validateDateOfEvent(event2, ctx);
|
|
4129
4629
|
validatePlaceOfEvent(event2, ctx);
|
|
@@ -4140,7 +4640,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
|
4140
4640
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
4141
4641
|
|
|
4142
4642
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4143
|
-
var
|
|
4643
|
+
var z38 = __toESM(require("zod/v4"));
|
|
4144
4644
|
|
|
4145
4645
|
// ../commons/src/searchConfigs.ts
|
|
4146
4646
|
function createSearchConfig(baseField) {
|
|
@@ -4337,21 +4837,31 @@ var event = Object.assign(eventFn, {
|
|
|
4337
4837
|
return {
|
|
4338
4838
|
$event: field3
|
|
4339
4839
|
};
|
|
4340
|
-
}
|
|
4840
|
+
},
|
|
4841
|
+
/**
|
|
4842
|
+
* Checks if the event currently has the given status.
|
|
4843
|
+
* @param eventStatus - The status to check for.
|
|
4844
|
+
*/
|
|
4845
|
+
hasStatus: (eventStatus) => status(eventStatus),
|
|
4846
|
+
/**
|
|
4847
|
+
* Checks if the event currently carries the given flag.
|
|
4848
|
+
* @param flagValue - The flag to check for.
|
|
4849
|
+
*/
|
|
4850
|
+
hasFlag: (flagValue) => flag(flagValue)
|
|
4341
4851
|
});
|
|
4342
4852
|
|
|
4343
4853
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4344
|
-
var
|
|
4854
|
+
var z36 = __toESM(require("zod/v4"));
|
|
4345
4855
|
var WorkqueueColumnKeysArray = [
|
|
4346
4856
|
...EventMetadataKeysArray,
|
|
4347
4857
|
"title",
|
|
4348
4858
|
"outbox"
|
|
4349
4859
|
];
|
|
4350
|
-
var WorkqueueColumnKeys =
|
|
4351
|
-
var WorkqueueColumnValue =
|
|
4860
|
+
var WorkqueueColumnKeys = z36.enum(WorkqueueColumnKeysArray);
|
|
4861
|
+
var WorkqueueColumnValue = z36.object({
|
|
4352
4862
|
$event: WorkqueueColumnKeys
|
|
4353
4863
|
});
|
|
4354
|
-
var WorkqueueColumn =
|
|
4864
|
+
var WorkqueueColumn = z36.object({
|
|
4355
4865
|
label: TranslationConfig,
|
|
4356
4866
|
value: WorkqueueColumnValue
|
|
4357
4867
|
}).meta({
|
|
@@ -4365,164 +4875,57 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4365
4875
|
}
|
|
4366
4876
|
|
|
4367
4877
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4368
|
-
var
|
|
4369
|
-
var SerializableExact =
|
|
4370
|
-
type:
|
|
4371
|
-
term:
|
|
4372
|
-
});
|
|
4373
|
-
var SerializableWithin =
|
|
4374
|
-
type:
|
|
4375
|
-
location:
|
|
4376
|
-
});
|
|
4377
|
-
var SerializedQueryExpression =
|
|
4378
|
-
eventType:
|
|
4379
|
-
status:
|
|
4380
|
-
createdAt:
|
|
4381
|
-
updatedAt:
|
|
4382
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
4383
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
4384
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4385
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4386
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
4387
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4388
|
-
createdAtLocation:
|
|
4389
|
-
|
|
4878
|
+
var z37 = __toESM(require("zod/v4"));
|
|
4879
|
+
var SerializableExact = z37.object({
|
|
4880
|
+
type: z37.literal("exact"),
|
|
4881
|
+
term: z37.union([z37.string(), SerializedUserField])
|
|
4882
|
+
});
|
|
4883
|
+
var SerializableWithin = z37.object({
|
|
4884
|
+
type: z37.literal("within"),
|
|
4885
|
+
location: z37.union([z37.string(), SerializedUserField])
|
|
4886
|
+
});
|
|
4887
|
+
var SerializedQueryExpression = z37.object({
|
|
4888
|
+
eventType: z37.string(),
|
|
4889
|
+
status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
|
|
4890
|
+
createdAt: z37.optional(DateCondition),
|
|
4891
|
+
updatedAt: z37.optional(DateCondition),
|
|
4892
|
+
"legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4893
|
+
"legalStatuses.DECLARED.createdByRole": z37.optional(AnyOf),
|
|
4894
|
+
"legalStatuses.REGISTERED.createdAt": z37.optional(DateCondition),
|
|
4895
|
+
"legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4896
|
+
"legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
|
|
4897
|
+
"legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
|
|
4898
|
+
"legalStatuses.REVOKED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4899
|
+
createdAtLocation: z37.optional(
|
|
4900
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
4390
4901
|
),
|
|
4391
|
-
updatedAtLocation:
|
|
4392
|
-
|
|
4902
|
+
updatedAtLocation: z37.optional(
|
|
4903
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
4393
4904
|
),
|
|
4394
|
-
updatedByUserRole:
|
|
4395
|
-
assignedTo:
|
|
4396
|
-
createdBy:
|
|
4905
|
+
updatedByUserRole: z37.optional(SerializableExact),
|
|
4906
|
+
assignedTo: z37.optional(SerializableExact),
|
|
4907
|
+
createdBy: z37.optional(SerializableExact),
|
|
4397
4908
|
createdByUserType: ExactUserType,
|
|
4398
|
-
updatedBy:
|
|
4399
|
-
trackingId:
|
|
4400
|
-
flags:
|
|
4909
|
+
updatedBy: z37.optional(SerializableExact),
|
|
4910
|
+
trackingId: z37.optional(Exact),
|
|
4911
|
+
flags: z37.optional(ContainsFlags),
|
|
4401
4912
|
data: QueryInput
|
|
4402
4913
|
}).partial();
|
|
4403
|
-
var Or2 =
|
|
4404
|
-
type:
|
|
4405
|
-
clauses:
|
|
4914
|
+
var Or2 = z37.object({
|
|
4915
|
+
type: z37.literal("or"),
|
|
4916
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
4406
4917
|
});
|
|
4407
|
-
var And2 =
|
|
4408
|
-
type:
|
|
4409
|
-
clauses:
|
|
4918
|
+
var And2 = z37.object({
|
|
4919
|
+
type: z37.literal("and"),
|
|
4920
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
4410
4921
|
});
|
|
4411
|
-
var CountryConfigQueryType =
|
|
4412
|
-
var CountryConfigQueryInputType =
|
|
4922
|
+
var CountryConfigQueryType = z37.discriminatedUnion("type", [And2, Or2]);
|
|
4923
|
+
var CountryConfigQueryInputType = z37.union([
|
|
4413
4924
|
SerializedQueryExpression,
|
|
4414
4925
|
And2,
|
|
4415
4926
|
Or2
|
|
4416
4927
|
]);
|
|
4417
4928
|
|
|
4418
|
-
// ../commons/src/icons.ts
|
|
4419
|
-
var z36 = __toESM(require("zod/v4"));
|
|
4420
|
-
var AvailableIcons = z36.enum([
|
|
4421
|
-
"Archived",
|
|
4422
|
-
"Assigned",
|
|
4423
|
-
"Briefcase",
|
|
4424
|
-
"Certified",
|
|
4425
|
-
"Close",
|
|
4426
|
-
"Collapse",
|
|
4427
|
-
"Draft",
|
|
4428
|
-
"DuplicateYellow",
|
|
4429
|
-
"Expand",
|
|
4430
|
-
"ExternalValidate",
|
|
4431
|
-
"FilledCheck",
|
|
4432
|
-
"InReview",
|
|
4433
|
-
"Offline",
|
|
4434
|
-
"Registered",
|
|
4435
|
-
"RequiresUpdates",
|
|
4436
|
-
"Sent",
|
|
4437
|
-
"Validated",
|
|
4438
|
-
"WaitingApproval",
|
|
4439
|
-
"ChartActivity",
|
|
4440
|
-
"Activity",
|
|
4441
|
-
"Archive",
|
|
4442
|
-
"ArchiveTray",
|
|
4443
|
-
"ArrowLeft",
|
|
4444
|
-
"ArrowRight",
|
|
4445
|
-
"Buildings",
|
|
4446
|
-
"Circle",
|
|
4447
|
-
"CaretDown",
|
|
4448
|
-
"CaretLeft",
|
|
4449
|
-
"CaretRight",
|
|
4450
|
-
"ChartBar",
|
|
4451
|
-
"ChartLine",
|
|
4452
|
-
"ChatCircle",
|
|
4453
|
-
"CheckSquare",
|
|
4454
|
-
"Compass",
|
|
4455
|
-
"Check",
|
|
4456
|
-
"Copy",
|
|
4457
|
-
"Database",
|
|
4458
|
-
"DotsThreeVertical",
|
|
4459
|
-
"ArrowCounterClockwise",
|
|
4460
|
-
"MagnifyingGlassMinus",
|
|
4461
|
-
"MagnifyingGlassPlus",
|
|
4462
|
-
"Export",
|
|
4463
|
-
"Eye",
|
|
4464
|
-
"EyeSlash",
|
|
4465
|
-
"Envelope",
|
|
4466
|
-
"File",
|
|
4467
|
-
"FileSearch",
|
|
4468
|
-
"FileMinus",
|
|
4469
|
-
"FilePlus",
|
|
4470
|
-
"FileText",
|
|
4471
|
-
"FileX",
|
|
4472
|
-
"Handshake",
|
|
4473
|
-
"Gear",
|
|
4474
|
-
"GitBranch",
|
|
4475
|
-
"IdentificationCard",
|
|
4476
|
-
"List",
|
|
4477
|
-
"ListBullets",
|
|
4478
|
-
"Lock",
|
|
4479
|
-
"MagnifyingGlass",
|
|
4480
|
-
"MapPin",
|
|
4481
|
-
"Medal",
|
|
4482
|
-
"NotePencil",
|
|
4483
|
-
"Paperclip",
|
|
4484
|
-
"PaperPlaneTilt",
|
|
4485
|
-
"Pen",
|
|
4486
|
-
"PenNib",
|
|
4487
|
-
"Pencil",
|
|
4488
|
-
"PencilSimpleLine",
|
|
4489
|
-
"Phone",
|
|
4490
|
-
"Plus",
|
|
4491
|
-
"Printer",
|
|
4492
|
-
"SignOut",
|
|
4493
|
-
"Stamp",
|
|
4494
|
-
"Star",
|
|
4495
|
-
"Target",
|
|
4496
|
-
"TextT",
|
|
4497
|
-
"Trash",
|
|
4498
|
-
"UploadSimple",
|
|
4499
|
-
"User",
|
|
4500
|
-
"UserPlus",
|
|
4501
|
-
"Users",
|
|
4502
|
-
"WarningCircle",
|
|
4503
|
-
"X",
|
|
4504
|
-
"ChatText",
|
|
4505
|
-
"CircleWavyCheck",
|
|
4506
|
-
"CircleWavyQuestion",
|
|
4507
|
-
"ArchiveBox",
|
|
4508
|
-
"ArrowCircleDown",
|
|
4509
|
-
"FileArrowUp",
|
|
4510
|
-
"FileDotted",
|
|
4511
|
-
"Files",
|
|
4512
|
-
"PencilLine",
|
|
4513
|
-
"PencilCircle",
|
|
4514
|
-
"UserCircle",
|
|
4515
|
-
"Clock",
|
|
4516
|
-
"QrCode",
|
|
4517
|
-
"Webcam",
|
|
4518
|
-
"Sun",
|
|
4519
|
-
"DeviceTabletCamera",
|
|
4520
|
-
"Globe",
|
|
4521
|
-
"Fingerprint",
|
|
4522
|
-
"PushPin",
|
|
4523
|
-
"Timer"
|
|
4524
|
-
]);
|
|
4525
|
-
|
|
4526
4929
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4527
4930
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
4528
4931
|
{
|
|
@@ -4542,16 +4945,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
4542
4945
|
value: event.field("updatedAt")
|
|
4543
4946
|
}
|
|
4544
4947
|
]);
|
|
4545
|
-
var WorkqueueConfig =
|
|
4546
|
-
slug:
|
|
4948
|
+
var WorkqueueConfig = z38.object({
|
|
4949
|
+
slug: z38.string().describe("Determines the url of the workqueue."),
|
|
4547
4950
|
name: TranslationConfig.describe(
|
|
4548
4951
|
"Title of the workflow (both in navigation and on the page)"
|
|
4549
4952
|
),
|
|
4550
4953
|
query: CountryConfigQueryType,
|
|
4551
|
-
action:
|
|
4954
|
+
action: z38.object({ type: WorkqueueActionType }).optional().describe(
|
|
4552
4955
|
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
4553
4956
|
),
|
|
4554
|
-
columns:
|
|
4957
|
+
columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
|
|
4555
4958
|
icon: AvailableIcons,
|
|
4556
4959
|
emptyMessage: TranslationConfig.optional()
|
|
4557
4960
|
}).describe("Configuration for workqueue.");
|
|
@@ -4565,10 +4968,10 @@ var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
|
4565
4968
|
id: "WorkqueueConfig",
|
|
4566
4969
|
description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
|
|
4567
4970
|
});
|
|
4568
|
-
var WorkqueueCountInput =
|
|
4569
|
-
|
|
4971
|
+
var WorkqueueCountInput = z38.array(
|
|
4972
|
+
z38.object({ slug: z38.string(), query: QueryType })
|
|
4570
4973
|
);
|
|
4571
|
-
var WorkqueueCountOutput =
|
|
4974
|
+
var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
|
|
4572
4975
|
|
|
4573
4976
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
4574
4977
|
var defaultWorkqueueColumns = [
|
|
@@ -4591,21 +4994,21 @@ var defaultWorkqueueColumns = [
|
|
|
4591
4994
|
];
|
|
4592
4995
|
|
|
4593
4996
|
// ../commons/src/events/Draft.ts
|
|
4594
|
-
var
|
|
4997
|
+
var z40 = __toESM(require("zod/v4"));
|
|
4595
4998
|
|
|
4596
4999
|
// ../commons/src/events/ActionInput.ts
|
|
4597
|
-
var
|
|
4598
|
-
var BaseActionInput =
|
|
5000
|
+
var z39 = __toESM(require("zod/v4"));
|
|
5001
|
+
var BaseActionInput = z39.object({
|
|
4599
5002
|
eventId: UUID,
|
|
4600
|
-
transactionId:
|
|
5003
|
+
transactionId: z39.string(),
|
|
4601
5004
|
declaration: ActionUpdate.default({}),
|
|
4602
5005
|
annotation: ActionUpdate.optional(),
|
|
4603
5006
|
originalActionId: UUID.optional(),
|
|
4604
5007
|
// should not be part of base action.
|
|
4605
|
-
keepAssignment:
|
|
4606
|
-
keepAssignmentIfAccepted:
|
|
4607
|
-
keepAssignmentIfRejected:
|
|
4608
|
-
waitFor:
|
|
5008
|
+
keepAssignment: z39.boolean().optional(),
|
|
5009
|
+
keepAssignmentIfAccepted: z39.boolean().optional(),
|
|
5010
|
+
keepAssignmentIfRejected: z39.boolean().optional(),
|
|
5011
|
+
waitFor: z39.boolean().default(true).describe(
|
|
4609
5012
|
"Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
|
|
4610
5013
|
),
|
|
4611
5014
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
@@ -4615,8 +5018,8 @@ var BaseActionInput = z38.object({
|
|
|
4615
5018
|
)
|
|
4616
5019
|
});
|
|
4617
5020
|
var CreateActionInput = BaseActionInput.extend(
|
|
4618
|
-
|
|
4619
|
-
type:
|
|
5021
|
+
z39.object({
|
|
5022
|
+
type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
4620
5023
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4621
5024
|
createdAtLocation: UUID.nullish().describe(
|
|
4622
5025
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -4624,14 +5027,14 @@ var CreateActionInput = BaseActionInput.extend(
|
|
|
4624
5027
|
}).shape
|
|
4625
5028
|
);
|
|
4626
5029
|
var RegisterActionInput = BaseActionInput.extend(
|
|
4627
|
-
|
|
4628
|
-
type:
|
|
4629
|
-
registrationNumber:
|
|
5030
|
+
z39.strictObject({
|
|
5031
|
+
type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
5032
|
+
registrationNumber: z39.string().optional()
|
|
4630
5033
|
}).shape
|
|
4631
5034
|
);
|
|
4632
5035
|
var NotifyActionInput = BaseActionInput.extend(
|
|
4633
|
-
|
|
4634
|
-
type:
|
|
5036
|
+
z39.object({
|
|
5037
|
+
type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
4635
5038
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4636
5039
|
createdAtLocation: UUID.nullish().describe(
|
|
4637
5040
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -4647,103 +5050,117 @@ var NotifyActionInput = BaseActionInput.extend(
|
|
|
4647
5050
|
}
|
|
4648
5051
|
});
|
|
4649
5052
|
var DeclareActionInput = BaseActionInput.extend(
|
|
4650
|
-
|
|
4651
|
-
type:
|
|
5053
|
+
z39.object({
|
|
5054
|
+
type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
4652
5055
|
}).shape
|
|
4653
5056
|
);
|
|
4654
5057
|
var EditActionInput = BaseActionInput.extend(
|
|
4655
|
-
|
|
4656
|
-
type:
|
|
5058
|
+
z39.object({
|
|
5059
|
+
type: z39.literal(ActionType.EDIT).default(ActionType.EDIT)
|
|
4657
5060
|
}).shape
|
|
4658
5061
|
);
|
|
4659
5062
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
4660
|
-
|
|
4661
|
-
type:
|
|
5063
|
+
z39.object({
|
|
5064
|
+
type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
4662
5065
|
content: PrintContent.optional()
|
|
4663
5066
|
}).shape
|
|
4664
5067
|
);
|
|
4665
5068
|
var RejectDeclarationActionInput = BaseActionInput.extend(
|
|
4666
|
-
|
|
4667
|
-
type:
|
|
5069
|
+
z39.object({
|
|
5070
|
+
type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
4668
5071
|
content: ReasonContent
|
|
4669
5072
|
}).shape
|
|
4670
5073
|
);
|
|
4671
5074
|
var DuplicateDetectedActionInput = BaseActionInput.extend(
|
|
4672
|
-
|
|
4673
|
-
type:
|
|
4674
|
-
content:
|
|
4675
|
-
duplicates:
|
|
5075
|
+
z39.object({
|
|
5076
|
+
type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
5077
|
+
content: z39.object({
|
|
5078
|
+
duplicates: z39.array(PotentialDuplicate)
|
|
4676
5079
|
})
|
|
4677
5080
|
}).shape
|
|
4678
5081
|
);
|
|
4679
5082
|
var MarkAsDuplicateActionInput = BaseActionInput.extend(
|
|
4680
|
-
|
|
4681
|
-
type:
|
|
4682
|
-
content:
|
|
5083
|
+
z39.object({
|
|
5084
|
+
type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
5085
|
+
content: z39.object({
|
|
4683
5086
|
duplicateOf: UUID
|
|
4684
5087
|
}).optional()
|
|
4685
5088
|
}).shape
|
|
4686
5089
|
);
|
|
4687
5090
|
var MarkNotDuplicateActionInput = BaseActionInput.extend(
|
|
4688
|
-
|
|
4689
|
-
type:
|
|
5091
|
+
z39.object({
|
|
5092
|
+
type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
4690
5093
|
}).shape
|
|
4691
5094
|
);
|
|
4692
5095
|
var ArchiveActionInput = BaseActionInput.extend(
|
|
4693
|
-
|
|
4694
|
-
type:
|
|
4695
|
-
|
|
5096
|
+
z39.object({
|
|
5097
|
+
type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
5098
|
+
/**
|
|
5099
|
+
* Archiving does not collect a reason on its own. Only the
|
|
5100
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
5101
|
+
*/
|
|
5102
|
+
content: ReasonContent.optional()
|
|
4696
5103
|
}).shape
|
|
4697
5104
|
);
|
|
4698
5105
|
var UnarchiveActionInput = BaseActionInput.extend(
|
|
4699
|
-
|
|
4700
|
-
type:
|
|
5106
|
+
z39.object({
|
|
5107
|
+
type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
5108
|
+
}).shape
|
|
5109
|
+
);
|
|
5110
|
+
var RevokeRegistrationActionInput = BaseActionInput.extend(
|
|
5111
|
+
z39.object({
|
|
5112
|
+
type: z39.literal(ActionType.REVOKE_REGISTRATION).default(ActionType.REVOKE_REGISTRATION)
|
|
5113
|
+
}).shape
|
|
5114
|
+
);
|
|
5115
|
+
var ReinstateRegistrationActionInput = BaseActionInput.extend(
|
|
5116
|
+
z39.object({
|
|
5117
|
+
type: z39.literal(ActionType.REINSTATE_REGISTRATION).default(ActionType.REINSTATE_REGISTRATION)
|
|
4701
5118
|
}).shape
|
|
4702
5119
|
);
|
|
4703
5120
|
var AssignActionInput = BaseActionInput.extend(
|
|
4704
|
-
|
|
4705
|
-
type:
|
|
4706
|
-
assignedTo:
|
|
5121
|
+
z39.object({
|
|
5122
|
+
type: z39.literal(ActionType.ASSIGN),
|
|
5123
|
+
assignedTo: z39.string()
|
|
4707
5124
|
}).shape
|
|
4708
5125
|
);
|
|
4709
5126
|
var UnassignActionInput = BaseActionInput.extend(
|
|
4710
|
-
|
|
4711
|
-
type:
|
|
4712
|
-
assignedTo:
|
|
5127
|
+
z39.object({
|
|
5128
|
+
type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
5129
|
+
assignedTo: z39.literal(null).default(null)
|
|
4713
5130
|
}).shape
|
|
4714
5131
|
);
|
|
4715
5132
|
var RequestCorrectionActionInput = BaseActionInput.extend(
|
|
4716
|
-
|
|
4717
|
-
type:
|
|
5133
|
+
z39.object({
|
|
5134
|
+
type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
4718
5135
|
}).shape
|
|
4719
5136
|
);
|
|
4720
5137
|
var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
4721
|
-
|
|
4722
|
-
requestId:
|
|
4723
|
-
type:
|
|
5138
|
+
z39.object({
|
|
5139
|
+
requestId: z39.string(),
|
|
5140
|
+
type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
4724
5141
|
content: ReasonContent
|
|
4725
5142
|
}).shape
|
|
4726
5143
|
);
|
|
4727
5144
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
4728
|
-
|
|
4729
|
-
requestId:
|
|
4730
|
-
type:
|
|
4731
|
-
content:
|
|
5145
|
+
z39.object({
|
|
5146
|
+
requestId: z39.string(),
|
|
5147
|
+
type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
5148
|
+
content: z39.object({ immediateCorrection: z39.boolean().optional() }).optional()
|
|
4732
5149
|
}).shape
|
|
4733
5150
|
);
|
|
4734
5151
|
var ReadActionInput = BaseActionInput.extend(
|
|
4735
|
-
|
|
4736
|
-
type:
|
|
5152
|
+
z39.object({
|
|
5153
|
+
type: z39.literal(ActionType.READ).default(ActionType.READ)
|
|
4737
5154
|
}).shape
|
|
4738
5155
|
);
|
|
4739
|
-
var DeleteActionInput =
|
|
5156
|
+
var DeleteActionInput = z39.object({ eventId: UUID });
|
|
4740
5157
|
var CustomActionInput = BaseActionInput.extend(
|
|
4741
|
-
|
|
4742
|
-
type:
|
|
4743
|
-
customActionType:
|
|
5158
|
+
z39.object({
|
|
5159
|
+
type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
|
|
5160
|
+
customActionType: z39.string().describe("Name of the custom action.")
|
|
4744
5161
|
}).shape
|
|
4745
5162
|
);
|
|
4746
|
-
var ActionInput =
|
|
5163
|
+
var ActionInput = z39.discriminatedUnion("type", [
|
|
4747
5164
|
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
4748
5165
|
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
4749
5166
|
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
@@ -4762,6 +5179,12 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
4762
5179
|
}),
|
|
4763
5180
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
4764
5181
|
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
5182
|
+
RevokeRegistrationActionInput.meta({
|
|
5183
|
+
id: "RevokeRegistrationActionInput"
|
|
5184
|
+
}),
|
|
5185
|
+
ReinstateRegistrationActionInput.meta({
|
|
5186
|
+
id: "ReinstateRegistrationActionInput"
|
|
5187
|
+
}),
|
|
4765
5188
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
4766
5189
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
4767
5190
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -4780,11 +5203,11 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
4780
5203
|
});
|
|
4781
5204
|
|
|
4782
5205
|
// ../commons/src/events/Draft.ts
|
|
4783
|
-
var Draft =
|
|
5206
|
+
var Draft = z40.object({
|
|
4784
5207
|
id: UUID,
|
|
4785
5208
|
eventId: UUID,
|
|
4786
|
-
transactionId:
|
|
4787
|
-
createdAt:
|
|
5209
|
+
transactionId: z40.string(),
|
|
5210
|
+
createdAt: z40.string().datetime(),
|
|
4788
5211
|
action: ActionBase.extend({
|
|
4789
5212
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE])
|
|
4790
5213
|
}).omit({ id: true, createdAtLocation: true })
|
|
@@ -4792,8 +5215,15 @@ var Draft = z39.object({
|
|
|
4792
5215
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
4793
5216
|
);
|
|
4794
5217
|
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
4795
|
-
|
|
4796
|
-
|
|
5218
|
+
/*
|
|
5219
|
+
* A draft can name a file that no action references. Such a file stays until
|
|
5220
|
+
* the record is deleted or the record's next action sweeps its prefix.
|
|
5221
|
+
* DECLARE is available only where one of those is still coming: a created
|
|
5222
|
+
* record, which can still be deleted, and a record part way through an edit,
|
|
5223
|
+
* which is about to be declared or registered.
|
|
5224
|
+
*/
|
|
5225
|
+
type: z40.literal(ActionTypes.enum.DECLARE),
|
|
5226
|
+
status: z40.enum([
|
|
4797
5227
|
ActionStatus.Requested,
|
|
4798
5228
|
ActionStatus.Accepted,
|
|
4799
5229
|
ActionStatus.Rejected
|
|
@@ -4801,127 +5231,58 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
4801
5231
|
});
|
|
4802
5232
|
|
|
4803
5233
|
// ../commons/src/events/EventInput.ts
|
|
4804
|
-
var
|
|
4805
|
-
var
|
|
4806
|
-
var EventInput =
|
|
4807
|
-
transactionId:
|
|
4808
|
-
type:
|
|
5234
|
+
var z41 = __toESM(require("zod/v4"));
|
|
5235
|
+
var import_uuid11 = require("uuid");
|
|
5236
|
+
var EventInput = z41.object({
|
|
5237
|
+
transactionId: z41.string(),
|
|
5238
|
+
type: z41.string(),
|
|
4809
5239
|
createdAtLocation: UUID.nullish().describe(
|
|
4810
5240
|
"Location where the event occurred. Required for system users."
|
|
4811
5241
|
)
|
|
4812
|
-
}).meta({ default: { transactionId: (0,
|
|
5242
|
+
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
4813
5243
|
|
|
4814
5244
|
// ../commons/src/events/EventDocument.ts
|
|
4815
|
-
var
|
|
4816
|
-
var EventDocument =
|
|
5245
|
+
var z42 = __toESM(require("zod/v4"));
|
|
5246
|
+
var EventDocument = z42.object({
|
|
4817
5247
|
id: UUID.describe("Unique identifier of the event."),
|
|
4818
|
-
type:
|
|
4819
|
-
createdAt:
|
|
4820
|
-
updatedAt:
|
|
5248
|
+
type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
5249
|
+
createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
5250
|
+
updatedAt: z42.string().datetime().describe(
|
|
4821
5251
|
"Timestamp of the last update, excluding changes from actions."
|
|
4822
5252
|
),
|
|
4823
|
-
actions:
|
|
4824
|
-
trackingId:
|
|
5253
|
+
actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
|
|
5254
|
+
trackingId: z42.string().describe(
|
|
4825
5255
|
"System-generated tracking identifier used to look up the event."
|
|
4826
5256
|
)
|
|
4827
5257
|
}).meta({ id: "EventDocument" });
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
// ../commons/src/events/state/utils.ts
|
|
4833
|
-
var import_lodash2 = require("lodash");
|
|
4834
|
-
var updateActions = ActionTypes.extract([
|
|
4835
|
-
ActionType.CREATE,
|
|
4836
|
-
ActionType.NOTIFY,
|
|
4837
|
-
ActionType.EDIT,
|
|
4838
|
-
ActionType.DECLARE,
|
|
4839
|
-
ActionType.REGISTER,
|
|
4840
|
-
ActionType.REJECT,
|
|
4841
|
-
ActionType.ARCHIVE,
|
|
4842
|
-
ActionType.UNARCHIVE,
|
|
4843
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4844
|
-
ActionType.REQUEST_CORRECTION,
|
|
4845
|
-
ActionType.APPROVE_CORRECTION,
|
|
4846
|
-
ActionType.REJECT_CORRECTION,
|
|
4847
|
-
ActionType.CUSTOM
|
|
4848
|
-
]);
|
|
4849
|
-
|
|
4850
|
-
// ../commons/src/events/state/flags.ts
|
|
4851
|
-
var import_lodash3 = require("lodash");
|
|
4852
|
-
var import_date_fns3 = require("date-fns");
|
|
4853
|
-
var INHERENT_FLAG_RULES = [
|
|
4854
|
-
{
|
|
4855
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4856
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4857
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4858
|
-
},
|
|
4859
|
-
{
|
|
4860
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4861
|
-
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4862
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4863
|
-
// round trip and comes back exactly as it was.
|
|
4864
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4865
|
-
setOn: [ActionType.NOTIFY],
|
|
4866
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4867
|
-
},
|
|
4868
|
-
{
|
|
4869
|
-
flag: InherentFlags.REJECTED,
|
|
4870
|
-
setOn: [ActionType.REJECT],
|
|
4871
|
-
resetOn: [
|
|
4872
|
-
ActionType.NOTIFY,
|
|
4873
|
-
ActionType.DECLARE,
|
|
4874
|
-
ActionType.EDIT,
|
|
4875
|
-
ActionType.REGISTER
|
|
4876
|
-
]
|
|
4877
|
-
},
|
|
4878
|
-
{
|
|
4879
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4880
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4881
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4882
|
-
},
|
|
4883
|
-
{
|
|
4884
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4885
|
-
setOn: [ActionType.EDIT],
|
|
4886
|
-
resetOnAnyOtherAction: true
|
|
4887
|
-
}
|
|
4888
|
-
];
|
|
5258
|
+
var EventDocumentOnlyLastAction = EventDocument.extend({
|
|
5259
|
+
actions: z42.array(Action).max(1).describe("Only the last action associated with the event.")
|
|
5260
|
+
}).brand("EventDocumentOnlyLastAction");
|
|
4889
5261
|
|
|
4890
5262
|
// ../commons/src/events/defineConfig.ts
|
|
4891
|
-
var
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
"event-with-optional-address"
|
|
4898
|
-
];
|
|
4899
|
-
function warnOnConfigurationIssues(config) {
|
|
4900
|
-
const eventId = config.id;
|
|
4901
|
-
if (IGNORED_EVENT_TYPES.includes(eventId)) {
|
|
4902
|
-
return;
|
|
4903
|
-
}
|
|
4904
|
-
const validateDeclarationAction = config.actions.find(
|
|
4905
|
-
(action) => action.type === ActionType.CUSTOM && action.customActionType === "VALIDATE_DECLARATION"
|
|
4906
|
-
);
|
|
4907
|
-
if (!validateDeclarationAction) {
|
|
5263
|
+
var z43 = __toESM(require("zod/v4"));
|
|
5264
|
+
function moveDeclarationToDeclareAction({
|
|
5265
|
+
declaration,
|
|
5266
|
+
...config
|
|
5267
|
+
}) {
|
|
5268
|
+
if (declaration) {
|
|
4908
5269
|
console.warn(
|
|
4909
|
-
`
|
|
4910
|
-
************** WARNING **************
|
|
4911
|
-
A custom action with customActionType 'VALIDATE_DECLARATION' is not defined for event '${eventId}'!
|
|
4912
|
-
For v2.0, we expect this to be defined for all events.
|
|
4913
|
-
|
|
4914
|
-
The deprecated v1.9 'ActionType.VALIDATE' actions are migrated to customActionType 'VALIDATE_DECLARATION' in v2.0.
|
|
4915
|
-
************** WARNING **************
|
|
4916
|
-
`
|
|
5270
|
+
`Event '${config.id}' defines \`declaration\` at the top level, which is deprecated and will be removed in a future release. Define it on the ${ActionType.DECLARE} action instead.`
|
|
4917
5271
|
);
|
|
4918
5272
|
}
|
|
5273
|
+
return {
|
|
5274
|
+
...config,
|
|
5275
|
+
actions: config.actions.map(
|
|
5276
|
+
(action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
|
|
5277
|
+
)
|
|
5278
|
+
};
|
|
4919
5279
|
}
|
|
4920
|
-
var
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
};
|
|
5280
|
+
var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
|
|
5281
|
+
if (validateExactlyOneDeclareAction(config, ctx)) {
|
|
5282
|
+
validateDeclarationGivenExactlyOnce(config, ctx);
|
|
5283
|
+
}
|
|
5284
|
+
}).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
|
|
5285
|
+
var defineConfig = (config) => EventConfigDefinition.parse(config);
|
|
4925
5286
|
|
|
4926
5287
|
// ../commons/src/events/test.utils.ts
|
|
4927
5288
|
var import_lodash5 = require("lodash");
|
|
@@ -5610,6 +5971,21 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
5610
5971
|
description: "Title of the review page"
|
|
5611
5972
|
},
|
|
5612
5973
|
fields: [
|
|
5974
|
+
{
|
|
5975
|
+
id: "annotation.hidden",
|
|
5976
|
+
type: FieldType.TEXT,
|
|
5977
|
+
label: {
|
|
5978
|
+
id: "annotation.hidden.label",
|
|
5979
|
+
defaultMessage: "Show not be visible",
|
|
5980
|
+
description: "Catch for rendering"
|
|
5981
|
+
},
|
|
5982
|
+
conditionals: [
|
|
5983
|
+
{
|
|
5984
|
+
type: ConditionalType.SHOW,
|
|
5985
|
+
conditional: never2()
|
|
5986
|
+
}
|
|
5987
|
+
]
|
|
5988
|
+
},
|
|
5613
5989
|
{
|
|
5614
5990
|
id: "review.comment",
|
|
5615
5991
|
type: FieldType.TEXTAREA,
|
|
@@ -5666,7 +6042,23 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
5666
6042
|
defaultMessage: "Who is applying for the membership?",
|
|
5667
6043
|
description: "This is the title of the section"
|
|
5668
6044
|
},
|
|
6045
|
+
showClearButton: true,
|
|
5669
6046
|
fields: [
|
|
6047
|
+
{
|
|
6048
|
+
id: "declaration.hidden",
|
|
6049
|
+
type: FieldType.TEXT,
|
|
6050
|
+
label: {
|
|
6051
|
+
id: "declaration.hidden.label",
|
|
6052
|
+
defaultMessage: "Show not be visible",
|
|
6053
|
+
description: "Catch for rendering"
|
|
6054
|
+
},
|
|
6055
|
+
conditionals: [
|
|
6056
|
+
{
|
|
6057
|
+
type: ConditionalType.SHOW,
|
|
6058
|
+
conditional: never2()
|
|
6059
|
+
}
|
|
6060
|
+
]
|
|
6061
|
+
},
|
|
5670
6062
|
{
|
|
5671
6063
|
id: "applicant.name",
|
|
5672
6064
|
type: FieldType.NAME,
|
|
@@ -6876,7 +7268,24 @@ var libraryMembershipEvent = defineConfig({
|
|
|
6876
7268
|
id: "event.library-membership.title"
|
|
6877
7269
|
},
|
|
6878
7270
|
summary: { fields: [] },
|
|
6879
|
-
actions: [
|
|
7271
|
+
actions: [
|
|
7272
|
+
{
|
|
7273
|
+
type: ActionType.DECLARE,
|
|
7274
|
+
label: {
|
|
7275
|
+
defaultMessage: "Declare",
|
|
7276
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7277
|
+
id: "event.library-membership.action.declare.label"
|
|
7278
|
+
},
|
|
7279
|
+
review: {
|
|
7280
|
+
title: {
|
|
7281
|
+
defaultMessage: "Library membership application",
|
|
7282
|
+
description: "Title of the review page",
|
|
7283
|
+
id: "event.library-membership.action.declare.form.review.title"
|
|
7284
|
+
},
|
|
7285
|
+
fields: []
|
|
7286
|
+
}
|
|
7287
|
+
}
|
|
7288
|
+
],
|
|
6880
7289
|
declaration: libraryMembershipForm
|
|
6881
7290
|
});
|
|
6882
7291
|
|
|
@@ -7322,6 +7731,22 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7322
7731
|
},
|
|
7323
7732
|
summary: { fields: [] },
|
|
7324
7733
|
actions: [
|
|
7734
|
+
{
|
|
7735
|
+
type: ActionType.DECLARE,
|
|
7736
|
+
label: {
|
|
7737
|
+
defaultMessage: "Declare",
|
|
7738
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7739
|
+
id: "event.digital-identity.action.declare.label"
|
|
7740
|
+
},
|
|
7741
|
+
review: {
|
|
7742
|
+
title: {
|
|
7743
|
+
defaultMessage: "Digital identity issuance",
|
|
7744
|
+
description: "Title of the review page",
|
|
7745
|
+
id: "event.digital-identity.action.declare.form.review.title"
|
|
7746
|
+
},
|
|
7747
|
+
fields: []
|
|
7748
|
+
}
|
|
7749
|
+
},
|
|
7325
7750
|
{
|
|
7326
7751
|
type: ActionType.PRINT_CERTIFICATE,
|
|
7327
7752
|
label: {
|
|
@@ -7335,165 +7760,100 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7335
7760
|
declaration: digitalIdentityForm
|
|
7336
7761
|
});
|
|
7337
7762
|
|
|
7338
|
-
// ../commons/src/events/test.utils.ts
|
|
7339
|
-
var
|
|
7340
|
-
var TestUserRole = z42.enum([
|
|
7341
|
-
"FIELD_AGENT",
|
|
7342
|
-
"LOCAL_REGISTRAR",
|
|
7343
|
-
"LOCAL_SYSTEM_ADMIN",
|
|
7344
|
-
"NATIONAL_REGISTRAR",
|
|
7345
|
-
"REGISTRATION_AGENT",
|
|
7346
|
-
"NATIONAL_SYSTEM_ADMIN",
|
|
7347
|
-
"SOCIAL_WORKER",
|
|
7348
|
-
"COMMUNITY_LEADER",
|
|
7349
|
-
"PROVINCIAL_REGISTRAR"
|
|
7350
|
-
]);
|
|
7351
|
-
|
|
7352
|
-
// ../commons/src/events/scopes.ts
|
|
7353
|
-
var import_lodash6 = require("lodash");
|
|
7763
|
+
// ../commons/src/events/test.utils.ts
|
|
7764
|
+
var z45 = __toESM(require("zod/v4"));
|
|
7354
7765
|
|
|
7355
7766
|
// ../commons/src/events/locations.ts
|
|
7356
|
-
var
|
|
7357
|
-
var LocationTypeV1 =
|
|
7767
|
+
var z44 = __toESM(require("zod/v4"));
|
|
7768
|
+
var LocationTypeV1 = z44.enum([
|
|
7358
7769
|
"ADMIN_STRUCTURE",
|
|
7359
7770
|
"CRVS_OFFICE",
|
|
7360
7771
|
"HEALTH_FACILITY"
|
|
7361
7772
|
]);
|
|
7362
|
-
var LocationStatus =
|
|
7363
|
-
var LocationVersion =
|
|
7773
|
+
var LocationStatus = z44.enum(["active", "inactive"]);
|
|
7774
|
+
var LocationVersion = z44.object({
|
|
7364
7775
|
versionId: UUID,
|
|
7365
|
-
effectiveFrom:
|
|
7366
|
-
name:
|
|
7367
|
-
externalId:
|
|
7776
|
+
effectiveFrom: z44.iso.date(),
|
|
7777
|
+
name: z44.string(),
|
|
7778
|
+
externalId: z44.string().nullish(),
|
|
7368
7779
|
status: LocationStatus
|
|
7369
7780
|
});
|
|
7370
|
-
var AdministrativeArea =
|
|
7781
|
+
var AdministrativeArea = z44.object({
|
|
7371
7782
|
id: UUID,
|
|
7372
|
-
name:
|
|
7373
|
-
externalId:
|
|
7783
|
+
name: z44.string(),
|
|
7784
|
+
externalId: z44.string().nullish(),
|
|
7374
7785
|
parentId: UUID.nullable(),
|
|
7375
7786
|
status: LocationStatus,
|
|
7376
|
-
versions:
|
|
7787
|
+
versions: z44.array(LocationVersion)
|
|
7377
7788
|
});
|
|
7378
|
-
var Location =
|
|
7789
|
+
var Location = z44.object({
|
|
7379
7790
|
id: UUID,
|
|
7380
|
-
name:
|
|
7381
|
-
externalId:
|
|
7791
|
+
name: z44.string(),
|
|
7792
|
+
externalId: z44.string().nullish(),
|
|
7382
7793
|
administrativeAreaId: UUID.nullable(),
|
|
7383
|
-
locationType:
|
|
7794
|
+
locationType: z44.string().nullable(),
|
|
7384
7795
|
status: LocationStatus,
|
|
7385
|
-
versions:
|
|
7796
|
+
versions: z44.array(LocationVersion)
|
|
7797
|
+
});
|
|
7798
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
7799
|
+
name: true,
|
|
7800
|
+
status: true,
|
|
7801
|
+
externalId: true
|
|
7802
|
+
});
|
|
7803
|
+
var ClientLocation = Location.omit({
|
|
7804
|
+
name: true,
|
|
7805
|
+
status: true,
|
|
7806
|
+
externalId: true
|
|
7807
|
+
});
|
|
7808
|
+
function toClientLocation(location) {
|
|
7809
|
+
return {
|
|
7810
|
+
id: location.id,
|
|
7811
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
7812
|
+
locationType: location.locationType,
|
|
7813
|
+
versions: location.versions
|
|
7814
|
+
};
|
|
7815
|
+
}
|
|
7816
|
+
function toClientAdministrativeArea(area) {
|
|
7817
|
+
return {
|
|
7818
|
+
id: area.id,
|
|
7819
|
+
parentId: area.parentId,
|
|
7820
|
+
versions: area.versions
|
|
7821
|
+
};
|
|
7822
|
+
}
|
|
7823
|
+
function validateAscendingDates(versions, ctx) {
|
|
7824
|
+
const ascending = versions.every(
|
|
7825
|
+
(version, index) => index === 0 || versions[index - 1].effectiveFrom < version.effectiveFrom
|
|
7826
|
+
);
|
|
7827
|
+
if (!ascending) {
|
|
7828
|
+
ctx.addIssue("versions must be strictly ascending by effectiveFrom");
|
|
7829
|
+
}
|
|
7830
|
+
}
|
|
7831
|
+
function validateUniqueIds(versions, ctx) {
|
|
7832
|
+
const versionIds = new Set(versions.map((version) => version.versionId));
|
|
7833
|
+
if (versionIds.size !== versions.length) {
|
|
7834
|
+
ctx.addIssue("versions must not repeat a versionId");
|
|
7835
|
+
}
|
|
7836
|
+
}
|
|
7837
|
+
var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
|
|
7838
|
+
validateAscendingDates(versions, ctx);
|
|
7839
|
+
validateUniqueIds(versions, ctx);
|
|
7386
7840
|
});
|
|
7387
|
-
var SetLocationPayload =
|
|
7841
|
+
var SetLocationPayload = z44.object({
|
|
7388
7842
|
id: UUID,
|
|
7389
|
-
name:
|
|
7390
|
-
externalId:
|
|
7843
|
+
name: z44.string(),
|
|
7844
|
+
externalId: z44.string().nullish(),
|
|
7391
7845
|
administrativeAreaId: UUID.nullable(),
|
|
7392
|
-
locationType:
|
|
7846
|
+
locationType: z44.string().nullable(),
|
|
7847
|
+
versions: SeededLocationVersions.optional()
|
|
7393
7848
|
});
|
|
7394
|
-
var SetAdministrativeAreaPayload =
|
|
7849
|
+
var SetAdministrativeAreaPayload = z44.object({
|
|
7395
7850
|
id: UUID,
|
|
7396
|
-
name:
|
|
7397
|
-
externalId:
|
|
7398
|
-
parentId: UUID.nullable()
|
|
7851
|
+
name: z44.string(),
|
|
7852
|
+
externalId: z44.string().nullish(),
|
|
7853
|
+
parentId: UUID.nullable(),
|
|
7854
|
+
versions: SeededLocationVersions.optional()
|
|
7399
7855
|
});
|
|
7400
7856
|
|
|
7401
|
-
// ../commons/src/events/scopes.ts
|
|
7402
|
-
var ACTION_SCOPE_MAP = {
|
|
7403
|
-
[ActionType.READ]: ["record.read"],
|
|
7404
|
-
[ActionType.CREATE]: ["record.create"],
|
|
7405
|
-
[ActionType.NOTIFY]: ["record.notify"],
|
|
7406
|
-
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
7407
|
-
[ActionType.EDIT]: ["record.edit"],
|
|
7408
|
-
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
7409
|
-
[ActionType.REGISTER]: ["record.register"],
|
|
7410
|
-
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
7411
|
-
[ActionType.REQUEST_CORRECTION]: [
|
|
7412
|
-
"record.request-correction",
|
|
7413
|
-
"record.correct"
|
|
7414
|
-
],
|
|
7415
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
7416
|
-
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
7417
|
-
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
7418
|
-
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
7419
|
-
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
7420
|
-
[ActionType.ARCHIVE]: ["record.archive"],
|
|
7421
|
-
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
7422
|
-
[ActionType.REJECT]: ["record.reject"],
|
|
7423
|
-
[ActionType.ASSIGN]: null,
|
|
7424
|
-
[ActionType.UNASSIGN]: null,
|
|
7425
|
-
[ActionType.DUPLICATE_DETECTED]: [],
|
|
7426
|
-
[ActionType.CUSTOM]: []
|
|
7427
|
-
};
|
|
7428
|
-
|
|
7429
|
-
// ../commons/src/events/state/availableActions.ts
|
|
7430
|
-
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7431
|
-
[EventStatus.enum.CREATED]: [
|
|
7432
|
-
ActionType.READ,
|
|
7433
|
-
ActionType.DECLARE,
|
|
7434
|
-
ActionType.NOTIFY,
|
|
7435
|
-
ActionType.DELETE,
|
|
7436
|
-
ActionType.CUSTOM
|
|
7437
|
-
],
|
|
7438
|
-
[EventStatus.enum.NOTIFIED]: [
|
|
7439
|
-
ActionType.READ,
|
|
7440
|
-
ActionType.EDIT,
|
|
7441
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
7442
|
-
ActionType.ARCHIVE,
|
|
7443
|
-
ActionType.REJECT,
|
|
7444
|
-
ActionType.CUSTOM
|
|
7445
|
-
],
|
|
7446
|
-
[EventStatus.enum.DECLARED]: [
|
|
7447
|
-
ActionType.READ,
|
|
7448
|
-
ActionType.REGISTER,
|
|
7449
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
7450
|
-
ActionType.ARCHIVE,
|
|
7451
|
-
ActionType.REJECT,
|
|
7452
|
-
ActionType.CUSTOM,
|
|
7453
|
-
ActionType.EDIT
|
|
7454
|
-
],
|
|
7455
|
-
[EventStatus.enum.REGISTERED]: [
|
|
7456
|
-
ActionType.READ,
|
|
7457
|
-
ActionType.PRINT_CERTIFICATE,
|
|
7458
|
-
ActionType.REQUEST_CORRECTION,
|
|
7459
|
-
ActionType.APPROVE_CORRECTION,
|
|
7460
|
-
ActionType.REJECT_CORRECTION,
|
|
7461
|
-
ActionType.CUSTOM,
|
|
7462
|
-
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
7463
|
-
],
|
|
7464
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
7465
|
-
ActionType.READ,
|
|
7466
|
-
ActionType.CUSTOM,
|
|
7467
|
-
ActionType.UNARCHIVE
|
|
7468
|
-
]
|
|
7469
|
-
};
|
|
7470
|
-
var ACTION_FILTERS = {
|
|
7471
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7472
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7473
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7474
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7475
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7476
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7477
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7478
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7479
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7480
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7481
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7482
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7483
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7484
|
-
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
7485
|
-
};
|
|
7486
|
-
var REJECTED_ACTIONS = [
|
|
7487
|
-
ActionType.READ,
|
|
7488
|
-
ActionType.NOTIFY,
|
|
7489
|
-
ActionType.CUSTOM,
|
|
7490
|
-
ActionType.EDIT,
|
|
7491
|
-
ActionType.ARCHIVE
|
|
7492
|
-
];
|
|
7493
|
-
|
|
7494
|
-
// ../commons/src/events/FileUtils.ts
|
|
7495
|
-
var import_lodash7 = require("lodash");
|
|
7496
|
-
|
|
7497
7857
|
// ../commons/src/events/mocks.test.utils.ts
|
|
7498
7858
|
function withVersionFields(entity) {
|
|
7499
7859
|
return {
|
|
@@ -7826,90 +8186,364 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
7826
8186
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7827
8187
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7828
8188
|
);
|
|
8189
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
8190
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
8191
|
+
);
|
|
8192
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
8193
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
8194
|
+
a.id,
|
|
8195
|
+
toClientAdministrativeArea(a)
|
|
8196
|
+
])
|
|
8197
|
+
);
|
|
8198
|
+
|
|
8199
|
+
// ../commons/src/events/test.utils.ts
|
|
8200
|
+
var TestUserRole = z45.enum([
|
|
8201
|
+
"FIELD_AGENT",
|
|
8202
|
+
"LOCAL_REGISTRAR",
|
|
8203
|
+
"LOCAL_SYSTEM_ADMIN",
|
|
8204
|
+
"NATIONAL_REGISTRAR",
|
|
8205
|
+
"REGISTRATION_AGENT",
|
|
8206
|
+
"NATIONAL_SYSTEM_ADMIN",
|
|
8207
|
+
"SOCIAL_WORKER",
|
|
8208
|
+
"COMMUNITY_LEADER",
|
|
8209
|
+
"PROVINCIAL_REGISTRAR"
|
|
8210
|
+
]);
|
|
8211
|
+
|
|
8212
|
+
// ../commons/src/events/scopes.ts
|
|
8213
|
+
var import_lodash6 = require("lodash");
|
|
8214
|
+
var ACTION_SCOPE_MAP = {
|
|
8215
|
+
[ActionType.READ]: ["record.read"],
|
|
8216
|
+
[ActionType.CREATE]: ["record.create"],
|
|
8217
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
|
8218
|
+
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
8219
|
+
[ActionType.EDIT]: ["record.edit"],
|
|
8220
|
+
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
8221
|
+
[ActionType.REGISTER]: ["record.register"],
|
|
8222
|
+
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
8223
|
+
[ActionType.REQUEST_CORRECTION]: [
|
|
8224
|
+
"record.request-correction",
|
|
8225
|
+
"record.correct"
|
|
8226
|
+
],
|
|
8227
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8228
|
+
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8229
|
+
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8230
|
+
[ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
|
|
8231
|
+
[ActionType.REINSTATE_REGISTRATION]: ["record.reinstate-registration"],
|
|
8232
|
+
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
8233
|
+
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
8234
|
+
[ActionType.ARCHIVE]: ["record.archive"],
|
|
8235
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
8236
|
+
[ActionType.REJECT]: ["record.reject"],
|
|
8237
|
+
[ActionType.ASSIGN]: null,
|
|
8238
|
+
[ActionType.UNASSIGN]: null,
|
|
8239
|
+
[ActionType.DUPLICATE_DETECTED]: [],
|
|
8240
|
+
[ActionType.CUSTOM]: []
|
|
8241
|
+
};
|
|
8242
|
+
var RECORD_WRITE_SCOPES = (0, import_lodash6.uniq)(
|
|
8243
|
+
Object.entries(ACTION_SCOPE_MAP).filter(([action]) => action !== ActionType.READ).flatMap(([, scopes]) => scopes ?? [])
|
|
8244
|
+
);
|
|
8245
|
+
|
|
8246
|
+
// ../commons/src/events/state/availableActions.ts
|
|
8247
|
+
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
8248
|
+
[EventStatus.enum.CREATED]: [
|
|
8249
|
+
ActionType.READ,
|
|
8250
|
+
ActionType.DECLARE,
|
|
8251
|
+
ActionType.NOTIFY,
|
|
8252
|
+
ActionType.DELETE
|
|
8253
|
+
],
|
|
8254
|
+
[EventStatus.enum.NOTIFIED]: [
|
|
8255
|
+
ActionType.READ,
|
|
8256
|
+
ActionType.EDIT,
|
|
8257
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8258
|
+
ActionType.ARCHIVE,
|
|
8259
|
+
ActionType.REJECT,
|
|
8260
|
+
ActionType.CUSTOM
|
|
8261
|
+
],
|
|
8262
|
+
[EventStatus.enum.DECLARED]: [
|
|
8263
|
+
ActionType.READ,
|
|
8264
|
+
ActionType.REGISTER,
|
|
8265
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8266
|
+
ActionType.ARCHIVE,
|
|
8267
|
+
ActionType.REJECT,
|
|
8268
|
+
ActionType.CUSTOM,
|
|
8269
|
+
ActionType.EDIT
|
|
8270
|
+
],
|
|
8271
|
+
[EventStatus.enum.REGISTERED]: [
|
|
8272
|
+
ActionType.READ,
|
|
8273
|
+
ActionType.PRINT_CERTIFICATE,
|
|
8274
|
+
ActionType.REQUEST_CORRECTION,
|
|
8275
|
+
ActionType.APPROVE_CORRECTION,
|
|
8276
|
+
ActionType.REJECT_CORRECTION,
|
|
8277
|
+
ActionType.CUSTOM,
|
|
8278
|
+
ClientSpecificAction.REVIEW_CORRECTION_REQUEST,
|
|
8279
|
+
ActionType.REVOKE_REGISTRATION
|
|
8280
|
+
],
|
|
8281
|
+
[EventStatus.enum.REVOKED]: [
|
|
8282
|
+
ActionType.READ,
|
|
8283
|
+
ActionType.REINSTATE_REGISTRATION
|
|
8284
|
+
],
|
|
8285
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
8286
|
+
ActionType.READ,
|
|
8287
|
+
ActionType.CUSTOM,
|
|
8288
|
+
ActionType.UNARCHIVE
|
|
8289
|
+
]
|
|
8290
|
+
};
|
|
8291
|
+
var ACTION_FILTERS = {
|
|
8292
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8293
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8294
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8295
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8296
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8297
|
+
[ActionType.REVOKE_REGISTRATION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8298
|
+
[ActionType.REINSTATE_REGISTRATION]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8299
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8300
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8301
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8302
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8303
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8304
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8305
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8306
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8307
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
8308
|
+
};
|
|
8309
|
+
var REJECTED_ACTIONS = [
|
|
8310
|
+
ActionType.READ,
|
|
8311
|
+
ActionType.NOTIFY,
|
|
8312
|
+
ActionType.CUSTOM,
|
|
8313
|
+
ActionType.EDIT,
|
|
8314
|
+
ActionType.ARCHIVE
|
|
8315
|
+
];
|
|
8316
|
+
|
|
8317
|
+
// ../commons/src/events/FileUtils.ts
|
|
8318
|
+
var import_lodash7 = require("lodash");
|
|
8319
|
+
|
|
8320
|
+
// ../commons/src/events/locationPayloads.ts
|
|
8321
|
+
var z46 = __toESM(require("zod/v4"));
|
|
8322
|
+
var CreateLocationPayload = z46.object({
|
|
8323
|
+
id: UUID.optional(),
|
|
8324
|
+
versionId: UUID.optional(),
|
|
8325
|
+
name: z46.string(),
|
|
8326
|
+
externalId: z46.string().nullish(),
|
|
8327
|
+
administrativeAreaId: UUID.nullable(),
|
|
8328
|
+
locationType: z46.string().nullable(),
|
|
8329
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8330
|
+
status: LocationStatus.default("active")
|
|
8331
|
+
});
|
|
8332
|
+
var UpdateLocationPayload = z46.strictObject({
|
|
8333
|
+
id: UUID,
|
|
8334
|
+
versionId: UUID.optional(),
|
|
8335
|
+
name: z46.string(),
|
|
8336
|
+
externalId: z46.string().nullish(),
|
|
8337
|
+
status: LocationStatus,
|
|
8338
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8339
|
+
lastVersionId: UUID
|
|
8340
|
+
});
|
|
8341
|
+
var WithdrawLocationVersionPayload = z46.object({
|
|
8342
|
+
id: UUID,
|
|
8343
|
+
versionId: UUID
|
|
8344
|
+
});
|
|
8345
|
+
var CreateAdministrativeAreaPayload = z46.object({
|
|
8346
|
+
id: UUID.optional(),
|
|
8347
|
+
versionId: UUID.optional(),
|
|
8348
|
+
name: z46.string(),
|
|
8349
|
+
externalId: z46.string().nullish(),
|
|
8350
|
+
parentId: UUID.nullable(),
|
|
8351
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8352
|
+
status: LocationStatus.default("active")
|
|
8353
|
+
});
|
|
8354
|
+
var UpdateAdministrativeAreaPayload = z46.strictObject({
|
|
8355
|
+
id: UUID,
|
|
8356
|
+
versionId: UUID.optional(),
|
|
8357
|
+
name: z46.string(),
|
|
8358
|
+
externalId: z46.string().nullish(),
|
|
8359
|
+
status: LocationStatus,
|
|
8360
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8361
|
+
lastVersionId: UUID
|
|
8362
|
+
});
|
|
8363
|
+
var WithdrawAdministrativeAreaVersionPayload = z46.object({
|
|
8364
|
+
id: UUID,
|
|
8365
|
+
versionId: UUID
|
|
8366
|
+
});
|
|
7829
8367
|
|
|
7830
8368
|
// ../commons/src/notification/UserNotifications.ts
|
|
7831
|
-
var
|
|
8369
|
+
var z47 = __toESM(require("zod/v4"));
|
|
7832
8370
|
var TriggerEvent = {
|
|
7833
8371
|
USER_CREATED: "user-created",
|
|
7834
8372
|
USER_UPDATED: "user-updated",
|
|
7835
8373
|
USERNAME_REMINDER: "username-reminder",
|
|
7836
8374
|
RESET_PASSWORD: "reset-password",
|
|
7837
8375
|
RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
|
|
8376
|
+
PASSWORD_RESET_LINK: "password-reset-link",
|
|
8377
|
+
USERNAME_REMINDER_LINK: "username-reminder-link",
|
|
7838
8378
|
RESEND_INVITE: "resend-invite",
|
|
7839
8379
|
TWO_FA: "2fa",
|
|
7840
8380
|
ALL_USER_NOTIFICATION: "all-user-notification",
|
|
7841
8381
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
7842
8382
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
7843
8383
|
};
|
|
7844
|
-
var Recipient =
|
|
8384
|
+
var Recipient = z47.object({
|
|
7845
8385
|
name: NameFieldValue.optional(),
|
|
7846
|
-
mobile:
|
|
7847
|
-
email:
|
|
7848
|
-
bcc:
|
|
8386
|
+
mobile: z47.string().optional(),
|
|
8387
|
+
email: z47.string().optional(),
|
|
8388
|
+
bcc: z47.array(z47.string()).optional()
|
|
7849
8389
|
});
|
|
7850
|
-
var BasePayload =
|
|
8390
|
+
var BasePayload = z47.object({
|
|
7851
8391
|
recipient: Recipient
|
|
7852
8392
|
});
|
|
7853
8393
|
var TriggerPayload = {
|
|
7854
8394
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
7855
|
-
username:
|
|
7856
|
-
temporaryPassword:
|
|
8395
|
+
username: z47.string(),
|
|
8396
|
+
temporaryPassword: z47.string()
|
|
7857
8397
|
}),
|
|
7858
8398
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
7859
|
-
oldUsername:
|
|
7860
|
-
newUsername:
|
|
8399
|
+
oldUsername: z47.string(),
|
|
8400
|
+
newUsername: z47.string()
|
|
7861
8401
|
}),
|
|
7862
8402
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
7863
|
-
username:
|
|
8403
|
+
username: z47.string()
|
|
7864
8404
|
}),
|
|
7865
8405
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
7866
|
-
code:
|
|
8406
|
+
code: z47.string()
|
|
7867
8407
|
}),
|
|
7868
8408
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
7869
|
-
temporaryPassword:
|
|
7870
|
-
admin:
|
|
7871
|
-
id:
|
|
8409
|
+
temporaryPassword: z47.string(),
|
|
8410
|
+
admin: z47.object({
|
|
8411
|
+
id: z47.string(),
|
|
7872
8412
|
name: NameFieldValue,
|
|
7873
|
-
role:
|
|
8413
|
+
role: z47.string()
|
|
7874
8414
|
})
|
|
7875
8415
|
}),
|
|
8416
|
+
[TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
|
|
8417
|
+
token: z47.string()
|
|
8418
|
+
}),
|
|
8419
|
+
[TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
|
|
8420
|
+
token: z47.string()
|
|
8421
|
+
}),
|
|
7876
8422
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
7877
|
-
username:
|
|
7878
|
-
temporaryPassword:
|
|
8423
|
+
username: z47.string(),
|
|
8424
|
+
temporaryPassword: z47.string()
|
|
7879
8425
|
}),
|
|
7880
8426
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
7881
|
-
code:
|
|
8427
|
+
code: z47.string()
|
|
7882
8428
|
}),
|
|
7883
8429
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
7884
|
-
subject:
|
|
7885
|
-
body:
|
|
8430
|
+
subject: z47.string(),
|
|
8431
|
+
body: z47.string()
|
|
7886
8432
|
}),
|
|
7887
8433
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
7888
|
-
code:
|
|
8434
|
+
code: z47.string()
|
|
7889
8435
|
}),
|
|
7890
8436
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
7891
|
-
code:
|
|
8437
|
+
code: z47.string()
|
|
7892
8438
|
})
|
|
7893
8439
|
};
|
|
8440
|
+
function parseUserEventTrigger(event2, body) {
|
|
8441
|
+
const schema = TriggerPayload[event2];
|
|
8442
|
+
return schema.parse(body);
|
|
8443
|
+
}
|
|
8444
|
+
|
|
8445
|
+
// ../commons/src/url.ts
|
|
8446
|
+
function joinUrl(base, path) {
|
|
8447
|
+
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
8448
|
+
return new URL(path, baseWithSlash);
|
|
8449
|
+
}
|
|
8450
|
+
|
|
8451
|
+
// ../commons/src/logger.ts
|
|
8452
|
+
var import_pino = __toESM(require("pino"));
|
|
8453
|
+
function normalizeLogArgs(args) {
|
|
8454
|
+
const [first, ...rest] = args;
|
|
8455
|
+
if (typeof first !== "string" || rest.length === 0) {
|
|
8456
|
+
return args;
|
|
8457
|
+
}
|
|
8458
|
+
const mergingObject = {};
|
|
8459
|
+
const primitives = [];
|
|
8460
|
+
for (const arg of rest) {
|
|
8461
|
+
if (arg instanceof Error) {
|
|
8462
|
+
mergingObject.err = import_pino.default.stdSerializers.err(arg);
|
|
8463
|
+
} else if (arg !== null && typeof arg === "object") {
|
|
8464
|
+
Object.assign(mergingObject, arg);
|
|
8465
|
+
} else {
|
|
8466
|
+
primitives.push(arg);
|
|
8467
|
+
}
|
|
8468
|
+
}
|
|
8469
|
+
const message = primitives.length ? `${first} ${primitives.join(" ")}` : first;
|
|
8470
|
+
return Object.keys(mergingObject).length ? [mergingObject, message] : [message];
|
|
8471
|
+
}
|
|
8472
|
+
function filterHealthCheckLogs(args, method) {
|
|
8473
|
+
const logger2 = this;
|
|
8474
|
+
for (const arg of args) {
|
|
8475
|
+
if (typeof arg === "string" && arg.includes("get /ping 200")) {
|
|
8476
|
+
if (logger2.debug) {
|
|
8477
|
+
return logger2.debug(...args);
|
|
8478
|
+
}
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
return method.apply(this, normalizeLogArgs(args));
|
|
8482
|
+
}
|
|
8483
|
+
function buildLoggerOptions() {
|
|
8484
|
+
return {
|
|
8485
|
+
serializers: { err: import_pino.default.stdSerializers.err },
|
|
8486
|
+
hooks: { logMethod: filterHealthCheckLogs }
|
|
8487
|
+
};
|
|
8488
|
+
}
|
|
8489
|
+
var logger = process.env.NODE_ENV === "production" ? (0, import_pino.default)({
|
|
8490
|
+
level: "info",
|
|
8491
|
+
redact: [
|
|
8492
|
+
"req.headers.authorization",
|
|
8493
|
+
"req.remoteAddress",
|
|
8494
|
+
"req.headers['x-real-ip']"
|
|
8495
|
+
],
|
|
8496
|
+
...buildLoggerOptions()
|
|
8497
|
+
}) : (0, import_pino.default)({
|
|
8498
|
+
level: "debug",
|
|
8499
|
+
transport: {
|
|
8500
|
+
target: "pino-pretty",
|
|
8501
|
+
options: {
|
|
8502
|
+
colorize: true,
|
|
8503
|
+
ignore: "pid,hostname"
|
|
8504
|
+
}
|
|
8505
|
+
},
|
|
8506
|
+
...buildLoggerOptions()
|
|
8507
|
+
});
|
|
8508
|
+
var level = process.env.NODE_ENV === "test" ? "silent" : process.env.LOG_LEVEL;
|
|
8509
|
+
if (level) {
|
|
8510
|
+
logger.level = level;
|
|
8511
|
+
}
|
|
8512
|
+
|
|
8513
|
+
// ../commons/src/notification/dispatch.ts
|
|
7894
8514
|
async function triggerUserEventNotification({
|
|
7895
8515
|
event: event2,
|
|
7896
8516
|
payload,
|
|
7897
8517
|
countryConfigUrl,
|
|
7898
8518
|
authHeader
|
|
7899
8519
|
}) {
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
8520
|
+
const response = await fetch(
|
|
8521
|
+
joinUrl(countryConfigUrl, `trigger/user/${event2}`),
|
|
8522
|
+
{
|
|
8523
|
+
method: "POST",
|
|
8524
|
+
body: JSON.stringify(payload),
|
|
8525
|
+
headers: {
|
|
8526
|
+
"Content-Type": "application/json",
|
|
8527
|
+
...authHeader
|
|
8528
|
+
}
|
|
7906
8529
|
}
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
8530
|
+
);
|
|
8531
|
+
if (!response.ok) {
|
|
8532
|
+
logger.error(
|
|
8533
|
+
`triggerUserEventNotification: dispatch failed for event "${event2}" with status ${response.status}`
|
|
8534
|
+
);
|
|
8535
|
+
}
|
|
8536
|
+
return response;
|
|
7912
8537
|
}
|
|
7913
8538
|
|
|
7914
8539
|
// src/notification/index.ts
|
|
7915
|
-
|
|
8540
|
+
z48.globalRegistry.clear();
|
|
8541
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
8542
|
+
0 && (module.exports = {
|
|
8543
|
+
BasePayload,
|
|
8544
|
+
Recipient,
|
|
8545
|
+
TriggerEvent,
|
|
8546
|
+
TriggerPayload,
|
|
8547
|
+
parseUserEventTrigger,
|
|
8548
|
+
triggerUserEventNotification
|
|
8549
|
+
});
|