@opencrvs/toolkit 1.9.12-rc.bce2e6f → 1.9.12-rc.be74e8b
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 +2038 -45
- package/dist/cli.js +850 -35
- package/dist/commons/api/router.d.ts +86 -79
- package/dist/commons/application-config/index.d.ts +6 -4
- package/dist/commons/events/ActionDocument.d.ts +6 -6
- package/dist/commons/events/ActionType.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +10 -10
- package/dist/commons/events/CountryConfigQueryInput.d.ts +222 -222
- package/dist/commons/events/Draft.d.ts +8 -8
- package/dist/commons/events/EventConfig.d.ts +1 -1
- package/dist/commons/events/EventDocument.d.ts +3 -3
- package/dist/commons/events/EventIndex.d.ts +15 -15
- package/dist/commons/events/EventMetadata.d.ts +12 -12
- package/dist/commons/events/FieldConfig.d.ts +26 -26
- package/dist/commons/events/FieldType.d.ts +1 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +4 -4
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +13 -13
- package/dist/commons/events/WorkqueueConfig.d.ts +239 -239
- package/dist/commons/events/scopes.d.ts +1 -1
- package/dist/commons/events/state/index.d.ts +2 -2
- package/dist/commons/events/state/utils.d.ts +3 -3
- package/dist/commons/events/utils.d.ts +3 -3
- package/dist/events/index.js +1 -1
- 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 +97 -21
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +848 -33
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +6 -5
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
- package/dist/notification/index.js +1 -1
- package/opencrvs-toolkit-1.9.12-rc.be74e8b.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-1.9.12-rc.bce2e6f.tgz +0 -0
|
@@ -9,7 +9,7 @@ export declare const ACTION_SCOPE_MAP: {
|
|
|
9
9
|
NOTIFY: "record.notify"[];
|
|
10
10
|
DECLARE: ("record.declare" | "record.register")[];
|
|
11
11
|
EDIT: "record.edit"[];
|
|
12
|
-
DELETE: "record.declare"[];
|
|
12
|
+
DELETE: ("record.declare" | "record.notify")[];
|
|
13
13
|
REGISTER: "record.register"[];
|
|
14
14
|
PRINT_CERTIFICATE: "record.print-certified-copies"[];
|
|
15
15
|
REQUEST_CORRECTION: ("record.request-correction" | "record.correct")[];
|
|
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
|
|
|
7
7
|
import { EventConfig } from '../EventConfig';
|
|
8
8
|
import { UUID } from '../../uuid';
|
|
9
9
|
import { DocumentPath } from '../../documents';
|
|
10
|
-
export declare function getStatusFromActions(actions: Array<Action>): "
|
|
10
|
+
export declare function getStatusFromActions(actions: Array<Action>): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
|
|
11
11
|
export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
|
|
12
12
|
export declare function getAssignedUserSignatureFromActions(actions: Array<ActionDocument>): string | null;
|
|
13
13
|
type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
|
|
@@ -64,7 +64,7 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
|
|
|
64
64
|
export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
|
|
65
65
|
id: string & import("zod").$brand<"UUID">;
|
|
66
66
|
type: string;
|
|
67
|
-
status: "
|
|
67
|
+
status: "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
|
|
68
68
|
legalStatuses: {
|
|
69
69
|
DECLARED?: {
|
|
70
70
|
createdAt: string;
|
|
@@ -289,15 +289,15 @@ export declare function getActionUpdateMetadata(actions: Action[]): Partial<{
|
|
|
289
289
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
290
290
|
} | {
|
|
291
291
|
id: string & import("zod").$brand<"UUID">;
|
|
292
|
-
createdAt: string;
|
|
293
292
|
transactionId: string;
|
|
294
293
|
createdByUserType: "user" | "system";
|
|
294
|
+
createdAt: string;
|
|
295
295
|
createdBy: string;
|
|
296
|
-
type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION"
|
|
296
|
+
type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
|
|
297
297
|
status: "Rejected";
|
|
298
|
-
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
299
298
|
createdByRole?: string | undefined;
|
|
300
299
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
300
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
301
301
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
302
302
|
}>;
|
|
303
303
|
/**
|
|
@@ -434,15 +434,15 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
434
434
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
435
435
|
} | {
|
|
436
436
|
id: string & import("zod").$brand<"UUID">;
|
|
437
|
-
createdAt: string;
|
|
438
437
|
transactionId: string;
|
|
439
438
|
createdByUserType: "user" | "system";
|
|
439
|
+
createdAt: string;
|
|
440
440
|
createdBy: string;
|
|
441
|
-
type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION"
|
|
441
|
+
type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
|
|
442
442
|
status: "Rejected";
|
|
443
|
-
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
444
443
|
createdByRole?: string | undefined;
|
|
445
444
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
445
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
446
446
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
447
447
|
} | undefined;
|
|
448
448
|
/**
|
package/dist/events/index.js
CHANGED
|
@@ -9930,7 +9930,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
9930
9930
|
[ActionType.NOTIFY]: ["record.notify"],
|
|
9931
9931
|
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
9932
9932
|
[ActionType.EDIT]: ["record.edit"],
|
|
9933
|
-
[ActionType.DELETE]: ["record.declare"],
|
|
9933
|
+
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
9934
9934
|
[ActionType.REGISTER]: ["record.register"],
|
|
9935
9935
|
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
9936
9936
|
[ActionType.REQUEST_CORRECTION]: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-config-files-to-ts.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-config-files-to-ts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert-config-files-to-ts.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-config-files-to-ts.ts"],"names":[],"mappings":"AAyuBA,wBAAsB,IAAI,kBAyPzB"}
|
|
@@ -318,25 +318,6 @@ function transformDashboardsValue(init, isProd) {
|
|
|
318
318
|
*/
|
|
319
319
|
function generateTsContent(configObj, exportName, group, isProd) {
|
|
320
320
|
var _a;
|
|
321
|
-
// ── File header ─────────────────────────────────────────────────────────────
|
|
322
|
-
const headerLines = [];
|
|
323
|
-
if (isProd) {
|
|
324
|
-
headerLines.push(`import { env } from './environment'`);
|
|
325
|
-
}
|
|
326
|
-
headerLines.push(`import { ${group.defineFn} } from '${group.importFrom}'`);
|
|
327
|
-
if (group.applicationConfigImportPath) {
|
|
328
|
-
headerLines.push(`import { applicationConfig } from '${group.applicationConfigImportPath}'`);
|
|
329
|
-
}
|
|
330
|
-
headerLines.push('');
|
|
331
|
-
if (isProd) {
|
|
332
|
-
headerLines.push(`const scheme = 'https'`);
|
|
333
|
-
headerLines.push(`const hostname = env.DOMAIN`);
|
|
334
|
-
headerLines.push(`const sentry = env.SENTRY_DSN`);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
headerLines.push(`const scheme = 'http'`);
|
|
338
|
-
headerLines.push(`const hostname = 'localhost'`);
|
|
339
|
-
}
|
|
340
321
|
// ── Config properties ────────────────────────────────────────────────────────
|
|
341
322
|
const propertyLines = [];
|
|
342
323
|
const seenKeys = new Set();
|
|
@@ -379,6 +360,26 @@ function generateTsContent(configObj, exportName, group, isProd) {
|
|
|
379
360
|
propertyLines.push(` ${key}: applicationConfig.${key}`);
|
|
380
361
|
}
|
|
381
362
|
const body = propertyLines.join(',\n');
|
|
363
|
+
const headerLines = [];
|
|
364
|
+
headerLines.push(`import * as fs from 'fs'`);
|
|
365
|
+
headerLines.push(`import { join } from 'path'`);
|
|
366
|
+
if (isProd) {
|
|
367
|
+
headerLines.push(`import { env } from './environment'`);
|
|
368
|
+
}
|
|
369
|
+
headerLines.push(`import { ${group.defineFn} } from '${group.importFrom}'`);
|
|
370
|
+
if (group.applicationConfigImportPath) {
|
|
371
|
+
headerLines.push(`import { applicationConfig } from '${group.applicationConfigImportPath}'`);
|
|
372
|
+
}
|
|
373
|
+
headerLines.push('');
|
|
374
|
+
if (isProd) {
|
|
375
|
+
headerLines.push(`const scheme = 'https'`);
|
|
376
|
+
headerLines.push(`const hostname = env.DOMAIN`);
|
|
377
|
+
headerLines.push(`const sentry = env.SENTRY_DSN`);
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
headerLines.push(`const scheme = 'http'`);
|
|
381
|
+
headerLines.push(`const hostname = 'localhost'`);
|
|
382
|
+
}
|
|
382
383
|
return [
|
|
383
384
|
...headerLines,
|
|
384
385
|
'',
|
|
@@ -571,6 +572,64 @@ function resolveConfigChain(configObj, path) {
|
|
|
571
572
|
}
|
|
572
573
|
return current.getText();
|
|
573
574
|
}
|
|
575
|
+
/**
|
|
576
|
+
* When inlining a value from `application-config.ts` into a file in a
|
|
577
|
+
* different directory, `__dirname`-based paths (e.g. for reading image
|
|
578
|
+
* assets) must be adjusted so they continue to resolve to the original
|
|
579
|
+
* location — the referenced files themselves are NOT moved.
|
|
580
|
+
*
|
|
581
|
+
* Rewrites `join(__dirname, ...)` / `path.join(__dirname, ...)` /
|
|
582
|
+
* `resolve(__dirname, ...)` / `path.resolve(__dirname, ...)` by inserting
|
|
583
|
+
* the relative path from the target directory back to the source directory
|
|
584
|
+
* as an extra leading argument.
|
|
585
|
+
*
|
|
586
|
+
* Example: inlining from `src/api/application/` into `src/login-config.ts`
|
|
587
|
+
* join(__dirname, 'login-bg.jpg')
|
|
588
|
+
* → join(__dirname, 'api/application', 'login-bg.jpg')
|
|
589
|
+
*/
|
|
590
|
+
function rewriteDirnameRefs(text, relDir) {
|
|
591
|
+
if (!relDir || relDir === '.')
|
|
592
|
+
return text;
|
|
593
|
+
const relForward = relDir.replace(/\\/g, '/');
|
|
594
|
+
return text.replace(/\b((?:path\.)?(?:join|resolve))\s*\(\s*__dirname\s*,/g, `$1(__dirname, '${relForward}',`);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Ensures the source file has a namespace `fs` import (`import * as fs from 'fs'`).
|
|
598
|
+
* No-op if a namespace or default `fs` import is already present.
|
|
599
|
+
*/
|
|
600
|
+
function ensureFsImport(sf) {
|
|
601
|
+
const hasFs = sf
|
|
602
|
+
.getImportDeclarations()
|
|
603
|
+
.some((d) => d.getModuleSpecifierValue() === 'fs' &&
|
|
604
|
+
(d.getNamespaceImport() || d.getDefaultImport()));
|
|
605
|
+
if (hasFs)
|
|
606
|
+
return;
|
|
607
|
+
sf.addImportDeclaration({
|
|
608
|
+
moduleSpecifier: 'fs',
|
|
609
|
+
namespaceImport: 'fs'
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Ensures the source file has a named `join` import from 'path'.
|
|
614
|
+
* Merges into an existing 'path' import if present, otherwise adds a new
|
|
615
|
+
* `import { join } from 'path'` declaration.
|
|
616
|
+
*/
|
|
617
|
+
function ensureJoinImport(sf) {
|
|
618
|
+
const pathImports = sf
|
|
619
|
+
.getImportDeclarations()
|
|
620
|
+
.filter((d) => d.getModuleSpecifierValue() === 'path');
|
|
621
|
+
if (pathImports.some((d) => d.getNamedImports().some((ni) => ni.getName() === 'join'))) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (pathImports.length > 0) {
|
|
625
|
+
pathImports[0].addNamedImport('join');
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
sf.addImportDeclaration({
|
|
629
|
+
moduleSpecifier: 'path',
|
|
630
|
+
namedImports: ['join']
|
|
631
|
+
});
|
|
632
|
+
}
|
|
574
633
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
575
634
|
function main() {
|
|
576
635
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -627,6 +686,7 @@ function main() {
|
|
|
627
686
|
// Before removing, inline every cross-file reference to each unknown key.
|
|
628
687
|
// Example: applicationConfig.BIRTH.LATE_REGISTRATION_TARGET → 45
|
|
629
688
|
const filesToSaveAfterInlining = new Set();
|
|
689
|
+
const appConfigDir = path_1.default.dirname(appConfigAbsPath);
|
|
630
690
|
for (const removedProp of propsToRemove) {
|
|
631
691
|
const key = removedProp.getName();
|
|
632
692
|
for (const sf of appConfigProject.getSourceFiles()) {
|
|
@@ -637,6 +697,12 @@ function main() {
|
|
|
637
697
|
continue;
|
|
638
698
|
if (sf.getFilePath().includes('/node_modules/'))
|
|
639
699
|
continue;
|
|
700
|
+
// Relative path from the target file's directory back to the
|
|
701
|
+
// applicationConfig's directory. Used to adjust `__dirname`-based
|
|
702
|
+
// paths in the inlined value (e.g. image asset references) since
|
|
703
|
+
// those assets are not moved.
|
|
704
|
+
const targetDir = path_1.default.dirname(sf.getFilePath());
|
|
705
|
+
const relDirFromTarget = path_1.default.relative(targetDir, appConfigDir);
|
|
640
706
|
// Break-and-restart after each replacement because replaceWithText()
|
|
641
707
|
// invalidates existing node references in the ts-morph tree
|
|
642
708
|
let madeReplacement = true;
|
|
@@ -664,8 +730,18 @@ function main() {
|
|
|
664
730
|
console.log(` Cannot resolve applicationConfig.${accessPath.join('.')} — skipping inline replacement`);
|
|
665
731
|
continue;
|
|
666
732
|
}
|
|
667
|
-
|
|
668
|
-
|
|
733
|
+
const adjustedValue = rewriteDirnameRefs(resolvedValue, relDirFromTarget);
|
|
734
|
+
node.replaceWithText(adjustedValue);
|
|
735
|
+
// If the inlined value references `fs` or `join`, ensure the
|
|
736
|
+
// target file has the corresponding imports — these are
|
|
737
|
+
// commonly used to read image assets from disk.
|
|
738
|
+
if (/\bfs\s*\./.test(adjustedValue)) {
|
|
739
|
+
ensureFsImport(sf);
|
|
740
|
+
}
|
|
741
|
+
if (/\bjoin\s*\(/.test(adjustedValue)) {
|
|
742
|
+
ensureJoinImport(sf);
|
|
743
|
+
}
|
|
744
|
+
console.log(` Inlined applicationConfig.${accessPath.join('.')} → ${adjustedValue} in ${path_1.default.relative((0, _1.getCwd)(), sf.getFilePath())}`);
|
|
669
745
|
filesToSaveAfterInlining.add(sf);
|
|
670
746
|
madeReplacement = true;
|
|
671
747
|
break; // restart — tree has changed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AA4BA,wBAAgB,MAAM,WAMrB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,iBA2BxD"}
|