@opencrvs/toolkit 2.1.0-rc.d13869e → 2.1.0-rc.d235243
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 +23 -5
- 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 +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 +2119 -1321
- 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 +21 -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 +16 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +46 -15
- 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 +634 -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 +5 -9
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +23 -6
- 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 +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 +47 -215
- 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/migrations/v2.2/add-e2e-tests.d.ts +19 -0
- package/dist/migrations/v2.2/add-e2e-tests.d.ts.map +1 -0
- package/dist/migrations/v2.2/add-e2e-tests.js +143 -0
- package/dist/migrations/v2.2/index.d.ts +6 -0
- package/dist/migrations/v2.2/index.d.ts.map +1 -0
- package/dist/migrations/v2.2/index.js +279 -0
- package/dist/migrations/v2.2/template-files.d.ts +8 -0
- package/dist/migrations/v2.2/template-files.d.ts.map +1 -0
- package/dist/migrations/v2.2/template-files.js +49 -0
- package/dist/migrations/v2.2/upgrade-tilt.d.ts +8 -0
- package/dist/migrations/v2.2/upgrade-tilt.d.ts.map +1 -0
- package/dist/migrations/v2.2/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 +25 -12
- package/dist/templates/countryconfig-template/.tiltignore +1 -0
- package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
- package/dist/templates/countryconfig-template/Tiltfile +112 -0
- package/dist/templates/countryconfig-template/assets/README.md +1 -0
- package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
- package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
- package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
- package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
- package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
- package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
- package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
- package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
- package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
- package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
- package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
- package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
- package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
- package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
- package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
- package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
- package/dist/templates/countryconfig-template/e2e/README.md +36 -0
- package/dist/templates/countryconfig-template/e2e/constants.ts +28 -0
- package/dist/templates/countryconfig-template/e2e/login.e2e.ts +59 -0
- package/dist/templates/countryconfig-template/package.json +153 -0
- package/dist/templates/countryconfig-template/playwright.config.ts +42 -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 +159 -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.d235243.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.d13869e.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.runVerifyEndpoints = runVerifyEndpoints;
|
|
46
|
+
/*
|
|
47
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
48
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
49
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
50
|
+
*
|
|
51
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
52
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
53
|
+
*
|
|
54
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
55
|
+
*/
|
|
56
|
+
/* eslint-disable no-console */
|
|
57
|
+
const colors_1 = require("kleur/colors");
|
|
58
|
+
const z = __importStar(require("zod/v4"));
|
|
59
|
+
const csv_1 = require("../csv");
|
|
60
|
+
const template_1 = require("../translations/template");
|
|
61
|
+
const REQUEST_TIMEOUT_MS = 15000;
|
|
62
|
+
/**
|
|
63
|
+
* The country config service listens on port 3040 locally. This command is
|
|
64
|
+
* meant to be run against that instance right after `opencrvs upgrade`, to
|
|
65
|
+
* confirm the upgraded config still exposes the expected endpoints and keeps
|
|
66
|
+
* the secured ones locked down.
|
|
67
|
+
*/
|
|
68
|
+
const DEFAULT_TARGET_URL = 'http://localhost:3040';
|
|
69
|
+
/**
|
|
70
|
+
* Publicly-served endpoints every country config must expose. The client and
|
|
71
|
+
* login apps, and core services, fetch these before or without user
|
|
72
|
+
* authentication, so they must respond with a 2xx status.
|
|
73
|
+
*
|
|
74
|
+
* `/fonts/{filename}` is handled separately: it is public but parameterised
|
|
75
|
+
* with a country-specific filename we cannot know, so we probe a made-up name.
|
|
76
|
+
*/
|
|
77
|
+
const REQUIRED_PUBLIC_ENDPOINTS = [
|
|
78
|
+
{ method: 'GET', path: '/client-config.js' },
|
|
79
|
+
{ method: 'GET', path: '/login-config.js' },
|
|
80
|
+
{ method: 'GET', path: '/handlebars.js' },
|
|
81
|
+
{ method: 'GET', path: '/content/client' },
|
|
82
|
+
{ method: 'GET', path: '/content/login' },
|
|
83
|
+
{ method: 'GET', path: '/content/map.geojson' },
|
|
84
|
+
{ method: 'GET', path: '/content/country-logo' },
|
|
85
|
+
{ method: 'GET', path: '/config/application' },
|
|
86
|
+
{ method: 'GET', path: '/config/workqueues' },
|
|
87
|
+
{ method: 'GET', path: '/config/locations' },
|
|
88
|
+
{ method: 'GET', path: '/config/roles' },
|
|
89
|
+
{ method: 'GET', path: '/config/events' }
|
|
90
|
+
];
|
|
91
|
+
/** Made-up path segment used to probe parameterised routes we can't enumerate. */
|
|
92
|
+
const PROBE_SEGMENT = 'verify-endpoints-probe';
|
|
93
|
+
/**
|
|
94
|
+
* User-notification trigger events. Core forwards an authenticated token to
|
|
95
|
+
* each of these, so a country config must never process them unauthenticated.
|
|
96
|
+
*
|
|
97
|
+
* Kept in sync with `TriggerEvent` in `../commons/notification` by the
|
|
98
|
+
* compile-time guard below.
|
|
99
|
+
*/
|
|
100
|
+
const SECURED_TRIGGER_USER_EVENTS = [
|
|
101
|
+
'user-created',
|
|
102
|
+
'user-updated',
|
|
103
|
+
'username-reminder',
|
|
104
|
+
'reset-password',
|
|
105
|
+
'reset-password-by-admin',
|
|
106
|
+
'password-reset-link',
|
|
107
|
+
'username-reminder-link',
|
|
108
|
+
'resend-invite',
|
|
109
|
+
'2fa',
|
|
110
|
+
'all-user-notification',
|
|
111
|
+
'change-phone-number',
|
|
112
|
+
'change-email-address'
|
|
113
|
+
];
|
|
114
|
+
/**
|
|
115
|
+
* Endpoints that must require authentication. Each must either be absent (404)
|
|
116
|
+
* or reject an unauthenticated request (401/403) — never process it. Paths
|
|
117
|
+
* with `{param}` segments use a throwaway concrete value; authentication is
|
|
118
|
+
* enforced before the handler ever inspects the parameters (so `/certificates`
|
|
119
|
+
* ids and the like do not need to be real).
|
|
120
|
+
*/
|
|
121
|
+
const SECURED_ENDPOINTS = [
|
|
122
|
+
...SECURED_TRIGGER_USER_EVENTS.map((event) => ({
|
|
123
|
+
method: 'POST',
|
|
124
|
+
path: `/trigger/user/${event}`
|
|
125
|
+
})),
|
|
126
|
+
{ method: 'POST', path: '/trigger/telemetry' },
|
|
127
|
+
{ method: 'GET', path: '/trigger/system/ready' },
|
|
128
|
+
{
|
|
129
|
+
method: 'GET',
|
|
130
|
+
path: `/certificates/${PROBE_SEGMENT}`,
|
|
131
|
+
label: '/certificates/{id}'
|
|
132
|
+
},
|
|
133
|
+
{ method: 'GET', path: '/certificates' },
|
|
134
|
+
{ method: 'GET', path: '/config/users' }
|
|
135
|
+
];
|
|
136
|
+
/**
|
|
137
|
+
* Used only when `/config/events` cannot be fetched, so the event action
|
|
138
|
+
* triggers are still checked against their route patterns.
|
|
139
|
+
*/
|
|
140
|
+
const FALLBACK_EVENT_TRIGGERS = [
|
|
141
|
+
{
|
|
142
|
+
method: 'POST',
|
|
143
|
+
path: `/trigger/events/${PROBE_SEGMENT}/actions/${PROBE_SEGMENT}`,
|
|
144
|
+
label: '/trigger/events/{event}/actions/{action}'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
method: 'POST',
|
|
148
|
+
path: `/trigger/events/birth/actions/${PROBE_SEGMENT}`,
|
|
149
|
+
label: '/trigger/events/birth/actions/{action}'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
method: 'POST',
|
|
153
|
+
path: `/trigger/events/death/actions/${PROBE_SEGMENT}`,
|
|
154
|
+
label: '/trigger/events/death/actions/{action}'
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
const isSuccess = (status) => status !== 'error' && status >= 200 && status < 300;
|
|
158
|
+
const requiresAuthOrAbsent = (status) => status === 401 || status === 403 || status === 404;
|
|
159
|
+
/**
|
|
160
|
+
* Issues a single request and returns its HTTP status, or `'error'` when the
|
|
161
|
+
* request could not be completed (DNS failure, connection refused, timeout).
|
|
162
|
+
*/
|
|
163
|
+
function requestStatus(url, method) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
try {
|
|
166
|
+
const response = yield fetch(url, {
|
|
167
|
+
method,
|
|
168
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
169
|
+
// Sent without an Authorization header on purpose. A secured route
|
|
170
|
+
// rejects with 401/403 before ever reading the body.
|
|
171
|
+
headers: method === 'POST' ? { 'Content-Type': 'application/json' } : undefined,
|
|
172
|
+
body: method === 'POST' ? '{}' : undefined
|
|
173
|
+
});
|
|
174
|
+
return response.status;
|
|
175
|
+
}
|
|
176
|
+
catch (_a) {
|
|
177
|
+
return 'error';
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function toEventTriggerConfig(value) {
|
|
182
|
+
if (typeof value !== 'object' || value === null) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
const record = value;
|
|
186
|
+
if (typeof record.id !== 'string') {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
const actions = Array.isArray(record.actions)
|
|
190
|
+
? Array.from(new Set(record.actions
|
|
191
|
+
.map((action) => {
|
|
192
|
+
if (typeof action !== 'object' || action === null) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
const type = action.type;
|
|
196
|
+
return typeof type === 'string' ? type : null;
|
|
197
|
+
})
|
|
198
|
+
.filter((type) => type !== null)))
|
|
199
|
+
: [];
|
|
200
|
+
return { id: record.id, actions };
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Fetches the event configuration so the event action triggers can be checked
|
|
204
|
+
* against the real event ids and action types. Returns `null` if the endpoint
|
|
205
|
+
* is unreachable or does not return the expected shape.
|
|
206
|
+
*/
|
|
207
|
+
function fetchEventConfigs(baseUrl) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
try {
|
|
210
|
+
const response = yield fetch(`${baseUrl}/config/events`, {
|
|
211
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
212
|
+
});
|
|
213
|
+
if (!response.ok) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
const body = yield response.json();
|
|
217
|
+
if (!Array.isArray(body)) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
return body
|
|
221
|
+
.map(toEventTriggerConfig)
|
|
222
|
+
.filter((config) => config !== null);
|
|
223
|
+
}
|
|
224
|
+
catch (_a) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Normalises the CLI argument into a base URL. Accepts either a bare domain
|
|
231
|
+
* (`example.org`, assumed https) or a full URL, and strips any trailing slash.
|
|
232
|
+
*/
|
|
233
|
+
function resolveBaseUrl(input) {
|
|
234
|
+
const withProtocol = /^https?:\/\//i.test(input) ? input : `https://${input}`;
|
|
235
|
+
return withProtocol.replace(/\/+$/, '');
|
|
236
|
+
}
|
|
237
|
+
function describeStatus(status) {
|
|
238
|
+
return status === 'error' ? 'no response' : `HTTP ${status}`;
|
|
239
|
+
}
|
|
240
|
+
function endpointLabel(check) {
|
|
241
|
+
var _a;
|
|
242
|
+
const shown = (_a = check.label) !== null && _a !== void 0 ? _a : check.path;
|
|
243
|
+
const suffix = check.label ? (0, colors_1.dim)(` → ${check.path}`) : '';
|
|
244
|
+
return `${check.method} ${shown}${suffix}`;
|
|
245
|
+
}
|
|
246
|
+
function line(ok, label, detail) {
|
|
247
|
+
const mark = ok ? (0, colors_1.green)('✓') : (0, colors_1.red)('✗');
|
|
248
|
+
return ` ${mark} ${label} ${(0, colors_1.dim)(`(${detail})`)}`;
|
|
249
|
+
}
|
|
250
|
+
function securedDetail(status) {
|
|
251
|
+
if (status === 401 || status === 403) {
|
|
252
|
+
return `${describeStatus(status)} — auth required`;
|
|
253
|
+
}
|
|
254
|
+
if (status === 404) {
|
|
255
|
+
return `${describeStatus(status)} — not implemented`;
|
|
256
|
+
}
|
|
257
|
+
if (status === 'error') {
|
|
258
|
+
return `${describeStatus(status)} — request failed`;
|
|
259
|
+
}
|
|
260
|
+
return `${describeStatus(status)} — INSECURE: ensure this endpoint requires authentication!`;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The version of the country config template to check against. Bump it with
|
|
264
|
+
* the toolkit's own major.minor: a toolkit release checks that a country config
|
|
265
|
+
* serves the copy core requires *at that version*, which is the same template
|
|
266
|
+
* the `add-translations` codemod adds rows from.
|
|
267
|
+
*/
|
|
268
|
+
const TEMPLATE_VERSION = '2.1';
|
|
269
|
+
/** The translation bundles a country config serves, one per CSV file core owns. */
|
|
270
|
+
const TRANSLATED_APPLICATIONS = ['client', 'login'];
|
|
271
|
+
function readTemplateTranslations(contents) {
|
|
272
|
+
const lines = contents.replace(/\r?\n$/, '').split(/\r?\n/);
|
|
273
|
+
return {
|
|
274
|
+
ids: lines
|
|
275
|
+
.slice(1)
|
|
276
|
+
.filter((line) => line !== '')
|
|
277
|
+
.map(csv_1.idOf),
|
|
278
|
+
languages: (0, csv_1.parseCsvLine)(lines[0]).filter((column) => column !== 'id' && column !== 'description')
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* What `GET /content/{application}` answers with: one entry per language, each
|
|
283
|
+
* carrying every message id that language has copy for.
|
|
284
|
+
*
|
|
285
|
+
* Parsed rather than cast, because the whole check turns on which ids are
|
|
286
|
+
* present — a bundle that is not this shape cannot be read as "the id is
|
|
287
|
+
* missing", and reporting it as such would be a false failure.
|
|
288
|
+
*/
|
|
289
|
+
const ServedTranslations = z.object({
|
|
290
|
+
languages: z.array(z.object({
|
|
291
|
+
lang: z.string(),
|
|
292
|
+
messages: z.record(z.string(), z.string())
|
|
293
|
+
}))
|
|
294
|
+
});
|
|
295
|
+
/**
|
|
296
|
+
* The bundle `GET /content/{application}` serves, or `null` when it cannot be
|
|
297
|
+
* read. An unreachable endpoint is already a failure in the public-endpoints
|
|
298
|
+
* section above, so it is not counted twice here.
|
|
299
|
+
*/
|
|
300
|
+
function fetchServedTranslations(baseUrl, application) {
|
|
301
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
302
|
+
try {
|
|
303
|
+
const response = yield fetch(`${baseUrl}/content/${application}`, {
|
|
304
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
305
|
+
});
|
|
306
|
+
if (!response.ok) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
const parsed = ServedTranslations.safeParse(yield response.json());
|
|
310
|
+
return parsed.success ? parsed.data.languages : null;
|
|
311
|
+
}
|
|
312
|
+
catch (_a) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/** How many missing ids to print before summarising the rest. */
|
|
318
|
+
const MISSING_IDS_SHOWN = 10;
|
|
319
|
+
/**
|
|
320
|
+
* Checks that every message id the country config template carries is served
|
|
321
|
+
* by the running country config.
|
|
322
|
+
*
|
|
323
|
+
* This is the API-side half of the translation checks: which files the copy is
|
|
324
|
+
* kept in, and what shape they are, is the country config's own business — this
|
|
325
|
+
* only asks whether the copy core needs comes back out of `/content/*`. A
|
|
326
|
+
* country config checks its *own* messages against its *own* files itself; see
|
|
327
|
+
* `check-translations.ts` in the country config template.
|
|
328
|
+
*
|
|
329
|
+
* An id is looked for across every language served rather than in one of them:
|
|
330
|
+
* a row in a CSV yields an entry under each of that file's language columns, so
|
|
331
|
+
* absent everywhere means absent from the files. Whether the copy is written is
|
|
332
|
+
* a separate matter, and an empty cell is legitimate — the template itself ships
|
|
333
|
+
* a few.
|
|
334
|
+
*
|
|
335
|
+
* Returns the number of failures.
|
|
336
|
+
*/
|
|
337
|
+
function verifyTranslations(baseUrl) {
|
|
338
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
let refs;
|
|
340
|
+
try {
|
|
341
|
+
refs = yield (0, template_1.candidateRefs)(TEMPLATE_VERSION);
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
console.log(' ' +
|
|
345
|
+
(0, colors_1.yellow)(`Could not list the ${TEMPLATE_VERSION} refs on GitHub (${error.message}); translations not checked.`));
|
|
346
|
+
return 0;
|
|
347
|
+
}
|
|
348
|
+
let failures = 0;
|
|
349
|
+
for (const application of TRANSLATED_APPLICATIONS) {
|
|
350
|
+
const endpoint = `GET /content/${application}`;
|
|
351
|
+
let fetched;
|
|
352
|
+
try {
|
|
353
|
+
fetched = yield (0, template_1.fetchTemplate)(refs, application);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
console.log(' ' +
|
|
357
|
+
(0, colors_1.yellow)(`Could not read ${application}.csv from the country config template on GitHub (${error.message}); ${endpoint} not checked.`));
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (!fetched) {
|
|
361
|
+
console.log(' ' +
|
|
362
|
+
(0, colors_1.yellow)(`No ${application}.csv in the ${TEMPLATE_VERSION} country config template on GitHub; ${endpoint} not checked.`));
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const template = readTemplateTranslations(fetched.contents);
|
|
366
|
+
const served = yield fetchServedTranslations(baseUrl, application);
|
|
367
|
+
if (!served) {
|
|
368
|
+
console.log(' ' + (0, colors_1.yellow)(`Could not read ${endpoint}; translations not checked.`));
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
const servedIds = new Set(served.flatMap(({ messages }) => Object.keys(messages)));
|
|
372
|
+
const missing = template.ids.filter((id) => !servedIds.has(id));
|
|
373
|
+
const servedLanguages = new Set(served.map(({ lang }) => lang));
|
|
374
|
+
const absentLanguages = template.languages.filter((lang) => !servedLanguages.has(lang));
|
|
375
|
+
if (missing.length === 0) {
|
|
376
|
+
console.log(line(true, endpoint, `all ${template.ids.length} id(s) from the ${fetched.ref} template served`));
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
failures++;
|
|
380
|
+
console.log(line(false, endpoint, `${missing.length} of ${template.ids.length} id(s) from the ${fetched.ref} template not served`));
|
|
381
|
+
for (const id of missing.slice(0, MISSING_IDS_SHOWN)) {
|
|
382
|
+
console.log(` ${(0, colors_1.dim)(id)}`);
|
|
383
|
+
}
|
|
384
|
+
if (missing.length > MISSING_IDS_SHOWN) {
|
|
385
|
+
console.log(` ${(0, colors_1.dim)(`… and ${missing.length - MISSING_IDS_SHOWN} more`)}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// A country dropping a language the template ships is its own decision, so
|
|
389
|
+
// this is worth saying but is not a failure.
|
|
390
|
+
if (absentLanguages.length > 0) {
|
|
391
|
+
console.log(' ' +
|
|
392
|
+
(0, colors_1.yellow)(`${application}: the template carries ${absentLanguages.join(', ')}, which this country config does not serve.`));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return failures;
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function runVerifyEndpoints() {
|
|
399
|
+
return __awaiter(this, arguments, void 0, function* (target = DEFAULT_TARGET_URL) {
|
|
400
|
+
const baseUrl = resolveBaseUrl(target);
|
|
401
|
+
console.log((0, colors_1.bold)(`Verifying country config endpoints at ${baseUrl}\n`));
|
|
402
|
+
let failures = 0;
|
|
403
|
+
console.log((0, colors_1.bold)('Required public endpoints (must respond 2xx):'));
|
|
404
|
+
for (const check of REQUIRED_PUBLIC_ENDPOINTS) {
|
|
405
|
+
const status = yield requestStatus(`${baseUrl}${check.path}`, check.method);
|
|
406
|
+
const ok = isSuccess(status);
|
|
407
|
+
if (!ok) {
|
|
408
|
+
failures++;
|
|
409
|
+
}
|
|
410
|
+
const detail = status === 404
|
|
411
|
+
? `${describeStatus(status)} — missing`
|
|
412
|
+
: ok
|
|
413
|
+
? describeStatus(status)
|
|
414
|
+
: `${describeStatus(status)} — unexpected`;
|
|
415
|
+
console.log(line(ok, endpointLabel(check), detail));
|
|
416
|
+
}
|
|
417
|
+
// `/fonts/{filename}` is public but the filename is country-specific and
|
|
418
|
+
// cannot be automated, so we probe a made-up name. A registered public route
|
|
419
|
+
// returns 404 (file not found) or 200 (if the name happens to exist); either
|
|
420
|
+
// is acceptable. 401/403 would mean the route was wrongly put behind auth.
|
|
421
|
+
{
|
|
422
|
+
const path = `/fonts/${PROBE_SEGMENT}.ttf`;
|
|
423
|
+
const status = yield requestStatus(`${baseUrl}${path}`, 'GET');
|
|
424
|
+
const ok = status === 200 || status === 404;
|
|
425
|
+
if (!ok) {
|
|
426
|
+
failures++;
|
|
427
|
+
}
|
|
428
|
+
let detail;
|
|
429
|
+
if (status === 404) {
|
|
430
|
+
detail = `${describeStatus(status)} — reachable (made-up filename)`;
|
|
431
|
+
}
|
|
432
|
+
else if (status === 200) {
|
|
433
|
+
detail = describeStatus(status);
|
|
434
|
+
}
|
|
435
|
+
else if (status === 401 || status === 403) {
|
|
436
|
+
detail = `${describeStatus(status)} — must be public`;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
detail = `${describeStatus(status)} — unexpected`;
|
|
440
|
+
}
|
|
441
|
+
console.log(line(ok, `GET /fonts/{filename}${(0, colors_1.dim)(` → ${path}`)}`, detail));
|
|
442
|
+
}
|
|
443
|
+
console.log();
|
|
444
|
+
console.log((0, colors_1.bold)('Secured endpoints (must be absent or require auth):'));
|
|
445
|
+
for (const check of SECURED_ENDPOINTS) {
|
|
446
|
+
const status = yield requestStatus(`${baseUrl}${check.path}`, check.method);
|
|
447
|
+
const ok = requiresAuthOrAbsent(status);
|
|
448
|
+
if (!ok) {
|
|
449
|
+
failures++;
|
|
450
|
+
}
|
|
451
|
+
console.log(line(ok, endpointLabel(check), securedDetail(status)));
|
|
452
|
+
}
|
|
453
|
+
console.log();
|
|
454
|
+
console.log((0, colors_1.bold)('Event action triggers (must be absent or require auth):'));
|
|
455
|
+
const events = yield fetchEventConfigs(baseUrl);
|
|
456
|
+
if (!events) {
|
|
457
|
+
console.log(' ' +
|
|
458
|
+
(0, colors_1.yellow)('Could not read /config/events; falling back to route-pattern checks.'));
|
|
459
|
+
for (const check of FALLBACK_EVENT_TRIGGERS) {
|
|
460
|
+
const status = yield requestStatus(`${baseUrl}${check.path}`, check.method);
|
|
461
|
+
const ok = requiresAuthOrAbsent(status);
|
|
462
|
+
if (!ok) {
|
|
463
|
+
failures++;
|
|
464
|
+
}
|
|
465
|
+
console.log(line(ok, endpointLabel(check), securedDetail(status)));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
else if (events.length === 0) {
|
|
469
|
+
console.log(' ' + (0, colors_1.yellow)('No events configured.'));
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
for (const event of events) {
|
|
473
|
+
// Fall back to a made-up action when an event declares none, so the
|
|
474
|
+
// route is still exercised.
|
|
475
|
+
const actions = event.actions.length ? event.actions : [PROBE_SEGMENT];
|
|
476
|
+
const failed = [];
|
|
477
|
+
for (const action of actions) {
|
|
478
|
+
const status = yield requestStatus(`${baseUrl}/trigger/events/${event.id}/actions/${action}`, 'POST');
|
|
479
|
+
if (!requiresAuthOrAbsent(status)) {
|
|
480
|
+
failed.push({ action, status });
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
const pattern = `POST /trigger/events/${event.id}/actions/{action}`;
|
|
484
|
+
if (failed.length === 0) {
|
|
485
|
+
console.log(line(true, pattern, `${actions.length} action(s) — all require auth`));
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
for (const failure of failed) {
|
|
489
|
+
failures++;
|
|
490
|
+
console.log(line(false, `POST /trigger/events/${event.id}/actions/${failure.action}`, securedDetail(failure.status)));
|
|
491
|
+
}
|
|
492
|
+
const okCount = actions.length - failed.length;
|
|
493
|
+
if (okCount > 0) {
|
|
494
|
+
console.log(line(true, pattern, `${okCount} other action(s) require auth`));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
console.log();
|
|
500
|
+
console.log((0, colors_1.bold)('Translations served (must cover the copy core requires):'));
|
|
501
|
+
failures += yield verifyTranslations(baseUrl);
|
|
502
|
+
console.log();
|
|
503
|
+
if (failures > 0) {
|
|
504
|
+
console.log((0, colors_1.red)((0, colors_1.bold)(`✗ ${failures} check(s) failed.`)) +
|
|
505
|
+
(0, colors_1.yellow)(' See the lines marked ✗ above.'));
|
|
506
|
+
process.exit(1);
|
|
507
|
+
}
|
|
508
|
+
console.log((0, colors_1.green)((0, colors_1.bold)('✓ All endpoint checks passed.')));
|
|
509
|
+
});
|
|
510
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencrvs/toolkit",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.d235243",
|
|
4
4
|
"description": "OpenCRVS toolkit for building country configurations",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -11,14 +11,18 @@
|
|
|
11
11
|
"./api": "./dist/api/index.js",
|
|
12
12
|
"./application-config": "./dist/application-config/index.js",
|
|
13
13
|
"./events": "./dist/events/index.js",
|
|
14
|
+
"./telemetry": "./dist/telemetry/index.js",
|
|
14
15
|
"./scopes": "./dist/scopes/index.js",
|
|
16
|
+
"./authentication": "./dist/authentication/index.js",
|
|
15
17
|
"./events/deduplication": "./dist/events/deduplication.js",
|
|
16
18
|
"./conditionals": "./dist/conditionals/index.js",
|
|
17
19
|
"./notification": "./dist/notification/index.js"
|
|
18
20
|
},
|
|
19
21
|
"scripts": {
|
|
20
22
|
"build": "./build.sh",
|
|
21
|
-
"build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit"
|
|
23
|
+
"build:all": "pnpm -w exec lerna run build --include-dependencies --scope @opencrvs/toolkit",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:compilation": "tsc --noEmit"
|
|
22
26
|
},
|
|
23
27
|
"repository": {
|
|
24
28
|
"type": "git",
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
"@inquirer/prompts": "^8.3.0",
|
|
29
33
|
"@octokit/core": "4.2.1",
|
|
30
34
|
"@trpc/client": "11.4.3",
|
|
31
|
-
"@trpc/server": "
|
|
35
|
+
"@trpc/server": "11.8.0",
|
|
32
36
|
"ajv": "^8.17.1",
|
|
33
37
|
"ajv-formats": "^3.0.1",
|
|
34
38
|
"date-fns": "^2.28.0",
|
|
@@ -41,25 +45,27 @@
|
|
|
41
45
|
"libsodium-wrappers": "^0.7.13",
|
|
42
46
|
"lodash": "^4.17.10",
|
|
43
47
|
"object-hash": "^3.0.0",
|
|
48
|
+
"pino": "^7.0.0",
|
|
44
49
|
"prompts": "^2.4.2",
|
|
45
50
|
"qs": "6.15.2",
|
|
46
51
|
"ssh2": "^1.17.0",
|
|
47
52
|
"superjson": "1.9.0-0",
|
|
48
53
|
"ts-morph": "^27.0.2",
|
|
49
54
|
"uuid": "^9.0.0",
|
|
50
|
-
"zod": "^4.
|
|
55
|
+
"zod": "^4.4.3",
|
|
51
56
|
"zod-openapi": "^5.4.6"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|
|
54
|
-
"@opencrvs/commons": "
|
|
55
|
-
"@opencrvs/events": "
|
|
59
|
+
"@opencrvs/commons": "workspace:*",
|
|
60
|
+
"@opencrvs/events": "workspace:*",
|
|
56
61
|
"@types/js-yaml": "4.0.9",
|
|
57
62
|
"@types/libsodium-wrappers": "^0.7.10",
|
|
58
63
|
"@types/object-hash": "^3.0.6",
|
|
59
64
|
"@types/prompts": "^2.4.9",
|
|
60
65
|
"@types/ssh2": "^1.15.5",
|
|
61
66
|
"@types/uuid": "^9.0.3",
|
|
62
|
-
"esbuild": "^0.24.0"
|
|
67
|
+
"esbuild": "^0.24.0",
|
|
68
|
+
"vitest": "^4.1.10"
|
|
63
69
|
},
|
|
64
70
|
"moduleNameMapper": {
|
|
65
71
|
"@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "tsconfig.build.tsbuildinfo"
|
|
5
|
+
},
|
|
6
|
+
// `references` is not inherited through `extends`, so it is repeated here.
|
|
7
|
+
// Without it the commons sources resolve through `paths` instead of the built
|
|
8
|
+
// project, and every one of them trips the rootDir check.
|
|
9
|
+
"references": [{ "path": "../commons/tsconfig-commonjs.json" }],
|
|
10
|
+
"exclude": ["**/node_modules/**", "dist", "**/*.test.ts"]
|
|
11
|
+
}
|