@opencrvs/toolkit 2.0.0-rc.6ff040f → 2.0.0-rc.71abbde
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 +3 -1
- package/dist/cli.js +98 -7
- package/dist/commons/api/router.d.ts +339 -0
- package/dist/conditionals/index.js +3 -1
- package/dist/events/index.js +3 -1
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +96 -5
- package/dist/notification/index.js +3 -1
- package/dist/scopes/index.js +3 -1
- package/opencrvs-toolkit-2.0.0-rc.71abbde.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.6ff040f.tgz +0 -0
|
@@ -831,7 +831,9 @@ var ScopeType = z11.enum([
|
|
|
831
831
|
var EncodedScope = z11.string().brand("EncodedScope");
|
|
832
832
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
833
833
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
834
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
834
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
835
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
836
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
835
837
|
};
|
|
836
838
|
|
|
837
839
|
// ../commons/src/authentication.ts
|
package/dist/cli.js
CHANGED
|
@@ -1883,9 +1883,9 @@ function updateRouteHandlers(sourceFiles, group, srcDir, relCwd) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
return replacedCount;
|
|
1885
1885
|
}
|
|
1886
|
-
function resolveConfigChain(configObj,
|
|
1886
|
+
function resolveConfigChain(configObj, path24) {
|
|
1887
1887
|
let current = configObj;
|
|
1888
|
-
for (const key of
|
|
1888
|
+
for (const key of path24) {
|
|
1889
1889
|
if (!import_ts_morph10.Node.isObjectLiteralExpression(current)) return null;
|
|
1890
1890
|
const prop = current.getProperty(key);
|
|
1891
1891
|
if (!prop || !import_ts_morph10.Node.isPropertyAssignment(prop)) return null;
|
|
@@ -2393,7 +2393,9 @@ var decodeScope = (query) => {
|
|
|
2393
2393
|
};
|
|
2394
2394
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
2395
2395
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
2396
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
2396
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
2397
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
2398
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
2397
2399
|
};
|
|
2398
2400
|
|
|
2399
2401
|
// ../commons/src/scopes.deprecated.do-not-use.ts
|
|
@@ -4831,9 +4833,9 @@ var import_path24 = require("path");
|
|
|
4831
4833
|
var TEMP_REMOTE2 = "opencrvs-upgrade-v19-v20-codemod-merge-infra";
|
|
4832
4834
|
var INFRASTRUCTURE_DIR = "infrastructure";
|
|
4833
4835
|
var BASE_BRANCH = "release-v1.9";
|
|
4834
|
-
function gitShowBytes(ref,
|
|
4836
|
+
function gitShowBytes(ref, path24) {
|
|
4835
4837
|
try {
|
|
4836
|
-
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${
|
|
4838
|
+
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${path24}`], {
|
|
4837
4839
|
cwd: process.cwd(),
|
|
4838
4840
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4839
4841
|
});
|
|
@@ -5009,6 +5011,94 @@ async function main26({
|
|
|
5009
5011
|
);
|
|
5010
5012
|
}
|
|
5011
5013
|
|
|
5014
|
+
// src/migrations/v2.0/fix-accept-requested-registration-function-type.ts
|
|
5015
|
+
var import_ts_morph22 = require("ts-morph");
|
|
5016
|
+
var import_path26 = __toESM(require("path"));
|
|
5017
|
+
var TARGET_FUNCTION_NAME = "acceptRequestedRegistration";
|
|
5018
|
+
var ACTION_PARAMETER_NAME = "action";
|
|
5019
|
+
var OLD_TYPE = "ActionInput";
|
|
5020
|
+
var NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
|
|
5021
|
+
function isAcceptRequestedRegistrationParameter(parameter) {
|
|
5022
|
+
const functionDeclaration = parameter.getFirstAncestorByKind(
|
|
5023
|
+
import_ts_morph22.SyntaxKind.FunctionDeclaration
|
|
5024
|
+
);
|
|
5025
|
+
if (functionDeclaration?.getName() === TARGET_FUNCTION_NAME) {
|
|
5026
|
+
return true;
|
|
5027
|
+
}
|
|
5028
|
+
const arrowFunction = parameter.getFirstAncestorByKind(
|
|
5029
|
+
import_ts_morph22.SyntaxKind.ArrowFunction
|
|
5030
|
+
);
|
|
5031
|
+
const variableDeclaration = arrowFunction?.getFirstAncestorByKind(
|
|
5032
|
+
import_ts_morph22.SyntaxKind.VariableDeclaration
|
|
5033
|
+
);
|
|
5034
|
+
return variableDeclaration?.getName() === TARGET_FUNCTION_NAME;
|
|
5035
|
+
}
|
|
5036
|
+
function processFile14(filePath, project) {
|
|
5037
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
5038
|
+
if (!sourceFile) return 0;
|
|
5039
|
+
let updatedCount = 0;
|
|
5040
|
+
for (const parameter of sourceFile.getDescendantsOfKind(
|
|
5041
|
+
import_ts_morph22.SyntaxKind.Parameter
|
|
5042
|
+
)) {
|
|
5043
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
5044
|
+
continue;
|
|
5045
|
+
}
|
|
5046
|
+
if (!isAcceptRequestedRegistrationParameter(parameter)) {
|
|
5047
|
+
continue;
|
|
5048
|
+
}
|
|
5049
|
+
const typeNode = parameter.getTypeNode();
|
|
5050
|
+
if (!typeNode || typeNode.getText() !== OLD_TYPE) {
|
|
5051
|
+
continue;
|
|
5052
|
+
}
|
|
5053
|
+
parameter.setType(NEW_TYPE);
|
|
5054
|
+
updatedCount++;
|
|
5055
|
+
console.log(
|
|
5056
|
+
` [${import_path26.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' in ${TARGET_FUNCTION_NAME} to ${NEW_TYPE}`
|
|
5057
|
+
);
|
|
5058
|
+
}
|
|
5059
|
+
return updatedCount;
|
|
5060
|
+
}
|
|
5061
|
+
async function main27() {
|
|
5062
|
+
const srcDir = import_path26.default.join(process.cwd(), "src");
|
|
5063
|
+
console.log(`Scanning for ${TARGET_FUNCTION_NAME} in: ${srcDir}
|
|
5064
|
+
`);
|
|
5065
|
+
const project = new import_ts_morph22.Project({
|
|
5066
|
+
tsConfigFilePath: import_path26.default.resolve(srcDir, "../tsconfig.json"),
|
|
5067
|
+
skipAddingFilesFromTsConfig: false
|
|
5068
|
+
});
|
|
5069
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
5070
|
+
const filePath = sf.getFilePath();
|
|
5071
|
+
return filePath.includes("/src/") && !filePath.includes("/node_modules/");
|
|
5072
|
+
});
|
|
5073
|
+
let totalUpdated = 0;
|
|
5074
|
+
const modifiedFiles = [];
|
|
5075
|
+
for (const sourceFile of sourceFiles) {
|
|
5076
|
+
const filePath = sourceFile.getFilePath();
|
|
5077
|
+
const updated = processFile14(filePath, project);
|
|
5078
|
+
if (updated > 0) {
|
|
5079
|
+
totalUpdated += updated;
|
|
5080
|
+
modifiedFiles.push(filePath);
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
if (modifiedFiles.length === 0) {
|
|
5084
|
+
console.log(
|
|
5085
|
+
`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter in ${TARGET_FUNCTION_NAME} found. Nothing to do.`
|
|
5086
|
+
);
|
|
5087
|
+
return;
|
|
5088
|
+
}
|
|
5089
|
+
console.log(`
|
|
5090
|
+
Saving ${modifiedFiles.length} modified file(s)...`);
|
|
5091
|
+
for (const filePath of modifiedFiles) {
|
|
5092
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
5093
|
+
await sourceFile.save();
|
|
5094
|
+
console.log(` Saved: ${import_path26.default.relative(process.cwd(), filePath)}`);
|
|
5095
|
+
}
|
|
5096
|
+
console.log(
|
|
5097
|
+
`
|
|
5098
|
+
Done. Updated ${totalUpdated} parameter type annotation(s) in ${TARGET_FUNCTION_NAME}.`
|
|
5099
|
+
);
|
|
5100
|
+
}
|
|
5101
|
+
|
|
5012
5102
|
// src/migrations/v2.0/index.ts
|
|
5013
5103
|
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
5014
5104
|
async function runUpgrade(dockerSwarm) {
|
|
@@ -5035,6 +5125,7 @@ async function runUpgrade(dockerSwarm) {
|
|
|
5035
5125
|
await main22();
|
|
5036
5126
|
await main23();
|
|
5037
5127
|
await main24();
|
|
5128
|
+
await main27();
|
|
5038
5129
|
await main17();
|
|
5039
5130
|
if (dockerSwarm) {
|
|
5040
5131
|
await main25();
|
|
@@ -5069,7 +5160,7 @@ Options:
|
|
|
5069
5160
|
'infrastructure/' directory is deleted (default).
|
|
5070
5161
|
-h, --help Show this message.
|
|
5071
5162
|
`.trim();
|
|
5072
|
-
function
|
|
5163
|
+
function main28() {
|
|
5073
5164
|
const command = args[0];
|
|
5074
5165
|
if (!command || command === "--help" || command === "-h") {
|
|
5075
5166
|
console.log(USAGE);
|
|
@@ -5144,4 +5235,4 @@ function handleCheckTranslations() {
|
|
|
5144
5235
|
console.warn("This command is not implemented yet!");
|
|
5145
5236
|
process.exit(1);
|
|
5146
5237
|
}
|
|
5147
|
-
|
|
5238
|
+
main28();
|
|
@@ -1445,6 +1445,345 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1445
1445
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
1446
1446
|
}>;
|
|
1447
1447
|
}>>;
|
|
1448
|
+
createAndNotify: import("@trpc/server").TRPCBuiltRouter<{
|
|
1449
|
+
ctx: Partial<{
|
|
1450
|
+
token: `Bearer ${string}`;
|
|
1451
|
+
user: {
|
|
1452
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1453
|
+
type: "system";
|
|
1454
|
+
signature?: undefined;
|
|
1455
|
+
primaryOfficeId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
1456
|
+
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
1457
|
+
} | {
|
|
1458
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1459
|
+
type: "user";
|
|
1460
|
+
role: string;
|
|
1461
|
+
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
1462
|
+
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1463
|
+
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1464
|
+
};
|
|
1465
|
+
}>;
|
|
1466
|
+
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
1467
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
1468
|
+
transformer: true;
|
|
1469
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
1470
|
+
request: import("@trpc/server").TRPCMutationProcedure<{
|
|
1471
|
+
input: {
|
|
1472
|
+
transactionId: string;
|
|
1473
|
+
eventType: string;
|
|
1474
|
+
createdAtLocation: string;
|
|
1475
|
+
declaration?: Record<string, unknown> | undefined;
|
|
1476
|
+
annotation?: Record<string, unknown> | undefined;
|
|
1477
|
+
originalActionId?: string | undefined;
|
|
1478
|
+
keepAssignment?: boolean | undefined;
|
|
1479
|
+
keepAssignmentIfAccepted?: boolean | undefined;
|
|
1480
|
+
keepAssignmentIfRejected?: boolean | undefined;
|
|
1481
|
+
waitFor?: boolean | undefined;
|
|
1482
|
+
};
|
|
1483
|
+
output: {
|
|
1484
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1485
|
+
type: string;
|
|
1486
|
+
createdAt: string;
|
|
1487
|
+
updatedAt: string;
|
|
1488
|
+
actions: ({
|
|
1489
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1490
|
+
transactionId: string;
|
|
1491
|
+
createdByUserType: "system" | "user";
|
|
1492
|
+
createdAt: string;
|
|
1493
|
+
createdBy: string;
|
|
1494
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1495
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1496
|
+
type: "CREATE";
|
|
1497
|
+
createdByRole?: string | undefined;
|
|
1498
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1499
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1500
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1501
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1502
|
+
} | {
|
|
1503
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1504
|
+
transactionId: string;
|
|
1505
|
+
createdByUserType: "system" | "user";
|
|
1506
|
+
createdAt: string;
|
|
1507
|
+
createdBy: string;
|
|
1508
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1509
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1510
|
+
type: "REJECT";
|
|
1511
|
+
content: {
|
|
1512
|
+
reason: string;
|
|
1513
|
+
};
|
|
1514
|
+
createdByRole?: string | undefined;
|
|
1515
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1516
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1517
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1518
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1519
|
+
} | {
|
|
1520
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1521
|
+
transactionId: string;
|
|
1522
|
+
createdByUserType: "system" | "user";
|
|
1523
|
+
createdAt: string;
|
|
1524
|
+
createdBy: string;
|
|
1525
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1526
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1527
|
+
type: "DUPLICATE_DETECTED";
|
|
1528
|
+
content: {
|
|
1529
|
+
duplicates: {
|
|
1530
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1531
|
+
trackingId: string;
|
|
1532
|
+
}[];
|
|
1533
|
+
};
|
|
1534
|
+
createdByRole?: string | undefined;
|
|
1535
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1536
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1537
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1538
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1539
|
+
} | {
|
|
1540
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1541
|
+
transactionId: string;
|
|
1542
|
+
createdByUserType: "system" | "user";
|
|
1543
|
+
createdAt: string;
|
|
1544
|
+
createdBy: string;
|
|
1545
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1546
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1547
|
+
type: "MARK_AS_NOT_DUPLICATE";
|
|
1548
|
+
createdByRole?: string | undefined;
|
|
1549
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1550
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1551
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1552
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1553
|
+
} | {
|
|
1554
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1555
|
+
transactionId: string;
|
|
1556
|
+
createdByUserType: "system" | "user";
|
|
1557
|
+
createdAt: string;
|
|
1558
|
+
createdBy: string;
|
|
1559
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1560
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1561
|
+
type: "MARK_AS_DUPLICATE";
|
|
1562
|
+
createdByRole?: string | undefined;
|
|
1563
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1564
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1565
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1566
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1567
|
+
content?: {
|
|
1568
|
+
duplicateOf: string & import("zod").$brand<"UUID">;
|
|
1569
|
+
} | undefined;
|
|
1570
|
+
} | {
|
|
1571
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1572
|
+
transactionId: string;
|
|
1573
|
+
createdByUserType: "system" | "user";
|
|
1574
|
+
createdAt: string;
|
|
1575
|
+
createdBy: string;
|
|
1576
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1577
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1578
|
+
type: "ARCHIVE";
|
|
1579
|
+
content: {
|
|
1580
|
+
reason: string;
|
|
1581
|
+
};
|
|
1582
|
+
createdByRole?: string | undefined;
|
|
1583
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1584
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1585
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1586
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1587
|
+
} | {
|
|
1588
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1589
|
+
transactionId: string;
|
|
1590
|
+
createdByUserType: "system" | "user";
|
|
1591
|
+
createdAt: string;
|
|
1592
|
+
createdBy: string;
|
|
1593
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1594
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1595
|
+
type: "NOTIFY";
|
|
1596
|
+
createdByRole?: string | undefined;
|
|
1597
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1598
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1599
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1600
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1601
|
+
} | {
|
|
1602
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1603
|
+
transactionId: string;
|
|
1604
|
+
createdByUserType: "system" | "user";
|
|
1605
|
+
createdAt: string;
|
|
1606
|
+
createdBy: string;
|
|
1607
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1608
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1609
|
+
type: "REGISTER";
|
|
1610
|
+
createdByRole?: string | undefined;
|
|
1611
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1612
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1613
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1614
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1615
|
+
registrationNumber?: string | undefined;
|
|
1616
|
+
} | {
|
|
1617
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1618
|
+
transactionId: string;
|
|
1619
|
+
createdByUserType: "system" | "user";
|
|
1620
|
+
createdAt: string;
|
|
1621
|
+
createdBy: string;
|
|
1622
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1623
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1624
|
+
type: "DECLARE";
|
|
1625
|
+
createdByRole?: string | undefined;
|
|
1626
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1627
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1628
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1629
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1630
|
+
} | {
|
|
1631
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1632
|
+
transactionId: string;
|
|
1633
|
+
createdByUserType: "system" | "user";
|
|
1634
|
+
createdAt: string;
|
|
1635
|
+
createdBy: string;
|
|
1636
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1637
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1638
|
+
type: "ASSIGN";
|
|
1639
|
+
assignedTo: string;
|
|
1640
|
+
createdByRole?: string | undefined;
|
|
1641
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1642
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1643
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1644
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1645
|
+
} | {
|
|
1646
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1647
|
+
transactionId: string;
|
|
1648
|
+
createdByUserType: "system" | "user";
|
|
1649
|
+
createdAt: string;
|
|
1650
|
+
createdBy: string;
|
|
1651
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1652
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1653
|
+
type: "REQUEST_CORRECTION";
|
|
1654
|
+
createdByRole?: string | undefined;
|
|
1655
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1656
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1657
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1658
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1659
|
+
} | {
|
|
1660
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1661
|
+
transactionId: string;
|
|
1662
|
+
createdByUserType: "system" | "user";
|
|
1663
|
+
createdAt: string;
|
|
1664
|
+
createdBy: string;
|
|
1665
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1666
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1667
|
+
type: "APPROVE_CORRECTION";
|
|
1668
|
+
requestId: string;
|
|
1669
|
+
createdByRole?: string | undefined;
|
|
1670
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1671
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1672
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1673
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1674
|
+
} | {
|
|
1675
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1676
|
+
transactionId: string;
|
|
1677
|
+
createdByUserType: "system" | "user";
|
|
1678
|
+
createdAt: string;
|
|
1679
|
+
createdBy: string;
|
|
1680
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1681
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1682
|
+
type: "REJECT_CORRECTION";
|
|
1683
|
+
requestId: string;
|
|
1684
|
+
content: {
|
|
1685
|
+
reason: string;
|
|
1686
|
+
};
|
|
1687
|
+
createdByRole?: string | undefined;
|
|
1688
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1689
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1690
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1691
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1692
|
+
} | {
|
|
1693
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1694
|
+
transactionId: string;
|
|
1695
|
+
createdByUserType: "system" | "user";
|
|
1696
|
+
createdAt: string;
|
|
1697
|
+
createdBy: string;
|
|
1698
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1699
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1700
|
+
type: "UNASSIGN";
|
|
1701
|
+
createdByRole?: string | undefined;
|
|
1702
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1703
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1704
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1705
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1706
|
+
} | {
|
|
1707
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1708
|
+
transactionId: string;
|
|
1709
|
+
createdByUserType: "system" | "user";
|
|
1710
|
+
createdAt: string;
|
|
1711
|
+
createdBy: string;
|
|
1712
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1713
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1714
|
+
type: "PRINT_CERTIFICATE";
|
|
1715
|
+
createdByRole?: string | undefined;
|
|
1716
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1717
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1718
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1719
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1720
|
+
content?: {
|
|
1721
|
+
templateId?: string | undefined;
|
|
1722
|
+
} | null | undefined;
|
|
1723
|
+
} | {
|
|
1724
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1725
|
+
transactionId: string;
|
|
1726
|
+
createdByUserType: "system" | "user";
|
|
1727
|
+
createdAt: string;
|
|
1728
|
+
createdBy: string;
|
|
1729
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1730
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1731
|
+
type: "READ";
|
|
1732
|
+
createdByRole?: string | undefined;
|
|
1733
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1734
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1735
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1736
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1737
|
+
} | {
|
|
1738
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1739
|
+
transactionId: string;
|
|
1740
|
+
createdByUserType: "system" | "user";
|
|
1741
|
+
createdAt: string;
|
|
1742
|
+
createdBy: string;
|
|
1743
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1744
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1745
|
+
type: "EDIT";
|
|
1746
|
+
content: {
|
|
1747
|
+
comment?: string | undefined;
|
|
1748
|
+
};
|
|
1749
|
+
createdByRole?: string | undefined;
|
|
1750
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1751
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1752
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1753
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1754
|
+
} | {
|
|
1755
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1756
|
+
transactionId: string;
|
|
1757
|
+
createdByUserType: "system" | "user";
|
|
1758
|
+
createdAt: string;
|
|
1759
|
+
createdBy: string;
|
|
1760
|
+
declaration: Record<string, import("../commons").FieldUpdateValue>;
|
|
1761
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
1762
|
+
type: "CUSTOM";
|
|
1763
|
+
customActionType: string;
|
|
1764
|
+
createdByRole?: string | undefined;
|
|
1765
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1766
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1767
|
+
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1768
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1769
|
+
} | {
|
|
1770
|
+
id: string & import("zod").$brand<"UUID">;
|
|
1771
|
+
transactionId: string;
|
|
1772
|
+
createdByUserType: "system" | "user";
|
|
1773
|
+
createdAt: string;
|
|
1774
|
+
createdBy: string;
|
|
1775
|
+
type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
|
|
1776
|
+
status: "Rejected";
|
|
1777
|
+
createdByRole?: string | undefined;
|
|
1778
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
1779
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1780
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1781
|
+
})[];
|
|
1782
|
+
trackingId: string;
|
|
1783
|
+
};
|
|
1784
|
+
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
1785
|
+
}>;
|
|
1786
|
+
}>>;
|
|
1448
1787
|
declare: import("@trpc/server").TRPCBuiltRouter<{
|
|
1449
1788
|
ctx: Partial<{
|
|
1450
1789
|
token: `Bearer ${string}`;
|
|
@@ -365,7 +365,9 @@ var ScopeType2 = z6.enum([
|
|
|
365
365
|
var EncodedScope2 = z6.string().brand("EncodedScope");
|
|
366
366
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
367
367
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
368
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
368
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
369
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
370
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
369
371
|
};
|
|
370
372
|
|
|
371
373
|
// ../commons/src/users/userReferences.ts
|
package/dist/events/index.js
CHANGED
|
@@ -704,7 +704,9 @@ var decodeScope = (query) => {
|
|
|
704
704
|
};
|
|
705
705
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
706
706
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
707
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
707
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
708
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
709
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
708
710
|
};
|
|
709
711
|
function getAcceptedScopesByType({
|
|
710
712
|
acceptedScopes,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-accept-requested-registration-function-type.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/fix-accept-requested-registration-function-type.ts"],"names":[],"mappings":"AAuFA,iBAAe,IAAI,kBA6ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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: In `acceptRequestedRegistration`, update the `action` 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 `acceptRequestedRegistration` (function declaration or const assignment)
|
|
35
|
+
* - Rewrites only the `action` parameter when its type is exactly `ActionInput`
|
|
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 isAcceptRequestedRegistrationParameter(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
|
+
for (const parameter of sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.Parameter)) {
|
|
60
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!isAcceptRequestedRegistrationParameter(parameter)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const typeNode = parameter.getTypeNode();
|
|
67
|
+
if (!typeNode || typeNode.getText() !== OLD_TYPE) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
parameter.setType(NEW_TYPE);
|
|
71
|
+
updatedCount++;
|
|
72
|
+
console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' in ${TARGET_FUNCTION_NAME} to ${NEW_TYPE}`);
|
|
73
|
+
}
|
|
74
|
+
return updatedCount;
|
|
75
|
+
}
|
|
76
|
+
function main() {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
79
|
+
console.log(`Scanning for ${TARGET_FUNCTION_NAME} in: ${srcDir}\n`);
|
|
80
|
+
const project = new ts_morph_1.Project({
|
|
81
|
+
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
82
|
+
skipAddingFilesFromTsConfig: false
|
|
83
|
+
});
|
|
84
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
85
|
+
const filePath = sf.getFilePath();
|
|
86
|
+
return filePath.includes('/src/') && !filePath.includes('/node_modules/');
|
|
87
|
+
});
|
|
88
|
+
let totalUpdated = 0;
|
|
89
|
+
const modifiedFiles = [];
|
|
90
|
+
for (const sourceFile of sourceFiles) {
|
|
91
|
+
const filePath = sourceFile.getFilePath();
|
|
92
|
+
const updated = processFile(filePath, project);
|
|
93
|
+
if (updated > 0) {
|
|
94
|
+
totalUpdated += updated;
|
|
95
|
+
modifiedFiles.push(filePath);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (modifiedFiles.length === 0) {
|
|
99
|
+
console.log(`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter in ${TARGET_FUNCTION_NAME} found. Nothing to do.`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
|
|
103
|
+
for (const filePath of modifiedFiles) {
|
|
104
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
105
|
+
yield sourceFile.save();
|
|
106
|
+
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
107
|
+
}
|
|
108
|
+
console.log(`\nDone. Updated ${totalUpdated} parameter type annotation(s) in ${TARGET_FUNCTION_NAME}.`);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -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":"AA8CA;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBAiCpD"}
|
|
@@ -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;
|
|
@@ -2405,7 +2405,9 @@ var decodeScope = (query) => {
|
|
|
2405
2405
|
};
|
|
2406
2406
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
2407
2407
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
2408
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
2408
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
2409
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
2410
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
2409
2411
|
};
|
|
2410
2412
|
|
|
2411
2413
|
// ../commons/src/scopes.deprecated.do-not-use.ts
|
|
@@ -4843,9 +4845,9 @@ var import_path24 = require("path");
|
|
|
4843
4845
|
var TEMP_REMOTE2 = "opencrvs-upgrade-v19-v20-codemod-merge-infra";
|
|
4844
4846
|
var INFRASTRUCTURE_DIR = "infrastructure";
|
|
4845
4847
|
var BASE_BRANCH = "release-v1.9";
|
|
4846
|
-
function gitShowBytes(ref,
|
|
4848
|
+
function gitShowBytes(ref, path24) {
|
|
4847
4849
|
try {
|
|
4848
|
-
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${
|
|
4850
|
+
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${path24}`], {
|
|
4849
4851
|
cwd: process.cwd(),
|
|
4850
4852
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4851
4853
|
});
|
|
@@ -5021,6 +5023,94 @@ async function main26({
|
|
|
5021
5023
|
);
|
|
5022
5024
|
}
|
|
5023
5025
|
|
|
5026
|
+
// src/migrations/v2.0/fix-accept-requested-registration-function-type.ts
|
|
5027
|
+
var import_ts_morph22 = require("ts-morph");
|
|
5028
|
+
var import_path26 = __toESM(require("path"));
|
|
5029
|
+
var TARGET_FUNCTION_NAME = "acceptRequestedRegistration";
|
|
5030
|
+
var ACTION_PARAMETER_NAME = "action";
|
|
5031
|
+
var OLD_TYPE = "ActionInput";
|
|
5032
|
+
var NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
|
|
5033
|
+
function isAcceptRequestedRegistrationParameter(parameter) {
|
|
5034
|
+
const functionDeclaration = parameter.getFirstAncestorByKind(
|
|
5035
|
+
import_ts_morph22.SyntaxKind.FunctionDeclaration
|
|
5036
|
+
);
|
|
5037
|
+
if (functionDeclaration?.getName() === TARGET_FUNCTION_NAME) {
|
|
5038
|
+
return true;
|
|
5039
|
+
}
|
|
5040
|
+
const arrowFunction = parameter.getFirstAncestorByKind(
|
|
5041
|
+
import_ts_morph22.SyntaxKind.ArrowFunction
|
|
5042
|
+
);
|
|
5043
|
+
const variableDeclaration = arrowFunction?.getFirstAncestorByKind(
|
|
5044
|
+
import_ts_morph22.SyntaxKind.VariableDeclaration
|
|
5045
|
+
);
|
|
5046
|
+
return variableDeclaration?.getName() === TARGET_FUNCTION_NAME;
|
|
5047
|
+
}
|
|
5048
|
+
function processFile14(filePath, project) {
|
|
5049
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
5050
|
+
if (!sourceFile) return 0;
|
|
5051
|
+
let updatedCount = 0;
|
|
5052
|
+
for (const parameter of sourceFile.getDescendantsOfKind(
|
|
5053
|
+
import_ts_morph22.SyntaxKind.Parameter
|
|
5054
|
+
)) {
|
|
5055
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
5056
|
+
continue;
|
|
5057
|
+
}
|
|
5058
|
+
if (!isAcceptRequestedRegistrationParameter(parameter)) {
|
|
5059
|
+
continue;
|
|
5060
|
+
}
|
|
5061
|
+
const typeNode = parameter.getTypeNode();
|
|
5062
|
+
if (!typeNode || typeNode.getText() !== OLD_TYPE) {
|
|
5063
|
+
continue;
|
|
5064
|
+
}
|
|
5065
|
+
parameter.setType(NEW_TYPE);
|
|
5066
|
+
updatedCount++;
|
|
5067
|
+
console.log(
|
|
5068
|
+
` [${import_path26.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' in ${TARGET_FUNCTION_NAME} to ${NEW_TYPE}`
|
|
5069
|
+
);
|
|
5070
|
+
}
|
|
5071
|
+
return updatedCount;
|
|
5072
|
+
}
|
|
5073
|
+
async function main27() {
|
|
5074
|
+
const srcDir = import_path26.default.join(process.cwd(), "src");
|
|
5075
|
+
console.log(`Scanning for ${TARGET_FUNCTION_NAME} in: ${srcDir}
|
|
5076
|
+
`);
|
|
5077
|
+
const project = new import_ts_morph22.Project({
|
|
5078
|
+
tsConfigFilePath: import_path26.default.resolve(srcDir, "../tsconfig.json"),
|
|
5079
|
+
skipAddingFilesFromTsConfig: false
|
|
5080
|
+
});
|
|
5081
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
5082
|
+
const filePath = sf.getFilePath();
|
|
5083
|
+
return filePath.includes("/src/") && !filePath.includes("/node_modules/");
|
|
5084
|
+
});
|
|
5085
|
+
let totalUpdated = 0;
|
|
5086
|
+
const modifiedFiles = [];
|
|
5087
|
+
for (const sourceFile of sourceFiles) {
|
|
5088
|
+
const filePath = sourceFile.getFilePath();
|
|
5089
|
+
const updated = processFile14(filePath, project);
|
|
5090
|
+
if (updated > 0) {
|
|
5091
|
+
totalUpdated += updated;
|
|
5092
|
+
modifiedFiles.push(filePath);
|
|
5093
|
+
}
|
|
5094
|
+
}
|
|
5095
|
+
if (modifiedFiles.length === 0) {
|
|
5096
|
+
console.log(
|
|
5097
|
+
`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter in ${TARGET_FUNCTION_NAME} found. Nothing to do.`
|
|
5098
|
+
);
|
|
5099
|
+
return;
|
|
5100
|
+
}
|
|
5101
|
+
console.log(`
|
|
5102
|
+
Saving ${modifiedFiles.length} modified file(s)...`);
|
|
5103
|
+
for (const filePath of modifiedFiles) {
|
|
5104
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
5105
|
+
await sourceFile.save();
|
|
5106
|
+
console.log(` Saved: ${import_path26.default.relative(process.cwd(), filePath)}`);
|
|
5107
|
+
}
|
|
5108
|
+
console.log(
|
|
5109
|
+
`
|
|
5110
|
+
Done. Updated ${totalUpdated} parameter type annotation(s) in ${TARGET_FUNCTION_NAME}.`
|
|
5111
|
+
);
|
|
5112
|
+
}
|
|
5113
|
+
|
|
5024
5114
|
// src/migrations/v2.0/index.ts
|
|
5025
5115
|
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
5026
5116
|
async function runUpgrade(dockerSwarm) {
|
|
@@ -5047,6 +5137,7 @@ async function runUpgrade(dockerSwarm) {
|
|
|
5047
5137
|
await main22();
|
|
5048
5138
|
await main23();
|
|
5049
5139
|
await main24();
|
|
5140
|
+
await main27();
|
|
5050
5141
|
await main17();
|
|
5051
5142
|
if (dockerSwarm) {
|
|
5052
5143
|
await main25();
|
|
@@ -293,7 +293,9 @@ var ScopeType = z2.enum([
|
|
|
293
293
|
var EncodedScope = z2.string().brand("EncodedScope");
|
|
294
294
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
295
295
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
296
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
296
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
297
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
298
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
297
299
|
};
|
|
298
300
|
|
|
299
301
|
// ../commons/src/authentication.ts
|
package/dist/scopes/index.js
CHANGED
|
@@ -365,7 +365,9 @@ var decodeScope = (query) => {
|
|
|
365
365
|
};
|
|
366
366
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
367
367
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
368
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
368
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
369
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
370
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
369
371
|
};
|
|
370
372
|
function getScopeOptionValue(scope, option) {
|
|
371
373
|
const options = "options" in scope ? scope.options : void 0;
|
|
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-accept-requested-registration-function-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
|