@opencrvs/toolkit 2.1.0-rc.ffe0b7f → 2.1.1-rc.52250d8
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 +22 -4
- 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 +362 -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 +3735 -1218
- package/dist/commons/api/router.d.ts +940 -363
- 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 +48 -12
- package/dist/commons/events/AuditLog.d.ts +148 -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 +109 -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/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 +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 +349 -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 +1 -1
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +27 -18
- 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 +7689 -7063
- 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 +2015 -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.1/remove-typings-from-dockerfile.d.ts +3 -0
- package/dist/migrations/v2.1/remove-typings-from-dockerfile.d.ts.map +1 -0
- package/dist/migrations/v2.1/remove-typings-from-dockerfile.js +121 -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 +1887 -1438
- package/dist/scopes/index.d.ts +614 -36
- package/dist/scopes/index.js +351 -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.1-rc.52250d8.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
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,93 +373,111 @@ 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",
|
|
393
|
+
"location.edit",
|
|
130
394
|
"attachment.upload",
|
|
131
395
|
"profile.electronic-signature",
|
|
132
396
|
"user.read-only-my-audit",
|
|
133
397
|
// Performance dashboard
|
|
134
398
|
"performance.read",
|
|
135
399
|
"performance.read-dashboards",
|
|
136
|
-
"performance.vital-statistics-export"
|
|
137
|
-
// Scopes used exclusively by countryconfig integration token
|
|
138
|
-
"record.confirm-registration",
|
|
139
|
-
"record.reject-registration"
|
|
400
|
+
"performance.vital-statistics-export"
|
|
140
401
|
]);
|
|
141
|
-
var scopeByEvent =
|
|
402
|
+
var scopeByEvent = z8.preprocess(
|
|
142
403
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
143
|
-
|
|
404
|
+
z8.array(z8.string()).optional()
|
|
144
405
|
).describe("Event type, e.g. birth, death");
|
|
145
|
-
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(
|
|
146
413
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
147
|
-
|
|
414
|
+
z8.array(z8.string()).optional()
|
|
148
415
|
).describe("User role, e.g. admin, field agent");
|
|
149
|
-
var scopeOptionsPlaceEvent =
|
|
416
|
+
var scopeOptionsPlaceEvent = z8.object({
|
|
150
417
|
event: scopeByEvent,
|
|
151
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
418
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
419
|
+
createdBy: UserFilter.optional(),
|
|
420
|
+
createdIn: JurisdictionFilter.optional()
|
|
152
421
|
}).describe("Options applicable to all record scopes.");
|
|
153
422
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
154
423
|
notifiedIn: JurisdictionFilter.optional(),
|
|
155
424
|
notifiedBy: UserFilter.optional(),
|
|
156
425
|
declaredIn: JurisdictionFilter.optional(),
|
|
157
|
-
declaredBy: UserFilter.optional()
|
|
426
|
+
declaredBy: UserFilter.optional(),
|
|
427
|
+
status: scopeByStatus
|
|
158
428
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
159
429
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
160
430
|
registeredIn: JurisdictionFilter.optional(),
|
|
161
|
-
registeredBy: UserFilter.optional()
|
|
431
|
+
registeredBy: UserFilter.optional(),
|
|
432
|
+
flags: ContainsFlags.optional()
|
|
162
433
|
}).describe(
|
|
163
434
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
164
435
|
);
|
|
165
436
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
166
|
-
customActionTypes:
|
|
437
|
+
customActionTypes: z8.preprocess(
|
|
167
438
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
168
|
-
|
|
439
|
+
z8.array(z8.string()).optional()
|
|
169
440
|
).describe("Allowed custom action types")
|
|
170
441
|
});
|
|
171
|
-
var AccessLevelOptions =
|
|
442
|
+
var AccessLevelOptions = z8.object({
|
|
172
443
|
accessLevel: JurisdictionFilter.optional()
|
|
173
444
|
});
|
|
174
445
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
175
446
|
role: userRole.optional()
|
|
176
447
|
});
|
|
177
|
-
var WorkqueueOrDashboardOptions =
|
|
178
|
-
ids:
|
|
448
|
+
var WorkqueueOrDashboardOptions = z8.object({
|
|
449
|
+
ids: z8.preprocess(
|
|
179
450
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
180
|
-
|
|
451
|
+
z8.array(z8.string())
|
|
181
452
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
182
453
|
});
|
|
183
|
-
var AllScopeOptions =
|
|
454
|
+
var AllScopeOptions = z8.object({
|
|
184
455
|
...AllRecordScopeOptions.shape,
|
|
185
456
|
...AccessLevelOptions.shape,
|
|
186
457
|
...AllUserScopeOptions.shape,
|
|
187
458
|
...WorkqueueOrDashboardOptions.shape
|
|
188
459
|
});
|
|
189
460
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
190
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
461
|
+
var ResolvedScopeOptionsPlaceEvent = z8.object({
|
|
191
462
|
event: scopeByEvent,
|
|
192
|
-
placeOfEvent: UUID.nullish()
|
|
463
|
+
placeOfEvent: UUID.nullish(),
|
|
464
|
+
createdBy: z8.string().optional(),
|
|
465
|
+
createdIn: UUID.nullish()
|
|
193
466
|
}).describe(
|
|
194
467
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
195
468
|
);
|
|
196
469
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
197
470
|
notifiedIn: UUID.nullish(),
|
|
198
|
-
notifiedBy:
|
|
471
|
+
notifiedBy: z8.string().optional(),
|
|
199
472
|
declaredIn: UUID.nullish(),
|
|
200
|
-
declaredBy:
|
|
473
|
+
declaredBy: z8.string().optional()
|
|
201
474
|
}).describe(
|
|
202
475
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
203
476
|
);
|
|
204
477
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
205
478
|
registeredIn: UUID.nullish(),
|
|
206
|
-
registeredBy:
|
|
479
|
+
registeredBy: z8.string().optional(),
|
|
480
|
+
flags: ContainsFlags.optional()
|
|
207
481
|
}).describe(
|
|
208
482
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
209
483
|
);
|
|
@@ -217,7 +491,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
217
491
|
"record.reject",
|
|
218
492
|
"record.archive",
|
|
219
493
|
"record.unarchive",
|
|
220
|
-
"record.review-duplicates",
|
|
221
494
|
"record.register"
|
|
222
495
|
]);
|
|
223
496
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -225,41 +498,53 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
225
498
|
"record.read",
|
|
226
499
|
"record.request-correction",
|
|
227
500
|
"record.correct",
|
|
228
|
-
"record.unassign-others"
|
|
501
|
+
"record.unassign-others",
|
|
502
|
+
"record.review-duplicates"
|
|
229
503
|
]);
|
|
230
504
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
231
|
-
templates:
|
|
505
|
+
templates: z8.preprocess(
|
|
232
506
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
233
|
-
|
|
507
|
+
z8.array(z8.string()).optional()
|
|
234
508
|
).describe(
|
|
235
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."
|
|
236
510
|
)
|
|
237
511
|
});
|
|
238
|
-
var
|
|
239
|
-
|
|
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({
|
|
240
521
|
type: ScopesWithPlaceEventOptions,
|
|
241
522
|
options: scopeOptionsPlaceEvent.optional()
|
|
242
523
|
}),
|
|
243
|
-
|
|
524
|
+
z8.object({
|
|
244
525
|
type: ScopesWithDeclaredOptions,
|
|
245
526
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
246
527
|
}),
|
|
247
|
-
|
|
528
|
+
z8.object({
|
|
248
529
|
type: ScopesWithFullOptions,
|
|
249
530
|
options: AllRecordScopeOptions.optional()
|
|
250
531
|
}),
|
|
251
|
-
|
|
252
|
-
type:
|
|
532
|
+
z8.object({
|
|
533
|
+
type: z8.literal("record.custom-action"),
|
|
253
534
|
options: CustomActionScopeOptions.optional()
|
|
254
535
|
}),
|
|
255
|
-
|
|
256
|
-
type:
|
|
536
|
+
z8.object({
|
|
537
|
+
type: z8.literal("record.print-certified-copies"),
|
|
257
538
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
539
|
+
}),
|
|
540
|
+
z8.object({
|
|
541
|
+
type: ActionConfirmationScopeType,
|
|
542
|
+
options: ActionConfirmationScopeOptions.optional()
|
|
258
543
|
})
|
|
259
544
|
]).describe(
|
|
260
545
|
"Scopes used to check user's permission to perform actions on a record."
|
|
261
546
|
);
|
|
262
|
-
var SystemScopeType =
|
|
547
|
+
var SystemScopeType = z8.enum([
|
|
263
548
|
"organisation.read-locations",
|
|
264
549
|
"user.read",
|
|
265
550
|
"user.create",
|
|
@@ -273,12 +558,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
273
558
|
"user.search"
|
|
274
559
|
]);
|
|
275
560
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
276
|
-
var UserScopeV2 =
|
|
277
|
-
|
|
561
|
+
var UserScopeV2 = z8.discriminatedUnion("type", [
|
|
562
|
+
z8.object({
|
|
278
563
|
type: ScopesWithRoleOption,
|
|
279
564
|
options: AllUserScopeOptions.optional()
|
|
280
565
|
}),
|
|
281
|
-
|
|
566
|
+
z8.object({
|
|
282
567
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
283
568
|
options: AccessLevelOptions.optional()
|
|
284
569
|
})
|
|
@@ -298,44 +583,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
298
583
|
function isCustomActionScope(scope) {
|
|
299
584
|
return scope.type === "record.custom-action";
|
|
300
585
|
}
|
|
301
|
-
var ResolvedRecordScopeV2 =
|
|
302
|
-
|
|
586
|
+
var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
|
|
587
|
+
z8.object({
|
|
303
588
|
type: ScopesWithPlaceEventOptions,
|
|
304
589
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
305
590
|
}),
|
|
306
|
-
|
|
591
|
+
z8.object({
|
|
307
592
|
type: ScopesWithDeclaredOptions,
|
|
308
593
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
309
594
|
}),
|
|
310
|
-
|
|
595
|
+
z8.object({
|
|
311
596
|
type: ScopesWithFullOptions,
|
|
312
597
|
options: ResolvedScopeOptionsFull.optional()
|
|
313
598
|
}),
|
|
314
|
-
|
|
315
|
-
type:
|
|
599
|
+
z8.object({
|
|
600
|
+
type: z8.literal("record.print-certified-copies"),
|
|
316
601
|
options: ResolvedScopeOptionsFull.extend({
|
|
317
|
-
templates:
|
|
602
|
+
templates: z8.array(z8.string()).optional()
|
|
318
603
|
}).optional()
|
|
319
604
|
})
|
|
320
605
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
321
|
-
var Scope2 =
|
|
322
|
-
|
|
606
|
+
var Scope2 = z8.discriminatedUnion("type", [
|
|
607
|
+
z8.object({ type: PlainScopeType }),
|
|
323
608
|
...RecordScopeV2.options,
|
|
324
609
|
...UserScopeV2.options,
|
|
325
|
-
|
|
326
|
-
type:
|
|
610
|
+
z8.object({
|
|
611
|
+
type: z8.literal("organisation.read-locations"),
|
|
327
612
|
options: AccessLevelOptions.optional()
|
|
328
613
|
}),
|
|
329
|
-
|
|
330
|
-
type:
|
|
614
|
+
z8.object({
|
|
615
|
+
type: z8.literal("workqueue"),
|
|
331
616
|
options: WorkqueueOrDashboardOptions
|
|
332
617
|
}),
|
|
333
|
-
|
|
334
|
-
type:
|
|
618
|
+
z8.object({
|
|
619
|
+
type: z8.literal("dashboard.view"),
|
|
335
620
|
options: WorkqueueOrDashboardOptions
|
|
336
621
|
})
|
|
337
622
|
]);
|
|
338
|
-
var ScopeType2 =
|
|
623
|
+
var ScopeType2 = z8.enum([
|
|
339
624
|
...SystemScopeType.options,
|
|
340
625
|
...RecordScopeTypeV2.options,
|
|
341
626
|
...PlainScopeType.options,
|
|
@@ -350,11 +635,12 @@ var unflattenScope = (input) => {
|
|
|
350
635
|
const { type, ...options } = input;
|
|
351
636
|
return { type, options };
|
|
352
637
|
};
|
|
353
|
-
var EncodedScope2 =
|
|
638
|
+
var EncodedScope2 = z8.string().brand("EncodedScope");
|
|
354
639
|
var encodeScope = (scope) => {
|
|
355
640
|
const flattened = flattenScope(scope);
|
|
356
641
|
return qs.stringify(flattened, {
|
|
357
642
|
arrayFormat: "comma",
|
|
643
|
+
commaRoundTrip: true,
|
|
358
644
|
allowDots: true,
|
|
359
645
|
addQueryPrefix: false,
|
|
360
646
|
encode: false
|
|
@@ -436,4 +722,4 @@ function defineRoles(roles) {
|
|
|
436
722
|
}
|
|
437
723
|
|
|
438
724
|
// src/scopes/index.ts
|
|
439
|
-
|
|
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
|
+
});
|