@opencrvs/toolkit 2.1.0-rc.982e0ae → 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/create-countryconfig/index.js +133 -2
- package/dist/application-config/index.js +17 -18
- package/dist/authentication/index.js +7 -6
- package/dist/cli.js +458 -204
- package/dist/commons/api/router.d.ts +6 -42
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +1 -1
- package/dist/commons/events/ActionConfig.d.ts +4 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -12
- package/dist/commons/events/FieldConfig.d.ts +16 -15
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/locations.d.ts +4 -0
- package/dist/commons/events/test.utils.d.ts +18 -1
- package/dist/commons/events/utils.d.ts +15 -0
- package/dist/conditionals/index.js +7 -6
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/setup-environment.js +44 -26
- 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 +1901 -1792
- 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 +1 -1
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -1
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +2 -7
- package/dist/migrations/v2.1/add-translations.d.ts +1 -1
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -1
- package/dist/migrations/v2.1/add-translations.js +1 -6
- package/dist/migrations/v2.1/enable-telemetry.d.ts +1 -1
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -1
- package/dist/migrations/v2.1/enable-telemetry.js +1 -6
- 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 +96 -84
- package/dist/notification/index.js +155 -152
- package/dist/scopes/index.d.ts +109 -5
- package/dist/scopes/index.js +7 -6
- package/dist/templates/charts-values/dependencies/values.yaml +2 -0
- package/dist/translations/check.d.ts +2 -0
- package/dist/translations/check.d.ts.map +1 -1
- package/dist/translations/check.js +9 -4
- package/dist/verify/endpoints.d.ts +18 -1
- package/dist/verify/endpoints.d.ts.map +1 -1
- package/dist/verify/endpoints.js +12 -4
- 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 +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.982e0ae.tgz +0 -0
|
@@ -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
|
}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -484,7 +484,7 @@ function main() {
|
|
|
484
484
|
console.log('Registering the password-reset-link and username-reminder-link notifications...\n');
|
|
485
485
|
if (!(0, fs_1.existsSync)(tsConfigFilePath)) {
|
|
486
486
|
warnSkipped(`tsconfig.json not found in ${cwd}; notification wiring skipped entirely`);
|
|
487
|
-
return;
|
|
487
|
+
return skipped;
|
|
488
488
|
}
|
|
489
489
|
const project = new ts_morph_1.Project({
|
|
490
490
|
tsConfigFilePath,
|
|
@@ -501,11 +501,6 @@ function main() {
|
|
|
501
501
|
writeEmailTemplates(cwd);
|
|
502
502
|
addCsvRows(cwd, NOTIFICATION_CSV, NOTIFICATION_CSV_ROWS);
|
|
503
503
|
addCsvRows(cwd, LOGIN_CSV, LOGIN_CSV_ROWS);
|
|
504
|
-
|
|
505
|
-
console.warn(`\n⚠️ ${skipped.length} step(s) were skipped. Wire the following by hand before upgrading:`);
|
|
506
|
-
for (const message of skipped) {
|
|
507
|
-
console.warn(` - ${message}`);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
504
|
+
return skipped;
|
|
510
505
|
});
|
|
511
506
|
}
|
|
@@ -4,6 +4,6 @@ import { CsvFile } from '../../csv';
|
|
|
4
4
|
* local file's columns.
|
|
5
5
|
*/
|
|
6
6
|
export declare function rowsToAdd(local: CsvFile, template: CsvFile): string[];
|
|
7
|
-
declare function main(): Promise<
|
|
7
|
+
declare function main(): Promise<string[]>;
|
|
8
8
|
export { main };
|
|
9
9
|
//# sourceMappingURL=add-translations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-translations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/add-translations.ts"],"names":[],"mappings":"AAiCA,OAAO,EACL,OAAO,EAMR,MAAM,WAAW,CAAA;AA2FlB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAgBrE;AAiED,iBAAe,IAAI,
|
|
1
|
+
{"version":3,"file":"add-translations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/add-translations.ts"],"names":[],"mappings":"AAiCA,OAAO,EACL,OAAO,EAMR,MAAM,WAAW,CAAA;AA2FlB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAgBrE;AAiED,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAoBvC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -203,11 +203,6 @@ function main() {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
|
|
207
|
-
console.warn(`\n⚠️ ${skipped.length} step(s) were skipped. Add the missing translations by hand before upgrading:`);
|
|
208
|
-
for (const message of skipped) {
|
|
209
|
-
console.warn(` - ${message}`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
206
|
+
return skipped;
|
|
212
207
|
});
|
|
213
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-telemetry.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/enable-telemetry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enable-telemetry.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/enable-telemetry.ts"],"names":[],"mappings":"AAuhBA,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CA0BvC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -428,11 +428,6 @@ function main() {
|
|
|
428
428
|
addEnvironmentVariables(project, cwd, config);
|
|
429
429
|
wireIndex(project, cwd);
|
|
430
430
|
yield project.save();
|
|
431
|
-
|
|
432
|
-
console.warn(`\n⚠️ ${skipped.length} telemetry step(s) were skipped. Wire the following by hand:`);
|
|
433
|
-
for (const message of skipped) {
|
|
434
|
-
console.warn(` - ${message}`);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
431
|
+
return skipped;
|
|
437
432
|
});
|
|
438
433
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
export interface UpgradeResult {
|
|
2
|
+
/**
|
|
3
|
+
* Everything the upgrade could not do for the country config, gathered from
|
|
4
|
+
* every codemod. Empty means the upgrade is genuinely complete.
|
|
5
|
+
*/
|
|
6
|
+
outstanding: string[];
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* Run the upgrade process for the country config in the current working
|
|
3
10
|
* directory.
|
|
11
|
+
*
|
|
12
|
+
* Each codemod is best-effort: a country config that renamed or restructured
|
|
13
|
+
* the files a codemod targets keeps its own structure, and the codemod records
|
|
14
|
+
* what it could not do rather than guessing. Those records are collected here
|
|
15
|
+
* so the caller can present one list of what is left, instead of the operator
|
|
16
|
+
* having to notice individual warnings in the scrollback.
|
|
4
17
|
*/
|
|
5
|
-
export declare function runUpgrade(dockerSwarm: boolean): Promise<
|
|
18
|
+
export declare function runUpgrade(dockerSwarm: boolean): Promise<UpgradeResult>;
|
|
6
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/index.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAa7E"}
|