@opencrvs/toolkit 2.0.0-rc.e6d7626 → 2.0.0-rc.e77f419
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 +1 -5
- package/dist/cli.js +95 -6
- package/dist/commons/api/router.d.ts +7 -30
- package/dist/commons/events/EventIndex.d.ts +0 -3
- package/dist/commons/events/EventMetadata.d.ts +0 -7
- package/dist/commons/events/state/index.d.ts +0 -4
- package/dist/commons/events/state/utils.d.ts +0 -2
- package/dist/events/index.js +1 -21
- 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 +93 -4
- package/dist/notification/index.js +1 -5
- package/opencrvs-toolkit-2.0.0-rc.e77f419.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.e6d7626.tgz +0 -0
|
@@ -1105,8 +1105,7 @@ var ActionCreationMetadata = z15.object({
|
|
|
1105
1105
|
),
|
|
1106
1106
|
createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1107
1107
|
acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1108
|
-
createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1109
|
-
createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
|
|
1108
|
+
createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1110
1109
|
});
|
|
1111
1110
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1112
1111
|
registrationNumber: z15.string().describe(
|
|
@@ -1134,9 +1133,6 @@ var EventMetadata = z15.object({
|
|
|
1134
1133
|
createdAtLocation: UUID.nullish().describe(
|
|
1135
1134
|
"Location of the user who created the event."
|
|
1136
1135
|
),
|
|
1137
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1138
|
-
"Signature of the user who created the event."
|
|
1139
|
-
),
|
|
1140
1136
|
updatedAtLocation: UUID.nullish().describe(
|
|
1141
1137
|
"Location of the user who last changed the status."
|
|
1142
1138
|
),
|
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;
|
|
@@ -4831,9 +4831,9 @@ var import_path24 = require("path");
|
|
|
4831
4831
|
var TEMP_REMOTE2 = "opencrvs-upgrade-v19-v20-codemod-merge-infra";
|
|
4832
4832
|
var INFRASTRUCTURE_DIR = "infrastructure";
|
|
4833
4833
|
var BASE_BRANCH = "release-v1.9";
|
|
4834
|
-
function gitShowBytes(ref,
|
|
4834
|
+
function gitShowBytes(ref, path24) {
|
|
4835
4835
|
try {
|
|
4836
|
-
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${
|
|
4836
|
+
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${path24}`], {
|
|
4837
4837
|
cwd: process.cwd(),
|
|
4838
4838
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4839
4839
|
});
|
|
@@ -5009,6 +5009,94 @@ async function main26({
|
|
|
5009
5009
|
);
|
|
5010
5010
|
}
|
|
5011
5011
|
|
|
5012
|
+
// src/migrations/v2.0/fix-accept-requested-registration-function-type.ts
|
|
5013
|
+
var import_ts_morph22 = require("ts-morph");
|
|
5014
|
+
var import_path26 = __toESM(require("path"));
|
|
5015
|
+
var TARGET_FUNCTION_NAME = "acceptRequestedRegistration";
|
|
5016
|
+
var ACTION_PARAMETER_NAME = "action";
|
|
5017
|
+
var OLD_TYPE = "ActionInput";
|
|
5018
|
+
var NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
|
|
5019
|
+
function isAcceptRequestedRegistrationParameter(parameter) {
|
|
5020
|
+
const functionDeclaration = parameter.getFirstAncestorByKind(
|
|
5021
|
+
import_ts_morph22.SyntaxKind.FunctionDeclaration
|
|
5022
|
+
);
|
|
5023
|
+
if (functionDeclaration?.getName() === TARGET_FUNCTION_NAME) {
|
|
5024
|
+
return true;
|
|
5025
|
+
}
|
|
5026
|
+
const arrowFunction = parameter.getFirstAncestorByKind(
|
|
5027
|
+
import_ts_morph22.SyntaxKind.ArrowFunction
|
|
5028
|
+
);
|
|
5029
|
+
const variableDeclaration = arrowFunction?.getFirstAncestorByKind(
|
|
5030
|
+
import_ts_morph22.SyntaxKind.VariableDeclaration
|
|
5031
|
+
);
|
|
5032
|
+
return variableDeclaration?.getName() === TARGET_FUNCTION_NAME;
|
|
5033
|
+
}
|
|
5034
|
+
function processFile14(filePath, project) {
|
|
5035
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
5036
|
+
if (!sourceFile) return 0;
|
|
5037
|
+
let updatedCount = 0;
|
|
5038
|
+
for (const parameter of sourceFile.getDescendantsOfKind(
|
|
5039
|
+
import_ts_morph22.SyntaxKind.Parameter
|
|
5040
|
+
)) {
|
|
5041
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
5042
|
+
continue;
|
|
5043
|
+
}
|
|
5044
|
+
if (!isAcceptRequestedRegistrationParameter(parameter)) {
|
|
5045
|
+
continue;
|
|
5046
|
+
}
|
|
5047
|
+
const typeNode = parameter.getTypeNode();
|
|
5048
|
+
if (!typeNode || typeNode.getText() !== OLD_TYPE) {
|
|
5049
|
+
continue;
|
|
5050
|
+
}
|
|
5051
|
+
parameter.setType(NEW_TYPE);
|
|
5052
|
+
updatedCount++;
|
|
5053
|
+
console.log(
|
|
5054
|
+
` [${import_path26.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' in ${TARGET_FUNCTION_NAME} to ${NEW_TYPE}`
|
|
5055
|
+
);
|
|
5056
|
+
}
|
|
5057
|
+
return updatedCount;
|
|
5058
|
+
}
|
|
5059
|
+
async function main27() {
|
|
5060
|
+
const srcDir = import_path26.default.join(process.cwd(), "src");
|
|
5061
|
+
console.log(`Scanning for ${TARGET_FUNCTION_NAME} in: ${srcDir}
|
|
5062
|
+
`);
|
|
5063
|
+
const project = new import_ts_morph22.Project({
|
|
5064
|
+
tsConfigFilePath: import_path26.default.resolve(srcDir, "../tsconfig.json"),
|
|
5065
|
+
skipAddingFilesFromTsConfig: false
|
|
5066
|
+
});
|
|
5067
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
5068
|
+
const filePath = sf.getFilePath();
|
|
5069
|
+
return filePath.includes("/src/") && !filePath.includes("/node_modules/");
|
|
5070
|
+
});
|
|
5071
|
+
let totalUpdated = 0;
|
|
5072
|
+
const modifiedFiles = [];
|
|
5073
|
+
for (const sourceFile of sourceFiles) {
|
|
5074
|
+
const filePath = sourceFile.getFilePath();
|
|
5075
|
+
const updated = processFile14(filePath, project);
|
|
5076
|
+
if (updated > 0) {
|
|
5077
|
+
totalUpdated += updated;
|
|
5078
|
+
modifiedFiles.push(filePath);
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
if (modifiedFiles.length === 0) {
|
|
5082
|
+
console.log(
|
|
5083
|
+
`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter in ${TARGET_FUNCTION_NAME} found. Nothing to do.`
|
|
5084
|
+
);
|
|
5085
|
+
return;
|
|
5086
|
+
}
|
|
5087
|
+
console.log(`
|
|
5088
|
+
Saving ${modifiedFiles.length} modified file(s)...`);
|
|
5089
|
+
for (const filePath of modifiedFiles) {
|
|
5090
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
5091
|
+
await sourceFile.save();
|
|
5092
|
+
console.log(` Saved: ${import_path26.default.relative(process.cwd(), filePath)}`);
|
|
5093
|
+
}
|
|
5094
|
+
console.log(
|
|
5095
|
+
`
|
|
5096
|
+
Done. Updated ${totalUpdated} parameter type annotation(s) in ${TARGET_FUNCTION_NAME}.`
|
|
5097
|
+
);
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5012
5100
|
// src/migrations/v2.0/index.ts
|
|
5013
5101
|
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
5014
5102
|
async function runUpgrade(dockerSwarm) {
|
|
@@ -5035,6 +5123,7 @@ async function runUpgrade(dockerSwarm) {
|
|
|
5035
5123
|
await main22();
|
|
5036
5124
|
await main23();
|
|
5037
5125
|
await main24();
|
|
5126
|
+
await main27();
|
|
5038
5127
|
await main17();
|
|
5039
5128
|
if (dockerSwarm) {
|
|
5040
5129
|
await main25();
|
|
@@ -5069,7 +5158,7 @@ Options:
|
|
|
5069
5158
|
'infrastructure/' directory is deleted (default).
|
|
5070
5159
|
-h, --help Show this message.
|
|
5071
5160
|
`.trim();
|
|
5072
|
-
function
|
|
5161
|
+
function main28() {
|
|
5073
5162
|
const command = args[0];
|
|
5074
5163
|
if (!command || command === "--help" || command === "-h") {
|
|
5075
5164
|
console.log(USAGE);
|
|
@@ -5144,4 +5233,4 @@ function handleCheckTranslations() {
|
|
|
5144
5233
|
console.warn("This command is not implemented yet!");
|
|
5145
5234
|
process.exit(1);
|
|
5146
5235
|
}
|
|
5147
|
-
|
|
5236
|
+
main28();
|
|
@@ -6343,7 +6343,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6343
6343
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6344
6344
|
createdByUserType?: "system" | "user" | null | undefined;
|
|
6345
6345
|
createdByRole?: string | undefined;
|
|
6346
|
-
createdBySignature?: string | null | undefined;
|
|
6347
6346
|
} | null | undefined;
|
|
6348
6347
|
REGISTERED?: {
|
|
6349
6348
|
createdAt: string;
|
|
@@ -6353,7 +6352,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6353
6352
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6354
6353
|
createdByUserType?: "system" | "user" | null | undefined;
|
|
6355
6354
|
createdByRole?: string | undefined;
|
|
6356
|
-
createdBySignature?: string | null | undefined;
|
|
6357
6355
|
} | null | undefined;
|
|
6358
6356
|
};
|
|
6359
6357
|
createdAt: string;
|
|
@@ -6371,7 +6369,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6371
6369
|
createdByUserType?: "system" | "user" | null | undefined;
|
|
6372
6370
|
updatedByUserRole?: string | null | undefined;
|
|
6373
6371
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6374
|
-
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
6375
6372
|
updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6376
6373
|
assignedTo?: string | null | undefined;
|
|
6377
6374
|
updatedBy?: string | null | undefined;
|
|
@@ -6830,33 +6827,22 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6830
6827
|
input: string[];
|
|
6831
6828
|
output: ({
|
|
6832
6829
|
id: string & import("zod").$brand<"UUID">;
|
|
6830
|
+
type: "user";
|
|
6833
6831
|
name: {
|
|
6834
6832
|
firstname: string;
|
|
6835
6833
|
surname: string;
|
|
6836
6834
|
};
|
|
6837
6835
|
role: string;
|
|
6838
6836
|
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
6839
|
-
|
|
6840
|
-
status: "active" | "pending" | "deactivated";
|
|
6837
|
+
fullHonorificName?: string | undefined;
|
|
6841
6838
|
avatar?: (string & import("zod").$brand<"DocumentPath">) | undefined;
|
|
6842
|
-
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
6843
6839
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6844
|
-
device?: string | undefined;
|
|
6845
|
-
fullHonorificName?: string | undefined;
|
|
6846
|
-
mobile?: string | undefined;
|
|
6847
|
-
email?: string | undefined;
|
|
6848
|
-
data?: Record<string, import("../commons").FieldValue> | undefined;
|
|
6849
6840
|
} | {
|
|
6850
6841
|
id: string & import("zod").$brand<"UUID">;
|
|
6851
|
-
name: string;
|
|
6852
6842
|
type: "system";
|
|
6843
|
+
name: string;
|
|
6853
6844
|
primaryOfficeId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
6854
6845
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
6855
|
-
signature?: undefined;
|
|
6856
|
-
avatar?: undefined;
|
|
6857
|
-
fullHonorificName?: string | undefined;
|
|
6858
|
-
legacyId?: string | undefined;
|
|
6859
|
-
status?: undefined;
|
|
6860
6846
|
})[];
|
|
6861
6847
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
6862
6848
|
}>;
|
|
@@ -6874,33 +6860,24 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6874
6860
|
};
|
|
6875
6861
|
output: ({
|
|
6876
6862
|
id: string & import("zod").$brand<"UUID">;
|
|
6863
|
+
type: "user";
|
|
6877
6864
|
name: {
|
|
6878
6865
|
firstname: string;
|
|
6879
6866
|
surname: string;
|
|
6880
6867
|
};
|
|
6881
6868
|
role: string;
|
|
6882
6869
|
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
6883
|
-
type: "user";
|
|
6884
6870
|
status: "active" | "pending" | "deactivated";
|
|
6871
|
+
fullHonorificName?: string | undefined;
|
|
6885
6872
|
avatar?: (string & import("zod").$brand<"DocumentPath">) | undefined;
|
|
6886
|
-
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
6887
6873
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6888
|
-
device?: string | undefined;
|
|
6889
|
-
fullHonorificName?: string | undefined;
|
|
6890
|
-
mobile?: string | undefined;
|
|
6891
|
-
email?: string | undefined;
|
|
6892
|
-
data?: Record<string, import("../commons").FieldValue> | undefined;
|
|
6893
6874
|
} | {
|
|
6894
6875
|
id: string & import("zod").$brand<"UUID">;
|
|
6895
|
-
name: string;
|
|
6896
6876
|
type: "system";
|
|
6877
|
+
name: string;
|
|
6897
6878
|
primaryOfficeId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
6898
6879
|
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
6899
|
-
|
|
6900
|
-
avatar?: undefined;
|
|
6901
|
-
fullHonorificName?: string | undefined;
|
|
6902
|
-
legacyId?: string | undefined;
|
|
6903
|
-
status?: undefined;
|
|
6880
|
+
status?: "active" | "pending" | "deactivated" | undefined;
|
|
6904
6881
|
})[];
|
|
6905
6882
|
meta: object;
|
|
6906
6883
|
}>;
|
|
@@ -20,7 +20,6 @@ export declare const EventIndex: z.ZodObject<{
|
|
|
20
20
|
}>>>;
|
|
21
21
|
acceptedAt: z.ZodISODateTime;
|
|
22
22
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
23
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
23
|
}, z.core.$strip>>>;
|
|
25
24
|
REGISTERED: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
26
25
|
createdAt: z.ZodISODateTime;
|
|
@@ -32,7 +31,6 @@ export declare const EventIndex: z.ZodObject<{
|
|
|
32
31
|
}>>>;
|
|
33
32
|
acceptedAt: z.ZodISODateTime;
|
|
34
33
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
35
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
34
|
registrationNumber: z.ZodString;
|
|
37
35
|
}, z.core.$strip>>>;
|
|
38
36
|
}, z.core.$strip>;
|
|
@@ -46,7 +44,6 @@ export declare const EventIndex: z.ZodObject<{
|
|
|
46
44
|
}>>>;
|
|
47
45
|
updatedByUserRole: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
46
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
49
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
|
|
50
47
|
updatedAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
51
48
|
updatedAt: z.ZodISODateTime;
|
|
52
49
|
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -23,7 +23,6 @@ export declare const ActionCreationMetadata: z.ZodObject<{
|
|
|
23
23
|
}>>>;
|
|
24
24
|
acceptedAt: z.ZodISODateTime;
|
|
25
25
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
26
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
26
|
}, z.core.$strip>;
|
|
28
27
|
export type ActionCreationMetadata = z.infer<typeof ActionCreationMetadata>;
|
|
29
28
|
export declare const RegistrationCreationMetadata: z.ZodObject<{
|
|
@@ -36,7 +35,6 @@ export declare const RegistrationCreationMetadata: z.ZodObject<{
|
|
|
36
35
|
}>>>;
|
|
37
36
|
acceptedAt: z.ZodISODateTime;
|
|
38
37
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
39
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
38
|
registrationNumber: z.ZodString;
|
|
41
39
|
}, z.core.$strip>;
|
|
42
40
|
export type RegistrationCreationMetadata = z.infer<typeof RegistrationCreationMetadata>;
|
|
@@ -51,7 +49,6 @@ export declare const LegalStatuses: z.ZodObject<{
|
|
|
51
49
|
}>>>;
|
|
52
50
|
acceptedAt: z.ZodISODateTime;
|
|
53
51
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
54
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
52
|
}, z.core.$strip>>>;
|
|
56
53
|
REGISTERED: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
57
54
|
createdAt: z.ZodISODateTime;
|
|
@@ -63,7 +60,6 @@ export declare const LegalStatuses: z.ZodObject<{
|
|
|
63
60
|
}>>>;
|
|
64
61
|
acceptedAt: z.ZodISODateTime;
|
|
65
62
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
66
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
63
|
registrationNumber: z.ZodString;
|
|
68
64
|
}, z.core.$strip>>>;
|
|
69
65
|
}, z.core.$strip>;
|
|
@@ -93,7 +89,6 @@ export declare const EventMetadata: z.ZodObject<{
|
|
|
93
89
|
}>>>;
|
|
94
90
|
acceptedAt: z.ZodISODateTime;
|
|
95
91
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
96
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
92
|
}, z.core.$strip>>>;
|
|
98
93
|
REGISTERED: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
99
94
|
createdAt: z.ZodISODateTime;
|
|
@@ -105,7 +100,6 @@ export declare const EventMetadata: z.ZodObject<{
|
|
|
105
100
|
}>>>;
|
|
106
101
|
acceptedAt: z.ZodISODateTime;
|
|
107
102
|
createdByRole: z.ZodOptional<z.ZodString>;
|
|
108
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
103
|
registrationNumber: z.ZodString;
|
|
110
104
|
}, z.core.$strip>>>;
|
|
111
105
|
}, z.core.$strip>;
|
|
@@ -119,7 +113,6 @@ export declare const EventMetadata: z.ZodObject<{
|
|
|
119
113
|
}>>>;
|
|
120
114
|
updatedByUserRole: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
115
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
122
|
-
createdBySignature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
|
|
123
116
|
updatedAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
124
117
|
updatedAt: z.ZodISODateTime;
|
|
125
118
|
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -9,7 +9,6 @@ import { UUID } from '../../uuid';
|
|
|
9
9
|
import { DocumentPath } from '../../documents';
|
|
10
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
|
-
export declare function getAssignedUserSignatureFromActions(actions: Array<ActionDocument>): string | null;
|
|
13
12
|
type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
|
|
14
13
|
[K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
|
|
15
14
|
} : T extends UUID ? T : T extends DocumentPath ? T : T extends string ? NonNullable<T> : T extends (infer U)[] ? NonNullableDeep<U>[] : T extends object ? {
|
|
@@ -73,7 +72,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
|
|
|
73
72
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
74
73
|
createdByUserType?: "user" | "system" | null | undefined;
|
|
75
74
|
createdByRole?: string | undefined;
|
|
76
|
-
createdBySignature?: string | null | undefined;
|
|
77
75
|
} | null | undefined;
|
|
78
76
|
REGISTERED?: {
|
|
79
77
|
createdAt: string;
|
|
@@ -83,7 +81,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
|
|
|
83
81
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
84
82
|
createdByUserType?: "user" | "system" | null | undefined;
|
|
85
83
|
createdByRole?: string | undefined;
|
|
86
|
-
createdBySignature?: string | null | undefined;
|
|
87
84
|
} | null | undefined;
|
|
88
85
|
};
|
|
89
86
|
createdAt: string;
|
|
@@ -101,7 +98,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
|
|
|
101
98
|
createdByUserType?: "user" | "system" | null | undefined;
|
|
102
99
|
updatedByUserRole?: string | null | undefined;
|
|
103
100
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
104
|
-
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
105
101
|
updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
106
102
|
assignedTo?: string | null | undefined;
|
|
107
103
|
updatedBy?: string | null | undefined;
|
|
@@ -312,7 +312,6 @@ export declare function getLegalStatuses(actions: Action[]): {
|
|
|
312
312
|
createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
313
313
|
acceptedAt: string;
|
|
314
314
|
createdByRole: string | undefined;
|
|
315
|
-
createdBySignature: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
316
315
|
registrationNumber: string | null | undefined;
|
|
317
316
|
} | null;
|
|
318
317
|
REGISTERED: {
|
|
@@ -322,7 +321,6 @@ export declare function getLegalStatuses(actions: Action[]): {
|
|
|
322
321
|
createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
323
322
|
acceptedAt: string;
|
|
324
323
|
createdByRole: string | undefined;
|
|
325
|
-
createdBySignature: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
326
324
|
registrationNumber: string | null | undefined;
|
|
327
325
|
} | null;
|
|
328
326
|
};
|
package/dist/events/index.js
CHANGED
|
@@ -306,7 +306,6 @@ __export(events_exports, {
|
|
|
306
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
307
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
308
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
309
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
310
309
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
311
310
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
312
311
|
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
@@ -1765,8 +1764,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1765
1764
|
),
|
|
1766
1765
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1767
1766
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1768
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1769
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1767
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1770
1768
|
});
|
|
1771
1769
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1772
1770
|
registrationNumber: z16.string().describe(
|
|
@@ -1794,9 +1792,6 @@ var EventMetadata = z16.object({
|
|
|
1794
1792
|
createdAtLocation: UUID.nullish().describe(
|
|
1795
1793
|
"Location of the user who created the event."
|
|
1796
1794
|
),
|
|
1797
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1798
|
-
"Signature of the user who created the event."
|
|
1799
|
-
),
|
|
1800
1795
|
updatedAtLocation: UUID.nullish().describe(
|
|
1801
1796
|
"Location of the user who last changed the status."
|
|
1802
1797
|
),
|
|
@@ -6147,7 +6142,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6147
6142
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6148
6143
|
acceptedAt: acceptAction.createdAt,
|
|
6149
6144
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6150
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6151
6145
|
registrationNumber
|
|
6152
6146
|
};
|
|
6153
6147
|
}
|
|
@@ -6361,17 +6355,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6361
6355
|
return user2;
|
|
6362
6356
|
}, null);
|
|
6363
6357
|
}
|
|
6364
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6365
|
-
return actions.reduce((signature, action) => {
|
|
6366
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6367
|
-
return action.createdBySignature || null;
|
|
6368
|
-
}
|
|
6369
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6370
|
-
return null;
|
|
6371
|
-
}
|
|
6372
|
-
return signature;
|
|
6373
|
-
}, null);
|
|
6374
|
-
}
|
|
6375
6358
|
function deepDropNulls(obj) {
|
|
6376
6359
|
if (Array.isArray(obj)) {
|
|
6377
6360
|
return obj.map(deepDropNulls);
|
|
@@ -6467,10 +6450,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6467
6450
|
createdBy: creationAction.createdBy,
|
|
6468
6451
|
createdByUserType: creationAction.createdByUserType,
|
|
6469
6452
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6470
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6471
6453
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6472
6454
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6473
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6474
6455
|
updatedBy: requestActionMetadata.createdBy,
|
|
6475
6456
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6476
6457
|
declaration,
|
|
@@ -9729,7 +9710,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9729
9710
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9730
9711
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9731
9712
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9732
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9733
9713
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9734
9714
|
assignedTo: overrides.assignedTo ?? null,
|
|
9735
9715
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -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;
|
|
@@ -4843,9 +4843,9 @@ var import_path24 = require("path");
|
|
|
4843
4843
|
var TEMP_REMOTE2 = "opencrvs-upgrade-v19-v20-codemod-merge-infra";
|
|
4844
4844
|
var INFRASTRUCTURE_DIR = "infrastructure";
|
|
4845
4845
|
var BASE_BRANCH = "release-v1.9";
|
|
4846
|
-
function gitShowBytes(ref,
|
|
4846
|
+
function gitShowBytes(ref, path24) {
|
|
4847
4847
|
try {
|
|
4848
|
-
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${
|
|
4848
|
+
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${path24}`], {
|
|
4849
4849
|
cwd: process.cwd(),
|
|
4850
4850
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4851
4851
|
});
|
|
@@ -5021,6 +5021,94 @@ async function main26({
|
|
|
5021
5021
|
);
|
|
5022
5022
|
}
|
|
5023
5023
|
|
|
5024
|
+
// src/migrations/v2.0/fix-accept-requested-registration-function-type.ts
|
|
5025
|
+
var import_ts_morph22 = require("ts-morph");
|
|
5026
|
+
var import_path26 = __toESM(require("path"));
|
|
5027
|
+
var TARGET_FUNCTION_NAME = "acceptRequestedRegistration";
|
|
5028
|
+
var ACTION_PARAMETER_NAME = "action";
|
|
5029
|
+
var OLD_TYPE = "ActionInput";
|
|
5030
|
+
var NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
|
|
5031
|
+
function isAcceptRequestedRegistrationParameter(parameter) {
|
|
5032
|
+
const functionDeclaration = parameter.getFirstAncestorByKind(
|
|
5033
|
+
import_ts_morph22.SyntaxKind.FunctionDeclaration
|
|
5034
|
+
);
|
|
5035
|
+
if (functionDeclaration?.getName() === TARGET_FUNCTION_NAME) {
|
|
5036
|
+
return true;
|
|
5037
|
+
}
|
|
5038
|
+
const arrowFunction = parameter.getFirstAncestorByKind(
|
|
5039
|
+
import_ts_morph22.SyntaxKind.ArrowFunction
|
|
5040
|
+
);
|
|
5041
|
+
const variableDeclaration = arrowFunction?.getFirstAncestorByKind(
|
|
5042
|
+
import_ts_morph22.SyntaxKind.VariableDeclaration
|
|
5043
|
+
);
|
|
5044
|
+
return variableDeclaration?.getName() === TARGET_FUNCTION_NAME;
|
|
5045
|
+
}
|
|
5046
|
+
function processFile14(filePath, project) {
|
|
5047
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
5048
|
+
if (!sourceFile) return 0;
|
|
5049
|
+
let updatedCount = 0;
|
|
5050
|
+
for (const parameter of sourceFile.getDescendantsOfKind(
|
|
5051
|
+
import_ts_morph22.SyntaxKind.Parameter
|
|
5052
|
+
)) {
|
|
5053
|
+
if (parameter.getName() !== ACTION_PARAMETER_NAME) {
|
|
5054
|
+
continue;
|
|
5055
|
+
}
|
|
5056
|
+
if (!isAcceptRequestedRegistrationParameter(parameter)) {
|
|
5057
|
+
continue;
|
|
5058
|
+
}
|
|
5059
|
+
const typeNode = parameter.getTypeNode();
|
|
5060
|
+
if (!typeNode || typeNode.getText() !== OLD_TYPE) {
|
|
5061
|
+
continue;
|
|
5062
|
+
}
|
|
5063
|
+
parameter.setType(NEW_TYPE);
|
|
5064
|
+
updatedCount++;
|
|
5065
|
+
console.log(
|
|
5066
|
+
` [${import_path26.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' in ${TARGET_FUNCTION_NAME} to ${NEW_TYPE}`
|
|
5067
|
+
);
|
|
5068
|
+
}
|
|
5069
|
+
return updatedCount;
|
|
5070
|
+
}
|
|
5071
|
+
async function main27() {
|
|
5072
|
+
const srcDir = import_path26.default.join(process.cwd(), "src");
|
|
5073
|
+
console.log(`Scanning for ${TARGET_FUNCTION_NAME} in: ${srcDir}
|
|
5074
|
+
`);
|
|
5075
|
+
const project = new import_ts_morph22.Project({
|
|
5076
|
+
tsConfigFilePath: import_path26.default.resolve(srcDir, "../tsconfig.json"),
|
|
5077
|
+
skipAddingFilesFromTsConfig: false
|
|
5078
|
+
});
|
|
5079
|
+
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
5080
|
+
const filePath = sf.getFilePath();
|
|
5081
|
+
return filePath.includes("/src/") && !filePath.includes("/node_modules/");
|
|
5082
|
+
});
|
|
5083
|
+
let totalUpdated = 0;
|
|
5084
|
+
const modifiedFiles = [];
|
|
5085
|
+
for (const sourceFile of sourceFiles) {
|
|
5086
|
+
const filePath = sourceFile.getFilePath();
|
|
5087
|
+
const updated = processFile14(filePath, project);
|
|
5088
|
+
if (updated > 0) {
|
|
5089
|
+
totalUpdated += updated;
|
|
5090
|
+
modifiedFiles.push(filePath);
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
if (modifiedFiles.length === 0) {
|
|
5094
|
+
console.log(
|
|
5095
|
+
`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter in ${TARGET_FUNCTION_NAME} found. Nothing to do.`
|
|
5096
|
+
);
|
|
5097
|
+
return;
|
|
5098
|
+
}
|
|
5099
|
+
console.log(`
|
|
5100
|
+
Saving ${modifiedFiles.length} modified file(s)...`);
|
|
5101
|
+
for (const filePath of modifiedFiles) {
|
|
5102
|
+
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
5103
|
+
await sourceFile.save();
|
|
5104
|
+
console.log(` Saved: ${import_path26.default.relative(process.cwd(), filePath)}`);
|
|
5105
|
+
}
|
|
5106
|
+
console.log(
|
|
5107
|
+
`
|
|
5108
|
+
Done. Updated ${totalUpdated} parameter type annotation(s) in ${TARGET_FUNCTION_NAME}.`
|
|
5109
|
+
);
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5024
5112
|
// src/migrations/v2.0/index.ts
|
|
5025
5113
|
var NON_SWARM_INFRA_SUBDIRS = ["postgres", "metabase"];
|
|
5026
5114
|
async function runUpgrade(dockerSwarm) {
|
|
@@ -5047,6 +5135,7 @@ async function runUpgrade(dockerSwarm) {
|
|
|
5047
5135
|
await main22();
|
|
5048
5136
|
await main23();
|
|
5049
5137
|
await main24();
|
|
5138
|
+
await main27();
|
|
5050
5139
|
await main17();
|
|
5051
5140
|
if (dockerSwarm) {
|
|
5052
5141
|
await main25();
|
|
@@ -1331,8 +1331,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1331
1331
|
),
|
|
1332
1332
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1333
1333
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1334
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1335
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1334
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1336
1335
|
});
|
|
1337
1336
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1338
1337
|
registrationNumber: z16.string().describe(
|
|
@@ -1360,9 +1359,6 @@ var EventMetadata = z16.object({
|
|
|
1360
1359
|
createdAtLocation: UUID.nullish().describe(
|
|
1361
1360
|
"Location of the user who created the event."
|
|
1362
1361
|
),
|
|
1363
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1364
|
-
"Signature of the user who created the event."
|
|
1365
|
-
),
|
|
1366
1362
|
updatedAtLocation: UUID.nullish().describe(
|
|
1367
1363
|
"Location of the user who last changed the status."
|
|
1368
1364
|
),
|
|
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
|