@opencrvs/toolkit 2.1.0-rc.12673aa → 2.1.0-rc.14fb6a5
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/build.sh +14 -4
- package/create-countryconfig/index.js +59 -30
- package/dist/application-config/index.js +26 -13
- package/dist/authentication/index.d.ts +8 -9
- package/dist/authentication/index.js +23 -8
- package/dist/cli.js +2268 -1385
- package/dist/commons/api/router.d.ts +252 -290
- 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 +18 -3
- package/dist/commons/events/ActionConfig.d.ts +5 -14
- package/dist/commons/events/ActionDocument.d.ts +30 -4
- package/dist/commons/events/AdvancedSearchConfig.d.ts +24 -12
- package/dist/commons/events/AuditLog.d.ts +1 -0
- package/dist/commons/events/Draft.d.ts +1 -21
- package/dist/commons/events/EventDocument.d.ts +4 -4
- package/dist/commons/events/FieldConfig.d.ts +20 -10
- package/dist/commons/events/FieldTypeMapping.d.ts +10 -10
- package/dist/commons/events/FieldValue.d.ts +1 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/scopes.d.ts +21 -1
- package/dist/commons/events/test.utils.d.ts +53 -21
- package/dist/commons/events/utils.d.ts +26 -2
- package/dist/conditionals/index.js +21 -7
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +2 -1
- 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 +586 -569
- package/dist/environment/swarm-to-k8s.js +3 -4
- package/dist/events/index.js +282 -138
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +4 -4
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -1
- package/dist/migrations/v2.1/add-translations.js +4 -68
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -1
- package/dist/migrations/v2.1/enable-telemetry.js +30 -13
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +927 -33
- 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/rename-api-paths.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 +105 -61
- package/dist/scopes/index.d.ts +288 -5
- package/dist/scopes/index.js +22 -7
- package/dist/telemetry/index.js +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +6 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +6 -0
- package/dist/templates/charts-values/opentelemetry/values.yaml +7 -0
- 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/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.map +1 -1
- package/dist/verify/endpoints.js +179 -14
- package/opencrvs-toolkit-2.1.0-rc.14fb6a5.tgz +0 -0
- package/package.json +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- 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 +0 -3
- 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/translations/check.d.ts +0 -21
- package/dist/translations/check.d.ts.map +0 -1
- package/dist/translations/check.js +0 -132
- package/opencrvs-toolkit-2.1.0-rc.12673aa.tgz +0 -0
package/build.sh
CHANGED
|
@@ -20,7 +20,7 @@ npx tsc --build tsconfig.build.json
|
|
|
20
20
|
npx esbuild src/events/index.ts --bundle --format=cjs --outdir=./dist/events --allow-overwrite --packages=external
|
|
21
21
|
|
|
22
22
|
# Build telemetry client (self-contained; .d.ts comes from tsc --build above)
|
|
23
|
-
npx esbuild src/telemetry/index.ts --bundle --format=cjs --outdir=./dist/telemetry --allow-overwrite --packages=external
|
|
23
|
+
npx esbuild src/telemetry/index.ts --bundle --platform=node --format=cjs --outdir=./dist/telemetry --allow-overwrite --packages=external
|
|
24
24
|
mkdir -p ./dist/commons/events
|
|
25
25
|
cp -r ../commons/build/dist/common/events/*.d.ts ./dist/commons/events
|
|
26
26
|
mkdir -p ./dist/commons/events/state
|
|
@@ -49,7 +49,7 @@ npx esbuild src/events/deduplication.ts --bundle --format=cjs --outdir=./dist/ev
|
|
|
49
49
|
cp -r ../commons/build/dist/common/events/deduplication.d.ts ./dist/events/deduplication.d.ts
|
|
50
50
|
|
|
51
51
|
# Build common notifications
|
|
52
|
-
npx esbuild src/notification/index.ts --bundle --format=cjs --outdir=./dist/notification --allow-overwrite --packages=external
|
|
52
|
+
npx esbuild src/notification/index.ts --bundle --platform=node --format=cjs --outdir=./dist/notification --allow-overwrite --packages=external
|
|
53
53
|
mkdir -p ./dist/commons/notification
|
|
54
54
|
cp -r ../commons/build/dist/common/notification/*.d.ts ./dist/commons/notification
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ mkdir -p ./dist/commons/application-config
|
|
|
59
59
|
cp -r ../commons/build/dist/common/application-config.d.ts ./dist/commons/application-config/index.d.ts
|
|
60
60
|
|
|
61
61
|
# Build migration CLI
|
|
62
|
-
npx esbuild src/migrations/v2.1/index.ts --bundle --format=cjs --outdir=./dist/migrations/v2.1 --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
|
|
62
|
+
npx esbuild src/migrations/v2.1/index.ts --bundle --platform=node --format=cjs --outdir=./dist/migrations/v2.1 --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
|
|
63
63
|
chmod +x ./dist/migrations/v2.1/index.js
|
|
64
64
|
|
|
65
65
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
@@ -71,8 +71,18 @@ else
|
|
|
71
71
|
fi
|
|
72
72
|
|
|
73
73
|
# Build CLI
|
|
74
|
-
npx esbuild src/cli.ts --bundle --format=cjs --outdir=./dist --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
|
|
74
|
+
npx esbuild src/cli.ts --bundle --platform=node --format=cjs --outdir=./dist --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
|
|
75
75
|
cp -R src/environment/templates dist/templates
|
|
76
|
+
# Template files copied into country configs by the upgrade-tilt and
|
|
77
|
+
# migrate-infrastructure-to-assets codemods. Image builds that use the toolkit as
|
|
78
|
+
# a library (testland, mosip-api) do not copy the template in and do not need them.
|
|
79
|
+
TEMPLATE_DIR=../countryconfig-template
|
|
80
|
+
if [ -d "$TEMPLATE_DIR" ]; then
|
|
81
|
+
mkdir -p dist/templates/countryconfig-template
|
|
82
|
+
cp -R $TEMPLATE_DIR/Tiltfile $TEMPLATE_DIR/.tiltignore $TEMPLATE_DIR/tilt $TEMPLATE_DIR/assets $TEMPLATE_DIR/Dockerfile.assets dist/templates/countryconfig-template/
|
|
83
|
+
else
|
|
84
|
+
echo "$TEMPLATE_DIR not found, 'opencrvs upgrade' will not be able to copy the template files"
|
|
85
|
+
fi
|
|
76
86
|
chmod +x ./dist/cli.js
|
|
77
87
|
|
|
78
88
|
echo "Build completed successfully."
|
|
@@ -96,27 +96,29 @@ function getLatestCommonReleaseTag() {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* version (stripped of the "-rc.<sha>" suffix) tells apart two different
|
|
103
|
-
* situations: an RC for a version already being stabilized on its own
|
|
104
|
-
* "release/X.Y.Z" branch (e.g. "2.0.1-rc.*" while a patch release is in
|
|
105
|
-
* progress) versus an RC for a version that hasn't been branched off yet and
|
|
106
|
-
* only exists on develop (e.g. "2.1.0-rc.*" while that release branch hasn't
|
|
107
|
-
* been cut). Scaffold from the release branch when it exists in both
|
|
108
|
-
* repositories, otherwise fall back to develop.
|
|
99
|
+
* Resolves the ref that both repositories are cloned from. A single ref
|
|
100
|
+
* clones both, so every candidate must exist in *both* - a tag present in
|
|
101
|
+
* only one of them can't be used.
|
|
109
102
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
103
|
+
* The exact "v<version>" tag wins whenever it exists: it pins a commit, so
|
|
104
|
+
* a release, an explicit `@X.Y.Z` pin, or a blessed prerelease (npm `@beta`,
|
|
105
|
+
* published from that tag) reproduces however late it's scaffolded.
|
|
106
|
+
*
|
|
107
|
+
* Otherwise a prerelease falls back to a branch, since a rolling release
|
|
108
|
+
* candidate (npm `@next`) is never tagged: "release/X.Y.Z" of the base
|
|
109
|
+
* version when that release has been cut, otherwise develop. A release
|
|
110
|
+
* falls back to the highest tag common to both repositories - never a
|
|
111
|
+
* mismatched pairing of the two at different releases - or errors.
|
|
118
112
|
*/
|
|
119
113
|
function resolveRef() {
|
|
114
|
+
const versionTag = 'v' + version
|
|
115
|
+
if (
|
|
116
|
+
tagExists(CORE_REPO_URL, versionTag) &&
|
|
117
|
+
tagExists(INFRASTRUCTURE_REPO_URL, versionTag)
|
|
118
|
+
) {
|
|
119
|
+
return versionTag
|
|
120
|
+
}
|
|
121
|
+
|
|
120
122
|
if (version.includes('-')) {
|
|
121
123
|
const releaseBranch = 'release/' + version.split('-')[0]
|
|
122
124
|
if (
|
|
@@ -128,19 +130,11 @@ function resolveRef() {
|
|
|
128
130
|
return 'develop'
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
const tag = 'v' + version
|
|
132
|
-
if (
|
|
133
|
-
tagExists(CORE_REPO_URL, tag) &&
|
|
134
|
-
tagExists(INFRASTRUCTURE_REPO_URL, tag)
|
|
135
|
-
) {
|
|
136
|
-
return tag
|
|
137
|
-
}
|
|
138
|
-
|
|
139
133
|
const latestCommonTag = getLatestCommonReleaseTag()
|
|
140
134
|
if (latestCommonTag) {
|
|
141
135
|
console.warn(
|
|
142
136
|
'\nWarning: tag "' +
|
|
143
|
-
|
|
137
|
+
versionTag +
|
|
144
138
|
'" was not found in both repositories; falling back to the latest ' +
|
|
145
139
|
'available release, ' +
|
|
146
140
|
latestCommonTag +
|
|
@@ -162,13 +156,43 @@ function resolveRef() {
|
|
|
162
156
|
* @param {*} param0 repository - The repository to clone (e.g., 'opencrvs/opencrvs-core').
|
|
163
157
|
* @param {*} param0 repositorySubPath - The subpath within the repository to clone (optional). Otherwise the entire repository will be cloned.
|
|
164
158
|
* @param {*} param0 branch - The branch to clone (optional). Defaults to the default branch if not specified.
|
|
159
|
+
* @param {*} param0 keepHistory - Keep the repository's git history instead of degit's usual history-free copy (optional, defaults to false). The cloned "origin" remote is replaced with "upstream", leaving the directory ready for the user to add their own fork/repo as "origin". Not supported together with repositorySubPath, since a plain git clone can't fetch a single subdirectory.
|
|
165
160
|
*
|
|
166
161
|
* @param {*} targetDir - The target directory where the repository will be cloned.
|
|
167
162
|
*/
|
|
168
163
|
async function cloneRepository(
|
|
169
|
-
{ repository, repositorySubPath, branch },
|
|
164
|
+
{ repository, repositorySubPath, branch, keepHistory = false },
|
|
170
165
|
targetDir
|
|
171
166
|
) {
|
|
167
|
+
if (keepHistory && repositorySubPath) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
'cloneRepository: keepHistory is not supported together with repositorySubPath.'
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (keepHistory) {
|
|
174
|
+
const repoUrl = `https://github.com/${repository}.git`
|
|
175
|
+
console.log(
|
|
176
|
+
`Cloning repository from ${repoUrl}#${branch} to ${targetDir}...`
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
execSync('git clone --branch ' + branch + ' ' + repoUrl + ' ' + targetDir, {
|
|
180
|
+
stdio: 'inherit'
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
console.log(
|
|
184
|
+
`Copied files from ${repoUrl}#${branch} to ${targetDir} succesfully.`
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
console.log(`Replacing 'origin' remote with 'upstream' in ${targetDir}...`)
|
|
188
|
+
execSync('git remote remove origin', { cwd: targetDir, stdio: 'inherit' })
|
|
189
|
+
execSync('git remote add upstream ' + repoUrl, {
|
|
190
|
+
cwd: targetDir,
|
|
191
|
+
stdio: 'inherit'
|
|
192
|
+
})
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
172
196
|
const repositoryPath = joinValues([repository, repositorySubPath], '/')
|
|
173
197
|
const fullPath = joinValues([repositoryPath, branch], '#')
|
|
174
198
|
|
|
@@ -424,7 +448,7 @@ async function main() {
|
|
|
424
448
|
|
|
425
449
|
try {
|
|
426
450
|
await cloneRepository(
|
|
427
|
-
{ repository: INFRASTRUCTURE_REPOSITORY, branch: ref },
|
|
451
|
+
{ repository: INFRASTRUCTURE_REPOSITORY, branch: ref, keepHistory: true },
|
|
428
452
|
infrastructureTargetPath
|
|
429
453
|
)
|
|
430
454
|
} catch (err) {
|
|
@@ -450,7 +474,12 @@ async function main() {
|
|
|
450
474
|
console.log(' tilt up\n')
|
|
451
475
|
console.log('To get started with the infrastructure:\n')
|
|
452
476
|
console.log(' cd ' + infrastructureDirName)
|
|
453
|
-
console.log(' git
|
|
477
|
+
console.log(' git remote add origin <your-infrastructure-repo-url>')
|
|
478
|
+
console.log(' git push -u origin ' + ref + '\n')
|
|
479
|
+
console.log(
|
|
480
|
+
'The "upstream" remote points at the official infrastructure repository, ' +
|
|
481
|
+
'so you can pull future releases with `git fetch upstream`.\n'
|
|
482
|
+
)
|
|
454
483
|
}
|
|
455
484
|
|
|
456
485
|
main()
|
|
@@ -331,8 +331,9 @@ var TextValue = z7.string();
|
|
|
331
331
|
var HiddenFieldValue = z7.string();
|
|
332
332
|
var NonEmptyTextValue = z7.string().trim().min(1);
|
|
333
333
|
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
334
|
+
var AGE_MAX_VALUE = 999;
|
|
334
335
|
var AgeValue = z7.object({
|
|
335
|
-
age: z7.number(),
|
|
336
|
+
age: z7.number().int().min(0).max(AGE_MAX_VALUE),
|
|
336
337
|
asOfDateRef: z7.string()
|
|
337
338
|
});
|
|
338
339
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
@@ -719,7 +720,9 @@ var RecordScopeTypeV2 = z13.enum([
|
|
|
719
720
|
"record.request-correction",
|
|
720
721
|
"record.correct",
|
|
721
722
|
"record.unassign-others",
|
|
722
|
-
"record.custom-action"
|
|
723
|
+
"record.custom-action",
|
|
724
|
+
"record.action.accept",
|
|
725
|
+
"record.action.reject"
|
|
723
726
|
]);
|
|
724
727
|
var PlainScopeType = z13.enum([
|
|
725
728
|
// Misc. system scopes
|
|
@@ -741,10 +744,7 @@ var PlainScopeType = z13.enum([
|
|
|
741
744
|
// Performance dashboard
|
|
742
745
|
"performance.read",
|
|
743
746
|
"performance.read-dashboards",
|
|
744
|
-
"performance.vital-statistics-export"
|
|
745
|
-
// Scopes used exclusively by countryconfig integration token
|
|
746
|
-
"record.confirm-registration",
|
|
747
|
-
"record.reject-registration"
|
|
747
|
+
"performance.vital-statistics-export"
|
|
748
748
|
]);
|
|
749
749
|
var scopeByEvent = z13.preprocess(
|
|
750
750
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -762,7 +762,9 @@ var userRole = z13.preprocess(
|
|
|
762
762
|
).describe("User role, e.g. admin, field agent");
|
|
763
763
|
var scopeOptionsPlaceEvent = z13.object({
|
|
764
764
|
event: scopeByEvent,
|
|
765
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
765
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
766
|
+
createdBy: UserFilter.optional(),
|
|
767
|
+
createdIn: JurisdictionFilter.optional()
|
|
766
768
|
}).describe("Options applicable to all record scopes.");
|
|
767
769
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
768
770
|
notifiedIn: JurisdictionFilter.optional(),
|
|
@@ -805,7 +807,9 @@ var AllScopeOptions = z13.object({
|
|
|
805
807
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
806
808
|
var ResolvedScopeOptionsPlaceEvent = z13.object({
|
|
807
809
|
event: scopeByEvent,
|
|
808
|
-
placeOfEvent: UUID.nullish()
|
|
810
|
+
placeOfEvent: UUID.nullish(),
|
|
811
|
+
createdBy: z13.string().optional(),
|
|
812
|
+
createdIn: UUID.nullish()
|
|
809
813
|
}).describe(
|
|
810
814
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
811
815
|
);
|
|
@@ -852,6 +856,13 @@ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
|
852
856
|
"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."
|
|
853
857
|
)
|
|
854
858
|
});
|
|
859
|
+
var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
|
|
860
|
+
"record.action.accept",
|
|
861
|
+
"record.action.reject"
|
|
862
|
+
]);
|
|
863
|
+
var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
|
|
864
|
+
"Options for confirming (accepting or rejecting) an action."
|
|
865
|
+
);
|
|
855
866
|
var RecordScopeV2 = z13.discriminatedUnion("type", [
|
|
856
867
|
z13.object({
|
|
857
868
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -872,6 +883,10 @@ var RecordScopeV2 = z13.discriminatedUnion("type", [
|
|
|
872
883
|
z13.object({
|
|
873
884
|
type: z13.literal("record.print-certified-copies"),
|
|
874
885
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
886
|
+
}),
|
|
887
|
+
z13.object({
|
|
888
|
+
type: ActionConfirmationScopeType,
|
|
889
|
+
options: ActionConfirmationScopeOptions.optional()
|
|
875
890
|
})
|
|
876
891
|
]).describe(
|
|
877
892
|
"Scopes used to check user's permission to perform actions on a record."
|
|
@@ -1108,7 +1123,7 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
1108
1123
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1109
1124
|
z15.object({
|
|
1110
1125
|
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1111
|
-
requestId:
|
|
1126
|
+
requestId: UUID,
|
|
1112
1127
|
// TODO move into 'content' property
|
|
1113
1128
|
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1114
1129
|
}).shape
|
|
@@ -1116,7 +1131,7 @@ var ApprovedCorrectionAction = ActionBase.extend(
|
|
|
1116
1131
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1117
1132
|
z15.object({
|
|
1118
1133
|
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1119
|
-
requestId:
|
|
1134
|
+
requestId: UUID,
|
|
1120
1135
|
// TODO move into 'content' property
|
|
1121
1136
|
content: ReasonContent
|
|
1122
1137
|
}).shape
|
|
@@ -2370,8 +2385,7 @@ var LoginConfig = z21.object({
|
|
|
2370
2385
|
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2371
2386
|
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2372
2387
|
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2373
|
-
LOGIN_BACKGROUND: BackgroundConfig
|
|
2374
|
-
SENTRY: z21.string().optional()
|
|
2388
|
+
LOGIN_BACKGROUND: BackgroundConfig
|
|
2375
2389
|
});
|
|
2376
2390
|
var defineLoginConfig = (config) => {
|
|
2377
2391
|
return LoginConfig.parse(config);
|
|
@@ -2379,7 +2393,6 @@ var defineLoginConfig = (config) => {
|
|
|
2379
2393
|
var ClientConfig = z21.object({
|
|
2380
2394
|
COUNTRY: z21.string(),
|
|
2381
2395
|
LANGUAGES: z21.array(z21.string()),
|
|
2382
|
-
SENTRY: z21.string().optional(),
|
|
2383
2396
|
LOGIN_URL: z21.string().optional(),
|
|
2384
2397
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2385
2398
|
DASHBOARDS: z21.array(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Nominal } from './nominal';
|
|
2
2
|
import * as z from 'zod/v4';
|
|
3
3
|
import { ScopeType, Scope, EncodedScope } from './scopes';
|
|
4
|
-
import { UUID } from './uuid';
|
|
5
4
|
export * from './scopes';
|
|
6
5
|
/**
|
|
7
6
|
* Returns an array of accepted scopes from a JWT token, filtered by the given accepted scope types.
|
|
@@ -25,8 +24,6 @@ export interface ITokenPayload {
|
|
|
25
24
|
scope: EncodedScope[];
|
|
26
25
|
role?: string;
|
|
27
26
|
userType: TokenUserType;
|
|
28
|
-
eventId?: UUID;
|
|
29
|
-
actionId?: UUID;
|
|
30
27
|
}
|
|
31
28
|
/**
|
|
32
29
|
* Depending on how the API is called, there might or might not be Bearer keyword in the header.
|
|
@@ -42,13 +39,15 @@ export declare const getUserId: (token: TokenWithBearer) => string;
|
|
|
42
39
|
*/
|
|
43
40
|
export declare const getUserIdFromToken: (token: string) => string | null;
|
|
44
41
|
/**
|
|
45
|
-
* Fixed subject (`sub`) of the service token that core's auth service mints
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
42
|
+
* Fixed subject (`sub`) of the service token that core's auth service mints at `GET /internal/service-token`.
|
|
43
|
+
* Core uses it for service-to-service calls where no user is involved.
|
|
44
|
+
*
|
|
45
|
+
* Must be a well-formed UUID so a service verifying the token can resolve it as
|
|
46
|
+
* a `SystemContext` as with `INTEGRATION_CREATOR_USER_ID` / `REINDEX_USER_ID`.
|
|
47
|
+
*
|
|
48
|
+
* See packages/auth/src/features/serviceToken/handler.ts
|
|
50
49
|
*/
|
|
51
|
-
export declare const SERVICE_USER_ID = "
|
|
50
|
+
export declare const SERVICE_USER_ID = "00000000-0000-4000-8000-000000000002";
|
|
52
51
|
/**
|
|
53
52
|
* True when a decoded token payload (e.g. Hapi's `request.auth.credentials`)
|
|
54
53
|
* belongs to core's service token, identified by its fixed subject. A country
|
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/authentication/index.ts
|
|
31
31
|
var authentication_exports = {};
|
|
32
32
|
__export(authentication_exports, {
|
|
33
|
+
ActionConfirmationScopeType: () => ActionConfirmationScopeType,
|
|
33
34
|
EncodedScope: () => EncodedScope,
|
|
34
35
|
JurisdictionFilter: () => JurisdictionFilter,
|
|
35
36
|
RecordScopeTypeV2: () => RecordScopeTypeV2,
|
|
@@ -361,7 +362,9 @@ var RecordScopeTypeV2 = z7.enum([
|
|
|
361
362
|
"record.request-correction",
|
|
362
363
|
"record.correct",
|
|
363
364
|
"record.unassign-others",
|
|
364
|
-
"record.custom-action"
|
|
365
|
+
"record.custom-action",
|
|
366
|
+
"record.action.accept",
|
|
367
|
+
"record.action.reject"
|
|
365
368
|
]);
|
|
366
369
|
var PlainScopeType = z7.enum([
|
|
367
370
|
// Misc. system scopes
|
|
@@ -383,10 +386,7 @@ var PlainScopeType = z7.enum([
|
|
|
383
386
|
// Performance dashboard
|
|
384
387
|
"performance.read",
|
|
385
388
|
"performance.read-dashboards",
|
|
386
|
-
"performance.vital-statistics-export"
|
|
387
|
-
// Scopes used exclusively by countryconfig integration token
|
|
388
|
-
"record.confirm-registration",
|
|
389
|
-
"record.reject-registration"
|
|
389
|
+
"performance.vital-statistics-export"
|
|
390
390
|
]);
|
|
391
391
|
var scopeByEvent = z7.preprocess(
|
|
392
392
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -404,7 +404,9 @@ var userRole = z7.preprocess(
|
|
|
404
404
|
).describe("User role, e.g. admin, field agent");
|
|
405
405
|
var scopeOptionsPlaceEvent = z7.object({
|
|
406
406
|
event: scopeByEvent,
|
|
407
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
407
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
408
|
+
createdBy: UserFilter.optional(),
|
|
409
|
+
createdIn: JurisdictionFilter.optional()
|
|
408
410
|
}).describe("Options applicable to all record scopes.");
|
|
409
411
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
410
412
|
notifiedIn: JurisdictionFilter.optional(),
|
|
@@ -447,7 +449,9 @@ var AllScopeOptions = z7.object({
|
|
|
447
449
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
448
450
|
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
449
451
|
event: scopeByEvent,
|
|
450
|
-
placeOfEvent: UUID.nullish()
|
|
452
|
+
placeOfEvent: UUID.nullish(),
|
|
453
|
+
createdBy: z7.string().optional(),
|
|
454
|
+
createdIn: UUID.nullish()
|
|
451
455
|
}).describe(
|
|
452
456
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
453
457
|
);
|
|
@@ -494,6 +498,13 @@ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
|
494
498
|
"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."
|
|
495
499
|
)
|
|
496
500
|
});
|
|
501
|
+
var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
|
|
502
|
+
"record.action.accept",
|
|
503
|
+
"record.action.reject"
|
|
504
|
+
]);
|
|
505
|
+
var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
|
|
506
|
+
"Options for confirming (accepting or rejecting) an action."
|
|
507
|
+
);
|
|
497
508
|
var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
498
509
|
z7.object({
|
|
499
510
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -514,6 +525,10 @@ var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
|
514
525
|
z7.object({
|
|
515
526
|
type: z7.literal("record.print-certified-copies"),
|
|
516
527
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
528
|
+
}),
|
|
529
|
+
z7.object({
|
|
530
|
+
type: ActionConfirmationScopeType,
|
|
531
|
+
options: ActionConfirmationScopeOptions.optional()
|
|
517
532
|
})
|
|
518
533
|
]).describe(
|
|
519
534
|
"Scopes used to check user's permission to perform actions on a record."
|
|
@@ -736,7 +751,7 @@ var getUserIdFromToken = (token) => {
|
|
|
736
751
|
return null;
|
|
737
752
|
}
|
|
738
753
|
};
|
|
739
|
-
var SERVICE_USER_ID = "
|
|
754
|
+
var SERVICE_USER_ID = "00000000-0000-4000-8000-000000000002";
|
|
740
755
|
function isServiceToken(credentials) {
|
|
741
756
|
return typeof credentials === "object" && credentials !== null && credentials.sub === SERVICE_USER_ID;
|
|
742
757
|
}
|