@opencrvs/toolkit 2.0.0-rc.754b1d1 → 2.0.0-rc.764c76e
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/dist/application-config/index.js +11 -39
- package/dist/cli.js +317 -1656
- package/dist/commons/api/router.d.ts +54 -55
- package/dist/commons/application-config/index.d.ts +4 -16
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/locations.d.ts +1 -17
- package/dist/conditionals/index.js +7 -35
- package/dist/events/index.js +7 -73
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +39 -63
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -19
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +13 -17
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +5 -4
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +5 -4
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
- package/dist/migrations/v2.0/create-events-index.js +2 -1
- package/dist/migrations/v2.0/index.d.ts +4 -8
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +314 -1624
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +7 -95
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +7 -6
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +4 -3
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +4 -3
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-delete-actions.js +4 -3
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-demo-scope.js +3 -2
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-deprecated-imports.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-hearth-migrations.js +2 -1
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +4 -3
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-review-from-register-action.js +4 -3
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
- package/dist/migrations/v2.0/rename-api-paths.js +4 -3
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
- package/dist/migrations/v2.0/rename-location-parent-id.js +4 -3
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +2 -1
- package/dist/notification/index.js +7 -35
- package/dist/scopes/index.d.ts +10 -82
- package/dist/scopes/index.js +8 -41
- package/opencrvs-toolkit-2.0.0-rc.764c76e.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
- package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -3
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -77
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -3
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -221
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-application-config-url.js +0 -342
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
- package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
- package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
- package/dist/migrations/v2.0/update-package-json.js +0 -105
- package/opencrvs-toolkit-2.0.0-rc.754b1d1.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-built-in-validate-actions-custom.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/make-built-in-validate-actions-custom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"make-built-in-validate-actions-custom.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/make-built-in-validate-actions-custom.ts"],"names":[],"mappings":"AA6WA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -41,14 +41,11 @@ exports.main = main;
|
|
|
41
41
|
* - Removes the `deduplication` property from those objects
|
|
42
42
|
* - Replaces `review: { fields: <value> }` with `form: <value>`, or
|
|
43
43
|
* `review: <expr>` with `form: <expr>.fields` when the value is not an inline object
|
|
44
|
-
* - Adds the top-level `validated` flag definition and `{ id: 'validated',
|
|
45
|
-
* operation: 'add' }` to the (now custom) validate action
|
|
46
|
-
* - Adds `{ id: 'validated', operation: 'remove' }` to every `REGISTER` action
|
|
47
|
-
* in the same config, closing the flag's lifecycle when registration happens
|
|
48
44
|
* - Saves the modified files in-place
|
|
49
45
|
*/
|
|
50
46
|
const ts_morph_1 = require("ts-morph");
|
|
51
47
|
const path_1 = __importDefault(require("path"));
|
|
48
|
+
const _1 = require(".");
|
|
52
49
|
const TOOLKIT_EVENTS_MODULE = '@opencrvs/toolkit/events';
|
|
53
50
|
const REQUIRED_SYMBOLS = [
|
|
54
51
|
'ConditionalType',
|
|
@@ -78,8 +75,6 @@ function ensureImports(sourceFile) {
|
|
|
78
75
|
const DEFINE_CONFIG_NAME = 'defineConfig';
|
|
79
76
|
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
80
77
|
const TYPE_PROPERTY_NAME = 'type';
|
|
81
|
-
const ID_PROPERTY_NAME = 'id';
|
|
82
|
-
const FLAGS_PROPERTY_NAME = 'flags';
|
|
83
78
|
const CUSTOM_ACTION_TYPE_PROPERTY_NAME = 'customActionType';
|
|
84
79
|
const AUDIT_HISTORY_LABEL_PROPERTY_NAME = 'auditHistoryLabel';
|
|
85
80
|
const DEDUPLICATION_PROPERTY_NAME = 'deduplication';
|
|
@@ -89,12 +84,9 @@ const FORM_PROPERTY_NAME = 'form';
|
|
|
89
84
|
const ACTION_TYPE_ENUM_NAME = 'ActionType';
|
|
90
85
|
const VALIDATE_MEMBER_NAME = 'VALIDATE';
|
|
91
86
|
const CUSTOM_MEMBER_NAME = 'CUSTOM';
|
|
92
|
-
const REGISTER_MEMBER_NAME = 'REGISTER';
|
|
93
87
|
const VALIDATE_STRING_LITERAL = 'VALIDATE';
|
|
94
88
|
const CUSTOM_STRING_LITERAL = 'CUSTOM';
|
|
95
|
-
const REGISTER_STRING_LITERAL = 'REGISTER';
|
|
96
89
|
const VALIDATE_DECLARATION_VALUE = 'VALIDATE_DECLARATION';
|
|
97
|
-
const VALIDATED_FLAG_VALUE = 'validated';
|
|
98
90
|
function isValidateType(typeInitializer) {
|
|
99
91
|
// Matches: ActionType.VALIDATE
|
|
100
92
|
if (typeInitializer.getKind() === ts_morph_1.SyntaxKind.PropertyAccessExpression) {
|
|
@@ -239,72 +231,6 @@ function transformValidateActionToCustom(obj, eventType) {
|
|
|
239
231
|
}
|
|
240
232
|
return true;
|
|
241
233
|
}
|
|
242
|
-
function isRegisterAction(action) {
|
|
243
|
-
const typeProperty = action.getProperty(TYPE_PROPERTY_NAME);
|
|
244
|
-
if (!typeProperty || !ts_morph_1.Node.isPropertyAssignment(typeProperty))
|
|
245
|
-
return false;
|
|
246
|
-
const typeInit = typeProperty.getInitializer();
|
|
247
|
-
if (!typeInit)
|
|
248
|
-
return false;
|
|
249
|
-
// Matches: ActionType.REGISTER
|
|
250
|
-
if (ts_morph_1.Node.isPropertyAccessExpression(typeInit)) {
|
|
251
|
-
const enumExpr = typeInit.getExpression();
|
|
252
|
-
return (ts_morph_1.Node.isIdentifier(enumExpr) &&
|
|
253
|
-
enumExpr.getText() === ACTION_TYPE_ENUM_NAME &&
|
|
254
|
-
typeInit.getName() === REGISTER_MEMBER_NAME);
|
|
255
|
-
}
|
|
256
|
-
// Matches: "REGISTER"
|
|
257
|
-
if (ts_morph_1.Node.isStringLiteral(typeInit)) {
|
|
258
|
-
return typeInit.getLiteralValue() === REGISTER_STRING_LITERAL;
|
|
259
|
-
}
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Returns true if an array literal contains an object literal with `id: <id>`.
|
|
264
|
-
*/
|
|
265
|
-
function arrayHasElementWithId(array, id) {
|
|
266
|
-
for (const el of array.getElements()) {
|
|
267
|
-
if (!ts_morph_1.Node.isObjectLiteralExpression(el))
|
|
268
|
-
continue;
|
|
269
|
-
const idProp = el.getProperty(ID_PROPERTY_NAME);
|
|
270
|
-
if (!idProp || !ts_morph_1.Node.isPropertyAssignment(idProp))
|
|
271
|
-
continue;
|
|
272
|
-
const idInit = idProp.getInitializer();
|
|
273
|
-
if (idInit &&
|
|
274
|
-
ts_morph_1.Node.isStringLiteral(idInit) &&
|
|
275
|
-
idInit.getLiteralValue() === id) {
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return false;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Adds `{ id: 'validated', operation: 'remove' }` to a REGISTER action's
|
|
283
|
-
* `flags` array. Skips if any `validated` flag entry is already present —
|
|
284
|
-
* this keeps the codemod idempotent and avoids stomping on an intentional
|
|
285
|
-
* `add` op a maintainer may have authored manually.
|
|
286
|
-
*
|
|
287
|
-
* Returns true if a change was made.
|
|
288
|
-
*/
|
|
289
|
-
function ensureRegisterRemovesValidatedFlag(action) {
|
|
290
|
-
const entry = `{ id: '${VALIDATED_FLAG_VALUE}', operation: 'remove' }`;
|
|
291
|
-
const flagsProp = action.getProperty(FLAGS_PROPERTY_NAME);
|
|
292
|
-
if (flagsProp && ts_morph_1.Node.isPropertyAssignment(flagsProp)) {
|
|
293
|
-
const flagsInit = flagsProp.getInitializer();
|
|
294
|
-
if (flagsInit && ts_morph_1.Node.isArrayLiteralExpression(flagsInit)) {
|
|
295
|
-
if (arrayHasElementWithId(flagsInit, VALIDATED_FLAG_VALUE))
|
|
296
|
-
return false;
|
|
297
|
-
flagsInit.addElement(entry);
|
|
298
|
-
return true;
|
|
299
|
-
}
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
action.addPropertyAssignment({
|
|
303
|
-
name: FLAGS_PROPERTY_NAME,
|
|
304
|
-
initializer: `[${entry}]`
|
|
305
|
-
});
|
|
306
|
-
return true;
|
|
307
|
-
}
|
|
308
234
|
function processFile(filePath, project) {
|
|
309
235
|
const sourceFile = project.getSourceFile(filePath);
|
|
310
236
|
if (!sourceFile)
|
|
@@ -337,7 +263,7 @@ function processFile(filePath, project) {
|
|
|
337
263
|
// Resolve the root event type for use in the auditHistoryLabel id
|
|
338
264
|
const eventType = resolveEventType(configArg);
|
|
339
265
|
if (!eventType) {
|
|
340
|
-
console.warn(` [${path_1.default.relative(
|
|
266
|
+
console.warn(` [${path_1.default.relative((0, _1.getCwd)(), configArg.getSourceFile().getFilePath())}] Could not resolve root 'type' from defineConfig — skipping auditHistoryLabel id generation`);
|
|
341
267
|
}
|
|
342
268
|
// Iterate over every element in the `actions` array
|
|
343
269
|
let fileNeedsImports = false;
|
|
@@ -350,7 +276,7 @@ function processFile(filePath, project) {
|
|
|
350
276
|
transformedCount++;
|
|
351
277
|
fileNeedsImports = true;
|
|
352
278
|
configHadValidateAction = true;
|
|
353
|
-
console.log(` [${path_1.default.relative(
|
|
279
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Transformed VALIDATE action to CUSTOM with customActionType: '${VALIDATE_DECLARATION_VALUE}'`);
|
|
354
280
|
}
|
|
355
281
|
}
|
|
356
282
|
// Add top-level flags array to the config object if a VALIDATE action was found
|
|
@@ -370,21 +296,7 @@ function processFile(filePath, project) {
|
|
|
370
296
|
}
|
|
371
297
|
]`
|
|
372
298
|
});
|
|
373
|
-
console.log(` [${path_1.default.relative(
|
|
374
|
-
}
|
|
375
|
-
// Close the `validated` flag's lifecycle: when the validate action adds the
|
|
376
|
-
// flag, the matching REGISTER action(s) must remove it on registration.
|
|
377
|
-
if (configHadValidateAction) {
|
|
378
|
-
for (const element of actionsInitializer.getElements()) {
|
|
379
|
-
if (!ts_morph_1.Node.isObjectLiteralExpression(element))
|
|
380
|
-
continue;
|
|
381
|
-
if (!isRegisterAction(element))
|
|
382
|
-
continue;
|
|
383
|
-
if (ensureRegisterRemovesValidatedFlag(element)) {
|
|
384
|
-
transformedCount++;
|
|
385
|
-
console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Added '${VALIDATED_FLAG_VALUE}' remove-flag to REGISTER action`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
299
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Added top-level 'flags' array to defineConfig`);
|
|
388
300
|
}
|
|
389
301
|
if (fileNeedsImports) {
|
|
390
302
|
ensureImports(sourceFile);
|
|
@@ -394,7 +306,7 @@ function processFile(filePath, project) {
|
|
|
394
306
|
}
|
|
395
307
|
function main() {
|
|
396
308
|
return __awaiter(this, void 0, void 0, function* () {
|
|
397
|
-
const srcDir = path_1.default.join(
|
|
309
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
398
310
|
console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
|
|
399
311
|
const project = new ts_morph_1.Project({
|
|
400
312
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -425,8 +337,8 @@ function main() {
|
|
|
425
337
|
for (const filePath of modifiedFiles) {
|
|
426
338
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
427
339
|
yield sourceFile.save();
|
|
428
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
340
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
429
341
|
}
|
|
430
|
-
console.log(`\nDone.
|
|
342
|
+
console.log(`\nDone. Transformed ${totalTransformed} VALIDATE action(s) to CUSTOM with customActionType: '${VALIDATE_DECLARATION_VALUE}'.`);
|
|
431
343
|
});
|
|
432
344
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-scopes.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-scopes.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -27,6 +27,7 @@ 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(".");
|
|
30
31
|
const ROLES_FILE_RELATIVE_PATH = 'src/data-seeding/roles/roles.ts';
|
|
31
32
|
const SCOPES_PROPERTY_NAME = 'scopes';
|
|
32
33
|
const TOOLKIT_SCOPES_MODULE = '@opencrvs/toolkit/scopes';
|
|
@@ -86,7 +87,7 @@ function migrateScopesArrays(rolesFilePath, project) {
|
|
|
86
87
|
const scopeKey = resolveScopeKeyFromElementAccess(element);
|
|
87
88
|
if (scopeKey && !(scopeKey in scopes_deprecated_do_not_use_1.SCOPES)) {
|
|
88
89
|
// eslint-disable-next-line no-console
|
|
89
|
-
console.warn(` [${path_1.default.relative(
|
|
90
|
+
console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Removing unknown scope reference: SCOPES.${scopeKey}`);
|
|
90
91
|
initializer.removeElement(index);
|
|
91
92
|
removedCount++;
|
|
92
93
|
continue;
|
|
@@ -94,7 +95,7 @@ function migrateScopesArrays(rolesFilePath, project) {
|
|
|
94
95
|
const legacyScope = resolveLegacyScopeFromElement(element);
|
|
95
96
|
if (!legacyScope) {
|
|
96
97
|
// eslint-disable-next-line no-console
|
|
97
|
-
console.warn(` [${path_1.default.relative(
|
|
98
|
+
console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Skipping non-literal scope expression: ${element.getText()}`);
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
try {
|
|
@@ -102,7 +103,7 @@ function migrateScopesArrays(rolesFilePath, project) {
|
|
|
102
103
|
const scope = (0, scopes_1.decodeScope)(migratedScope);
|
|
103
104
|
if (!scope) {
|
|
104
105
|
// eslint-disable-next-line no-console
|
|
105
|
-
console.warn(` [${path_1.default.relative(
|
|
106
|
+
console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Could not decode migrated scope '${migratedScope}'.`);
|
|
106
107
|
continue;
|
|
107
108
|
}
|
|
108
109
|
element.replaceWithText(JSON.stringify(scope));
|
|
@@ -110,13 +111,13 @@ function migrateScopesArrays(rolesFilePath, project) {
|
|
|
110
111
|
}
|
|
111
112
|
catch (error) {
|
|
112
113
|
// eslint-disable-next-line no-console
|
|
113
|
-
console.warn(` [${path_1.default.relative(
|
|
114
|
+
console.warn(` [${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}] Could not migrate scope '${legacyScope}': ${error}`);
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
if (removedCount > 0) {
|
|
118
119
|
// eslint-disable-next-line no-console
|
|
119
|
-
console.log(` Removed ${removedCount} unknown SCOPES reference(s) from '${path_1.default.relative(
|
|
120
|
+
console.log(` Removed ${removedCount} unknown SCOPES reference(s) from '${path_1.default.relative((0, _1.getCwd)(), rolesFilePath)}'.`);
|
|
120
121
|
}
|
|
121
122
|
return { migratedCount, removedCount };
|
|
122
123
|
}
|
|
@@ -248,7 +249,7 @@ function removeRoleTypeDefinitionAndUnusedImports(rolesFilePath, project) {
|
|
|
248
249
|
}
|
|
249
250
|
function main() {
|
|
250
251
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
const cwd =
|
|
252
|
+
const cwd = (0, _1.getCwd)();
|
|
252
253
|
const srcDir = path_1.default.join(cwd, 'src');
|
|
253
254
|
const rolesFilePath = path_1.default.join(cwd, ROLES_FILE_RELATIVE_PATH);
|
|
254
255
|
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":"
|
|
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"}
|
|
@@ -45,6 +45,7 @@ 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(".");
|
|
48
49
|
const DEFINE_WORKQUEUES_NAME = 'defineWorkqueues';
|
|
49
50
|
const QUERY_PROPERTY_NAME = 'query';
|
|
50
51
|
const TYPE_PROPERTY_NAME = 'type';
|
|
@@ -222,7 +223,7 @@ function processFile(filePath, project) {
|
|
|
222
223
|
const changed = walkQuery(queryInit);
|
|
223
224
|
if (changed > 0) {
|
|
224
225
|
migratedCount += changed;
|
|
225
|
-
console.log(` [${path_1.default.relative(
|
|
226
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Migrated ${changed} clause(s): VALIDATED status → flags.anyOf`);
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
}
|
|
@@ -231,7 +232,7 @@ function processFile(filePath, project) {
|
|
|
231
232
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
232
233
|
function main() {
|
|
233
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
const srcDir = path_1.default.join(
|
|
235
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
235
236
|
console.log(`Scanning for defineWorkqueues calls in: ${srcDir}\n`);
|
|
236
237
|
const project = new ts_morph_1.Project({
|
|
237
238
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -260,7 +261,7 @@ function main() {
|
|
|
260
261
|
for (const filePath of modifiedFiles) {
|
|
261
262
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
262
263
|
yield sourceFile.save();
|
|
263
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
264
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
264
265
|
}
|
|
265
266
|
console.log(`\nDone. Migrated ${totalMigrated} clause(s) from VALIDATED status to flags.anyOf['validated'].`);
|
|
266
267
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-workqueue-configs.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/migrate-workqueue-configs.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -43,6 +43,7 @@ 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(".");
|
|
46
47
|
const DEFINE_WORKQUEUES_NAME = 'defineWorkqueues';
|
|
47
48
|
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
48
49
|
const ACTION_PROPERTY_NAME = 'action';
|
|
@@ -170,7 +171,7 @@ function processFile(filePath, project) {
|
|
|
170
171
|
if (!sourceFile)
|
|
171
172
|
return 0;
|
|
172
173
|
let migratedWorkqueues = 0;
|
|
173
|
-
const relPath = path_1.default.relative(
|
|
174
|
+
const relPath = path_1.default.relative((0, _1.getCwd)(), filePath);
|
|
174
175
|
const callExpressions = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.CallExpression);
|
|
175
176
|
for (const call of callExpressions) {
|
|
176
177
|
const expression = call.getExpression();
|
|
@@ -194,7 +195,7 @@ function processFile(filePath, project) {
|
|
|
194
195
|
}
|
|
195
196
|
function main() {
|
|
196
197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
const srcDir = path_1.default.join(
|
|
198
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
198
199
|
// eslint-disable-next-line no-console
|
|
199
200
|
console.log(`Scanning for defineWorkqueues calls in: ${srcDir}\n`);
|
|
200
201
|
const project = new ts_morph_1.Project({
|
|
@@ -228,7 +229,7 @@ function main() {
|
|
|
228
229
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
229
230
|
yield sourceFile.save();
|
|
230
231
|
// eslint-disable-next-line no-console
|
|
231
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
232
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
232
233
|
}
|
|
233
234
|
// eslint-disable-next-line no-console
|
|
234
235
|
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":"
|
|
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"}
|
|
@@ -39,6 +39,7 @@ 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(".");
|
|
42
43
|
const DEFINE_CONFIG_NAME = 'defineConfig';
|
|
43
44
|
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
44
45
|
const TYPE_PROPERTY_NAME = 'type';
|
|
@@ -111,14 +112,14 @@ function processFile(filePath, project) {
|
|
|
111
112
|
for (const index of indicesToRemove.reverse()) {
|
|
112
113
|
actionsInitializer.removeElement(index);
|
|
113
114
|
removedCount++;
|
|
114
|
-
console.log(` [${path_1.default.relative(
|
|
115
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed DELETE action at index ${index}`);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
return removedCount;
|
|
118
119
|
}
|
|
119
120
|
function main() {
|
|
120
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const srcDir = path_1.default.join(
|
|
122
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
122
123
|
console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
|
|
123
124
|
const project = new ts_morph_1.Project({
|
|
124
125
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -149,7 +150,7 @@ function main() {
|
|
|
149
150
|
for (const filePath of modifiedFiles) {
|
|
150
151
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
151
152
|
yield sourceFile.save();
|
|
152
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
153
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
153
154
|
}
|
|
154
155
|
console.log(`\nDone. Removed ${totalRemoved} DELETE action(s) from defineConfig call(s).`);
|
|
155
156
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-demo-scope.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-demo-scope.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -25,13 +25,14 @@ 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(".");
|
|
28
29
|
const ROLES_HANDLER_RELATIVE_PATH = 'src/data-seeding/roles/handler.ts';
|
|
29
30
|
function main() {
|
|
30
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
32
|
var _a;
|
|
32
|
-
const rolesHandlerPath = path_1.default.join(
|
|
33
|
+
const rolesHandlerPath = path_1.default.join((0, _1.getCwd)(), ROLES_HANDLER_RELATIVE_PATH);
|
|
33
34
|
const project = new ts_morph_1.Project({
|
|
34
|
-
tsConfigFilePath: path_1.default.resolve(
|
|
35
|
+
tsConfigFilePath: path_1.default.resolve((0, _1.getCwd)(), 'tsconfig.json'),
|
|
35
36
|
skipAddingFilesFromTsConfig: false
|
|
36
37
|
});
|
|
37
38
|
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":"
|
|
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"}
|
|
@@ -25,6 +25,7 @@ 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(".");
|
|
28
29
|
const DEPRECATED_IMPORT = 'SCOPES';
|
|
29
30
|
const TARGET_MODULES = new Set([
|
|
30
31
|
'@opencrvs/toolkit/scopes',
|
|
@@ -55,13 +56,13 @@ function processFile(filePath, project) {
|
|
|
55
56
|
if (!hasAnyNamedImportsLeft && !hasDefaultImport && !hasNamespaceImport) {
|
|
56
57
|
decl.remove();
|
|
57
58
|
}
|
|
58
|
-
console.log(` [${path_1.default.relative(
|
|
59
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed ${matchingNamedImports.length} deprecated '${DEPRECATED_IMPORT}' import(s) from '${decl.getModuleSpecifierValue()}'`);
|
|
59
60
|
}
|
|
60
61
|
return removedCount;
|
|
61
62
|
}
|
|
62
63
|
function main() {
|
|
63
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const srcDir = path_1.default.join(
|
|
65
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
65
66
|
console.log(`Scanning for deprecated imports in: ${srcDir}\n`);
|
|
66
67
|
const project = new ts_morph_1.Project({
|
|
67
68
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -89,7 +90,7 @@ function main() {
|
|
|
89
90
|
console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
|
|
90
91
|
for (const filePath of modifiedFiles) {
|
|
91
92
|
yield project.getSourceFileOrThrow(filePath).save();
|
|
92
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
93
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
93
94
|
}
|
|
94
95
|
console.log(`\nDone. Removed ${totalRemoved} deprecated import(s).`);
|
|
95
96
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-hearth-migrations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/remove-hearth-migrations.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -48,6 +48,7 @@ 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(".");
|
|
51
52
|
const PATHS_TO_REMOVE = [
|
|
52
53
|
{
|
|
53
54
|
relativePath: 'src/migrations/hearth',
|
|
@@ -62,7 +63,7 @@ const PATHS_TO_REMOVE = [
|
|
|
62
63
|
function main() {
|
|
63
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
65
|
for (const { relativePath, label } of PATHS_TO_REMOVE) {
|
|
65
|
-
const absolutePath = path_1.default.join(
|
|
66
|
+
const absolutePath = path_1.default.join((0, _1.getCwd)(), relativePath);
|
|
66
67
|
if (fs.existsSync(absolutePath)) {
|
|
67
68
|
fs.rmSync(absolutePath, { recursive: true, force: true });
|
|
68
69
|
// 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":"
|
|
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"}
|
|
@@ -38,6 +38,7 @@ 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(".");
|
|
41
42
|
const INHERENT_FLAGS_ENUM_NAME = 'InherentFlags';
|
|
42
43
|
const PENDING_CERTIFICATION_MEMBER = 'PENDING_CERTIFICATION';
|
|
43
44
|
function isPendingCertificationFlag(node) {
|
|
@@ -66,14 +67,14 @@ function processFile(filePath, project) {
|
|
|
66
67
|
for (const index of indicesToRemove.reverse()) {
|
|
67
68
|
array.removeElement(index);
|
|
68
69
|
removedCount++;
|
|
69
|
-
console.log(` [${path_1.default.relative(
|
|
70
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed InherentFlags.PENDING_CERTIFICATION from array`);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
return removedCount;
|
|
73
74
|
}
|
|
74
75
|
function main() {
|
|
75
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const srcDir = path_1.default.join(
|
|
77
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
77
78
|
console.log(`Scanning for InherentFlags.PENDING_CERTIFICATION array elements in: ${srcDir}\n`);
|
|
78
79
|
const project = new ts_morph_1.Project({
|
|
79
80
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -102,7 +103,7 @@ function main() {
|
|
|
102
103
|
for (const filePath of modifiedFiles) {
|
|
103
104
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
104
105
|
yield sourceFile.save();
|
|
105
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
106
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
106
107
|
}
|
|
107
108
|
console.log(`\nDone. Removed ${totalRemoved} InherentFlags.PENDING_CERTIFICATION element(s) from array(s).`);
|
|
108
109
|
});
|
|
@@ -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":"
|
|
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"}
|
|
@@ -39,6 +39,7 @@ 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(".");
|
|
42
43
|
const DEFINE_CONFIG_NAME = 'defineConfig';
|
|
43
44
|
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
44
45
|
const TYPE_PROPERTY_NAME = 'type';
|
|
@@ -116,7 +117,7 @@ function processFile(filePath, project) {
|
|
|
116
117
|
const wasRemoved = removeReviewFromRegisterActions(element);
|
|
117
118
|
if (wasRemoved) {
|
|
118
119
|
removedCount++;
|
|
119
|
-
console.log(` [${path_1.default.relative(
|
|
120
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Removed 'review' from REGISTER action`);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -124,7 +125,7 @@ function processFile(filePath, project) {
|
|
|
124
125
|
}
|
|
125
126
|
function main() {
|
|
126
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const srcDir = path_1.default.join(
|
|
128
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
128
129
|
console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
|
|
129
130
|
const project = new ts_morph_1.Project({
|
|
130
131
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -156,7 +157,7 @@ function main() {
|
|
|
156
157
|
for (const filePath of modifiedFiles) {
|
|
157
158
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
158
159
|
yield sourceFile.save();
|
|
159
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
160
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
160
161
|
}
|
|
161
162
|
console.log(`\nDone. Removed ${totalRemoved} 'review' property assignment(s) from REGISTER action(s).`);
|
|
162
163
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-api-paths.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-api-paths.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -43,6 +43,7 @@ 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(".");
|
|
46
47
|
// ─── Path rename table ────────────────────────────────────────────────────────
|
|
47
48
|
// Add new renames here as further API paths are changed between versions.
|
|
48
49
|
const PATH_RENAMES = {
|
|
@@ -129,7 +130,7 @@ function processFile(filePath, project) {
|
|
|
129
130
|
if (!sourceFile)
|
|
130
131
|
return 0;
|
|
131
132
|
let renamedCount = 0;
|
|
132
|
-
const relPath = path_1.default.relative(
|
|
133
|
+
const relPath = path_1.default.relative((0, _1.getCwd)(), filePath);
|
|
133
134
|
// Collect candidates first to avoid iterating a mutating tree
|
|
134
135
|
const candidates = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
|
|
135
136
|
for (const obj of candidates) {
|
|
@@ -146,7 +147,7 @@ function processFile(filePath, project) {
|
|
|
146
147
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
147
148
|
function main() {
|
|
148
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const srcDir = path_1.default.join(
|
|
150
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
150
151
|
console.log(`Scanning for Hapi route configs in: ${srcDir}\n`);
|
|
151
152
|
console.log('Active path renames:');
|
|
152
153
|
for (const [from, to] of Object.entries(PATH_RENAMES)) {
|
|
@@ -180,7 +181,7 @@ function main() {
|
|
|
180
181
|
for (const filePath of modifiedFiles) {
|
|
181
182
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
182
183
|
yield sourceFile.save();
|
|
183
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
184
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
184
185
|
}
|
|
185
186
|
console.log(`\nDone. Renamed ${totalRenamed} route path(s).`);
|
|
186
187
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-location-parent-id.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-location-parent-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rename-location-parent-id.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/rename-location-parent-id.ts"],"names":[],"mappings":"AAqJA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -45,6 +45,7 @@ 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(".");
|
|
48
49
|
const OLD_PROPERTY_NAME = 'parentId';
|
|
49
50
|
const NEW_PROPERTY_NAME = 'administrativeAreaId';
|
|
50
51
|
const LOCATION_TYPE_NAME = 'Location';
|
|
@@ -137,14 +138,14 @@ function processFile(filePath, project) {
|
|
|
137
138
|
// surrounding whitespace and optional-chain tokens (?.)
|
|
138
139
|
propAccess.getNameNode().replaceWithText(NEW_PROPERTY_NAME);
|
|
139
140
|
renamedCount++;
|
|
140
|
-
console.log(` [${path_1.default.relative(
|
|
141
|
+
console.log(` [${path_1.default.relative((0, _1.getCwd)(), filePath)}] Renamed Location.${OLD_PROPERTY_NAME} → Location.${NEW_PROPERTY_NAME}`);
|
|
141
142
|
}
|
|
142
143
|
return renamedCount;
|
|
143
144
|
}
|
|
144
145
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
145
146
|
function main() {
|
|
146
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const srcDir = path_1.default.join(
|
|
148
|
+
const srcDir = path_1.default.join((0, _1.getCwd)(), 'src');
|
|
148
149
|
console.log(`Scanning for Location.${OLD_PROPERTY_NAME} references in: ${srcDir}\n`);
|
|
149
150
|
const project = new ts_morph_1.Project({
|
|
150
151
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -173,7 +174,7 @@ function main() {
|
|
|
173
174
|
for (const filePath of modifiedFiles) {
|
|
174
175
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
175
176
|
yield sourceFile.save();
|
|
176
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
177
|
+
console.log(` Saved: ${path_1.default.relative((0, _1.getCwd)(), filePath)}`);
|
|
177
178
|
}
|
|
178
179
|
console.log(`\nDone. Renamed ${totalRenamed} Location.${OLD_PROPERTY_NAME} reference(s) to Location.${NEW_PROPERTY_NAME}.`);
|
|
179
180
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplify-analytics-precalculations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/simplify-analytics-precalculations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simplify-analytics-precalculations.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/simplify-analytics-precalculations.ts"],"names":[],"mappings":"AAuLA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAyCnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -51,6 +51,7 @@ exports.main = main;
|
|
|
51
51
|
const ts_morph_1 = require("ts-morph");
|
|
52
52
|
const fs_1 = __importDefault(require("fs"));
|
|
53
53
|
const path_1 = __importDefault(require("path"));
|
|
54
|
+
const _1 = require(".");
|
|
54
55
|
const ANALYTICS_FILE_REL = 'src/analytics/analytics.ts';
|
|
55
56
|
const FUNCTION_NAME = 'precalculateAdditionalAnalytics';
|
|
56
57
|
const IMPORT_NAMES_TO_REMOVE = new Set(['Event', 'precalculateBirthEvent']);
|
|
@@ -163,7 +164,7 @@ function simplifyPrecalculateFunction(sourceFile) {
|
|
|
163
164
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
164
165
|
function main() {
|
|
165
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
const cwd =
|
|
167
|
+
const cwd = (0, _1.getCwd)();
|
|
167
168
|
const absPath = path_1.default.join(cwd, ANALYTICS_FILE_REL);
|
|
168
169
|
if (!fs_1.default.existsSync(absPath)) {
|
|
169
170
|
console.log(`[${ANALYTICS_FILE_REL}] does not exist — nothing to clean up.`);
|