@opencrvs/toolkit 1.9.12-rc.f84b805 → 1.9.12-rc.f8f1dc7
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 +13 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/application-config/index.d.ts +2 -0
- package/dist/application-config/index.d.ts.map +1 -0
- package/dist/application-config/index.js +2128 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3410 -0
- package/dist/commons/api/router.d.ts +3397 -2266
- package/dist/commons/application-config/index.d.ts +84 -0
- package/dist/commons/conditionals/conditionals.d.ts +27 -3
- package/dist/commons/conditionals/validate.d.ts +13 -2
- package/dist/commons/events/ActionConfig.d.ts +415 -1555
- package/dist/commons/events/ActionDocument.d.ts +888 -1941
- package/dist/commons/events/ActionInput.d.ts +277 -1073
- package/dist/commons/events/ActionType.d.ts +91 -11
- package/dist/commons/events/AdvancedSearchConfig.d.ts +294 -1496
- package/dist/commons/events/AuditLog.d.ts +405 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +30 -190
- package/dist/commons/events/Conditional.d.ts +26 -38
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1592 -4471
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +72 -107
- package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
- package/dist/commons/events/EventConfig.d.ts +36 -2420
- package/dist/commons/events/EventConfigInput.d.ts +0 -3
- package/dist/commons/events/EventDocument.d.ts +354 -1366
- package/dist/commons/events/EventIndex.d.ts +212 -1010
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +130 -357
- package/dist/commons/events/FieldConfig.d.ts +2891 -12900
- package/dist/commons/events/FieldType.d.ts +26 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +314 -906
- package/dist/commons/events/FieldValue.d.ts +149 -527
- package/dist/commons/events/FileUtils.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +54 -721
- package/dist/commons/events/PageConfig.d.ts +58 -320
- package/dist/commons/events/PlainDate.d.ts +1 -1
- package/dist/commons/events/SummaryConfig.d.ts +14 -161
- package/dist/commons/events/TemplateConfig.d.ts +2 -3
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
- package/dist/commons/events/WorkqueueConfig.d.ts +2208 -7553
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -247
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/index.d.ts +3 -0
- package/dist/commons/events/locations.d.ts +57 -20
- package/dist/commons/events/scopes.d.ts +36 -35
- package/dist/commons/events/state/availableActions.d.ts +7 -2
- package/dist/commons/events/state/flags.d.ts +21 -3
- package/dist/commons/events/state/index.d.ts +30 -27
- package/dist/commons/events/state/utils.d.ts +190 -172
- package/dist/commons/events/test.utils.d.ts +52 -11
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +374 -443
- package/dist/commons/notification/UserNotifications.d.ts +61 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +302 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2847 -2113
- package/dist/migrations/v2.0/add-analytics-option-to-event-configs.d.ts +3 -0
- package/dist/migrations/v2.0/add-analytics-option-to-event-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-analytics-option-to-event-configs.js +139 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +143 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +829 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
- package/dist/migrations/v2.0/index.d.ts +7 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +3349 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-scopes.js +282 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-api-paths.js +188 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +2075 -1769
- package/dist/scopes/index.d.ts +640 -353
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +340 -300
- package/opencrvs-toolkit-1.9.12-rc.f8f1dc7.tgz +0 -0
- package/package.json +18 -8
- package/tsconfig.json +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.main = main;
|
|
23
|
+
/**
|
|
24
|
+
* Codemod: Replace selected files with their upstream v2.0 versions from
|
|
25
|
+
* opencrvs/opencrvs-countryconfig.
|
|
26
|
+
*
|
|
27
|
+
* Usage:
|
|
28
|
+
* ts-node -r tsconfig-paths/register src/migrations/v2.0/checkout-upstream-files.ts
|
|
29
|
+
*
|
|
30
|
+
* What it does:
|
|
31
|
+
* 1. Registers a temporary git remote that points at the canonical
|
|
32
|
+
* opencrvs-countryconfig repository.
|
|
33
|
+
* 2. Fetches the chosen upstream branch at --depth=1 to keep it fast.
|
|
34
|
+
* 3. Path-scoped checkouts each listed file from that branch. The upstream
|
|
35
|
+
* version is written to the working tree AND staged in the index, so
|
|
36
|
+
* the dev can review the diff afterwards with:
|
|
37
|
+
* git diff --cached -- <file>
|
|
38
|
+
* 4. Removes the temporary remote in all cases (success, failure, or
|
|
39
|
+
* unexpected error) via a `finally` block.
|
|
40
|
+
*
|
|
41
|
+
* Why a git-based approach (as opposed to a raw HTTPS download):
|
|
42
|
+
* - Git handles text, binary, and line endings correctly.
|
|
43
|
+
* - The checked-out files end up staged, giving an obvious review UX.
|
|
44
|
+
* - `git checkout <ref> -- <paths>` is a blob-level copy, so it works
|
|
45
|
+
* whether or not the target repo shares history with
|
|
46
|
+
* opencrvs-countryconfig (e.g. country implementations started from
|
|
47
|
+
* scratch rather than forked).
|
|
48
|
+
*
|
|
49
|
+
* Caveats:
|
|
50
|
+
* - Overwrites any local modifications to the listed files. Run the
|
|
51
|
+
* upgrade on a clean working tree, or accept that the upstream version
|
|
52
|
+
* replaces yours.
|
|
53
|
+
* - Requires git to be installed and network access to github.com.
|
|
54
|
+
* - Requires the country config working directory to be a git repo.
|
|
55
|
+
*/
|
|
56
|
+
const child_process_1 = require("child_process");
|
|
57
|
+
const _1 = require(".");
|
|
58
|
+
const UPSTREAM_URL = 'https://github.com/opencrvs/opencrvs-countryconfig.git';
|
|
59
|
+
// @TODO: This needs to be changed to 'release-v2.0.0' once the branch is created
|
|
60
|
+
const UPSTREAM_BRANCH = 'codemod-analytics';
|
|
61
|
+
// Remote name used only for the duration of this codemod. Prefixed to avoid
|
|
62
|
+
// clashing with remotes the user may have (origin, upstream, etc.).
|
|
63
|
+
const TEMP_REMOTE = 'opencrvs-upgrade-v19-v20-codemod';
|
|
64
|
+
const FILES_TO_CHECKOUT = [
|
|
65
|
+
'infrastructure/postgres/setup-analytics.sh',
|
|
66
|
+
'src/analytics/analytics.ts'
|
|
67
|
+
];
|
|
68
|
+
// ─── Git helpers ─────────────────────────────────────────────────────────────
|
|
69
|
+
/**
|
|
70
|
+
* Runs a git command in the country config working directory.
|
|
71
|
+
*
|
|
72
|
+
* By default stderr is inherited so the user sees progress output from
|
|
73
|
+
* long-running commands (e.g. `git fetch`). Pass `silent: true` to suppress
|
|
74
|
+
* both stdout and stderr when you only care about the exit code.
|
|
75
|
+
*/
|
|
76
|
+
function runGit(args, { silent = false } = {}) {
|
|
77
|
+
return (0, child_process_1.execFileSync)('git', args, {
|
|
78
|
+
cwd: (0, _1.getCwd)(),
|
|
79
|
+
encoding: 'utf8',
|
|
80
|
+
stdio: silent ? ['ignore', 'pipe', 'pipe'] : ['ignore', 'pipe', 'inherit']
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Runs a git command and returns true on success, false on failure.
|
|
85
|
+
* Stderr/stdout are suppressed — use only when the exit code is the only
|
|
86
|
+
* signal you care about.
|
|
87
|
+
*/
|
|
88
|
+
function tryGit(args) {
|
|
89
|
+
try {
|
|
90
|
+
runGit(args, { silent: true });
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
catch (_a) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function assertIsGitRepo() {
|
|
98
|
+
if (!tryGit(['rev-parse', '--is-inside-work-tree'])) {
|
|
99
|
+
throw new Error(`checkout-upstream-files: ${(0, _1.getCwd)()} is not a git repository. Initialise git (or run the upgrade inside a git checkout) before re-running.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
103
|
+
function main() {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
console.log(`Checking out ${FILES_TO_CHECKOUT.length} file(s) from ${UPSTREAM_URL}@${UPSTREAM_BRANCH}...\n`);
|
|
106
|
+
assertIsGitRepo();
|
|
107
|
+
// Best-effort cleanup of a stale temp remote from a previous aborted run.
|
|
108
|
+
tryGit(['remote', 'remove', TEMP_REMOTE]);
|
|
109
|
+
try {
|
|
110
|
+
console.log(` Adding temporary remote '${TEMP_REMOTE}' → ${UPSTREAM_URL}`);
|
|
111
|
+
runGit(['remote', 'add', TEMP_REMOTE, UPSTREAM_URL], { silent: true });
|
|
112
|
+
console.log(` Fetching ${TEMP_REMOTE}/${UPSTREAM_BRANCH} (depth 1)...`);
|
|
113
|
+
runGit(['fetch', '--depth=1', TEMP_REMOTE, UPSTREAM_BRANCH]);
|
|
114
|
+
const ref = `${TEMP_REMOTE}/${UPSTREAM_BRANCH}`;
|
|
115
|
+
const missing = [];
|
|
116
|
+
let checkedOut = 0;
|
|
117
|
+
for (const file of FILES_TO_CHECKOUT) {
|
|
118
|
+
// `--` separates paths from refs and avoids ambiguity when a path
|
|
119
|
+
// happens to match a branch/tag name.
|
|
120
|
+
if (tryGit(['checkout', ref, '--', file])) {
|
|
121
|
+
console.log(` Checked out ${file} from ${ref}`);
|
|
122
|
+
checkedOut++;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
console.warn(` [warn] ${file} not found on ${ref} — skipping. Verify the path exists on that branch.`);
|
|
126
|
+
missing.push(file);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
console.log(`\n Checked out ${checkedOut}/${FILES_TO_CHECKOUT.length} file(s) from ${ref}.`);
|
|
130
|
+
if (missing.length > 0) {
|
|
131
|
+
console.warn(` Missing on upstream branch: ${missing.join(', ')}`);
|
|
132
|
+
}
|
|
133
|
+
if (checkedOut > 0) {
|
|
134
|
+
console.log(` Review the staged changes with: git diff --cached -- ${FILES_TO_CHECKOUT.map((f) => `'${f}'`).join(' ')}\n`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
if (tryGit(['remote', 'remove', TEMP_REMOTE])) {
|
|
139
|
+
console.log(` Removed temporary remote '${TEMP_REMOTE}'.`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-config-files-to-ts.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-config-files-to-ts.ts"],"names":[],"mappings":"AAyuBA,wBAAsB,IAAI,kBAyPzB"}
|