@opencrvs/toolkit 2.0.0-rc.eac601e → 2.0.0-rc.ede78c9

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 (80) hide show
  1. package/dist/application-config/index.js +39 -11
  2. package/dist/cli.js +1418 -149
  3. package/dist/commons/api/router.d.ts +55 -54
  4. package/dist/commons/application-config/index.d.ts +16 -4
  5. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  6. package/dist/commons/events/FieldConfig.d.ts +5 -0
  7. package/dist/commons/events/locations.d.ts +17 -1
  8. package/dist/conditionals/index.js +35 -7
  9. package/dist/events/index.js +73 -7
  10. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  11. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +3 -4
  12. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  13. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  14. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  15. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  16. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  17. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -13
  18. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  19. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  20. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  21. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  22. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  23. package/dist/migrations/v2.0/create-events-index.js +1 -2
  24. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +3 -0
  25. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  26. package/dist/migrations/v2.0/delete-infrastructure-directory.js +77 -0
  27. package/dist/migrations/v2.0/index.d.ts +8 -4
  28. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/index.js +1386 -146
  30. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +5 -6
  32. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +3 -0
  33. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  34. package/dist/migrations/v2.0/merge-infrastructure-directory.js +221 -0
  35. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  36. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  37. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  38. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  39. package/dist/migrations/v2.0/migrate-scopes.js +6 -7
  40. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  42. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/migrate-workqueue-configs.js +3 -4
  44. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  46. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  47. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  48. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  50. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  51. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  52. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  53. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  54. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  55. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  56. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  57. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  58. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  59. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  60. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  61. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  62. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  63. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  64. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  65. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  66. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  67. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  68. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  69. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  70. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  71. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  72. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  73. package/dist/migrations/v2.0/update-package-json.js +105 -0
  74. package/dist/notification/index.js +35 -7
  75. package/dist/scopes/index.d.ts +82 -10
  76. package/dist/scopes/index.js +41 -8
  77. package/opencrvs-toolkit-2.0.0-rc.ede78c9.tgz +0 -0
  78. package/package.json +1 -1
  79. package/tsconfig.tsbuildinfo +1 -1
  80. package/opencrvs-toolkit-2.0.0-rc.eac601e.tgz +0 -0
@@ -87,7 +87,6 @@ exports.main = main;
87
87
  const fs = __importStar(require("fs"));
88
88
  const ts_morph_1 = require("ts-morph");
89
89
  const path_1 = __importDefault(require("path"));
90
- const _1 = require(".");
91
90
  // ─── Schema-valid keys per config type ───────────────────────────────────────
92
91
  const CLIENT_VALID_KEYS = new Set([
93
92
  'COUNTRY',
@@ -634,8 +633,8 @@ function ensureJoinImport(sf) {
634
633
  function main() {
635
634
  return __awaiter(this, void 0, void 0, function* () {
636
635
  var _a;
637
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
638
- const relCwd = (fp) => path_1.default.relative((0, _1.getCwd)(), fp);
636
+ const srcDir = path_1.default.join(process.cwd(), 'src');
637
+ const relCwd = (fp) => path_1.default.relative(process.cwd(), fp);
639
638
  // ── Phase 1: Convert JS config files to TypeScript ────────────────────────
640
639
  console.log('Phase 1: Converting JS config files to TypeScript...\n');
641
640
  let convertedCount = 0;
@@ -741,7 +740,7 @@ function main() {
741
740
  if (/\bjoin\s*\(/.test(adjustedValue)) {
742
741
  ensureJoinImport(sf);
743
742
  }
744
- console.log(` Inlined applicationConfig.${accessPath.join('.')} → ${adjustedValue} in ${path_1.default.relative((0, _1.getCwd)(), sf.getFilePath())}`);
743
+ console.log(` Inlined applicationConfig.${accessPath.join('.')} → ${adjustedValue} in ${path_1.default.relative(process.cwd(), sf.getFilePath())}`);
745
744
  filesToSaveAfterInlining.add(sf);
746
745
  madeReplacement = true;
747
746
  break; // restart — tree has changed
@@ -752,7 +751,7 @@ function main() {
752
751
  // Persist files that received inline replacements
753
752
  for (const sf of Array.from(filesToSaveAfterInlining)) {
754
753
  yield sf.save();
755
- console.log(` Saved (inlined): ${path_1.default.relative((0, _1.getCwd)(), sf.getFilePath())}`);
754
+ console.log(` Saved (inlined): ${path_1.default.relative(process.cwd(), sf.getFilePath())}`);
756
755
  }
757
756
  // Remove in reverse order to avoid index shifting
758
757
  for (const prop of [...propsToRemove].reverse()) {
@@ -1 +1 @@
1
- {"version":3,"file":"convert-paragraph-to-heading.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-paragraph-to-heading.ts"],"names":[],"mappings":"AAwJA,iBAAe,IAAI,kBA6ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"convert-paragraph-to-heading.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-paragraph-to-heading.ts"],"names":[],"mappings":"AAsJA,iBAAe,IAAI,kBA6ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -42,7 +42,6 @@ exports.main = main;
42
42
  */
43
43
  const ts_morph_1 = require("ts-morph");
44
44
  const path_1 = __importDefault(require("path"));
45
- const _1 = require(".");
46
45
  const FIELD_TYPE_ENUM_NAME = 'FieldType';
47
46
  const PARAGRAPH_MEMBER_NAME = 'PARAGRAPH';
48
47
  const HEADING_MEMBER_NAME = 'HEADING';
@@ -112,18 +111,18 @@ function processFile(filePath, project) {
112
111
  const result = transformParagraphField(obj);
113
112
  if (result === 'converted-to-heading') {
114
113
  changedCount++;
115
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Converted PARAGRAPH with heading fontVariant to HEADING`);
114
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Converted PARAGRAPH with heading fontVariant to HEADING`);
116
115
  }
117
116
  else if (result === 'removed-font-variant') {
118
117
  changedCount++;
119
- console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed non-heading fontVariant from PARAGRAPH`);
118
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Removed non-heading fontVariant from PARAGRAPH`);
120
119
  }
121
120
  }
122
121
  return changedCount;
123
122
  }
124
123
  function main() {
125
124
  return __awaiter(this, void 0, void 0, function* () {
126
- const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
125
+ const srcDir = path_1.default.join(process.cwd(), 'src');
127
126
  console.log(`Scanning for FieldType.PARAGRAPH fields in: ${srcDir}\n`);
128
127
  const project = new ts_morph_1.Project({
129
128
  tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
@@ -152,7 +151,7 @@ function main() {
152
151
  for (const filePath of modifiedFiles) {
153
152
  const sourceFile = project.getSourceFileOrThrow(filePath);
154
153
  yield sourceFile.save();
155
- console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
154
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
156
155
  }
157
156
  console.log(`\nDone. Processed ${totalChanged} FieldType.PARAGRAPH field(s).`);
158
157
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create-events-index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/create-events-index.ts"],"names":[],"mappings":"AAqTA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAmEnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"create-events-index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/create-events-index.ts"],"names":[],"mappings":"AAmTA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAmEnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -63,7 +63,6 @@ exports.main = main;
63
63
  const ts_morph_1 = require("ts-morph");
64
64
  const fs_1 = __importDefault(require("fs"));
65
65
  const path_1 = __importDefault(require("path"));
66
- const _1 = require(".");
67
66
  const DEFINE_CONFIG_NAME = 'defineConfig';
68
67
  const HANDLER_FUNCTION_NAMES = new Set([
69
68
  'getCustomEventsHandler',
@@ -274,7 +273,7 @@ function modifyHandler(sourceFile, exportNames) {
274
273
  // ─── Entry point ─────────────────────────────────────────────────────────────
275
274
  function main() {
276
275
  return __awaiter(this, void 0, void 0, function* () {
277
- const cwd = (0, _1.getCwd)();
276
+ const cwd = process.cwd();
278
277
  const srcDir = path_1.default.join(cwd, 'src');
279
278
  console.log(`Scanning for defineConfig event exports in: ${srcDir}\n`);
280
279
  const project = new ts_morph_1.Project({
@@ -0,0 +1,3 @@
1
+ declare function main(): Promise<void>;
2
+ export { main };
3
+ //# sourceMappingURL=delete-infrastructure-directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-infrastructure-directory.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/delete-infrastructure-directory.ts"],"names":[],"mappings":"AA4CA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAgCnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,77 @@
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: Remove the local `infrastructure/` directory.
25
+ *
26
+ * Used by the v1.9 → v2.0 upgrade when the country config does NOT deploy
27
+ * via Docker Swarm. In that case the `infrastructure/` directory shipped
28
+ * with opencrvs-countryconfig is no longer needed and can be removed.
29
+ *
30
+ * Usage:
31
+ * ts-node -r tsconfig-paths/register src/migrations/v2.0/delete-infrastructure-directory.ts
32
+ *
33
+ * What it does:
34
+ * 1. Stages deletion of all tracked files under `infrastructure/` via
35
+ * `git rm -rf --ignore-unmatch -- infrastructure/`. This both removes
36
+ * the files from the working tree and records the deletion in the
37
+ * index, so it shows up in the upgrade commit alongside the other
38
+ * codemod changes.
39
+ * 2. Cleans up any untracked files / empty directory that `git rm` left
40
+ * behind, so the path is fully gone from the working tree.
41
+ *
42
+ * Caveats:
43
+ * - Destructive: any local edits to `infrastructure/` are lost. Run on a
44
+ * clean working tree (or after committing your local changes).
45
+ * - If `infrastructure/` doesn't exist, this codemod is a no-op.
46
+ * - Requires git to be installed and the country config working directory
47
+ * to be a git repo.
48
+ */
49
+ const fs_1 = require("fs");
50
+ const path_1 = require("path");
51
+ const checkout_upstream_files_1 = require("./checkout-upstream-files");
52
+ const INFRASTRUCTURE_DIR = 'infrastructure';
53
+ function main() {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const fullPath = (0, path_1.join)(process.cwd(), INFRASTRUCTURE_DIR);
56
+ if (!(0, fs_1.existsSync)(fullPath)) {
57
+ console.log(`'${INFRASTRUCTURE_DIR}/' not found in ${process.cwd()} — nothing to delete.`);
58
+ return;
59
+ }
60
+ console.log(`Deleting '${INFRASTRUCTURE_DIR}/'...\n`);
61
+ (0, checkout_upstream_files_1.assertIsGitRepo)();
62
+ // `git rm -rf --ignore-unmatch` removes tracked files (working tree + index)
63
+ // and is a no-op for paths with no tracked entries, so it's safe to run
64
+ // even when `infrastructure/` exists only as untracked files.
65
+ (0, checkout_upstream_files_1.runGit)(['rm', '-rf', '--ignore-unmatch', '--', `${INFRASTRUCTURE_DIR}/`], {
66
+ silent: true
67
+ });
68
+ console.log(` Staged deletion of tracked files under '${INFRASTRUCTURE_DIR}/'.`);
69
+ // `git rm` leaves untracked files (and any now-empty directory) on disk;
70
+ // remove whatever's left so the path is fully gone.
71
+ if ((0, fs_1.existsSync)(fullPath)) {
72
+ (0, fs_1.rmSync)(fullPath, { recursive: true, force: true });
73
+ console.log(` Removed remaining untracked files under '${INFRASTRUCTURE_DIR}/'.`);
74
+ }
75
+ console.log(`\n Done. Review the staged deletion with: git diff --cached -- '${INFRASTRUCTURE_DIR}/'`);
76
+ });
77
+ }
@@ -1,7 +1,11 @@
1
- export declare function getCwd(): string;
2
1
  /**
3
- * Run the upgrade process for a given country config directory.
4
- * @param ccwd - The country config working directory.
2
+ * Run the upgrade process for the country config in the current working
3
+ * directory.
4
+ *
5
+ * @param dockerSwarm - When true, the local `infrastructure/` directory is
6
+ * merged with upstream changes (Docker Swarm deployments still need it).
7
+ * When false (the default), `infrastructure/` is deleted entirely, since
8
+ * non-Swarm deployments no longer ship it.
5
9
  */
6
- export declare function runUpgrade(ccwd: string | undefined): Promise<void>;
10
+ export declare function runUpgrade(dockerSwarm: boolean): Promise<void>;
7
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AA+BA,wBAAgB,MAAM,WAMrB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,iBA8BxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AAqCA;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBA+BpD"}