@opencrvs/toolkit 2.1.0-rc.99061f0 → 2.1.0-rc.9a83eed
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/README.md +2 -12
- package/build.sh +9 -1
- package/create-countryconfig/index.js +412 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +347 -281
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +751 -0
- package/dist/cli.js +2077 -299
- package/dist/commons/api/router.d.ts +689 -110
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +4 -0
- package/dist/commons/events/ActionDocument.d.ts +5 -11
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +36 -12
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +99 -63
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +169 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +25 -4
- package/dist/commons/events/utils.d.ts +17 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +335 -64
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/logger.d.ts +15 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +45 -27
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +3 -8
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +4 -0
- package/dist/environment/utils.d.ts +0 -12
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -28
- package/dist/events/index.js +7660 -7156
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +1 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +34 -6
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +506 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +208 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +433 -0
- package/dist/migrations/v2.1/index.d.ts +14 -1
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1077 -7
- package/dist/notification/index.js +1835 -1425
- package/dist/scopes/index.d.ts +435 -36
- package/dist/scopes/index.js +336 -64
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/dependencies/values.yaml +2 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/check.d.ts +21 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +132 -0
- package/dist/verify/endpoints.d.ts +19 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +353 -0
- package/dist/verify/scopes.d.ts +13 -0
- package/dist/verify/scopes.d.ts.map +1 -0
- package/dist/verify/scopes.js +131 -0
- package/dist/verify/upgrade.d.ts +14 -0
- package/dist/verify/upgrade.d.ts.map +1 -0
- package/dist/verify/upgrade.js +111 -0
- package/opencrvs-toolkit-2.1.0-rc.9a83eed.tgz +0 -0
- package/package.json +12 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.99061f0.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-
|
|
2
|
-
export declare const UPSTREAM_BRANCH = "release/
|
|
1
|
+
export declare const UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-farajaland.git";
|
|
2
|
+
export declare const UPSTREAM_BRANCH = "release/v2.0.0";
|
|
3
3
|
/**
|
|
4
4
|
* Runs a git command in the country config working directory.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,wDAC8B,CAAA;AAEvD,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAc/C;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,MAAc,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAO9C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAID,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -58,8 +58,8 @@ exports.main = main;
|
|
|
58
58
|
* - Requires the country config working directory to be a git repo.
|
|
59
59
|
*/
|
|
60
60
|
const child_process_1 = require("child_process");
|
|
61
|
-
exports.UPSTREAM_URL = 'https://github.com/opencrvs/opencrvs-
|
|
62
|
-
exports.UPSTREAM_BRANCH = 'release/
|
|
61
|
+
exports.UPSTREAM_URL = 'https://github.com/opencrvs/opencrvs-farajaland.git';
|
|
62
|
+
exports.UPSTREAM_BRANCH = 'release/v2.0.0';
|
|
63
63
|
// Remote name used only for the duration of this codemod. Prefixed to avoid
|
|
64
64
|
// clashing with remotes the user may have (origin, upstream, etc.).
|
|
65
65
|
const TEMP_REMOTE = 'opencrvs-upgrade-v19-v20-codemod';
|
|
@@ -56,7 +56,7 @@ exports.main = main;
|
|
|
56
56
|
* so `git merge-base HEAD upstream/develop` typically returns nothing.
|
|
57
57
|
* - With no merge-base, a 3-way merge degenerates to a 2-way diff against
|
|
58
58
|
* an empty file — every line that differs becomes a conflict.
|
|
59
|
-
* - `release
|
|
59
|
+
* - `release/1.9.15` is the latest 1.9.x release on upstream and is a
|
|
60
60
|
* near-perfect representation of "what `infrastructure/` looked like
|
|
61
61
|
* before v2.0", regardless of whether the fork's git history reaches it.
|
|
62
62
|
* - For files the country config never modified relative to that baseline,
|
|
@@ -81,7 +81,7 @@ exports.main = main;
|
|
|
81
81
|
* sides changed a binary file, the result will be invalid and a warning
|
|
82
82
|
* is printed.
|
|
83
83
|
* - Forks that are on a much older 1.9.x and never merged later 1.9 patches
|
|
84
|
-
* may see a few extra conflicts on files where 1.9.x → release
|
|
84
|
+
* may see a few extra conflicts on files where 1.9.x → release/1.9.15
|
|
85
85
|
* patches and v1.9 → v2.0 changes textually overlap.
|
|
86
86
|
*/
|
|
87
87
|
const child_process_1 = require("child_process");
|
|
@@ -97,7 +97,7 @@ const INFRASTRUCTURE_DIR = 'infrastructure';
|
|
|
97
97
|
// Synthetic merge-base: the tip of upstream's latest 1.9.x release line.
|
|
98
98
|
// We use this branch's content as the "common ancestor" for every file,
|
|
99
99
|
// since most country forks don't share git history with upstream.
|
|
100
|
-
const BASE_BRANCH = 'release
|
|
100
|
+
const BASE_BRANCH = 'release/1.9.15';
|
|
101
101
|
/**
|
|
102
102
|
* Reads `git show <ref>:<path>` as a Uint8Array (binary-safe).
|
|
103
103
|
* Returns `null` if the path doesn't exist at that ref.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-explicit-correction-flags.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/add-explicit-correction-flags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-explicit-correction-flags.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/add-explicit-correction-flags.ts"],"names":[],"mappings":"AA8QA,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CA4EvC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -52,6 +52,7 @@ exports.main = main;
|
|
|
52
52
|
*/
|
|
53
53
|
const ts_morph_1 = require("ts-morph");
|
|
54
54
|
const path_1 = __importDefault(require("path"));
|
|
55
|
+
const fs_1 = require("fs");
|
|
55
56
|
const DEFINE_CONFIG_NAME = 'defineConfig';
|
|
56
57
|
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
57
58
|
const TYPE_PROPERTY_NAME = 'type';
|
|
@@ -59,6 +60,11 @@ const FLAGS_PROPERTY_NAME = 'flags';
|
|
|
59
60
|
const CONDITIONALS_PROPERTY_NAME = 'conditionals';
|
|
60
61
|
const ACTION_TYPE_ENUM_NAME = 'ActionType';
|
|
61
62
|
const REQUEST_CORRECTION_TYPE = 'REQUEST_CORRECTION';
|
|
63
|
+
const skipped = [];
|
|
64
|
+
function warnSkipped(message) {
|
|
65
|
+
skipped.push(message);
|
|
66
|
+
console.warn(` ⚠️ ${message}`);
|
|
67
|
+
}
|
|
62
68
|
const CORRECTION_ACTIONS_TO_ADD = [
|
|
63
69
|
{
|
|
64
70
|
actionType: 'APPROVE_CORRECTION',
|
|
@@ -144,8 +150,9 @@ function buildCorrectionActionText(spec, typeStyle, flagsText, conditionalsText)
|
|
|
144
150
|
function processFile(filePath, project) {
|
|
145
151
|
const sourceFile = project.getSourceFile(filePath);
|
|
146
152
|
if (!sourceFile)
|
|
147
|
-
return 0;
|
|
153
|
+
return { changes: 0, defineConfigs: 0 };
|
|
148
154
|
let changes = 0;
|
|
155
|
+
let defineConfigs = 0;
|
|
149
156
|
const relPath = path_1.default.relative(process.cwd(), filePath);
|
|
150
157
|
const callExpressions = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.CallExpression);
|
|
151
158
|
for (const call of callExpressions) {
|
|
@@ -154,6 +161,7 @@ function processFile(filePath, project) {
|
|
|
154
161
|
expression.getText() !== DEFINE_CONFIG_NAME) {
|
|
155
162
|
continue;
|
|
156
163
|
}
|
|
164
|
+
defineConfigs++;
|
|
157
165
|
const args = call.getArguments();
|
|
158
166
|
if (args.length === 0)
|
|
159
167
|
continue;
|
|
@@ -194,14 +202,19 @@ function processFile(filePath, project) {
|
|
|
194
202
|
console.log(` [${relPath}] Added ${spec.actionType} action carrying over REQUEST_CORRECTION's flags/conditionals`);
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
|
-
return changes;
|
|
205
|
+
return { changes, defineConfigs };
|
|
198
206
|
}
|
|
199
207
|
function main() {
|
|
200
208
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
209
|
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
210
|
+
const tsConfigFilePath = path_1.default.resolve(srcDir, '../tsconfig.json');
|
|
202
211
|
console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
|
|
212
|
+
if (!(0, fs_1.existsSync)(tsConfigFilePath)) {
|
|
213
|
+
warnSkipped(`tsconfig.json not found next to ${srcDir}, so no source could be read; add APPROVE_CORRECTION/REJECT_CORRECTION action configs by hand wherever REQUEST_CORRECTION sets flags or conditionals`);
|
|
214
|
+
return skipped;
|
|
215
|
+
}
|
|
203
216
|
const project = new ts_morph_1.Project({
|
|
204
|
-
tsConfigFilePath
|
|
217
|
+
tsConfigFilePath,
|
|
205
218
|
skipAddingFilesFromTsConfig: false
|
|
206
219
|
});
|
|
207
220
|
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
@@ -210,18 +223,32 @@ function main() {
|
|
|
210
223
|
});
|
|
211
224
|
console.log(`Found ${sourceFiles.length} source file(s) to analyse.\n`);
|
|
212
225
|
let totalChanges = 0;
|
|
226
|
+
let totalDefineConfigs = 0;
|
|
213
227
|
const modifiedFiles = [];
|
|
214
228
|
for (const sourceFile of sourceFiles) {
|
|
215
229
|
const filePath = sourceFile.getFilePath();
|
|
216
|
-
const changes = processFile(filePath, project);
|
|
230
|
+
const { changes, defineConfigs } = processFile(filePath, project);
|
|
231
|
+
totalDefineConfigs += defineConfigs;
|
|
217
232
|
if (changes > 0) {
|
|
218
233
|
totalChanges += changes;
|
|
219
234
|
modifiedFiles.push(filePath);
|
|
220
235
|
}
|
|
221
236
|
}
|
|
237
|
+
/*
|
|
238
|
+
* Finding no `defineConfig` call at all is not the same as finding nothing to
|
|
239
|
+
* change. This codemod recognises event configuration only through that call,
|
|
240
|
+
* so a country config that declares its events some other way looks
|
|
241
|
+
* identical to one that needed no change — and would silently keep flags and
|
|
242
|
+
* conditionals that stopped applying to APPROVE_CORRECTION/REJECT_CORRECTION
|
|
243
|
+
* in this release. Say so rather than reporting success.
|
|
244
|
+
*/
|
|
245
|
+
if (totalDefineConfigs === 0) {
|
|
246
|
+
warnSkipped('No defineConfig call was found under src/, so no event configuration could be inspected; check by hand that any flags or conditionals on REQUEST_CORRECTION are repeated on APPROVE_CORRECTION and REJECT_CORRECTION');
|
|
247
|
+
return skipped;
|
|
248
|
+
}
|
|
222
249
|
if (modifiedFiles.length === 0) {
|
|
223
|
-
console.log(
|
|
224
|
-
return;
|
|
250
|
+
console.log(`No REQUEST_CORRECTION actions with flags/conditionals found across ${totalDefineConfigs} defineConfig call(s). Nothing to do.`);
|
|
251
|
+
return skipped;
|
|
225
252
|
}
|
|
226
253
|
console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
|
|
227
254
|
for (const filePath of modifiedFiles) {
|
|
@@ -230,5 +257,6 @@ function main() {
|
|
|
230
257
|
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
231
258
|
}
|
|
232
259
|
console.log(`\nDone. Added ${totalChanges} correction action config(s) across ${modifiedFiles.length} file(s).`);
|
|
260
|
+
return skipped;
|
|
233
261
|
});
|
|
234
262
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-recovery-link-notifications.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/add-recovery-link-notifications.ts"],"names":[],"mappings":"AAopBA,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAmCvC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|