@opencrvs/toolkit 2.1.0-rc.7985421 → 2.1.0-rc.7c723fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -12
- package/build.sh +22 -4
- package/create-countryconfig/index.js +441 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +361 -284
- package/dist/authentication/index.d.ts +66 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +765 -0
- package/dist/cli.js +3751 -1232
- package/dist/commons/api/router.d.ts +745 -372
- 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 +5 -14
- package/dist/commons/events/ActionDocument.d.ts +35 -15
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +42 -12
- package/dist/commons/events/AuditLog.d.ts +39 -0
- package/dist/commons/events/Draft.d.ts +1 -21
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +472 -4
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +104 -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 +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/locations.d.ts +162 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/scopes.d.ts +21 -1
- package/dist/commons/events/test.utils.d.ts +78 -25
- package/dist/commons/events/utils.d.ts +39 -4
- 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 +348 -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/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +12 -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/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.d.ts +1 -1
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +594 -562
- 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 +5 -9
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +21 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/environment/utils.d.ts +0 -12
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -28
- package/dist/events/index.js +7286 -6783
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +149 -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 +1952 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -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 +8 -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/notification/index.js +1839 -1499
- package/dist/scopes/index.d.ts +612 -36
- package/dist/scopes/index.js +350 -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 +23 -9
- 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.1.0-rc.7c723fe.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.7985421.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
package/dist/scopes/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/scopes/index.ts
|
|
31
31
|
var scopes_exports = {};
|
|
32
32
|
__export(scopes_exports, {
|
|
33
|
+
ActionConfirmationScopeType: () => ActionConfirmationScopeType,
|
|
33
34
|
EncodedScope: () => EncodedScope2,
|
|
34
35
|
JurisdictionFilter: () => JurisdictionFilter,
|
|
35
36
|
RecordScopeTypeV2: () => RecordScopeTypeV2,
|
|
@@ -59,10 +60,10 @@ __export(scopes_exports, {
|
|
|
59
60
|
scopeUsesRoleOptions: () => scopeUsesRoleOptions
|
|
60
61
|
});
|
|
61
62
|
module.exports = __toCommonJS(scopes_exports);
|
|
62
|
-
var
|
|
63
|
+
var z9 = __toESM(require("zod/v4"));
|
|
63
64
|
|
|
64
65
|
// ../commons/src/scopes.ts
|
|
65
|
-
var
|
|
66
|
+
var z8 = __toESM(require("zod/v4"));
|
|
66
67
|
var qs = __toESM(require("qs"));
|
|
67
68
|
|
|
68
69
|
// ../commons/src/uuid.ts
|
|
@@ -96,12 +97,267 @@ var getTokenPayload = (token) => {
|
|
|
96
97
|
};
|
|
97
98
|
var TokenWithBearer = z2.string().regex(/^Bearer\s/);
|
|
98
99
|
|
|
100
|
+
// ../commons/src/events/ActionType.ts
|
|
101
|
+
var z3 = __toESM(require("zod/v4"));
|
|
102
|
+
var ActionType = {
|
|
103
|
+
// Pre-declaration actions
|
|
104
|
+
DELETE: "DELETE",
|
|
105
|
+
CREATE: "CREATE",
|
|
106
|
+
NOTIFY: "NOTIFY",
|
|
107
|
+
// Declaration actions
|
|
108
|
+
DECLARE: "DECLARE",
|
|
109
|
+
REGISTER: "REGISTER",
|
|
110
|
+
EDIT: "EDIT",
|
|
111
|
+
// Declaration system actions. Non-configurable.
|
|
112
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
113
|
+
REJECT: "REJECT",
|
|
114
|
+
// REJECT_DECLARATION
|
|
115
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
116
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
117
|
+
ARCHIVE: "ARCHIVE",
|
|
118
|
+
UNARCHIVE: "UNARCHIVE",
|
|
119
|
+
// Record actions
|
|
120
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
121
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
122
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
123
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
124
|
+
// General actions
|
|
125
|
+
READ: "READ",
|
|
126
|
+
ASSIGN: "ASSIGN",
|
|
127
|
+
UNASSIGN: "UNASSIGN",
|
|
128
|
+
// Custom action
|
|
129
|
+
CUSTOM: "CUSTOM"
|
|
130
|
+
};
|
|
131
|
+
var ConfirmableActions = [
|
|
132
|
+
ActionType.NOTIFY,
|
|
133
|
+
ActionType.DECLARE,
|
|
134
|
+
ActionType.EDIT,
|
|
135
|
+
ActionType.REGISTER,
|
|
136
|
+
ActionType.REJECT,
|
|
137
|
+
ActionType.ARCHIVE,
|
|
138
|
+
ActionType.UNARCHIVE,
|
|
139
|
+
ActionType.PRINT_CERTIFICATE,
|
|
140
|
+
ActionType.REQUEST_CORRECTION,
|
|
141
|
+
ActionType.APPROVE_CORRECTION,
|
|
142
|
+
ActionType.REJECT_CORRECTION,
|
|
143
|
+
ActionType.CUSTOM
|
|
144
|
+
];
|
|
145
|
+
var ActionTypes = z3.enum([
|
|
146
|
+
"DELETE",
|
|
147
|
+
"CREATE",
|
|
148
|
+
"NOTIFY",
|
|
149
|
+
"DECLARE",
|
|
150
|
+
"EDIT",
|
|
151
|
+
"REGISTER",
|
|
152
|
+
"DUPLICATE_DETECTED",
|
|
153
|
+
"REJECT",
|
|
154
|
+
"MARK_AS_DUPLICATE",
|
|
155
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
156
|
+
"ARCHIVE",
|
|
157
|
+
"UNARCHIVE",
|
|
158
|
+
"PRINT_CERTIFICATE",
|
|
159
|
+
"REQUEST_CORRECTION",
|
|
160
|
+
"REJECT_CORRECTION",
|
|
161
|
+
"APPROVE_CORRECTION",
|
|
162
|
+
"READ",
|
|
163
|
+
"ASSIGN",
|
|
164
|
+
"UNASSIGN",
|
|
165
|
+
"CUSTOM"
|
|
166
|
+
]);
|
|
167
|
+
var declarationActionValues = [
|
|
168
|
+
ActionTypes.enum.DECLARE,
|
|
169
|
+
ActionTypes.enum.EDIT,
|
|
170
|
+
ActionTypes.enum.REGISTER,
|
|
171
|
+
ActionTypes.enum.NOTIFY,
|
|
172
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
173
|
+
];
|
|
174
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
175
|
+
var declarationUpdateActionValues = [
|
|
176
|
+
...declarationActionValues,
|
|
177
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
178
|
+
];
|
|
179
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
180
|
+
declarationUpdateActionValues
|
|
181
|
+
);
|
|
182
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
183
|
+
var writeActions = ActionTypes.exclude([
|
|
184
|
+
ActionType.CREATE,
|
|
185
|
+
ActionType.READ,
|
|
186
|
+
ActionType.ASSIGN,
|
|
187
|
+
ActionType.UNASSIGN
|
|
188
|
+
]);
|
|
189
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
190
|
+
ActionType.READ,
|
|
191
|
+
ActionType.DELETE,
|
|
192
|
+
ActionType.DECLARE,
|
|
193
|
+
ActionType.REGISTER,
|
|
194
|
+
ActionType.EDIT,
|
|
195
|
+
ActionType.REJECT,
|
|
196
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
197
|
+
ActionType.ARCHIVE,
|
|
198
|
+
ActionType.UNARCHIVE,
|
|
199
|
+
ActionType.PRINT_CERTIFICATE,
|
|
200
|
+
ActionType.REQUEST_CORRECTION
|
|
201
|
+
]);
|
|
202
|
+
var META_ACTIONS = [
|
|
203
|
+
ActionType.ASSIGN,
|
|
204
|
+
ActionType.UNASSIGN,
|
|
205
|
+
ActionType.READ
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
// ../commons/src/events/ActionStatus.ts
|
|
209
|
+
var ActionStatus = {
|
|
210
|
+
Requested: "Requested",
|
|
211
|
+
Accepted: "Accepted",
|
|
212
|
+
Rejected: "Rejected"
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// ../commons/src/events/Flag.ts
|
|
216
|
+
var z6 = __toESM(require("zod/v4"));
|
|
217
|
+
|
|
218
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
219
|
+
var z4 = __toESM(require("zod/v4"));
|
|
220
|
+
var TranslationConfig = z4.object({
|
|
221
|
+
id: z4.string().describe(
|
|
222
|
+
"The identifier of the translation referred in translation CSV files"
|
|
223
|
+
),
|
|
224
|
+
defaultMessage: z4.string().describe("Default translation message"),
|
|
225
|
+
description: z4.string().describe(
|
|
226
|
+
"Describe the translation for a translator to be able to identify it."
|
|
227
|
+
)
|
|
228
|
+
}).meta({
|
|
229
|
+
description: "Translation configuration",
|
|
230
|
+
id: "TranslationConfig"
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// ../commons/src/events/Conditional.ts
|
|
234
|
+
var z5 = __toESM(require("zod/v4"));
|
|
235
|
+
var Conditional = z5.any().describe("JSONSchema").meta({
|
|
236
|
+
description: "JSON schema conditional configuration",
|
|
237
|
+
id: "Conditional"
|
|
238
|
+
});
|
|
239
|
+
var ConditionalType = {
|
|
240
|
+
SHOW: "SHOW",
|
|
241
|
+
ENABLE: "ENABLE",
|
|
242
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
243
|
+
};
|
|
244
|
+
var ShowConditional = z5.object({
|
|
245
|
+
type: z5.literal(ConditionalType.SHOW),
|
|
246
|
+
conditional: Conditional
|
|
247
|
+
}).describe(
|
|
248
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
249
|
+
);
|
|
250
|
+
var EnableConditional = z5.object({
|
|
251
|
+
type: z5.literal(ConditionalType.ENABLE),
|
|
252
|
+
conditional: Conditional
|
|
253
|
+
}).describe(
|
|
254
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
255
|
+
);
|
|
256
|
+
var ActionConditional = z5.discriminatedUnion("type", [
|
|
257
|
+
// Action can be shown / hidden
|
|
258
|
+
ShowConditional,
|
|
259
|
+
// Action can be shown to the user in the list but as disabled
|
|
260
|
+
EnableConditional
|
|
261
|
+
]).meta({
|
|
262
|
+
id: "ActionConditional",
|
|
263
|
+
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."
|
|
264
|
+
});
|
|
265
|
+
var DisplayOnReviewConditional = z5.object({
|
|
266
|
+
type: z5.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
267
|
+
conditional: Conditional
|
|
268
|
+
}).describe(
|
|
269
|
+
"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."
|
|
270
|
+
);
|
|
271
|
+
var FieldConditional = z5.discriminatedUnion("type", [
|
|
272
|
+
// Field input can be shown / hidden
|
|
273
|
+
ShowConditional,
|
|
274
|
+
// Field input can be shown to the user but as disabled
|
|
275
|
+
EnableConditional,
|
|
276
|
+
// Field output can be shown / hidden on the review page
|
|
277
|
+
DisplayOnReviewConditional
|
|
278
|
+
]).meta({
|
|
279
|
+
id: "FieldConditional",
|
|
280
|
+
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."
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// ../commons/src/events/Flag.ts
|
|
284
|
+
var InherentFlags = {
|
|
285
|
+
INCOMPLETE: "incomplete",
|
|
286
|
+
REJECTED: "rejected",
|
|
287
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
288
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
289
|
+
/**
|
|
290
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
291
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
292
|
+
*
|
|
293
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
294
|
+
*/
|
|
295
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
296
|
+
};
|
|
297
|
+
var actionFlagPattern;
|
|
298
|
+
function getActionFlagPattern() {
|
|
299
|
+
actionFlagPattern ??= new RegExp(
|
|
300
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
301
|
+
ActionStatus
|
|
302
|
+
).join("|").toLowerCase()})$`
|
|
303
|
+
);
|
|
304
|
+
return actionFlagPattern;
|
|
305
|
+
}
|
|
306
|
+
var ActionFlag = z6.string().refine((value) => getActionFlagPattern().test(value), {
|
|
307
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
308
|
+
});
|
|
309
|
+
var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
310
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
311
|
+
InherentFlags
|
|
312
|
+
).join(", ")}`
|
|
313
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
314
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
315
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
316
|
+
var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
|
|
317
|
+
var ContainsFlags = z6.object({
|
|
318
|
+
anyOf: z6.array(Flag).optional(),
|
|
319
|
+
noneOf: z6.array(Flag).optional(),
|
|
320
|
+
allOf: z6.array(Flag).optional()
|
|
321
|
+
}).meta({
|
|
322
|
+
id: "ContainsFlags"
|
|
323
|
+
});
|
|
324
|
+
var FlagConfig = z6.object({
|
|
325
|
+
id: CustomFlag,
|
|
326
|
+
requiresAction: z6.boolean().describe(
|
|
327
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
328
|
+
),
|
|
329
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
330
|
+
}).meta({
|
|
331
|
+
id: "FlagConfig",
|
|
332
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
333
|
+
});
|
|
334
|
+
var ActionFlagConfig = z6.object({
|
|
335
|
+
id: Flag,
|
|
336
|
+
operation: z6.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
337
|
+
conditional: Conditional.optional().describe(
|
|
338
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
339
|
+
)
|
|
340
|
+
}).meta({
|
|
341
|
+
id: "ActionFlagConfig",
|
|
342
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// ../commons/src/events/EventStatus.ts
|
|
346
|
+
var z7 = __toESM(require("zod/v4"));
|
|
347
|
+
var EventStatus = z7.enum([
|
|
348
|
+
"CREATED",
|
|
349
|
+
"NOTIFIED",
|
|
350
|
+
"DECLARED",
|
|
351
|
+
"REGISTERED",
|
|
352
|
+
"ARCHIVED"
|
|
353
|
+
]);
|
|
354
|
+
|
|
99
355
|
// ../commons/src/scopes.ts
|
|
100
|
-
var JurisdictionFilter =
|
|
356
|
+
var JurisdictionFilter = z8.enum(["administrativeArea", "location", "all"]).describe(
|
|
101
357
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
102
358
|
);
|
|
103
|
-
var UserFilter =
|
|
104
|
-
var RecordScopeTypeV2 =
|
|
359
|
+
var UserFilter = z8.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
360
|
+
var RecordScopeTypeV2 = z8.enum([
|
|
105
361
|
"record.search",
|
|
106
362
|
"record.create",
|
|
107
363
|
"record.read",
|
|
@@ -117,14 +373,21 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
117
373
|
"record.request-correction",
|
|
118
374
|
"record.correct",
|
|
119
375
|
"record.unassign-others",
|
|
120
|
-
"record.custom-action"
|
|
376
|
+
"record.custom-action",
|
|
377
|
+
"record.action.accept",
|
|
378
|
+
"record.action.reject"
|
|
121
379
|
]);
|
|
122
|
-
var PlainScopeType =
|
|
380
|
+
var PlainScopeType = z8.enum([
|
|
123
381
|
// Misc. system scopes
|
|
124
382
|
"bypassratelimit",
|
|
125
383
|
"record.reindex",
|
|
126
384
|
"user.data-seeding",
|
|
127
385
|
"integration.create",
|
|
386
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
387
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
388
|
+
// deliberately option-less: system clients have no office and no
|
|
389
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
390
|
+
"integration.audit.read",
|
|
128
391
|
"record.import",
|
|
129
392
|
"config.update-all",
|
|
130
393
|
"location.edit",
|
|
@@ -134,77 +397,87 @@ var PlainScopeType = z3.enum([
|
|
|
134
397
|
// Performance dashboard
|
|
135
398
|
"performance.read",
|
|
136
399
|
"performance.read-dashboards",
|
|
137
|
-
"performance.vital-statistics-export"
|
|
138
|
-
// Scopes used exclusively by countryconfig integration token
|
|
139
|
-
"record.confirm-registration",
|
|
140
|
-
"record.reject-registration"
|
|
400
|
+
"performance.vital-statistics-export"
|
|
141
401
|
]);
|
|
142
|
-
var scopeByEvent =
|
|
402
|
+
var scopeByEvent = z8.preprocess(
|
|
143
403
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
144
|
-
|
|
404
|
+
z8.array(z8.string()).optional()
|
|
145
405
|
).describe("Event type, e.g. birth, death");
|
|
146
|
-
var
|
|
406
|
+
var scopeByStatus = z8.preprocess(
|
|
407
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
408
|
+
z8.array(EventStatus).optional()
|
|
409
|
+
).describe(
|
|
410
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
411
|
+
);
|
|
412
|
+
var userRole = z8.preprocess(
|
|
147
413
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
148
|
-
|
|
414
|
+
z8.array(z8.string()).optional()
|
|
149
415
|
).describe("User role, e.g. admin, field agent");
|
|
150
|
-
var scopeOptionsPlaceEvent =
|
|
416
|
+
var scopeOptionsPlaceEvent = z8.object({
|
|
151
417
|
event: scopeByEvent,
|
|
152
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
418
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
419
|
+
createdBy: UserFilter.optional(),
|
|
420
|
+
createdIn: JurisdictionFilter.optional()
|
|
153
421
|
}).describe("Options applicable to all record scopes.");
|
|
154
422
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
155
423
|
notifiedIn: JurisdictionFilter.optional(),
|
|
156
424
|
notifiedBy: UserFilter.optional(),
|
|
157
425
|
declaredIn: JurisdictionFilter.optional(),
|
|
158
|
-
declaredBy: UserFilter.optional()
|
|
426
|
+
declaredBy: UserFilter.optional(),
|
|
427
|
+
status: scopeByStatus
|
|
159
428
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
160
429
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
161
430
|
registeredIn: JurisdictionFilter.optional(),
|
|
162
|
-
registeredBy: UserFilter.optional()
|
|
431
|
+
registeredBy: UserFilter.optional(),
|
|
432
|
+
flags: ContainsFlags.optional()
|
|
163
433
|
}).describe(
|
|
164
434
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
165
435
|
);
|
|
166
436
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
167
|
-
customActionTypes:
|
|
437
|
+
customActionTypes: z8.preprocess(
|
|
168
438
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
169
|
-
|
|
439
|
+
z8.array(z8.string()).optional()
|
|
170
440
|
).describe("Allowed custom action types")
|
|
171
441
|
});
|
|
172
|
-
var AccessLevelOptions =
|
|
442
|
+
var AccessLevelOptions = z8.object({
|
|
173
443
|
accessLevel: JurisdictionFilter.optional()
|
|
174
444
|
});
|
|
175
445
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
176
446
|
role: userRole.optional()
|
|
177
447
|
});
|
|
178
|
-
var WorkqueueOrDashboardOptions =
|
|
179
|
-
ids:
|
|
448
|
+
var WorkqueueOrDashboardOptions = z8.object({
|
|
449
|
+
ids: z8.preprocess(
|
|
180
450
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
181
|
-
|
|
451
|
+
z8.array(z8.string())
|
|
182
452
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
183
453
|
});
|
|
184
|
-
var AllScopeOptions =
|
|
454
|
+
var AllScopeOptions = z8.object({
|
|
185
455
|
...AllRecordScopeOptions.shape,
|
|
186
456
|
...AccessLevelOptions.shape,
|
|
187
457
|
...AllUserScopeOptions.shape,
|
|
188
458
|
...WorkqueueOrDashboardOptions.shape
|
|
189
459
|
});
|
|
190
460
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
191
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
461
|
+
var ResolvedScopeOptionsPlaceEvent = z8.object({
|
|
192
462
|
event: scopeByEvent,
|
|
193
|
-
placeOfEvent: UUID.nullish()
|
|
463
|
+
placeOfEvent: UUID.nullish(),
|
|
464
|
+
createdBy: z8.string().optional(),
|
|
465
|
+
createdIn: UUID.nullish()
|
|
194
466
|
}).describe(
|
|
195
467
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
196
468
|
);
|
|
197
469
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
198
470
|
notifiedIn: UUID.nullish(),
|
|
199
|
-
notifiedBy:
|
|
471
|
+
notifiedBy: z8.string().optional(),
|
|
200
472
|
declaredIn: UUID.nullish(),
|
|
201
|
-
declaredBy:
|
|
473
|
+
declaredBy: z8.string().optional()
|
|
202
474
|
}).describe(
|
|
203
475
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
204
476
|
);
|
|
205
477
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
206
478
|
registeredIn: UUID.nullish(),
|
|
207
|
-
registeredBy:
|
|
479
|
+
registeredBy: z8.string().optional(),
|
|
480
|
+
flags: ContainsFlags.optional()
|
|
208
481
|
}).describe(
|
|
209
482
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
210
483
|
);
|
|
@@ -218,7 +491,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
218
491
|
"record.reject",
|
|
219
492
|
"record.archive",
|
|
220
493
|
"record.unarchive",
|
|
221
|
-
"record.review-duplicates",
|
|
222
494
|
"record.register"
|
|
223
495
|
]);
|
|
224
496
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -226,41 +498,53 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
226
498
|
"record.read",
|
|
227
499
|
"record.request-correction",
|
|
228
500
|
"record.correct",
|
|
229
|
-
"record.unassign-others"
|
|
501
|
+
"record.unassign-others",
|
|
502
|
+
"record.review-duplicates"
|
|
230
503
|
]);
|
|
231
504
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
232
|
-
templates:
|
|
505
|
+
templates: z8.preprocess(
|
|
233
506
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
234
|
-
|
|
507
|
+
z8.array(z8.string()).optional()
|
|
235
508
|
).describe(
|
|
236
509
|
"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."
|
|
237
510
|
)
|
|
238
511
|
});
|
|
239
|
-
var
|
|
240
|
-
|
|
512
|
+
var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
|
|
513
|
+
"record.action.accept",
|
|
514
|
+
"record.action.reject"
|
|
515
|
+
]);
|
|
516
|
+
var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
|
|
517
|
+
"Options for confirming (accepting or rejecting) an action."
|
|
518
|
+
);
|
|
519
|
+
var RecordScopeV2 = z8.discriminatedUnion("type", [
|
|
520
|
+
z8.object({
|
|
241
521
|
type: ScopesWithPlaceEventOptions,
|
|
242
522
|
options: scopeOptionsPlaceEvent.optional()
|
|
243
523
|
}),
|
|
244
|
-
|
|
524
|
+
z8.object({
|
|
245
525
|
type: ScopesWithDeclaredOptions,
|
|
246
526
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
247
527
|
}),
|
|
248
|
-
|
|
528
|
+
z8.object({
|
|
249
529
|
type: ScopesWithFullOptions,
|
|
250
530
|
options: AllRecordScopeOptions.optional()
|
|
251
531
|
}),
|
|
252
|
-
|
|
253
|
-
type:
|
|
532
|
+
z8.object({
|
|
533
|
+
type: z8.literal("record.custom-action"),
|
|
254
534
|
options: CustomActionScopeOptions.optional()
|
|
255
535
|
}),
|
|
256
|
-
|
|
257
|
-
type:
|
|
536
|
+
z8.object({
|
|
537
|
+
type: z8.literal("record.print-certified-copies"),
|
|
258
538
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
539
|
+
}),
|
|
540
|
+
z8.object({
|
|
541
|
+
type: ActionConfirmationScopeType,
|
|
542
|
+
options: ActionConfirmationScopeOptions.optional()
|
|
259
543
|
})
|
|
260
544
|
]).describe(
|
|
261
545
|
"Scopes used to check user's permission to perform actions on a record."
|
|
262
546
|
);
|
|
263
|
-
var SystemScopeType =
|
|
547
|
+
var SystemScopeType = z8.enum([
|
|
264
548
|
"organisation.read-locations",
|
|
265
549
|
"user.read",
|
|
266
550
|
"user.create",
|
|
@@ -274,12 +558,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
274
558
|
"user.search"
|
|
275
559
|
]);
|
|
276
560
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
277
|
-
var UserScopeV2 =
|
|
278
|
-
|
|
561
|
+
var UserScopeV2 = z8.discriminatedUnion("type", [
|
|
562
|
+
z8.object({
|
|
279
563
|
type: ScopesWithRoleOption,
|
|
280
564
|
options: AllUserScopeOptions.optional()
|
|
281
565
|
}),
|
|
282
|
-
|
|
566
|
+
z8.object({
|
|
283
567
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
284
568
|
options: AccessLevelOptions.optional()
|
|
285
569
|
})
|
|
@@ -299,44 +583,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
299
583
|
function isCustomActionScope(scope) {
|
|
300
584
|
return scope.type === "record.custom-action";
|
|
301
585
|
}
|
|
302
|
-
var ResolvedRecordScopeV2 =
|
|
303
|
-
|
|
586
|
+
var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
|
|
587
|
+
z8.object({
|
|
304
588
|
type: ScopesWithPlaceEventOptions,
|
|
305
589
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
306
590
|
}),
|
|
307
|
-
|
|
591
|
+
z8.object({
|
|
308
592
|
type: ScopesWithDeclaredOptions,
|
|
309
593
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
310
594
|
}),
|
|
311
|
-
|
|
595
|
+
z8.object({
|
|
312
596
|
type: ScopesWithFullOptions,
|
|
313
597
|
options: ResolvedScopeOptionsFull.optional()
|
|
314
598
|
}),
|
|
315
|
-
|
|
316
|
-
type:
|
|
599
|
+
z8.object({
|
|
600
|
+
type: z8.literal("record.print-certified-copies"),
|
|
317
601
|
options: ResolvedScopeOptionsFull.extend({
|
|
318
|
-
templates:
|
|
602
|
+
templates: z8.array(z8.string()).optional()
|
|
319
603
|
}).optional()
|
|
320
604
|
})
|
|
321
605
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
322
|
-
var Scope2 =
|
|
323
|
-
|
|
606
|
+
var Scope2 = z8.discriminatedUnion("type", [
|
|
607
|
+
z8.object({ type: PlainScopeType }),
|
|
324
608
|
...RecordScopeV2.options,
|
|
325
609
|
...UserScopeV2.options,
|
|
326
|
-
|
|
327
|
-
type:
|
|
610
|
+
z8.object({
|
|
611
|
+
type: z8.literal("organisation.read-locations"),
|
|
328
612
|
options: AccessLevelOptions.optional()
|
|
329
613
|
}),
|
|
330
|
-
|
|
331
|
-
type:
|
|
614
|
+
z8.object({
|
|
615
|
+
type: z8.literal("workqueue"),
|
|
332
616
|
options: WorkqueueOrDashboardOptions
|
|
333
617
|
}),
|
|
334
|
-
|
|
335
|
-
type:
|
|
618
|
+
z8.object({
|
|
619
|
+
type: z8.literal("dashboard.view"),
|
|
336
620
|
options: WorkqueueOrDashboardOptions
|
|
337
621
|
})
|
|
338
622
|
]);
|
|
339
|
-
var ScopeType2 =
|
|
623
|
+
var ScopeType2 = z8.enum([
|
|
340
624
|
...SystemScopeType.options,
|
|
341
625
|
...RecordScopeTypeV2.options,
|
|
342
626
|
...PlainScopeType.options,
|
|
@@ -351,11 +635,12 @@ var unflattenScope = (input) => {
|
|
|
351
635
|
const { type, ...options } = input;
|
|
352
636
|
return { type, options };
|
|
353
637
|
};
|
|
354
|
-
var EncodedScope2 =
|
|
638
|
+
var EncodedScope2 = z8.string().brand("EncodedScope");
|
|
355
639
|
var encodeScope = (scope) => {
|
|
356
640
|
const flattened = flattenScope(scope);
|
|
357
641
|
return qs.stringify(flattened, {
|
|
358
642
|
arrayFormat: "comma",
|
|
643
|
+
commaRoundTrip: true,
|
|
359
644
|
allowDots: true,
|
|
360
645
|
addQueryPrefix: false,
|
|
361
646
|
encode: false
|
|
@@ -437,4 +722,4 @@ function defineRoles(roles) {
|
|
|
437
722
|
}
|
|
438
723
|
|
|
439
724
|
// src/scopes/index.ts
|
|
440
|
-
|
|
725
|
+
z9.globalRegistry.clear();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** A single telemetry metric value. */
|
|
2
|
+
export type TelemetryMetricValue = number | string | boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The telemetry report a country configuration hands to {@link sendTelemetry}.
|
|
5
|
+
* `schema_version` is stamped by `sendTelemetry`, not by the caller.
|
|
6
|
+
*/
|
|
7
|
+
export interface TelemetryReport {
|
|
8
|
+
/** Client clock, ISO 8601. Kept stable across retries of the same report. */
|
|
9
|
+
reported_at: string;
|
|
10
|
+
/** ISO-style country code of the instance. */
|
|
11
|
+
country_code: string;
|
|
12
|
+
/** Organisation running the instance. Empty string when unset. */
|
|
13
|
+
organisation: string;
|
|
14
|
+
/** Public domain of the instance, or `null`. */
|
|
15
|
+
domain: string | null;
|
|
16
|
+
instance: {
|
|
17
|
+
application_name: string;
|
|
18
|
+
environment: string;
|
|
19
|
+
app_version?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Flat map of dotted metric keys to primitive values. */
|
|
22
|
+
metrics: Record<string, TelemetryMetricValue>;
|
|
23
|
+
}
|
|
24
|
+
/** Outcome of a {@link sendTelemetry} call. */
|
|
25
|
+
export interface TelemetryResult {
|
|
26
|
+
/**
|
|
27
|
+
* How the send resolved:
|
|
28
|
+
* - `sent` — the status service accepted the report (2xx);
|
|
29
|
+
* - `rejected` — the status service returned a non-2xx response.
|
|
30
|
+
*/
|
|
31
|
+
outcome: 'sent' | 'rejected';
|
|
32
|
+
/** HTTP status of the request. */
|
|
33
|
+
status: number;
|
|
34
|
+
/** Response body for a `rejected` outcome. */
|
|
35
|
+
detail?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sends a telemetry report to the OpenCRVS status service. The endpoint and the
|
|
39
|
+
* schema version are fixed by this version of the toolkit.
|
|
40
|
+
*
|
|
41
|
+
* This always attempts the send; deciding *whether* to report (e.g. only from
|
|
42
|
+
* production instances) is the caller's responsibility. Network errors reject.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sendTelemetry(report: TelemetryReport): Promise<TelemetryResult>;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAuBA,uCAAuC;AACvC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE;QACR,gBAAgB,EAAE,MAAM,CAAA;QACxB,WAAW,EAAE,MAAM,CAAA;QACnB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CAC9C;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,UAAU,CAAA;IAC5B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC,CAa1B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/telemetry/index.ts
|
|
21
|
+
var telemetry_exports = {};
|
|
22
|
+
__export(telemetry_exports, {
|
|
23
|
+
sendTelemetry: () => sendTelemetry
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(telemetry_exports);
|
|
26
|
+
var TELEMETRY_URL = "https://status.opencrvs.org/v1/telemetry";
|
|
27
|
+
var SCHEMA_VERSION = "1.0";
|
|
28
|
+
async function sendTelemetry(report) {
|
|
29
|
+
const response = await fetch(TELEMETRY_URL, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { "Content-Type": "application/json" },
|
|
32
|
+
body: JSON.stringify({ schema_version: SCHEMA_VERSION, ...report })
|
|
33
|
+
});
|
|
34
|
+
if (response.ok) {
|
|
35
|
+
return { outcome: "sent", status: response.status };
|
|
36
|
+
}
|
|
37
|
+
const detail = await response.text().catch(() => "");
|
|
38
|
+
return { outcome: "rejected", status: response.status, detail };
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
sendTelemetry
|
|
43
|
+
});
|