@opencrvs/toolkit 2.0.0-rc.1f9315c → 2.0.0-rc.21b1468
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/create-countryconfig/index.js +73 -0
- package/create-countryconfig/package.json +11 -0
- package/dist/application-config/index.js +5 -3
- package/dist/cli.js +100 -9
- package/dist/commons/api/router.d.ts +12171 -412
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/conditionals/index.js +5 -3
- package/dist/events/index.js +5 -3
- package/dist/migrations/v2.0/fix-action-confirmation-handler-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-action-confirmation-handler-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-action-confirmation-handler-type.js +113 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +98 -7
- package/dist/notification/index.js +5 -3
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +5 -3
- package/opencrvs-toolkit-2.0.0-rc.21b1468.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.1f9315c.tgz +0 -0
|
@@ -86,16 +86,16 @@ export declare const user: typeof userSerializer & {
|
|
|
86
86
|
};
|
|
87
87
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
88
88
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
89
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
89
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
90
90
|
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
94
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
94
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
95
95
|
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
96
96
|
}) => {
|
|
97
97
|
$jurisdiction: "administrativeArea" | "location" | "all" | {
|
|
98
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
98
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
99
99
|
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
100
100
|
};
|
|
101
101
|
};
|
|
@@ -1723,6 +1723,7 @@ declare const AdministrativeAreaField: z.ZodObject<{
|
|
|
1723
1723
|
"user.read": "user.read";
|
|
1724
1724
|
"user.create": "user.create";
|
|
1725
1725
|
"user.edit": "user.edit";
|
|
1726
|
+
"user.search": "user.search";
|
|
1726
1727
|
workqueue: "workqueue";
|
|
1727
1728
|
"dashboard.view": "dashboard.view";
|
|
1728
1729
|
}>;
|
|
@@ -1842,6 +1843,7 @@ declare const LocationInput: z.ZodObject<{
|
|
|
1842
1843
|
"user.read": "user.read";
|
|
1843
1844
|
"user.create": "user.create";
|
|
1844
1845
|
"user.edit": "user.edit";
|
|
1846
|
+
"user.search": "user.search";
|
|
1845
1847
|
workqueue: "workqueue";
|
|
1846
1848
|
"dashboard.view": "dashboard.view";
|
|
1847
1849
|
}>;
|
|
@@ -2026,6 +2028,7 @@ declare const Facility: z.ZodObject<{
|
|
|
2026
2028
|
"user.read": "user.read";
|
|
2027
2029
|
"user.create": "user.create";
|
|
2028
2030
|
"user.edit": "user.edit";
|
|
2031
|
+
"user.search": "user.search";
|
|
2029
2032
|
workqueue: "workqueue";
|
|
2030
2033
|
"dashboard.view": "dashboard.view";
|
|
2031
2034
|
}>;
|
|
@@ -2131,6 +2134,7 @@ declare const Office: z.ZodObject<{
|
|
|
2131
2134
|
"user.read": "user.read";
|
|
2132
2135
|
"user.create": "user.create";
|
|
2133
2136
|
"user.edit": "user.edit";
|
|
2137
|
+
"user.search": "user.search";
|
|
2134
2138
|
workqueue: "workqueue";
|
|
2135
2139
|
"dashboard.view": "dashboard.view";
|
|
2136
2140
|
}>;
|
|
@@ -2323,6 +2327,7 @@ declare const Address: z.ZodObject<{
|
|
|
2323
2327
|
"user.read": "user.read";
|
|
2324
2328
|
"user.create": "user.create";
|
|
2325
2329
|
"user.edit": "user.edit";
|
|
2330
|
+
"user.search": "user.search";
|
|
2326
2331
|
workqueue: "workqueue";
|
|
2327
2332
|
"dashboard.view": "dashboard.view";
|
|
2328
2333
|
}>;
|
|
@@ -298,12 +298,14 @@ var SystemScopeType = z6.enum([
|
|
|
298
298
|
"organisation.read-locations",
|
|
299
299
|
"user.read",
|
|
300
300
|
"user.create",
|
|
301
|
-
"user.edit"
|
|
301
|
+
"user.edit",
|
|
302
|
+
"user.search"
|
|
302
303
|
]);
|
|
303
304
|
var UserScopeType = SystemScopeType.extract([
|
|
304
305
|
"user.read",
|
|
305
306
|
"user.create",
|
|
306
|
-
"user.edit"
|
|
307
|
+
"user.edit",
|
|
308
|
+
"user.search"
|
|
307
309
|
]);
|
|
308
310
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
309
311
|
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
@@ -312,7 +314,7 @@ var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
|
312
314
|
options: AllUserScopeOptions.optional()
|
|
313
315
|
}),
|
|
314
316
|
z6.object({
|
|
315
|
-
type: UserScopeType.extract(["user.read"]),
|
|
317
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
316
318
|
options: AccessLevelOptions.optional()
|
|
317
319
|
})
|
|
318
320
|
]);
|
package/dist/events/index.js
CHANGED
|
@@ -610,12 +610,14 @@ var SystemScopeType = z2.enum([
|
|
|
610
610
|
"organisation.read-locations",
|
|
611
611
|
"user.read",
|
|
612
612
|
"user.create",
|
|
613
|
-
"user.edit"
|
|
613
|
+
"user.edit",
|
|
614
|
+
"user.search"
|
|
614
615
|
]);
|
|
615
616
|
var UserScopeType = SystemScopeType.extract([
|
|
616
617
|
"user.read",
|
|
617
618
|
"user.create",
|
|
618
|
-
"user.edit"
|
|
619
|
+
"user.edit",
|
|
620
|
+
"user.search"
|
|
619
621
|
]);
|
|
620
622
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
621
623
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -624,7 +626,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
624
626
|
options: AllUserScopeOptions.optional()
|
|
625
627
|
}),
|
|
626
628
|
z2.object({
|
|
627
|
-
type: UserScopeType.extract(["user.read"]),
|
|
629
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
628
630
|
options: AccessLevelOptions.optional()
|
|
629
631
|
})
|
|
630
632
|
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-action-confirmation-handler-type.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/fix-action-confirmation-handler-type.ts"],"names":[],"mappings":"AAsFA,iBAAe,IAAI,kBA6ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.main = main;
|
|
26
|
+
/**
|
|
27
|
+
* Codemod: Update action confirmation handler parameter type from:
|
|
28
|
+
* action: ActionInput
|
|
29
|
+
* to:
|
|
30
|
+
* action: Extract<ActionInput, { type?: 'REGISTER' }>
|
|
31
|
+
*
|
|
32
|
+
* What it does:
|
|
33
|
+
* - Scans all TypeScript files under `src/`
|
|
34
|
+
* - Finds function parameters named `action` with type exactly `ActionInput`
|
|
35
|
+
* - Rewrites the type annotation to the extracted REGISTER action subtype
|
|
36
|
+
* - Saves modified files in-place
|
|
37
|
+
*/
|
|
38
|
+
/* eslint-disable no-console */
|
|
39
|
+
const ts_morph_1 = require("ts-morph");
|
|
40
|
+
const path_1 = __importDefault(require("path"));
|
|
41
|
+
const TARGET_FUNCTION_NAME = 'acceptRequestedRegistration';
|
|
42
|
+
const ACTION_PARAMETER_NAME = 'action';
|
|
43
|
+
const OLD_TYPE = 'ActionInput';
|
|
44
|
+
const NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
|
|
45
|
+
function isTargetFunctionParameter(parameter) {
|
|
46
|
+
const functionDeclaration = parameter.getFirstAncestorByKind(ts_morph_1.SyntaxKind.FunctionDeclaration);
|
|
47
|
+
if ((functionDeclaration === null || functionDeclaration === void 0 ? void 0 : functionDeclaration.getName()) === TARGET_FUNCTION_NAME) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
const arrowFunction = parameter.getFirstAncestorByKind(ts_morph_1.SyntaxKind.ArrowFunction);
|
|
51
|
+
const variableDeclaration = arrowFunction === null || arrowFunction === void 0 ? void 0 : arrowFunction.getFirstAncestorByKind(ts_morph_1.SyntaxKind.VariableDeclaration);
|
|
52
|
+
return (variableDeclaration === null || variableDeclaration === void 0 ? void 0 : variableDeclaration.getName()) === TARGET_FUNCTION_NAME;
|
|
53
|
+
}
|
|
54
|
+
function processFile(filePath, project) {
|
|
55
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
56
|
+
if (!sourceFile)
|
|
57
|
+
return 0;
|
|
58
|
+
let updatedCount = 0;
|
|
59
|
+
const parameters = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.Parameter);
|
|
60
|
+
for (const parameter of parameters) {
|
|
61
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (!isTargetFunctionParameter(parameter)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const typeNode = parameter.getTypeNode();
|
|
68
|
+
if (!typeNode)
|
|
69
|
+
continue;
|
|
70
|
+
if (typeNode.getText() !== OLD_TYPE) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
parameter.setType(NEW_TYPE);
|
|
74
|
+
updatedCount++;
|
|
75
|
+
console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' parameter type to ${NEW_TYPE}`);
|
|
76
|
+
}
|
|
77
|
+
return updatedCount;
|
|
78
|
+
}
|
|
79
|
+
function main() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
82
|
+
console.log(`Scanning for action confirmation handler types in: ${srcDir}\n`);
|
|
83
|
+
const project = new ts_morph_1.Project({
|
|
84
|
+
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
85
|
+
skipAddingFilesFromTsConfig: false
|
|
86
|
+
});
|
|
87
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
88
|
+
const filePath = sf.getFilePath();
|
|
89
|
+
return filePath.includes('/src/') && !filePath.includes('/node_modules/');
|
|
90
|
+
});
|
|
91
|
+
let totalUpdated = 0;
|
|
92
|
+
const modifiedFiles = [];
|
|
93
|
+
for (const sourceFile of sourceFiles) {
|
|
94
|
+
const filePath = sourceFile.getFilePath();
|
|
95
|
+
const updated = processFile(filePath, project);
|
|
96
|
+
if (updated > 0) {
|
|
97
|
+
totalUpdated += updated;
|
|
98
|
+
modifiedFiles.push(filePath);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (modifiedFiles.length === 0) {
|
|
102
|
+
console.log(`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter signatures found. Nothing to do.`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
|
|
106
|
+
for (const filePath of modifiedFiles) {
|
|
107
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
108
|
+
yield sourceFile.save();
|
|
109
|
+
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
110
|
+
}
|
|
111
|
+
console.log(`\nDone. Updated ${totalUpdated} '${ACTION_PARAMETER_NAME}' parameter type annotation(s).`);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
@@ -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":"AAsCA;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBAgCpD"}
|
|
@@ -1895,9 +1895,9 @@ function updateRouteHandlers(sourceFiles, group, srcDir, relCwd) {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
return replacedCount;
|
|
1897
1897
|
}
|
|
1898
|
-
function resolveConfigChain(configObj,
|
|
1898
|
+
function resolveConfigChain(configObj, path24) {
|
|
1899
1899
|
let current = configObj;
|
|
1900
|
-
for (const key of
|
|
1900
|
+
for (const key of path24) {
|
|
1901
1901
|
if (!import_ts_morph10.Node.isObjectLiteralExpression(current)) return null;
|
|
1902
1902
|
const prop = current.getProperty(key);
|
|
1903
1903
|
if (!prop || !import_ts_morph10.Node.isPropertyAssignment(prop)) return null;
|
|
@@ -2308,12 +2308,14 @@ var SystemScopeType = z3.enum([
|
|
|
2308
2308
|
"organisation.read-locations",
|
|
2309
2309
|
"user.read",
|
|
2310
2310
|
"user.create",
|
|
2311
|
-
"user.edit"
|
|
2311
|
+
"user.edit",
|
|
2312
|
+
"user.search"
|
|
2312
2313
|
]);
|
|
2313
2314
|
var UserScopeType = SystemScopeType.extract([
|
|
2314
2315
|
"user.read",
|
|
2315
2316
|
"user.create",
|
|
2316
|
-
"user.edit"
|
|
2317
|
+
"user.edit",
|
|
2318
|
+
"user.search"
|
|
2317
2319
|
]);
|
|
2318
2320
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
2319
2321
|
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
@@ -2322,7 +2324,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
|
2322
2324
|
options: AllUserScopeOptions.optional()
|
|
2323
2325
|
}),
|
|
2324
2326
|
z3.object({
|
|
2325
|
-
type: UserScopeType.extract(["user.read"]),
|
|
2327
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
2326
2328
|
options: AccessLevelOptions.optional()
|
|
2327
2329
|
})
|
|
2328
2330
|
]);
|
|
@@ -4707,9 +4709,9 @@ var import_path24 = require("path");
|
|
|
4707
4709
|
var TEMP_REMOTE2 = "opencrvs-upgrade-v19-v20-codemod-merge-infra";
|
|
4708
4710
|
var INFRASTRUCTURE_DIR = "infrastructure";
|
|
4709
4711
|
var BASE_BRANCH = "release-v1.9";
|
|
4710
|
-
function gitShowBytes(ref,
|
|
4712
|
+
function gitShowBytes(ref, path24) {
|
|
4711
4713
|
try {
|
|
4712
|
-
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${
|
|
4714
|
+
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${path24}`], {
|
|
4713
4715
|
cwd: process.cwd(),
|
|
4714
4716
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4715
4717
|
});
|
|
@@ -4848,6 +4850,94 @@ async function main26() {
|
|
|
4848
4850
|
);
|
|
4849
4851
|
}
|
|
4850
4852
|
|
|
4853
|
+
// src/migrations/v2.0/fix-action-confirmation-handler-type.ts
|
|
4854
|
+
var import_ts_morph22 = require("ts-morph");
|
|
4855
|
+
var import_path26 = __toESM(require("path"));
|
|
4856
|
+
var TARGET_FUNCTION_NAME = "acceptRequestedRegistration";
|
|
4857
|
+
var ACTION_PARAMETER_NAME = "action";
|
|
4858
|
+
var OLD_TYPE = "ActionInput";
|
|
4859
|
+
var NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
|
|
4860
|
+
function isTargetFunctionParameter(parameter) {
|
|
4861
|
+
const functionDeclaration = parameter.getFirstAncestorByKind(
|
|
4862
|
+
import_ts_morph22.SyntaxKind.FunctionDeclaration
|
|
4863
|
+
);
|
|
4864
|
+
if (functionDeclaration?.getName() === TARGET_FUNCTION_NAME) {
|
|
4865
|
+
return true;
|
|
4866
|
+
}
|
|
4867
|
+
const arrowFunction = parameter.getFirstAncestorByKind(
|
|
4868
|
+
import_ts_morph22.SyntaxKind.ArrowFunction
|
|
4869
|
+
);
|
|
4870
|
+
const variableDeclaration = arrowFunction?.getFirstAncestorByKind(
|
|
4871
|
+
import_ts_morph22.SyntaxKind.VariableDeclaration
|
|
4872
|
+
);
|
|
4873
|
+
return variableDeclaration?.getName() === TARGET_FUNCTION_NAME;
|
|
4874
|
+
}
|
|
4875
|
+
function processFile14(filePath, project) {
|
|
4876
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
4877
|
+
if (!sourceFile) return 0;
|
|
4878
|
+
let updatedCount = 0;
|
|
4879
|
+
const parameters = sourceFile.getDescendantsOfKind(import_ts_morph22.SyntaxKind.Parameter);
|
|
4880
|
+
for (const parameter of parameters) {
|
|
4881
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
4882
|
+
continue;
|
|
4883
|
+
}
|
|
4884
|
+
if (!isTargetFunctionParameter(parameter)) {
|
|
4885
|
+
continue;
|
|
4886
|
+
}
|
|
4887
|
+
const typeNode = parameter.getTypeNode();
|
|
4888
|
+
if (!typeNode) continue;
|
|
4889
|
+
if (typeNode.getText() !== OLD_TYPE) {
|
|
4890
|
+
continue;
|
|
4891
|
+
}
|
|
4892
|
+
parameter.setType(NEW_TYPE);
|
|
4893
|
+
updatedCount++;
|
|
4894
|
+
console.log(
|
|
4895
|
+
` [${import_path26.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' parameter type to ${NEW_TYPE}`
|
|
4896
|
+
);
|
|
4897
|
+
}
|
|
4898
|
+
return updatedCount;
|
|
4899
|
+
}
|
|
4900
|
+
async function main27() {
|
|
4901
|
+
const srcDir = import_path26.default.join(process.cwd(), "src");
|
|
4902
|
+
console.log(`Scanning for action confirmation handler types in: ${srcDir}
|
|
4903
|
+
`);
|
|
4904
|
+
const project = new import_ts_morph22.Project({
|
|
4905
|
+
tsConfigFilePath: import_path26.default.resolve(srcDir, "../tsconfig.json"),
|
|
4906
|
+
skipAddingFilesFromTsConfig: false
|
|
4907
|
+
});
|
|
4908
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
4909
|
+
const filePath = sf.getFilePath();
|
|
4910
|
+
return filePath.includes("/src/") && !filePath.includes("/node_modules/");
|
|
4911
|
+
});
|
|
4912
|
+
let totalUpdated = 0;
|
|
4913
|
+
const modifiedFiles = [];
|
|
4914
|
+
for (const sourceFile of sourceFiles) {
|
|
4915
|
+
const filePath = sourceFile.getFilePath();
|
|
4916
|
+
const updated = processFile14(filePath, project);
|
|
4917
|
+
if (updated > 0) {
|
|
4918
|
+
totalUpdated += updated;
|
|
4919
|
+
modifiedFiles.push(filePath);
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4922
|
+
if (modifiedFiles.length === 0) {
|
|
4923
|
+
console.log(
|
|
4924
|
+
`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter signatures found. Nothing to do.`
|
|
4925
|
+
);
|
|
4926
|
+
return;
|
|
4927
|
+
}
|
|
4928
|
+
console.log(`
|
|
4929
|
+
Saving ${modifiedFiles.length} modified file(s)...`);
|
|
4930
|
+
for (const filePath of modifiedFiles) {
|
|
4931
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
4932
|
+
await sourceFile.save();
|
|
4933
|
+
console.log(` Saved: ${import_path26.default.relative(process.cwd(), filePath)}`);
|
|
4934
|
+
}
|
|
4935
|
+
console.log(
|
|
4936
|
+
`
|
|
4937
|
+
Done. Updated ${totalUpdated} '${ACTION_PARAMETER_NAME}' parameter type annotation(s).`
|
|
4938
|
+
);
|
|
4939
|
+
}
|
|
4940
|
+
|
|
4851
4941
|
// src/migrations/v2.0/index.ts
|
|
4852
4942
|
async function runUpgrade(dockerSwarm) {
|
|
4853
4943
|
await main18();
|
|
@@ -4870,6 +4960,7 @@ async function runUpgrade(dockerSwarm) {
|
|
|
4870
4960
|
await main19();
|
|
4871
4961
|
await main20();
|
|
4872
4962
|
await main21();
|
|
4963
|
+
await main27();
|
|
4873
4964
|
await main22();
|
|
4874
4965
|
await main23();
|
|
4875
4966
|
await main24();
|
|
@@ -226,12 +226,14 @@ var SystemScopeType = z2.enum([
|
|
|
226
226
|
"organisation.read-locations",
|
|
227
227
|
"user.read",
|
|
228
228
|
"user.create",
|
|
229
|
-
"user.edit"
|
|
229
|
+
"user.edit",
|
|
230
|
+
"user.search"
|
|
230
231
|
]);
|
|
231
232
|
var UserScopeType = SystemScopeType.extract([
|
|
232
233
|
"user.read",
|
|
233
234
|
"user.create",
|
|
234
|
-
"user.edit"
|
|
235
|
+
"user.edit",
|
|
236
|
+
"user.search"
|
|
235
237
|
]);
|
|
236
238
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
237
239
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -240,7 +242,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
240
242
|
options: AllUserScopeOptions.optional()
|
|
241
243
|
}),
|
|
242
244
|
z2.object({
|
|
243
|
-
type: UserScopeType.extract(["user.read"]),
|
|
245
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
244
246
|
options: AccessLevelOptions.optional()
|
|
245
247
|
})
|
|
246
248
|
]);
|
package/dist/scopes/index.d.ts
CHANGED
|
@@ -227,12 +227,14 @@ declare const SystemScopeType: z.ZodEnum<{
|
|
|
227
227
|
"user.read": "user.read";
|
|
228
228
|
"user.create": "user.create";
|
|
229
229
|
"user.edit": "user.edit";
|
|
230
|
+
"user.search": "user.search";
|
|
230
231
|
}>;
|
|
231
232
|
export type SystemScopeType = z.infer<typeof SystemScopeType>;
|
|
232
233
|
declare const UserScopeType: z.ZodEnum<{
|
|
233
234
|
"user.read": "user.read";
|
|
234
235
|
"user.create": "user.create";
|
|
235
236
|
"user.edit": "user.edit";
|
|
237
|
+
"user.search": "user.search";
|
|
236
238
|
}>;
|
|
237
239
|
export type UserScopeType = z.infer<typeof UserScopeType>;
|
|
238
240
|
declare const ScopesWithRoleOption: z.ZodEnum<{
|
|
@@ -256,6 +258,7 @@ export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
256
258
|
}, z.core.$strip>, z.ZodObject<{
|
|
257
259
|
type: z.ZodEnum<{
|
|
258
260
|
"user.read": "user.read";
|
|
261
|
+
"user.search": "user.search";
|
|
259
262
|
}>;
|
|
260
263
|
options: z.ZodOptional<z.ZodObject<{
|
|
261
264
|
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
@@ -493,6 +496,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
493
496
|
}, z.core.$strip>, z.ZodObject<{
|
|
494
497
|
type: z.ZodEnum<{
|
|
495
498
|
"user.read": "user.read";
|
|
499
|
+
"user.search": "user.search";
|
|
496
500
|
}>;
|
|
497
501
|
options: z.ZodOptional<z.ZodObject<{
|
|
498
502
|
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
@@ -556,6 +560,7 @@ export declare const ScopeType: z.ZodEnum<{
|
|
|
556
560
|
"user.read": "user.read";
|
|
557
561
|
"user.create": "user.create";
|
|
558
562
|
"user.edit": "user.edit";
|
|
563
|
+
"user.search": "user.search";
|
|
559
564
|
workqueue: "workqueue";
|
|
560
565
|
"dashboard.view": "dashboard.view";
|
|
561
566
|
}>;
|
|
@@ -635,7 +640,7 @@ export declare const decodeScope: (query: EncodedScope) => {
|
|
|
635
640
|
role?: string[] | undefined;
|
|
636
641
|
} | undefined;
|
|
637
642
|
} | {
|
|
638
|
-
type: "user.read";
|
|
643
|
+
type: "user.read" | "user.search";
|
|
639
644
|
options?: {
|
|
640
645
|
accessLevel?: "administrativeArea" | "location" | "all" | undefined;
|
|
641
646
|
} | undefined;
|
package/dist/scopes/index.js
CHANGED
|
@@ -257,12 +257,14 @@ var SystemScopeType = z3.enum([
|
|
|
257
257
|
"organisation.read-locations",
|
|
258
258
|
"user.read",
|
|
259
259
|
"user.create",
|
|
260
|
-
"user.edit"
|
|
260
|
+
"user.edit",
|
|
261
|
+
"user.search"
|
|
261
262
|
]);
|
|
262
263
|
var UserScopeType = SystemScopeType.extract([
|
|
263
264
|
"user.read",
|
|
264
265
|
"user.create",
|
|
265
|
-
"user.edit"
|
|
266
|
+
"user.edit",
|
|
267
|
+
"user.search"
|
|
266
268
|
]);
|
|
267
269
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
268
270
|
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
@@ -271,7 +273,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
|
271
273
|
options: AllUserScopeOptions.optional()
|
|
272
274
|
}),
|
|
273
275
|
z3.object({
|
|
274
|
-
type: UserScopeType.extract(["user.read"]),
|
|
276
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
275
277
|
options: AccessLevelOptions.optional()
|
|
276
278
|
})
|
|
277
279
|
]);
|
|
Binary file
|
package/package.json
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -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-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.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/delete-infrastructure-directory.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.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-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.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/migrations/v2.0/update-package-json.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/add-resend-invite-notification.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/delete-infrastructure-directory.ts","./src/migrations/v2.0/fix-action-confirmation-handler-type.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.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-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.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/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
|
|
Binary file
|