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

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.
@@ -1826,9 +1826,9 @@ function updateRouteHandlers(sourceFiles, group, srcDir, relCwd) {
1826
1826
  }
1827
1827
  return replacedCount;
1828
1828
  }
1829
- function resolveConfigChain(configObj, path18) {
1829
+ function resolveConfigChain(configObj, path15) {
1830
1830
  let current = configObj;
1831
- for (const key of path18) {
1831
+ for (const key of path15) {
1832
1832
  if (!import_ts_morph10.Node.isObjectLiteralExpression(current)) return null;
1833
1833
  const prop = current.getProperty(key);
1834
1834
  if (!prop || !import_ts_morph10.Node.isPropertyAssignment(prop)) return null;
@@ -3139,491 +3139,6 @@ async function main15() {
3139
3139
  }
3140
3140
  }
3141
3141
 
3142
- // src/migrations/v2.0/add-analytics-option-to-event-configs.ts
3143
- var import_ts_morph15 = require("ts-morph");
3144
- var import_path16 = __toESM(require("path"));
3145
- var DEFINE_CONFIG_NAME5 = "defineConfig";
3146
- var ID_PROPERTY_NAME = "id";
3147
- var ANALYTICS_PROPERTY_NAME = "analytics";
3148
- function getEventLabel(configArg) {
3149
- const idProp = configArg.getProperty(ID_PROPERTY_NAME);
3150
- if (!idProp || !import_ts_morph15.Node.isPropertyAssignment(idProp)) return "<unknown event>";
3151
- const initializer = idProp.getInitializer();
3152
- if (!initializer) return "<unknown event>";
3153
- if (import_ts_morph15.Node.isStringLiteral(initializer)) {
3154
- return initializer.getLiteralValue();
3155
- }
3156
- return initializer.getText();
3157
- }
3158
- function hasAnalyticsProperty(configArg) {
3159
- return configArg.getProperty(ANALYTICS_PROPERTY_NAME) !== void 0;
3160
- }
3161
- function processFile12(filePath, project) {
3162
- const sourceFile = project.getSourceFile(filePath);
3163
- if (!sourceFile) return 0;
3164
- const relPath = import_path16.default.relative(getCwd(), filePath);
3165
- let changes = 0;
3166
- const callExpressions = sourceFile.getDescendantsOfKind(
3167
- import_ts_morph15.SyntaxKind.CallExpression
3168
- );
3169
- for (const call of callExpressions) {
3170
- const expression = call.getExpression();
3171
- if (!import_ts_morph15.Node.isIdentifier(expression)) continue;
3172
- if (expression.getText() !== DEFINE_CONFIG_NAME5) continue;
3173
- const args = call.getArguments();
3174
- if (args.length === 0) continue;
3175
- const configArg = args[0];
3176
- if (!import_ts_morph15.Node.isObjectLiteralExpression(configArg)) continue;
3177
- const eventLabel = getEventLabel(configArg);
3178
- if (hasAnalyticsProperty(configArg)) {
3179
- console.log(
3180
- ` [${relPath}] Skipped '${eventLabel}' \u2014 'analytics' already declared.`
3181
- );
3182
- continue;
3183
- }
3184
- configArg.addPropertyAssignment({
3185
- name: ANALYTICS_PROPERTY_NAME,
3186
- initializer: "true"
3187
- });
3188
- console.log(` [${relPath}] Added 'analytics: true' to '${eventLabel}'.`);
3189
- changes++;
3190
- }
3191
- return changes;
3192
- }
3193
- async function main16() {
3194
- const srcDir = import_path16.default.join(getCwd(), "src");
3195
- console.log(`Scanning for defineConfig calls in: ${srcDir}
3196
- `);
3197
- const project = new import_ts_morph15.Project({
3198
- tsConfigFilePath: import_path16.default.resolve(srcDir, "../tsconfig.json"),
3199
- skipAddingFilesFromTsConfig: false
3200
- });
3201
- const sourceFiles = project.getSourceFiles().filter((sf) => {
3202
- const fp = sf.getFilePath();
3203
- return fp.includes("/src/") && !fp.includes("/node_modules/");
3204
- });
3205
- console.log(`Found ${sourceFiles.length} source file(s) to analyse.
3206
- `);
3207
- let totalChanges = 0;
3208
- const modifiedFiles = [];
3209
- for (const sourceFile of sourceFiles) {
3210
- const filePath = sourceFile.getFilePath();
3211
- const changes = processFile12(filePath, project);
3212
- if (changes > 0) {
3213
- totalChanges += changes;
3214
- modifiedFiles.push(filePath);
3215
- }
3216
- }
3217
- if (modifiedFiles.length === 0) {
3218
- console.log("No event configs needed updating. Nothing to do.");
3219
- return;
3220
- }
3221
- console.log(`
3222
- Saving ${modifiedFiles.length} modified file(s)...`);
3223
- for (const filePath of modifiedFiles) {
3224
- const sourceFile = project.getSourceFileOrThrow(filePath);
3225
- await sourceFile.save();
3226
- console.log(` Saved: ${import_path16.default.relative(getCwd(), filePath)}`);
3227
- }
3228
- console.log(
3229
- `
3230
- Done. Added 'analytics: true' to ${totalChanges} event config(s) across ${modifiedFiles.length} file(s).`
3231
- );
3232
- }
3233
-
3234
- // src/migrations/v2.0/create-events-index.ts
3235
- var import_ts_morph16 = require("ts-morph");
3236
- var import_fs = __toESM(require("fs"));
3237
- var import_path17 = __toESM(require("path"));
3238
- var DEFINE_CONFIG_NAME6 = "defineConfig";
3239
- var HANDLER_FUNCTION_NAMES = /* @__PURE__ */ new Set([
3240
- "getCustomEventsHandler",
3241
- "getEventsHandler"
3242
- ]);
3243
- var EVENT_CONFIGS_IDENTIFIER = "eventConfigs";
3244
- var EVENTS_INDEX_IMPORT_PATH = "@countryconfig/events";
3245
- var RESPONSE_METHOD_NAME = "response";
3246
- var LICENSE_HEADER = `/*
3247
- * This Source Code Form is subject to the terms of the Mozilla Public
3248
- * License, v. 2.0. If a copy of the MPL was not distributed with this
3249
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
3250
- *
3251
- * OpenCRVS is also distributed under the terms of the Civil Registration
3252
- * & Healthcare Disclaimer located at http://opencrvs.org/license.
3253
- *
3254
- * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
3255
- */
3256
- `;
3257
- function findEventConfigExports(project, srcDir) {
3258
- const found = [];
3259
- const eventsIndexAbs = import_path17.default.join(srcDir, "events", "index.ts");
3260
- for (const sourceFile of project.getSourceFiles()) {
3261
- const filePath = sourceFile.getFilePath();
3262
- if (!filePath.startsWith(srcDir) || filePath.includes("/node_modules/")) {
3263
- continue;
3264
- }
3265
- if (filePath === eventsIndexAbs) continue;
3266
- for (const statement of sourceFile.getVariableStatements()) {
3267
- if (!statement.hasExportKeyword()) continue;
3268
- for (const decl of statement.getDeclarations()) {
3269
- const initializer = decl.getInitializer();
3270
- if (!initializer) continue;
3271
- const unwrapped = import_ts_morph16.Node.isAsExpression(initializer) ? initializer.getExpression() : initializer;
3272
- if (!import_ts_morph16.Node.isCallExpression(unwrapped)) continue;
3273
- const callee = unwrapped.getExpression();
3274
- if (!import_ts_morph16.Node.isIdentifier(callee)) continue;
3275
- if (callee.getText() !== DEFINE_CONFIG_NAME6) continue;
3276
- found.push({ name: decl.getName(), filePath });
3277
- }
3278
- }
3279
- }
3280
- return found;
3281
- }
3282
- function buildIndexImportSpecifier(eventConfigFilePath, srcDir) {
3283
- const eventsIndexDir = import_path17.default.join(srcDir, "events");
3284
- let rel = import_path17.default.relative(eventsIndexDir, eventConfigFilePath).split(import_path17.default.sep).join("/");
3285
- if (rel.endsWith(".ts")) rel = rel.slice(0, -".ts".length);
3286
- if (rel.endsWith("/index")) rel = rel.slice(0, -"/index".length);
3287
- if (!rel.startsWith(".")) rel = "./" + rel;
3288
- return rel;
3289
- }
3290
- function buildEventsIndexSource(exports, srcDir) {
3291
- const imports = exports.map(
3292
- (e) => `import { ${e.name} } from '${buildIndexImportSpecifier(
3293
- e.filePath,
3294
- srcDir
3295
- )}'`
3296
- ).join("\n");
3297
- const array3 = `export const ${EVENT_CONFIGS_IDENTIFIER} = [${exports.map((e) => e.name).join(", ")}]`;
3298
- return `${LICENSE_HEADER}${imports}
3299
-
3300
- ${array3}
3301
- `;
3302
- }
3303
- function findHandlerSourceFile(project, srcDir) {
3304
- for (const sf of project.getSourceFiles()) {
3305
- const fp = sf.getFilePath();
3306
- if (!fp.startsWith(srcDir) || fp.includes("/node_modules/")) continue;
3307
- for (const fn of sf.getFunctions()) {
3308
- const name = fn.getName();
3309
- if (name && HANDLER_FUNCTION_NAMES.has(name)) return sf;
3310
- }
3311
- for (const statement of sf.getVariableStatements()) {
3312
- for (const decl of statement.getDeclarations()) {
3313
- if (HANDLER_FUNCTION_NAMES.has(decl.getName())) return sf;
3314
- }
3315
- }
3316
- }
3317
- return void 0;
3318
- }
3319
- function modifyHandler(sourceFile, exportNames) {
3320
- const changes = [];
3321
- for (const importDecl of [...sourceFile.getImportDeclarations()]) {
3322
- const namedImports = importDecl.getNamedImports();
3323
- if (namedImports.length === 0) continue;
3324
- const matched = namedImports.filter((ni) => exportNames.has(ni.getName()));
3325
- if (matched.length === 0) continue;
3326
- const removedNames = matched.map((ni) => ni.getName());
3327
- for (const ni of matched) ni.remove();
3328
- changes.push(`removed direct imports: ${removedNames.join(", ")}`);
3329
- const stillUsed = importDecl.getNamedImports().length > 0 || importDecl.getDefaultImport() || importDecl.getNamespaceImport();
3330
- if (!stillUsed) importDecl.remove();
3331
- }
3332
- for (const statement of [...sourceFile.getVariableStatements()]) {
3333
- if (!statement.hasExportKeyword()) continue;
3334
- const hasEventConfigs = statement.getDeclarations().some((d) => d.getName() === EVENT_CONFIGS_IDENTIFIER);
3335
- if (hasEventConfigs) {
3336
- statement.remove();
3337
- changes.push(`removed inline 'export const ${EVENT_CONFIGS_IDENTIFIER}'`);
3338
- }
3339
- }
3340
- const existing = sourceFile.getImportDeclaration(
3341
- (imp) => imp.getModuleSpecifierValue() === EVENTS_INDEX_IMPORT_PATH
3342
- );
3343
- if (existing) {
3344
- const already = existing.getNamedImports().some((ni) => ni.getName() === EVENT_CONFIGS_IDENTIFIER);
3345
- if (!already) {
3346
- existing.addNamedImport(EVENT_CONFIGS_IDENTIFIER);
3347
- changes.push(
3348
- `added '${EVENT_CONFIGS_IDENTIFIER}' to existing import from '${EVENTS_INDEX_IMPORT_PATH}'`
3349
- );
3350
- }
3351
- } else {
3352
- sourceFile.addImportDeclaration({
3353
- moduleSpecifier: EVENTS_INDEX_IMPORT_PATH,
3354
- namedImports: [EVENT_CONFIGS_IDENTIFIER]
3355
- });
3356
- changes.push(
3357
- `added import { ${EVENT_CONFIGS_IDENTIFIER} } from '${EVENTS_INDEX_IMPORT_PATH}'`
3358
- );
3359
- }
3360
- for (const call of sourceFile.getDescendantsOfKind(
3361
- import_ts_morph16.SyntaxKind.CallExpression
3362
- )) {
3363
- const callee = call.getExpression();
3364
- if (!import_ts_morph16.Node.isPropertyAccessExpression(callee)) continue;
3365
- if (callee.getName() !== RESPONSE_METHOD_NAME) continue;
3366
- const args = call.getArguments();
3367
- if (args.length !== 1) continue;
3368
- const [arg] = args;
3369
- if (!import_ts_morph16.Node.isArrayLiteralExpression(arg)) continue;
3370
- if (arg.getElements().length === 0) continue;
3371
- if (!arg.getElements().every((el) => import_ts_morph16.Node.isIdentifier(el))) continue;
3372
- arg.replaceWithText(EVENT_CONFIGS_IDENTIFIER);
3373
- changes.push(
3374
- `rewrote h.response([...]) \u2192 h.response(${EVENT_CONFIGS_IDENTIFIER})`
3375
- );
3376
- }
3377
- return changes;
3378
- }
3379
- async function main17() {
3380
- const cwd2 = getCwd();
3381
- const srcDir = import_path17.default.join(cwd2, "src");
3382
- console.log(`Scanning for defineConfig event exports in: ${srcDir}
3383
- `);
3384
- const project = new import_ts_morph16.Project({
3385
- tsConfigFilePath: import_path17.default.resolve(srcDir, "../tsconfig.json"),
3386
- skipAddingFilesFromTsConfig: false
3387
- });
3388
- const eventConfigExports = findEventConfigExports(project, srcDir);
3389
- if (eventConfigExports.length === 0) {
3390
- console.log(
3391
- "No top-level `export const X = defineConfig(...)` declarations found. Nothing to do."
3392
- );
3393
- return;
3394
- }
3395
- console.log(`Found ${eventConfigExports.length} event config export(s):`);
3396
- for (const e of eventConfigExports) {
3397
- console.log(` ${e.name} \u2190 ${import_path17.default.relative(cwd2, e.filePath)}`);
3398
- }
3399
- const eventsIndexAbs = import_path17.default.join(srcDir, "events", "index.ts");
3400
- const eventsIndexRel = import_path17.default.relative(cwd2, eventsIndexAbs);
3401
- if (import_fs.default.existsSync(eventsIndexAbs)) {
3402
- console.log(`
3403
- [${eventsIndexRel}] already exists \u2014 leaving untouched.`);
3404
- } else {
3405
- import_fs.default.mkdirSync(import_path17.default.dirname(eventsIndexAbs), { recursive: true });
3406
- const source = buildEventsIndexSource(eventConfigExports, srcDir);
3407
- const eventsIndexFile = project.createSourceFile(eventsIndexAbs, source, {
3408
- overwrite: false
3409
- });
3410
- await eventsIndexFile.save();
3411
- console.log(
3412
- `
3413
- [${eventsIndexRel}] created with ${EVENT_CONFIGS_IDENTIFIER} of ${eventConfigExports.length} event(s).`
3414
- );
3415
- }
3416
- const handler = findHandlerSourceFile(project, srcDir);
3417
- if (!handler) {
3418
- console.log(
3419
- `
3420
- No event-config handler file found (looked for exported function(s): ${Array.from(
3421
- HANDLER_FUNCTION_NAMES
3422
- ).join(", ")}). Skipping handler rewrite.`
3423
- );
3424
- return;
3425
- }
3426
- const handlerRelPath = import_path17.default.relative(cwd2, handler.getFilePath());
3427
- const exportNameSet = new Set(eventConfigExports.map((e) => e.name));
3428
- const changes = modifyHandler(handler, exportNameSet);
3429
- if (changes.length === 0) {
3430
- console.log(`
3431
- [${handlerRelPath}] already wired to ${EVENTS_INDEX_IMPORT_PATH} \u2014 no changes.`);
3432
- return;
3433
- }
3434
- for (const c of changes) console.log(` [${handlerRelPath}] ${c}`);
3435
- await handler.save();
3436
- console.log(`
3437
- Saved ${handlerRelPath}.`);
3438
- }
3439
-
3440
- // src/migrations/v2.0/checkout-upstream-files.ts
3441
- var import_child_process = require("child_process");
3442
- var UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
3443
- var UPSTREAM_BRANCH = "codemod-analytics";
3444
- var TEMP_REMOTE = "opencrvs-upgrade-v19-v20-codemod";
3445
- var FILES_TO_CHECKOUT = [
3446
- "infrastructure/postgres/setup-analytics.sh",
3447
- "src/analytics/analytics.ts"
3448
- ];
3449
- function runGit(args, { silent = false } = {}) {
3450
- return (0, import_child_process.execFileSync)("git", args, {
3451
- cwd: getCwd(),
3452
- encoding: "utf8",
3453
- stdio: silent ? ["ignore", "pipe", "pipe"] : ["ignore", "pipe", "inherit"]
3454
- });
3455
- }
3456
- function tryGit(args) {
3457
- try {
3458
- runGit(args, { silent: true });
3459
- return true;
3460
- } catch {
3461
- return false;
3462
- }
3463
- }
3464
- function assertIsGitRepo() {
3465
- if (!tryGit(["rev-parse", "--is-inside-work-tree"])) {
3466
- throw new Error(
3467
- `checkout-upstream-files: ${getCwd()} is not a git repository. Initialise git (or run the upgrade inside a git checkout) before re-running.`
3468
- );
3469
- }
3470
- }
3471
- async function main18() {
3472
- console.log(
3473
- `Checking out ${FILES_TO_CHECKOUT.length} file(s) from ${UPSTREAM_URL}@${UPSTREAM_BRANCH}...
3474
- `
3475
- );
3476
- assertIsGitRepo();
3477
- tryGit(["remote", "remove", TEMP_REMOTE]);
3478
- try {
3479
- console.log(` Adding temporary remote '${TEMP_REMOTE}' \u2192 ${UPSTREAM_URL}`);
3480
- runGit(["remote", "add", TEMP_REMOTE, UPSTREAM_URL], { silent: true });
3481
- console.log(` Fetching ${TEMP_REMOTE}/${UPSTREAM_BRANCH} (depth 1)...`);
3482
- runGit(["fetch", "--depth=1", TEMP_REMOTE, UPSTREAM_BRANCH]);
3483
- const ref = `${TEMP_REMOTE}/${UPSTREAM_BRANCH}`;
3484
- const missing = [];
3485
- let checkedOut = 0;
3486
- for (const file of FILES_TO_CHECKOUT) {
3487
- if (tryGit(["checkout", ref, "--", file])) {
3488
- console.log(` Checked out ${file} from ${ref}`);
3489
- checkedOut++;
3490
- } else {
3491
- console.warn(
3492
- ` [warn] ${file} not found on ${ref} \u2014 skipping. Verify the path exists on that branch.`
3493
- );
3494
- missing.push(file);
3495
- }
3496
- }
3497
- console.log(
3498
- `
3499
- Checked out ${checkedOut}/${FILES_TO_CHECKOUT.length} file(s) from ${ref}.`
3500
- );
3501
- if (missing.length > 0) {
3502
- console.warn(` Missing on upstream branch: ${missing.join(", ")}`);
3503
- }
3504
- if (checkedOut > 0) {
3505
- console.log(
3506
- ` Review the staged changes with: git diff --cached -- ${FILES_TO_CHECKOUT.map(
3507
- (f) => `'${f}'`
3508
- ).join(" ")}
3509
- `
3510
- );
3511
- }
3512
- } finally {
3513
- if (tryGit(["remote", "remove", TEMP_REMOTE])) {
3514
- console.log(` Removed temporary remote '${TEMP_REMOTE}'.`);
3515
- }
3516
- }
3517
- }
3518
-
3519
- // src/migrations/v2.0/simplify-analytics-precalculations.ts
3520
- var import_ts_morph17 = require("ts-morph");
3521
- var import_fs2 = __toESM(require("fs"));
3522
- var import_path18 = __toESM(require("path"));
3523
- var ANALYTICS_FILE_REL = "src/analytics/analytics.ts";
3524
- var FUNCTION_NAME = "precalculateAdditionalAnalytics";
3525
- var IMPORT_NAMES_TO_REMOVE = /* @__PURE__ */ new Set(["Event", "precalculateBirthEvent"]);
3526
- var RETURN_EXPRESSION_TEXT = "declaration";
3527
- function removeTargetedNamedImports(sourceFile) {
3528
- const log = [];
3529
- for (const importDecl of [...sourceFile.getImportDeclarations()]) {
3530
- const namedImports = importDecl.getNamedImports();
3531
- if (namedImports.length === 0) continue;
3532
- const matched = namedImports.filter(
3533
- (ni) => IMPORT_NAMES_TO_REMOVE.has(ni.getName())
3534
- );
3535
- if (matched.length === 0) continue;
3536
- const removedNames = matched.map((ni) => ni.getName());
3537
- for (const ni of matched) ni.remove();
3538
- log.push(
3539
- `removed import(s) ${removedNames.join(", ")} from '${importDecl.getModuleSpecifierValue()}'`
3540
- );
3541
- const stillUsed = importDecl.getNamedImports().length > 0 || importDecl.getDefaultImport() || importDecl.getNamespaceImport();
3542
- if (!stillUsed) importDecl.remove();
3543
- }
3544
- return log;
3545
- }
3546
- function findPrecalculateFunction(sourceFile) {
3547
- for (const fn of sourceFile.getFunctions()) {
3548
- if (fn.getName() === FUNCTION_NAME) return fn;
3549
- }
3550
- for (const statement of sourceFile.getVariableStatements()) {
3551
- for (const decl of statement.getDeclarations()) {
3552
- if (decl.getName() === FUNCTION_NAME) return decl;
3553
- }
3554
- }
3555
- return void 0;
3556
- }
3557
- function getFunctionBodyBlock(fn) {
3558
- if (import_ts_morph17.Node.isFunctionDeclaration(fn)) return fn.getBody();
3559
- const initializer = fn.getInitializer();
3560
- if (!initializer) return void 0;
3561
- if (!import_ts_morph17.Node.isArrowFunction(initializer) && !import_ts_morph17.Node.isFunctionExpression(initializer)) {
3562
- return void 0;
3563
- }
3564
- return initializer.getBody();
3565
- }
3566
- function simplifyPrecalculateFunction(sourceFile) {
3567
- const log = [];
3568
- const fn = findPrecalculateFunction(sourceFile);
3569
- if (!fn) return log;
3570
- const body = getFunctionBodyBlock(fn);
3571
- if (!body || !import_ts_morph17.Node.isBlock(body)) return log;
3572
- for (const statement of [...body.getStatements()]) {
3573
- const references = statement.getDescendantsOfKind(import_ts_morph17.SyntaxKind.Identifier).some((id) => IMPORT_NAMES_TO_REMOVE.has(id.getText()));
3574
- if (references) {
3575
- statement.remove();
3576
- log.push(`removed statement in ${FUNCTION_NAME} referencing removed imports`);
3577
- }
3578
- }
3579
- const remaining = body.getStatements();
3580
- const last = remaining[remaining.length - 1];
3581
- const alreadyCorrect = last && import_ts_morph17.Node.isReturnStatement(last) && last.getExpression()?.getText() === RETURN_EXPRESSION_TEXT;
3582
- if (!alreadyCorrect) {
3583
- body.addStatements(`return ${RETURN_EXPRESSION_TEXT}`);
3584
- log.push(
3585
- `ensured '${FUNCTION_NAME}' ends with 'return ${RETURN_EXPRESSION_TEXT}'`
3586
- );
3587
- }
3588
- return log;
3589
- }
3590
- async function main19() {
3591
- const cwd2 = getCwd();
3592
- const absPath = import_path18.default.join(cwd2, ANALYTICS_FILE_REL);
3593
- if (!import_fs2.default.existsSync(absPath)) {
3594
- console.log(
3595
- `[${ANALYTICS_FILE_REL}] does not exist \u2014 nothing to clean up.`
3596
- );
3597
- return;
3598
- }
3599
- const project = new import_ts_morph17.Project({
3600
- tsConfigFilePath: import_path18.default.resolve(cwd2, "tsconfig.json"),
3601
- skipAddingFilesFromTsConfig: false
3602
- });
3603
- const sourceFile = project.getSourceFile(absPath);
3604
- if (!sourceFile) {
3605
- console.log(
3606
- `[${ANALYTICS_FILE_REL}] is not part of the tsconfig project. Skipping.`
3607
- );
3608
- return;
3609
- }
3610
- console.log(`Cleaning up ${ANALYTICS_FILE_REL}...
3611
- `);
3612
- const importLogs = removeTargetedNamedImports(sourceFile);
3613
- const fnLogs = simplifyPrecalculateFunction(sourceFile);
3614
- const allLogs = [...importLogs, ...fnLogs];
3615
- if (allLogs.length === 0) {
3616
- console.log(`[${ANALYTICS_FILE_REL}] already clean \u2014 nothing to do.`);
3617
- return;
3618
- }
3619
- for (const log of allLogs) {
3620
- console.log(` [${ANALYTICS_FILE_REL}] ${log}`);
3621
- }
3622
- await sourceFile.save();
3623
- console.log(`
3624
- Saved ${ANALYTICS_FILE_REL}.`);
3625
- }
3626
-
3627
3142
  // src/migrations/v2.0/index.ts
3628
3143
  var cwd;
3629
3144
  function getCwd() {
@@ -3658,8 +3173,4 @@ async function runUpgrade(ccwd) {
3658
3173
  await main12();
3659
3174
  await main14();
3660
3175
  await main15();
3661
- await main16();
3662
- await main17();
3663
- await main18();
3664
- await main19();
3665
3176
  }
@@ -3661,9 +3661,6 @@ var _EventConfigBase = z33.object({
3661
3661
  ),
3662
3662
  flags: z33.array(FlagConfig).optional().default([]).describe(
3663
3663
  "Configuration of flags associated with the actions of this event type."
3664
- ),
3665
- analytics: z33.boolean().optional().default(false).describe(
3666
- "Indicates whether the recors of this event type are included in analytics"
3667
3664
  )
3668
3665
  });
3669
3666
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.12-rc.bcebfd3",
3
+ "version": "1.9.12-rc.bda22f7",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-analytics-option-to-event-configs.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
1
+ {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
@@ -1,3 +0,0 @@
1
- declare function main(): Promise<void>;
2
- export { main };
3
- //# sourceMappingURL=add-analytics-option-to-event-configs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-analytics-option-to-event-configs.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/add-analytics-option-to-event-configs.ts"],"names":[],"mappings":"AA4GA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA6CnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}