@opencrvs/toolkit 1.9.12-rc.fdec004 → 1.9.12-rc.ff04697

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.
Files changed (53) hide show
  1. package/dist/cli.js +246 -80
  2. package/dist/commons/api/router.d.ts +72 -67
  3. package/dist/events/index.js +1 -10
  4. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  5. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +3 -4
  6. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  7. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  8. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -13
  9. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  10. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  11. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  12. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  13. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  14. package/dist/migrations/v2.0/create-events-index.js +1 -2
  15. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +3 -0
  16. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  17. package/dist/migrations/v2.0/delete-infrastructure-directory.js +77 -0
  18. package/dist/migrations/v2.0/index.d.ts +8 -4
  19. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  20. package/dist/migrations/v2.0/index.js +214 -77
  21. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  22. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +5 -6
  23. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +3 -0
  24. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  25. package/dist/migrations/v2.0/merge-infrastructure-directory.js +221 -0
  26. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  27. package/dist/migrations/v2.0/migrate-scopes.js +6 -7
  28. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  30. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/migrate-workqueue-configs.js +3 -4
  32. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  33. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  34. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  35. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  36. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  37. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  38. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  39. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  40. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  42. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  44. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  46. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  47. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  48. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  50. package/opencrvs-toolkit-1.9.12-rc.ff04697.tgz +0 -0
  51. package/package.json +1 -1
  52. package/tsconfig.tsbuildinfo +1 -1
  53. package/opencrvs-toolkit-1.9.12-rc.fdec004.tgz +0 -0
@@ -45,7 +45,6 @@ exports.main = main;
45
45
  */
46
46
  const ts_morph_1 = require("ts-morph");
47
47
  const path_1 = __importDefault(require("path"));
48
- const _1 = require(".");
49
48
  const TOOLKIT_EVENTS_MODULE = '@opencrvs/toolkit/events';
50
49
  const REQUIRED_SYMBOLS = [
51
50
  'ConditionalType',
@@ -263,7 +262,7 @@ function processFile(filePath, project) {
263
262
  // Resolve the root event type for use in the auditHistoryLabel id
264
263
  const eventType = resolveEventType(configArg);
265
264
  if (!eventType) {
266
- console.warn(` [${path_1.default.relative((0, _1.getCwd)(), configArg.getSourceFile().getFilePath())}] Could not resolve root 'type' from defineConfig — skipping auditHistoryLabel id generation`);
265
+ console.warn(` [${path_1.default.relative(process.cwd(), configArg.getSourceFile().getFilePath())}] Could not resolve root 'type' from defineConfig — skipping auditHistoryLabel id generation`);
267
266
  }
268
267
  // Iterate over every element in the `actions` array
269
268
  let fileNeedsImports = false;
@@ -276,7 +275,7 @@ function processFile(filePath, project) {
276
275
  transformedCount++;
277
276
  fileNeedsImports = true;
278
277
  configHadValidateAction = true;
279
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Transformed VALIDATE action to CUSTOM with customActionType: '${VALIDATE_DECLARATION_VALUE}'`);
278
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Transformed VALIDATE action to CUSTOM with customActionType: '${VALIDATE_DECLARATION_VALUE}'`);
280
279
  }
281
280
  }
282
281
  // Add top-level flags array to the config object if a VALIDATE action was found
@@ -296,7 +295,7 @@ function processFile(filePath, project) {
296
295
  }
297
296
  ]`
298
297
  });
299
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Added top-level 'flags' array to defineConfig`);
298
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Added top-level 'flags' array to defineConfig`);
300
299
  }
301
300
  if (fileNeedsImports) {
302
301
  ensureImports(sourceFile);
@@ -306,7 +305,7 @@ function processFile(filePath, project) {
306
305
  }
307
306
  function main() {
308
307
  return __awaiter(this, void 0, void 0, function* () {
309
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
308
+ const srcDir = path_1.default.join(process.cwd(), 'src');
310
309
  console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
311
310
  const project = new ts_morph_1.Project({
312
311
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -337,7 +336,7 @@ function main() {
337
336
  for (const filePath of modifiedFiles) {
338
337
  const sourceFile = project.getSourceFileOrThrow(filePath);
339
338
  yield sourceFile.save();
340
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
339
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
341
340
  }
342
341
  console.log(`\nDone. Transformed ${totalTransformed} VALIDATE action(s) to CUSTOM with customActionType: '${VALIDATE_DECLARATION_VALUE}'.`);
343
342
  });
@@ -0,0 +1,3 @@
1
+ declare function main(): Promise<void>;
2
+ export { main };
3
+ //# sourceMappingURL=merge-infrastructure-directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-infrastructure-directory.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/merge-infrastructure-directory.ts"],"names":[],"mappings":"AAsHA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAkInC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,221 @@
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: Merge upstream changes into the local `infrastructure/` directory
25
+ * from opencrvs/opencrvs-countryconfig.
26
+ *
27
+ * Usage:
28
+ * ts-node -r tsconfig-paths/register src/migrations/v2.0/merge-infrastructure-directory.ts
29
+ *
30
+ * What it does:
31
+ * 1. Registers a temporary git remote that points at the canonical
32
+ * opencrvs-countryconfig repository and fetches both:
33
+ * - the upstream "theirs" branch (v2.0) → `UPSTREAM_BRANCH`
34
+ * - the synthetic merge-base branch (latest 1.9 release line)
35
+ * → `BASE_BRANCH`
36
+ * 2. For every file under `infrastructure/` on upstream "theirs", performs
37
+ * a file-scoped 3-way merge:
38
+ * - new file on upstream → checked out and staged
39
+ * - existing file → 3-way merged in place via `git merge-file`,
40
+ * using the BASE_BRANCH version of the file
41
+ * as the ancestor (or an empty file if the
42
+ * base doesn't have it)
43
+ * Files local to the country config that don't exist on upstream are
44
+ * left untouched.
45
+ * 3. Cleanly merged files are staged. Files with conflicts are left in the
46
+ * working tree with standard <<<<<<< / ======= / >>>>>>> markers and
47
+ * MUST be resolved manually by the developer.
48
+ * 4. Removes the temporary remote in all cases (success, failure, or
49
+ * unexpected error) via a `finally` block.
50
+ *
51
+ * Why a content-based synthetic merge-base instead of `git merge-base`:
52
+ * - Country config repos rarely share git history with
53
+ * opencrvs-countryconfig (squashed forks, template-cloned repos, etc.),
54
+ * so `git merge-base HEAD upstream/develop` typically returns nothing.
55
+ * - With no merge-base, a 3-way merge degenerates to a 2-way diff against
56
+ * an empty file — every line that differs becomes a conflict.
57
+ * - `release-v1.9` is the latest 1.9.x release line on upstream and is a
58
+ * near-perfect representation of "what `infrastructure/` looked like
59
+ * before v2.0", regardless of whether the fork's git history reaches it.
60
+ * - For files the country config never modified relative to that baseline,
61
+ * `git merge-file` resolves cleanly to upstream's v2.0 version. Conflicts
62
+ * are produced only where local edits genuinely overlap with v1.9 → v2.0
63
+ * upstream edits — which is what the developer needs to review anyway.
64
+ *
65
+ * Why per-file merge instead of a real `git merge`:
66
+ * - Limits the blast radius to `infrastructure/` only — no other paths
67
+ * are touched.
68
+ * - Doesn't put the repository into an in-progress merge state
69
+ * (no MERGE_HEAD), so subsequent codemods/commands behave normally.
70
+ * - Works regardless of whether the local repo shares history with
71
+ * opencrvs-countryconfig.
72
+ *
73
+ * Caveats:
74
+ * - Local edits to merged files may be overwritten where they overlap
75
+ * with upstream changes. Run on a clean working tree.
76
+ * - Requires git to be installed and network access to github.com.
77
+ * - Requires the country config working directory to be a git repo.
78
+ * - Binary files in `infrastructure/` are not merged textually; if both
79
+ * sides changed a binary file, the result will be invalid and a warning
80
+ * is printed.
81
+ * - Forks that are on a much older 1.9.x and never merged later 1.9 patches
82
+ * may see a few extra conflicts on files where 1.9.x → release-v1.9
83
+ * patches and v1.9 → v2.0 changes textually overlap.
84
+ */
85
+ const child_process_1 = require("child_process");
86
+ const fs_1 = require("fs");
87
+ const os_1 = require("os");
88
+ const path_1 = require("path");
89
+ const checkout_upstream_files_1 = require("./checkout-upstream-files");
90
+ // Distinct from the remote used by `checkout-upstream-files` so that a stale
91
+ // remote left behind by an aborted run of one codemod doesn't trip up the
92
+ // other.
93
+ const TEMP_REMOTE = 'opencrvs-upgrade-v19-v20-codemod-merge-infra';
94
+ const INFRASTRUCTURE_DIR = 'infrastructure';
95
+ // Synthetic merge-base: the tip of upstream's latest 1.9.x release line.
96
+ // We use this branch's content as the "common ancestor" for every file,
97
+ // since most country forks don't share git history with upstream.
98
+ const BASE_BRANCH = 'release-v1.9';
99
+ /**
100
+ * Reads `git show <ref>:<path>` as a Uint8Array (binary-safe).
101
+ * Returns `null` if the path doesn't exist at that ref.
102
+ */
103
+ function gitShowBytes(ref, path) {
104
+ try {
105
+ const buf = (0, child_process_1.execFileSync)('git', ['show', `${ref}:${path}`], {
106
+ cwd: process.cwd(),
107
+ stdio: ['ignore', 'pipe', 'pipe']
108
+ });
109
+ // Return a plain Uint8Array view to satisfy strict typings of `fs`
110
+ // (which want `ArrayBufferView`, not Node's `Buffer` subtype).
111
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
112
+ }
113
+ catch (_a) {
114
+ return null;
115
+ }
116
+ }
117
+ // ─── Entry point ─────────────────────────────────────────────────────────────
118
+ function main() {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ console.log(`Merging '${INFRASTRUCTURE_DIR}/' from ${checkout_upstream_files_1.UPSTREAM_URL}@${checkout_upstream_files_1.UPSTREAM_BRANCH} (base: ${BASE_BRANCH})...\n`);
121
+ (0, checkout_upstream_files_1.assertIsGitRepo)();
122
+ // Best-effort cleanup of a stale temp remote from a previous aborted run.
123
+ (0, checkout_upstream_files_1.tryGit)(['remote', 'remove', TEMP_REMOTE]);
124
+ try {
125
+ console.log(` Adding temporary remote '${TEMP_REMOTE}' → ${checkout_upstream_files_1.UPSTREAM_URL}`);
126
+ (0, checkout_upstream_files_1.runGit)(['remote', 'add', TEMP_REMOTE, checkout_upstream_files_1.UPSTREAM_URL], { silent: true });
127
+ // Fetch both branches at depth=1 — we only need their tip contents,
128
+ // not their history (the merge is content-based, not history-based).
129
+ console.log(` Fetching ${TEMP_REMOTE}/{${checkout_upstream_files_1.UPSTREAM_BRANCH},${BASE_BRANCH}} (depth 1)...`);
130
+ (0, checkout_upstream_files_1.runGit)(['fetch', '--depth=1', TEMP_REMOTE, checkout_upstream_files_1.UPSTREAM_BRANCH, BASE_BRANCH]);
131
+ const ref = `${TEMP_REMOTE}/${checkout_upstream_files_1.UPSTREAM_BRANCH}`;
132
+ const baseRef = `${TEMP_REMOTE}/${BASE_BRANCH}`;
133
+ // -z gives NUL-separated paths so filenames with spaces or newlines
134
+ // survive the round-trip.
135
+ const upstreamFiles = (0, checkout_upstream_files_1.runGit)([
136
+ 'ls-tree',
137
+ '-r',
138
+ '--name-only',
139
+ '-z',
140
+ ref,
141
+ '--',
142
+ `${INFRASTRUCTURE_DIR}/`
143
+ ], { silent: true })
144
+ .split('\0')
145
+ .filter(Boolean);
146
+ if (upstreamFiles.length === 0) {
147
+ console.log(` No files found under '${INFRASTRUCTURE_DIR}/' on ${ref}. Nothing to merge.`);
148
+ return;
149
+ }
150
+ const tmpDir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), 'opencrvs-merge-infra-'));
151
+ const baseTmp = (0, path_1.join)(tmpDir, 'base');
152
+ const theirsTmp = (0, path_1.join)(tmpDir, 'theirs');
153
+ let added = 0;
154
+ let merged = 0;
155
+ const conflictedFiles = [];
156
+ for (const file of upstreamFiles) {
157
+ const fullPath = (0, path_1.join)(process.cwd(), file);
158
+ if (!(0, fs_1.existsSync)(fullPath)) {
159
+ // New upstream file — `git checkout` handles binary correctly and
160
+ // stages the result, matching the UX of `checkout-upstream-files`.
161
+ if ((0, checkout_upstream_files_1.tryGit)(['checkout', ref, '--', file])) {
162
+ console.log(` + ${file} (new from upstream)`);
163
+ added++;
164
+ }
165
+ else {
166
+ console.warn(` [warn] failed to add new file ${file}`);
167
+ }
168
+ continue;
169
+ }
170
+ const theirContents = gitShowBytes(ref, file);
171
+ if (theirContents === null) {
172
+ // Shouldn't happen — `ls-tree` just told us the file is there.
173
+ console.warn(` [warn] could not read ${file} from ${ref} — skipping.`);
174
+ continue;
175
+ }
176
+ (0, fs_1.writeFileSync)(theirsTmp, theirContents);
177
+ // Pull the base version from upstream's latest 1.9 release line. If
178
+ // the file didn't exist there yet (added in v2.0), fall back to an
179
+ // empty base — `git merge-file` will then treat any local content as
180
+ // a local addition.
181
+ const baseContents = gitShowBytes(baseRef, file);
182
+ (0, fs_1.writeFileSync)(baseTmp, baseContents !== null && baseContents !== void 0 ? baseContents : new Uint8Array(0));
183
+ // `git merge-file` does an in-place 3-way merge. Exit codes:
184
+ // 0 → clean merge
185
+ // 1..N → that many conflicts; markers written into the file
186
+ // <0/127 → error (e.g. binary file rejected)
187
+ try {
188
+ (0, child_process_1.execFileSync)('git', ['merge-file', fullPath, baseTmp, theirsTmp], {
189
+ cwd: process.cwd(),
190
+ stdio: ['ignore', 'pipe', 'pipe']
191
+ });
192
+ (0, checkout_upstream_files_1.runGit)(['add', '--', file], { silent: true });
193
+ merged++;
194
+ }
195
+ catch (err) {
196
+ const status = err.status;
197
+ if (typeof status === 'number' && status > 0) {
198
+ conflictedFiles.push(file);
199
+ console.warn(` ! ${file} (${status} conflict${status > 1 ? 's' : ''})`);
200
+ }
201
+ else {
202
+ conflictedFiles.push(file);
203
+ console.warn(` [warn] merge failed for ${file} (likely binary or unreadable) — left untouched.`);
204
+ }
205
+ }
206
+ }
207
+ console.log(`\n Done. ${added} added, ${merged} merged cleanly, ${conflictedFiles.length} with conflicts.`);
208
+ if (conflictedFiles.length > 0) {
209
+ console.warn(`\n NOTE: ${conflictedFiles.length} file(s) under '${INFRASTRUCTURE_DIR}/' have merge conflicts that you must resolve manually.\n` +
210
+ ` Look for the standard conflict markers (<<<<<<<, =======, >>>>>>>) in:\n` +
211
+ conflictedFiles.map((f) => ` - ${f}`).join('\n') +
212
+ `\n After resolving, stage the fixes with: git add ${INFRASTRUCTURE_DIR}/`);
213
+ }
214
+ }
215
+ finally {
216
+ if ((0, checkout_upstream_files_1.tryGit)(['remote', 'remove', TEMP_REMOTE])) {
217
+ console.log(` Removed temporary remote '${TEMP_REMOTE}'.`);
218
+ }
219
+ }
220
+ });
221
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-scopes.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-scopes.ts"],"names":[],"mappings":"AA2VA,iBAAe,IAAI,kBAmDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"migrate-scopes.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-scopes.ts"],"names":[],"mappings":"AAyVA,iBAAe,IAAI,kBAmDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -27,7 +27,6 @@ const ts_morph_1 = require("ts-morph");
27
27
  const path_1 = __importDefault(require("path"));
28
28
  const scopes_1 = require("../commons/scopes");
29
29
  const scopes_deprecated_do_not_use_1 = require("../commons/scopes.deprecated.do-not-use");
30
- const _1 = require(".");
31
30
  const ROLES_FILE_RELATIVE_PATH = 'src/data-seeding/roles/roles.ts';
32
31
  const SCOPES_PROPERTY_NAME = 'scopes';
33
32
  const TOOLKIT_SCOPES_MODULE = '@opencrvs/toolkit/scopes';
@@ -87,7 +86,7 @@ function migrateScopesArrays(rolesFilePath, project) {
87
86
  const scopeKey = resolveScopeKeyFromElementAccess(element);
88
87
  if (scopeKey && !(scopeKey in scopes_deprecated_do_not_use_1.SCOPES)) {
89
88
  // eslint-disable-next-line no-console
90
- console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Removing unknown scope reference: SCOPES.${scopeKey}`);
89
+ console.warn(` [${path_1.default.relative(process.cwd(), rolesFilePath)}] Removing unknown scope reference: SCOPES.${scopeKey}`);
91
90
  initializer.removeElement(index);
92
91
  removedCount++;
93
92
  continue;
@@ -95,7 +94,7 @@ function migrateScopesArrays(rolesFilePath, project) {
95
94
  const legacyScope = resolveLegacyScopeFromElement(element);
96
95
  if (!legacyScope) {
97
96
  // eslint-disable-next-line no-console
98
- console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Skipping non-literal scope expression: ${element.getText()}`);
97
+ console.warn(` [${path_1.default.relative(process.cwd(), rolesFilePath)}] Skipping non-literal scope expression: ${element.getText()}`);
99
98
  continue;
100
99
  }
101
100
  try {
@@ -103,7 +102,7 @@ function migrateScopesArrays(rolesFilePath, project) {
103
102
  const scope = (0, scopes_1.decodeScope)(migratedScope);
104
103
  if (!scope) {
105
104
  // eslint-disable-next-line no-console
106
- console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Could not decode migrated scope '${migratedScope}'.`);
105
+ console.warn(` [${path_1.default.relative(process.cwd(), rolesFilePath)}] Could not decode migrated scope '${migratedScope}'.`);
107
106
  continue;
108
107
  }
109
108
  element.replaceWithText(JSON.stringify(scope));
@@ -111,13 +110,13 @@ function migrateScopesArrays(rolesFilePath, project) {
111
110
  }
112
111
  catch (error) {
113
112
  // eslint-disable-next-line no-console
114
- console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Could not migrate scope '${legacyScope}': ${error}`);
113
+ console.warn(` [${path_1.default.relative(process.cwd(), rolesFilePath)}] Could not migrate scope '${legacyScope}': ${error}`);
115
114
  }
116
115
  }
117
116
  }
118
117
  if (removedCount > 0) {
119
118
  // eslint-disable-next-line no-console
120
- console.log(` Removed ${removedCount} unknown SCOPES reference(s) from '${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}'.`);
119
+ console.log(` Removed ${removedCount} unknown SCOPES reference(s) from '${path_1.default.relative(process.cwd(), rolesFilePath)}'.`);
121
120
  }
122
121
  return { migratedCount, removedCount };
123
122
  }
@@ -249,7 +248,7 @@ function removeRoleTypeDefinitionAndUnusedImports(rolesFilePath, project) {
249
248
  }
250
249
  function main() {
251
250
  return __awaiter(this, void 0, void 0, function* () {
252
- const cwd = (0, _1.getCwd)();
251
+ const cwd = process.cwd();
253
252
  const srcDir = path_1.default.join(cwd, 'src');
254
253
  const rolesFilePath = path_1.default.join(cwd, ROLES_FILE_RELATIVE_PATH);
255
254
  console.log(`Scanning roles scopes in: ${rolesFilePath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-validated-workqueue-status-to-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts"],"names":[],"mappings":"AA2QA,iBAAe,IAAI,kBA+ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"migrate-validated-workqueue-status-to-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts"],"names":[],"mappings":"AAyQA,iBAAe,IAAI,kBA+ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -45,7 +45,6 @@ exports.main = main;
45
45
  */
46
46
  const ts_morph_1 = require("ts-morph");
47
47
  const path_1 = __importDefault(require("path"));
48
- const _1 = require(".");
49
48
  const DEFINE_WORKQUEUES_NAME = 'defineWorkqueues';
50
49
  const QUERY_PROPERTY_NAME = 'query';
51
50
  const TYPE_PROPERTY_NAME = 'type';
@@ -223,7 +222,7 @@ function processFile(filePath, project) {
223
222
  const changed = walkQuery(queryInit);
224
223
  if (changed > 0) {
225
224
  migratedCount += changed;
226
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Migrated ${changed} clause(s): VALIDATED status → flags.anyOf`);
225
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Migrated ${changed} clause(s): VALIDATED status → flags.anyOf`);
227
226
  }
228
227
  }
229
228
  }
@@ -232,7 +231,7 @@ function processFile(filePath, project) {
232
231
  // ─── Entry point ─────────────────────────────────────────────────────────────
233
232
  function main() {
234
233
  return __awaiter(this, void 0, void 0, function* () {
235
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
234
+ const srcDir = path_1.default.join(process.cwd(), 'src');
236
235
  console.log(`Scanning for defineWorkqueues calls in: ${srcDir}\n`);
237
236
  const project = new ts_morph_1.Project({
238
237
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -261,7 +260,7 @@ function main() {
261
260
  for (const filePath of modifiedFiles) {
262
261
  const sourceFile = project.getSourceFileOrThrow(filePath);
263
262
  yield sourceFile.save();
264
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
263
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
265
264
  }
266
265
  console.log(`\nDone. Migrated ${totalMigrated} clause(s) from VALIDATED status to flags.anyOf['validated'].`);
267
266
  });
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-workqueue-configs.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-workqueue-configs.ts"],"names":[],"mappings":"AAiPA,iBAAe,IAAI,kBAqDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"migrate-workqueue-configs.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-workqueue-configs.ts"],"names":[],"mappings":"AA+OA,iBAAe,IAAI,kBAqDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -43,7 +43,6 @@ exports.main = main;
43
43
  */
44
44
  const ts_morph_1 = require("ts-morph");
45
45
  const path_1 = __importDefault(require("path"));
46
- const _1 = require(".");
47
46
  const DEFINE_WORKQUEUES_NAME = 'defineWorkqueues';
48
47
  const ACTIONS_PROPERTY_NAME = 'actions';
49
48
  const ACTION_PROPERTY_NAME = 'action';
@@ -171,7 +170,7 @@ function processFile(filePath, project) {
171
170
  if (!sourceFile)
172
171
  return 0;
173
172
  let migratedWorkqueues = 0;
174
- const relPath = path_1.default.relative((0, _1.getCwd)(), filePath);
173
+ const relPath = path_1.default.relative(process.cwd(), filePath);
175
174
  const callExpressions = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.CallExpression);
176
175
  for (const call of callExpressions) {
177
176
  const expression = call.getExpression();
@@ -195,7 +194,7 @@ function processFile(filePath, project) {
195
194
  }
196
195
  function main() {
197
196
  return __awaiter(this, void 0, void 0, function* () {
198
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
197
+ const srcDir = path_1.default.join(process.cwd(), 'src');
199
198
  // eslint-disable-next-line no-console
200
199
  console.log(`Scanning for defineWorkqueues calls in: ${srcDir}\n`);
201
200
  const project = new ts_morph_1.Project({
@@ -229,7 +228,7 @@ function main() {
229
228
  const sourceFile = project.getSourceFileOrThrow(filePath);
230
229
  yield sourceFile.save();
231
230
  // eslint-disable-next-line no-console
232
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
231
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
233
232
  }
234
233
  // eslint-disable-next-line no-console
235
234
  console.log(`\nDone. Migrated ${totalMigrated} deprecated workqueue 'actions' definition(s) to 'action'.`);
@@ -1 +1 @@
1
- {"version":3,"file":"remove-delete-actions.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-delete-actions.ts"],"names":[],"mappings":"AA2IA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-delete-actions.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-delete-actions.ts"],"names":[],"mappings":"AAyIA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -39,7 +39,6 @@ exports.main = main;
39
39
  */
40
40
  const ts_morph_1 = require("ts-morph");
41
41
  const path_1 = __importDefault(require("path"));
42
- const _1 = require(".");
43
42
  const DEFINE_CONFIG_NAME = 'defineConfig';
44
43
  const ACTIONS_PROPERTY_NAME = 'actions';
45
44
  const TYPE_PROPERTY_NAME = 'type';
@@ -112,14 +111,14 @@ function processFile(filePath, project) {
112
111
  for (const index of indicesToRemove.reverse()) {
113
112
  actionsInitializer.removeElement(index);
114
113
  removedCount++;
115
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed DELETE action at index ${index}`);
114
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Removed DELETE action at index ${index}`);
116
115
  }
117
116
  }
118
117
  return removedCount;
119
118
  }
120
119
  function main() {
121
120
  return __awaiter(this, void 0, void 0, function* () {
122
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
121
+ const srcDir = path_1.default.join(process.cwd(), 'src');
123
122
  console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
124
123
  const project = new ts_morph_1.Project({
125
124
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -150,7 +149,7 @@ function main() {
150
149
  for (const filePath of modifiedFiles) {
151
150
  const sourceFile = project.getSourceFileOrThrow(filePath);
152
151
  yield sourceFile.save();
153
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
152
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
154
153
  }
155
154
  console.log(`\nDone. Removed ${totalRemoved} DELETE action(s) from defineConfig call(s).`);
156
155
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove-demo-scope.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-demo-scope.ts"],"names":[],"mappings":"AAiBA,iBAAe,IAAI,kBA8DlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-demo-scope.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-demo-scope.ts"],"names":[],"mappings":"AAeA,iBAAe,IAAI,kBA8DlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -25,14 +25,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.main = main;
26
26
  const path_1 = __importDefault(require("path"));
27
27
  const ts_morph_1 = require("ts-morph");
28
- const _1 = require(".");
29
28
  const ROLES_HANDLER_RELATIVE_PATH = 'src/data-seeding/roles/handler.ts';
30
29
  function main() {
31
30
  return __awaiter(this, void 0, void 0, function* () {
32
31
  var _a;
33
- const rolesHandlerPath = path_1.default.join((0, _1.getCwd)(), ROLES_HANDLER_RELATIVE_PATH);
32
+ const rolesHandlerPath = path_1.default.join(process.cwd(), ROLES_HANDLER_RELATIVE_PATH);
34
33
  const project = new ts_morph_1.Project({
35
- tsConfigFilePath: path_1.default.resolve((0, _1.getCwd)(), 'tsconfig.json'),
34
+ tsConfigFilePath: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
36
35
  skipAddingFilesFromTsConfig: false
37
36
  });
38
37
  const sourceFile = project.getSourceFile(rolesHandlerPath);
@@ -1 +1 @@
1
- {"version":3,"file":"remove-deprecated-imports.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-deprecated-imports.ts"],"names":[],"mappings":"AA2DA,iBAAe,IAAI,kBAyClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-deprecated-imports.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-deprecated-imports.ts"],"names":[],"mappings":"AAyDA,iBAAe,IAAI,kBAyClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -25,7 +25,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.main = main;
26
26
  const ts_morph_1 = require("ts-morph");
27
27
  const path_1 = __importDefault(require("path"));
28
- const _1 = require(".");
29
28
  const DEPRECATED_IMPORT = 'SCOPES';
30
29
  const TARGET_MODULES = new Set([
31
30
  '@opencrvs/toolkit/scopes',
@@ -56,13 +55,13 @@ function processFile(filePath, project) {
56
55
  if (!hasAnyNamedImportsLeft && !hasDefaultImport && !hasNamespaceImport) {
57
56
  decl.remove();
58
57
  }
59
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed ${matchingNamedImports.length} deprecated '${DEPRECATED_IMPORT}' import(s) from '${decl.getModuleSpecifierValue()}'`);
58
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Removed ${matchingNamedImports.length} deprecated '${DEPRECATED_IMPORT}' import(s) from '${decl.getModuleSpecifierValue()}'`);
60
59
  }
61
60
  return removedCount;
62
61
  }
63
62
  function main() {
64
63
  return __awaiter(this, void 0, void 0, function* () {
65
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
64
+ const srcDir = path_1.default.join(process.cwd(), 'src');
66
65
  console.log(`Scanning for deprecated imports in: ${srcDir}\n`);
67
66
  const project = new ts_morph_1.Project({
68
67
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -90,7 +89,7 @@ function main() {
90
89
  console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
91
90
  for (const filePath of modifiedFiles) {
92
91
  yield project.getSourceFileOrThrow(filePath).save();
93
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
92
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
94
93
  }
95
94
  console.log(`\nDone. Removed ${totalRemoved} deprecated import(s).`);
96
95
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove-hearth-migrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-hearth-migrations.ts"],"names":[],"mappings":"AA2BA,iBAAe,IAAI,kBAalB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-hearth-migrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-hearth-migrations.ts"],"names":[],"mappings":"AAyBA,iBAAe,IAAI,kBAalB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -48,7 +48,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.main = main;
49
49
  const fs = __importStar(require("fs"));
50
50
  const path_1 = __importDefault(require("path"));
51
- const _1 = require(".");
52
51
  const PATHS_TO_REMOVE = [
53
52
  {
54
53
  relativePath: 'src/migrations/hearth',
@@ -63,7 +62,7 @@ const PATHS_TO_REMOVE = [
63
62
  function main() {
64
63
  return __awaiter(this, void 0, void 0, function* () {
65
64
  for (const { relativePath, label } of PATHS_TO_REMOVE) {
66
- const absolutePath = path_1.default.join((0, _1.getCwd)(), relativePath);
65
+ const absolutePath = path_1.default.join(process.cwd(), relativePath);
67
66
  if (fs.existsSync(absolutePath)) {
68
67
  fs.rmSync(absolutePath, { recursive: true, force: true });
69
68
  // eslint-disable-next-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"remove-pending-certification-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-pending-certification-flag.ts"],"names":[],"mappings":"AA2EA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-pending-certification-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-pending-certification-flag.ts"],"names":[],"mappings":"AAyEA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -38,7 +38,6 @@ exports.main = main;
38
38
  */
39
39
  const ts_morph_1 = require("ts-morph");
40
40
  const path_1 = __importDefault(require("path"));
41
- const _1 = require(".");
42
41
  const INHERENT_FLAGS_ENUM_NAME = 'InherentFlags';
43
42
  const PENDING_CERTIFICATION_MEMBER = 'PENDING_CERTIFICATION';
44
43
  function isPendingCertificationFlag(node) {
@@ -67,14 +66,14 @@ function processFile(filePath, project) {
67
66
  for (const index of indicesToRemove.reverse()) {
68
67
  array.removeElement(index);
69
68
  removedCount++;
70
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed InherentFlags.PENDING_CERTIFICATION from array`);
69
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Removed InherentFlags.PENDING_CERTIFICATION from array`);
71
70
  }
72
71
  }
73
72
  return removedCount;
74
73
  }
75
74
  function main() {
76
75
  return __awaiter(this, void 0, void 0, function* () {
77
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
76
+ const srcDir = path_1.default.join(process.cwd(), 'src');
78
77
  console.log(`Scanning for InherentFlags.PENDING_CERTIFICATION array elements in: ${srcDir}\n`);
79
78
  const project = new ts_morph_1.Project({
80
79
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -103,7 +102,7 @@ function main() {
103
102
  for (const filePath of modifiedFiles) {
104
103
  const sourceFile = project.getSourceFileOrThrow(filePath);
105
104
  yield sourceFile.save();
106
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
105
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
107
106
  }
108
107
  console.log(`\nDone. Removed ${totalRemoved} InherentFlags.PENDING_CERTIFICATION element(s) from array(s).`);
109
108
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove-review-from-register-action.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-review-from-register-action.ts"],"names":[],"mappings":"AAoJA,iBAAe,IAAI,kBAkDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"remove-review-from-register-action.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-review-from-register-action.ts"],"names":[],"mappings":"AAkJA,iBAAe,IAAI,kBAkDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -39,7 +39,6 @@ exports.main = main;
39
39
  */
40
40
  const ts_morph_1 = require("ts-morph");
41
41
  const path_1 = __importDefault(require("path"));
42
- const _1 = require(".");
43
42
  const DEFINE_CONFIG_NAME = 'defineConfig';
44
43
  const ACTIONS_PROPERTY_NAME = 'actions';
45
44
  const TYPE_PROPERTY_NAME = 'type';
@@ -117,7 +116,7 @@ function processFile(filePath, project) {
117
116
  const wasRemoved = removeReviewFromRegisterActions(element);
118
117
  if (wasRemoved) {
119
118
  removedCount++;
120
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed 'review' from REGISTER action`);
119
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Removed 'review' from REGISTER action`);
121
120
  }
122
121
  }
123
122
  }
@@ -125,7 +124,7 @@ function processFile(filePath, project) {
125
124
  }
126
125
  function main() {
127
126
  return __awaiter(this, void 0, void 0, function* () {
128
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
127
+ const srcDir = path_1.default.join(process.cwd(), 'src');
129
128
  console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
130
129
  const project = new ts_morph_1.Project({
131
130
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -157,7 +156,7 @@ function main() {
157
156
  for (const filePath of modifiedFiles) {
158
157
  const sourceFile = project.getSourceFileOrThrow(filePath);
159
158
  yield sourceFile.save();
160
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
159
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
161
160
  }
162
161
  console.log(`\nDone. Removed ${totalRemoved} 'review' property assignment(s) from REGISTER action(s).`);
163
162
  });
@@ -1 +1 @@
1
- {"version":3,"file":"rename-api-paths.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-api-paths.ts"],"names":[],"mappings":"AAyJA,iBAAe,IAAI,kBAgDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"rename-api-paths.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-api-paths.ts"],"names":[],"mappings":"AAuJA,iBAAe,IAAI,kBAgDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}