@opencrvs/toolkit 2.0.0-rc.26c1189 → 2.0.0-rc.28e4d24
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 +20 -12
- package/dist/cli.js +95 -6
- package/dist/commons/api/router.d.ts +12151 -399
- package/dist/commons/events/ActionInput.d.ts +0 -36
- package/dist/commons/events/Draft.d.ts +0 -1
- package/dist/events/index.js +20 -13
- 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 +93 -4
- package/dist/notification/index.js +20 -13
- package/opencrvs-toolkit-2.0.0-rc.28e4d24.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.26c1189.tgz +0 -0
|
@@ -6,7 +6,6 @@ export declare const BaseActionInput: z.ZodObject<{
|
|
|
6
6
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
7
7
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
8
8
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
10
9
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
11
10
|
}, z.core.$strip>;
|
|
12
11
|
export declare const RegisterActionInput: z.ZodObject<{
|
|
@@ -16,7 +15,6 @@ export declare const RegisterActionInput: z.ZodObject<{
|
|
|
16
15
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
17
16
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
18
17
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
20
18
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
21
19
|
type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
|
|
22
20
|
registrationNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -29,7 +27,6 @@ export declare const NotifyActionInput: z.ZodObject<{
|
|
|
29
27
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
30
28
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
31
29
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
33
30
|
type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
|
|
34
31
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
35
32
|
}, z.core.$strip>;
|
|
@@ -41,7 +38,6 @@ export declare const DeclareActionInput: z.ZodObject<{
|
|
|
41
38
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
42
39
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
43
40
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
45
41
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
46
42
|
type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
|
|
47
43
|
}, z.core.$strip>;
|
|
@@ -52,7 +48,6 @@ export declare const EditActionInput: z.ZodObject<{
|
|
|
52
48
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
53
49
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
54
50
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
56
51
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
57
52
|
type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
|
|
58
53
|
content: z.ZodObject<{
|
|
@@ -67,7 +62,6 @@ export declare const PrintCertificateActionInput: z.ZodObject<{
|
|
|
67
62
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
68
63
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
69
64
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
71
65
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
72
66
|
type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
|
|
73
67
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -82,7 +76,6 @@ export declare const RejectDeclarationActionInput: z.ZodObject<{
|
|
|
82
76
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
83
77
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
84
78
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
86
79
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
87
80
|
type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
|
|
88
81
|
content: z.ZodObject<{
|
|
@@ -97,7 +90,6 @@ export declare const DuplicateDetectedActionInput: z.ZodObject<{
|
|
|
97
90
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
98
91
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
99
92
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
101
93
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
102
94
|
type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
|
|
103
95
|
content: z.ZodObject<{
|
|
@@ -114,7 +106,6 @@ export declare const MarkAsDuplicateActionInput: z.ZodObject<{
|
|
|
114
106
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
115
107
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
116
108
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
118
109
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
119
110
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
|
|
120
111
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -129,7 +120,6 @@ export declare const MarkNotDuplicateActionInput: z.ZodObject<{
|
|
|
129
120
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
130
121
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
131
122
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
133
123
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
134
124
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
|
|
135
125
|
}, z.core.$strip>;
|
|
@@ -141,7 +131,6 @@ export declare const ArchiveActionInput: z.ZodObject<{
|
|
|
141
131
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
142
132
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
143
133
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
145
134
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
146
135
|
type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
|
|
147
136
|
content: z.ZodObject<{
|
|
@@ -156,7 +145,6 @@ export declare const AssignActionInput: z.ZodObject<{
|
|
|
156
145
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
157
146
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
158
147
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
160
148
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
161
149
|
type: z.ZodLiteral<"ASSIGN">;
|
|
162
150
|
assignedTo: z.ZodString;
|
|
@@ -169,7 +157,6 @@ export declare const UnassignActionInput: z.ZodObject<{
|
|
|
169
157
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
170
158
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
171
159
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
173
160
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
174
161
|
type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
|
|
175
162
|
assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
|
|
@@ -182,7 +169,6 @@ export declare const RequestCorrectionActionInput: z.ZodObject<{
|
|
|
182
169
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
183
170
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
184
171
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
186
172
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
187
173
|
type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
|
|
188
174
|
}, z.core.$strip>;
|
|
@@ -194,7 +180,6 @@ export declare const RejectCorrectionActionInput: z.ZodObject<{
|
|
|
194
180
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
195
181
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
196
182
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
198
183
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
199
184
|
requestId: z.ZodString;
|
|
200
185
|
type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
|
|
@@ -210,7 +195,6 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
|
|
|
210
195
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
211
196
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
212
197
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
214
198
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
215
199
|
requestId: z.ZodString;
|
|
216
200
|
type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
|
|
@@ -223,7 +207,6 @@ export declare const ReadActionInput: z.ZodObject<{
|
|
|
223
207
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
224
208
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
225
209
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
227
210
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
228
211
|
type: z.ZodDefault<z.ZodLiteral<"READ">>;
|
|
229
212
|
}, z.core.$strip>;
|
|
@@ -239,7 +222,6 @@ export declare const CustomActionInput: z.ZodObject<{
|
|
|
239
222
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
240
223
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
241
224
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
243
225
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
244
226
|
type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
|
|
245
227
|
customActionType: z.ZodString;
|
|
@@ -260,7 +242,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
260
242
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
261
243
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
262
244
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
264
245
|
type: z.ZodDefault<z.ZodLiteral<"CREATE">>;
|
|
265
246
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
266
247
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -270,7 +251,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
270
251
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
271
252
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
272
253
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
274
254
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
275
255
|
type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
|
|
276
256
|
registrationNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -281,7 +261,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
281
261
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
282
262
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
283
263
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
284
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
285
264
|
type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
|
|
286
265
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
287
266
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -291,7 +270,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
291
270
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
292
271
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
293
272
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
295
273
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
296
274
|
type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
|
|
297
275
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -301,7 +279,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
301
279
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
302
280
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
303
281
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
305
282
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
306
283
|
type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
|
|
307
284
|
content: z.ZodObject<{
|
|
@@ -314,7 +291,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
314
291
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
315
292
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
316
293
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
317
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
318
294
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
319
295
|
type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
|
|
320
296
|
content: z.ZodObject<{
|
|
@@ -330,7 +306,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
330
306
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
331
307
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
332
308
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
333
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
334
309
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
335
310
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
|
|
336
311
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -343,7 +318,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
343
318
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
344
319
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
345
320
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
346
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
347
321
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
348
322
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
|
|
349
323
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -353,7 +327,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
353
327
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
354
328
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
355
329
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
356
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
357
330
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
358
331
|
type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
|
|
359
332
|
content: z.ZodObject<{
|
|
@@ -366,7 +339,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
366
339
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
367
340
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
368
341
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
369
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
370
342
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
371
343
|
type: z.ZodLiteral<"ASSIGN">;
|
|
372
344
|
assignedTo: z.ZodString;
|
|
@@ -377,7 +349,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
377
349
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
378
350
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
379
351
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
380
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
381
352
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
382
353
|
type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
|
|
383
354
|
assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
|
|
@@ -388,7 +359,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
388
359
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
389
360
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
390
361
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
391
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
392
362
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
393
363
|
type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
|
|
394
364
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -401,7 +371,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
401
371
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
402
372
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
403
373
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
404
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
405
374
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
406
375
|
type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
|
|
407
376
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -411,7 +380,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
411
380
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
412
381
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
413
382
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
414
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
415
383
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
416
384
|
requestId: z.ZodString;
|
|
417
385
|
type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
|
|
@@ -425,7 +393,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
425
393
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
426
394
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
427
395
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
428
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
429
396
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
430
397
|
requestId: z.ZodString;
|
|
431
398
|
type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
|
|
@@ -436,7 +403,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
436
403
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
437
404
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
438
405
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
439
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
440
406
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
441
407
|
type: z.ZodDefault<z.ZodLiteral<"READ">>;
|
|
442
408
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -446,7 +412,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
446
412
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
447
413
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
448
414
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
449
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
450
415
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
451
416
|
type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
|
|
452
417
|
customActionType: z.ZodString;
|
|
@@ -457,7 +422,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
457
422
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
458
423
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
459
424
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
460
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
461
425
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
462
426
|
type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
|
|
463
427
|
content: z.ZodObject<{
|
|
@@ -51,7 +51,6 @@ export declare const DraftInput: z.ZodObject<{
|
|
|
51
51
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
52
52
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
53
53
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
55
54
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
56
55
|
type: z.ZodEnum<{
|
|
57
56
|
CUSTOM: "CUSTOM";
|
package/dist/events/index.js
CHANGED
|
@@ -1414,20 +1414,28 @@ function schemaPriority(schema) {
|
|
|
1414
1414
|
return idx === -1 ? 9999 : idx;
|
|
1415
1415
|
}
|
|
1416
1416
|
function safeUnion(schemas) {
|
|
1417
|
-
const sortedSchemas = [...schemas].sort(
|
|
1418
|
-
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1419
|
-
);
|
|
1420
1417
|
return z12.any().superRefine((val, ctx) => {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1418
|
+
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
1419
|
+
if (successful.length === 1) {
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
if (successful.length === 0) {
|
|
1423
|
+
ctx.addIssue({
|
|
1424
|
+
code: "invalid_type",
|
|
1425
|
+
expected: "custom",
|
|
1426
|
+
message: "Value does not match any schema"
|
|
1427
|
+
});
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1431
|
+
const best = successful[0];
|
|
1432
|
+
if (!best.safeParse(val).success) {
|
|
1433
|
+
ctx.addIssue({
|
|
1434
|
+
expected: "custom",
|
|
1435
|
+
code: "invalid_type",
|
|
1436
|
+
message: "Value did not match the best schema"
|
|
1437
|
+
});
|
|
1425
1438
|
}
|
|
1426
|
-
ctx.addIssue({
|
|
1427
|
-
code: "invalid_type",
|
|
1428
|
-
expected: "custom",
|
|
1429
|
-
message: "Value does not match any schema"
|
|
1430
|
-
});
|
|
1431
1439
|
}).meta({
|
|
1432
1440
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1433
1441
|
});
|
|
@@ -5892,7 +5900,6 @@ var BaseActionInput = z38.object({
|
|
|
5892
5900
|
originalActionId: UUID.optional(),
|
|
5893
5901
|
// should not be part of base action.
|
|
5894
5902
|
keepAssignment: z38.boolean().optional(),
|
|
5895
|
-
waitFor: z38.boolean().optional(),
|
|
5896
5903
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5897
5904
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5898
5905
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -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;
|
|
@@ -4709,9 +4709,9 @@ var import_path24 = require("path");
|
|
|
4709
4709
|
var TEMP_REMOTE2 = "opencrvs-upgrade-v19-v20-codemod-merge-infra";
|
|
4710
4710
|
var INFRASTRUCTURE_DIR = "infrastructure";
|
|
4711
4711
|
var BASE_BRANCH = "release-v1.9";
|
|
4712
|
-
function gitShowBytes(ref,
|
|
4712
|
+
function gitShowBytes(ref, path24) {
|
|
4713
4713
|
try {
|
|
4714
|
-
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${
|
|
4714
|
+
const buf = (0, import_child_process2.execFileSync)("git", ["show", `${ref}:${path24}`], {
|
|
4715
4715
|
cwd: process.cwd(),
|
|
4716
4716
|
stdio: ["ignore", "pipe", "pipe"]
|
|
4717
4717
|
});
|
|
@@ -4850,6 +4850,94 @@ async function main26() {
|
|
|
4850
4850
|
);
|
|
4851
4851
|
}
|
|
4852
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
|
+
|
|
4853
4941
|
// src/migrations/v2.0/index.ts
|
|
4854
4942
|
async function runUpgrade(dockerSwarm) {
|
|
4855
4943
|
await main18();
|
|
@@ -4872,6 +4960,7 @@ async function runUpgrade(dockerSwarm) {
|
|
|
4872
4960
|
await main19();
|
|
4873
4961
|
await main20();
|
|
4874
4962
|
await main21();
|
|
4963
|
+
await main27();
|
|
4875
4964
|
await main22();
|
|
4876
4965
|
await main23();
|
|
4877
4966
|
await main24();
|
|
@@ -980,20 +980,28 @@ function schemaPriority(schema) {
|
|
|
980
980
|
return idx === -1 ? 9999 : idx;
|
|
981
981
|
}
|
|
982
982
|
function safeUnion(schemas) {
|
|
983
|
-
const sortedSchemas = [...schemas].sort(
|
|
984
|
-
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
985
|
-
);
|
|
986
983
|
return z12.any().superRefine((val, ctx) => {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
984
|
+
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
985
|
+
if (successful.length === 1) {
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
if (successful.length === 0) {
|
|
989
|
+
ctx.addIssue({
|
|
990
|
+
code: "invalid_type",
|
|
991
|
+
expected: "custom",
|
|
992
|
+
message: "Value does not match any schema"
|
|
993
|
+
});
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
997
|
+
const best = successful[0];
|
|
998
|
+
if (!best.safeParse(val).success) {
|
|
999
|
+
ctx.addIssue({
|
|
1000
|
+
expected: "custom",
|
|
1001
|
+
code: "invalid_type",
|
|
1002
|
+
message: "Value did not match the best schema"
|
|
1003
|
+
});
|
|
991
1004
|
}
|
|
992
|
-
ctx.addIssue({
|
|
993
|
-
code: "invalid_type",
|
|
994
|
-
expected: "custom",
|
|
995
|
-
message: "Value does not match any schema"
|
|
996
|
-
});
|
|
997
1005
|
}).meta({
|
|
998
1006
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
999
1007
|
});
|
|
@@ -4172,7 +4180,6 @@ var BaseActionInput = z38.object({
|
|
|
4172
4180
|
originalActionId: UUID.optional(),
|
|
4173
4181
|
// should not be part of base action.
|
|
4174
4182
|
keepAssignment: z38.boolean().optional(),
|
|
4175
|
-
waitFor: z38.boolean().optional(),
|
|
4176
4183
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4177
4184
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
4178
4185
|
createdAtLocation: UUID.nullish().describe(
|
|
Binary file
|