@opencrvs/toolkit 1.9.12-rc.bcb6220 → 1.9.12-rc.bcebfd3

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 (133) hide show
  1. package/build.sh +13 -0
  2. package/dist/api/index.d.ts.map +1 -1
  3. package/dist/application-config/index.d.ts +2 -0
  4. package/dist/application-config/index.d.ts.map +1 -0
  5. package/dist/application-config/index.js +2128 -0
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +3726 -0
  9. package/dist/commons/api/router.d.ts +3397 -2266
  10. package/dist/commons/application-config/index.d.ts +84 -0
  11. package/dist/commons/conditionals/conditionals.d.ts +27 -3
  12. package/dist/commons/conditionals/validate.d.ts +13 -2
  13. package/dist/commons/events/ActionConfig.d.ts +415 -1555
  14. package/dist/commons/events/ActionDocument.d.ts +888 -1941
  15. package/dist/commons/events/ActionInput.d.ts +277 -1073
  16. package/dist/commons/events/ActionType.d.ts +91 -11
  17. package/dist/commons/events/AdvancedSearchConfig.d.ts +294 -1496
  18. package/dist/commons/events/AuditLog.d.ts +405 -0
  19. package/dist/commons/events/CompositeFieldValue.d.ts +30 -190
  20. package/dist/commons/events/Conditional.d.ts +26 -38
  21. package/dist/commons/events/Constants.d.ts +1 -1
  22. package/dist/commons/events/CountryConfigQueryInput.d.ts +1592 -4471
  23. package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
  24. package/dist/commons/events/Draft.d.ts +72 -107
  25. package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
  26. package/dist/commons/events/EventConfig.d.ts +36 -2420
  27. package/dist/commons/events/EventConfigInput.d.ts +0 -3
  28. package/dist/commons/events/EventDocument.d.ts +354 -1366
  29. package/dist/commons/events/EventIndex.d.ts +212 -1010
  30. package/dist/commons/events/EventInput.d.ts +3 -8
  31. package/dist/commons/events/EventMetadata.d.ts +130 -357
  32. package/dist/commons/events/FieldConfig.d.ts +2891 -12900
  33. package/dist/commons/events/FieldType.d.ts +26 -4
  34. package/dist/commons/events/FieldTypeMapping.d.ts +314 -906
  35. package/dist/commons/events/FieldValue.d.ts +149 -527
  36. package/dist/commons/events/FileUtils.d.ts +2 -2
  37. package/dist/commons/events/Flag.d.ts +67 -0
  38. package/dist/commons/events/FormConfig.d.ts +54 -721
  39. package/dist/commons/events/PageConfig.d.ts +58 -320
  40. package/dist/commons/events/PlainDate.d.ts +1 -1
  41. package/dist/commons/events/SummaryConfig.d.ts +14 -161
  42. package/dist/commons/events/TemplateConfig.d.ts +2 -3
  43. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  44. package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
  45. package/dist/commons/events/WorkqueueConfig.d.ts +2208 -7553
  46. package/dist/commons/events/deduplication.d.ts +3 -3
  47. package/dist/commons/events/defineConfig.d.ts +2 -247
  48. package/dist/commons/events/eventConfigValidation.d.ts +8 -0
  49. package/dist/commons/events/index.d.ts +3 -0
  50. package/dist/commons/events/locations.d.ts +57 -20
  51. package/dist/commons/events/scopes.d.ts +36 -35
  52. package/dist/commons/events/state/availableActions.d.ts +7 -2
  53. package/dist/commons/events/state/flags.d.ts +21 -3
  54. package/dist/commons/events/state/index.d.ts +30 -27
  55. package/dist/commons/events/state/utils.d.ts +190 -172
  56. package/dist/commons/events/test.utils.d.ts +52 -11
  57. package/dist/commons/events/transactions.d.ts +1 -1
  58. package/dist/commons/events/utils.d.ts +374 -443
  59. package/dist/commons/notification/UserNotifications.d.ts +61 -637
  60. package/dist/conditionals/index.d.ts.map +1 -1
  61. package/dist/conditionals/index.js +302 -14
  62. package/dist/events/deduplication.d.ts +3 -3
  63. package/dist/events/index.js +2847 -2113
  64. package/dist/migrations/v2.0/add-analytics-option-to-event-configs.d.ts +3 -0
  65. package/dist/migrations/v2.0/add-analytics-option-to-event-configs.d.ts.map +1 -0
  66. package/dist/migrations/v2.0/add-analytics-option-to-event-configs.js +139 -0
  67. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
  68. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
  69. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
  70. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
  71. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
  72. package/dist/migrations/v2.0/checkout-upstream-files.js +143 -0
  73. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
  74. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
  75. package/dist/migrations/v2.0/convert-config-files-to-ts.js +829 -0
  76. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
  77. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
  78. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
  79. package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
  80. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
  81. package/dist/migrations/v2.0/create-events-index.js +326 -0
  82. package/dist/migrations/v2.0/index.d.ts +7 -0
  83. package/dist/migrations/v2.0/index.d.ts.map +1 -0
  84. package/dist/migrations/v2.0/index.js +3665 -0
  85. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
  86. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
  87. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
  88. package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
  89. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
  90. package/dist/migrations/v2.0/migrate-scopes.js +282 -0
  91. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
  92. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
  93. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
  94. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
  95. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
  96. package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
  97. package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
  98. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
  99. package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
  100. package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
  101. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
  102. package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
  103. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
  104. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
  105. package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
  106. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
  107. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
  108. package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
  109. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
  110. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
  111. package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
  112. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
  113. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
  114. package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
  115. package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
  116. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
  117. package/dist/migrations/v2.0/rename-api-paths.js +188 -0
  118. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
  119. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
  120. package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
  121. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
  122. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
  123. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +196 -0
  124. package/dist/notification/index.d.ts.map +1 -1
  125. package/dist/notification/index.js +2075 -1769
  126. package/dist/scopes/index.d.ts +640 -353
  127. package/dist/scopes/index.d.ts.map +1 -1
  128. package/dist/scopes/index.js +340 -300
  129. package/opencrvs-toolkit-1.9.12-rc.bcebfd3.tgz +0 -0
  130. package/package.json +18 -8
  131. package/tsconfig.json +12 -2
  132. package/tsconfig.tsbuildinfo +1 -1
  133. 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,2 @@
1
+ export declare function main(): Promise<void>;
2
+ //# sourceMappingURL=convert-config-files-to-ts.d.ts.map
@@ -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"}