@opencrvs/toolkit 2.0.0-rc.c661677 → 2.0.0-rc.c7f111d

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.
Files changed (27) hide show
  1. package/dist/application-config/index.js +15 -20
  2. package/dist/cli.js +187 -93
  3. package/dist/commons/api/router.d.ts +15 -27
  4. package/dist/commons/events/ActionInput.d.ts +36 -0
  5. package/dist/commons/events/Draft.d.ts +1 -0
  6. package/dist/commons/events/EventIndex.d.ts +1 -0
  7. package/dist/commons/events/EventMetadata.d.ts +1 -0
  8. package/dist/commons/events/state/index.d.ts +2 -1
  9. package/dist/events/index.js +16 -20
  10. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  11. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  12. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  13. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  14. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  15. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  16. package/dist/migrations/v2.0/index.d.ts +5 -3
  17. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  18. package/dist/migrations/v2.0/index.js +187 -93
  19. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  20. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  21. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  22. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  23. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  24. package/dist/notification/index.js +16 -20
  25. package/opencrvs-toolkit-2.0.0-rc.c7f111d.tgz +0 -0
  26. package/package.json +1 -1
  27. package/opencrvs-toolkit-2.0.0-rc.c661677.tgz +0 -0
@@ -6,6 +6,7 @@ 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>;
9
10
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
10
11
  }, z.core.$strip>;
11
12
  export declare const RegisterActionInput: z.ZodObject<{
@@ -15,6 +16,7 @@ export declare const RegisterActionInput: z.ZodObject<{
15
16
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
16
17
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
17
18
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
19
+ waitFor: z.ZodOptional<z.ZodBoolean>;
18
20
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
19
21
  type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
20
22
  registrationNumber: z.ZodOptional<z.ZodString>;
@@ -27,6 +29,7 @@ export declare const NotifyActionInput: z.ZodObject<{
27
29
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
28
30
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
29
31
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
32
+ waitFor: z.ZodOptional<z.ZodBoolean>;
30
33
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
31
34
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
32
35
  }, z.core.$strip>;
@@ -38,6 +41,7 @@ export declare const DeclareActionInput: z.ZodObject<{
38
41
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
39
42
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
40
43
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
44
+ waitFor: z.ZodOptional<z.ZodBoolean>;
41
45
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
42
46
  type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
43
47
  }, z.core.$strip>;
@@ -48,6 +52,7 @@ export declare const EditActionInput: z.ZodObject<{
48
52
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
49
53
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
50
54
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
55
+ waitFor: z.ZodOptional<z.ZodBoolean>;
51
56
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
52
57
  type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
53
58
  content: z.ZodObject<{
@@ -62,6 +67,7 @@ export declare const PrintCertificateActionInput: z.ZodObject<{
62
67
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
63
68
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
64
69
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
70
+ waitFor: z.ZodOptional<z.ZodBoolean>;
65
71
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
66
72
  type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
67
73
  content: z.ZodOptional<z.ZodObject<{
@@ -76,6 +82,7 @@ export declare const RejectDeclarationActionInput: z.ZodObject<{
76
82
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
77
83
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
78
84
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
85
+ waitFor: z.ZodOptional<z.ZodBoolean>;
79
86
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
80
87
  type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
81
88
  content: z.ZodObject<{
@@ -90,6 +97,7 @@ export declare const DuplicateDetectedActionInput: z.ZodObject<{
90
97
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
91
98
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
92
99
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
100
+ waitFor: z.ZodOptional<z.ZodBoolean>;
93
101
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
94
102
  type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
95
103
  content: z.ZodObject<{
@@ -106,6 +114,7 @@ export declare const MarkAsDuplicateActionInput: z.ZodObject<{
106
114
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
107
115
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
108
116
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
117
+ waitFor: z.ZodOptional<z.ZodBoolean>;
109
118
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
110
119
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
111
120
  content: z.ZodOptional<z.ZodObject<{
@@ -120,6 +129,7 @@ export declare const MarkNotDuplicateActionInput: z.ZodObject<{
120
129
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
121
130
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
122
131
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
132
+ waitFor: z.ZodOptional<z.ZodBoolean>;
123
133
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
124
134
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
125
135
  }, z.core.$strip>;
@@ -131,6 +141,7 @@ export declare const ArchiveActionInput: z.ZodObject<{
131
141
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
132
142
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
133
143
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
144
+ waitFor: z.ZodOptional<z.ZodBoolean>;
134
145
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
135
146
  type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
136
147
  content: z.ZodObject<{
@@ -145,6 +156,7 @@ export declare const AssignActionInput: z.ZodObject<{
145
156
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
146
157
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
147
158
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
159
+ waitFor: z.ZodOptional<z.ZodBoolean>;
148
160
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
149
161
  type: z.ZodLiteral<"ASSIGN">;
150
162
  assignedTo: z.ZodString;
@@ -157,6 +169,7 @@ export declare const UnassignActionInput: z.ZodObject<{
157
169
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
158
170
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
159
171
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
172
+ waitFor: z.ZodOptional<z.ZodBoolean>;
160
173
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
161
174
  type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
162
175
  assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
@@ -169,6 +182,7 @@ export declare const RequestCorrectionActionInput: z.ZodObject<{
169
182
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
170
183
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
171
184
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
185
+ waitFor: z.ZodOptional<z.ZodBoolean>;
172
186
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
173
187
  type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
174
188
  }, z.core.$strip>;
@@ -180,6 +194,7 @@ export declare const RejectCorrectionActionInput: z.ZodObject<{
180
194
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
181
195
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
182
196
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
197
+ waitFor: z.ZodOptional<z.ZodBoolean>;
183
198
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
184
199
  requestId: z.ZodString;
185
200
  type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
@@ -195,6 +210,7 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
195
210
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
196
211
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
197
212
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
213
+ waitFor: z.ZodOptional<z.ZodBoolean>;
198
214
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
199
215
  requestId: z.ZodString;
200
216
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
@@ -207,6 +223,7 @@ export declare const ReadActionInput: z.ZodObject<{
207
223
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
208
224
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
209
225
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
226
+ waitFor: z.ZodOptional<z.ZodBoolean>;
210
227
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
211
228
  type: z.ZodDefault<z.ZodLiteral<"READ">>;
212
229
  }, z.core.$strip>;
@@ -222,6 +239,7 @@ export declare const CustomActionInput: z.ZodObject<{
222
239
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
223
240
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
224
241
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
242
+ waitFor: z.ZodOptional<z.ZodBoolean>;
225
243
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
226
244
  type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
227
245
  customActionType: z.ZodString;
@@ -242,6 +260,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
260
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
243
261
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
244
262
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
263
+ waitFor: z.ZodOptional<z.ZodBoolean>;
245
264
  type: z.ZodDefault<z.ZodLiteral<"CREATE">>;
246
265
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
247
266
  }, z.core.$strip>, z.ZodObject<{
@@ -251,6 +270,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
251
270
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
252
271
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
253
272
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
273
+ waitFor: z.ZodOptional<z.ZodBoolean>;
254
274
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
255
275
  type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
256
276
  registrationNumber: z.ZodOptional<z.ZodString>;
@@ -261,6 +281,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
261
281
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
262
282
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
263
283
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
284
+ waitFor: z.ZodOptional<z.ZodBoolean>;
264
285
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
265
286
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
266
287
  }, z.core.$strip>, z.ZodObject<{
@@ -270,6 +291,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
270
291
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
271
292
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
272
293
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
294
+ waitFor: z.ZodOptional<z.ZodBoolean>;
273
295
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
274
296
  type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
275
297
  }, z.core.$strip>, z.ZodObject<{
@@ -279,6 +301,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
279
301
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
280
302
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
281
303
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
304
+ waitFor: z.ZodOptional<z.ZodBoolean>;
282
305
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
283
306
  type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
284
307
  content: z.ZodObject<{
@@ -291,6 +314,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
291
314
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
292
315
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
293
316
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
317
+ waitFor: z.ZodOptional<z.ZodBoolean>;
294
318
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
295
319
  type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
296
320
  content: z.ZodObject<{
@@ -306,6 +330,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
306
330
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
307
331
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
308
332
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
333
+ waitFor: z.ZodOptional<z.ZodBoolean>;
309
334
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
310
335
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
311
336
  content: z.ZodOptional<z.ZodObject<{
@@ -318,6 +343,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
318
343
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
319
344
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
320
345
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
346
+ waitFor: z.ZodOptional<z.ZodBoolean>;
321
347
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
322
348
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
323
349
  }, z.core.$strip>, z.ZodObject<{
@@ -327,6 +353,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
327
353
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
328
354
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
329
355
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
356
+ waitFor: z.ZodOptional<z.ZodBoolean>;
330
357
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
331
358
  type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
332
359
  content: z.ZodObject<{
@@ -339,6 +366,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
339
366
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
340
367
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
341
368
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
369
+ waitFor: z.ZodOptional<z.ZodBoolean>;
342
370
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
343
371
  type: z.ZodLiteral<"ASSIGN">;
344
372
  assignedTo: z.ZodString;
@@ -349,6 +377,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
349
377
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
350
378
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
351
379
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
380
+ waitFor: z.ZodOptional<z.ZodBoolean>;
352
381
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
353
382
  type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
354
383
  assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
@@ -359,6 +388,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
359
388
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
360
389
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
361
390
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
391
+ waitFor: z.ZodOptional<z.ZodBoolean>;
362
392
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
363
393
  type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
364
394
  content: z.ZodOptional<z.ZodObject<{
@@ -371,6 +401,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
371
401
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
372
402
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
373
403
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
404
+ waitFor: z.ZodOptional<z.ZodBoolean>;
374
405
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
375
406
  type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
376
407
  }, z.core.$strip>, z.ZodObject<{
@@ -380,6 +411,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
380
411
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
381
412
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
382
413
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
414
+ waitFor: z.ZodOptional<z.ZodBoolean>;
383
415
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
384
416
  requestId: z.ZodString;
385
417
  type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
@@ -393,6 +425,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
393
425
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
394
426
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
395
427
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
428
+ waitFor: z.ZodOptional<z.ZodBoolean>;
396
429
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
397
430
  requestId: z.ZodString;
398
431
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
@@ -403,6 +436,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
403
436
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
404
437
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
405
438
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
439
+ waitFor: z.ZodOptional<z.ZodBoolean>;
406
440
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
407
441
  type: z.ZodDefault<z.ZodLiteral<"READ">>;
408
442
  }, z.core.$strip>, z.ZodObject<{
@@ -412,6 +446,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
412
446
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
413
447
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
414
448
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
449
+ waitFor: z.ZodOptional<z.ZodBoolean>;
415
450
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
416
451
  type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
417
452
  customActionType: z.ZodString;
@@ -422,6 +457,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
422
457
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
423
458
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
424
459
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
460
+ waitFor: z.ZodOptional<z.ZodBoolean>;
425
461
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
426
462
  type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
427
463
  content: z.ZodObject<{
@@ -51,6 +51,7 @@ 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>;
54
55
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
55
56
  type: z.ZodEnum<{
56
57
  CUSTOM: "CUSTOM";
@@ -50,6 +50,7 @@ export declare const EventIndex: z.ZodObject<{
50
50
  updatedAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
51
51
  updatedAt: z.ZodISODateTime;
52
52
  assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ assignedToSignature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
53
54
  updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
55
  trackingId: z.ZodString;
55
56
  potentialDuplicates: z.ZodArray<z.ZodObject<{
@@ -123,6 +123,7 @@ export declare const EventMetadata: z.ZodObject<{
123
123
  updatedAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
124
124
  updatedAt: z.ZodISODateTime;
125
125
  assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ assignedToSignature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
126
127
  updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
128
  trackingId: z.ZodString;
128
129
  potentialDuplicates: z.ZodArray<z.ZodObject<{
@@ -9,7 +9,7 @@ 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;
12
+ export declare function getAssignedUserSignatureFromActions(actions: Array<ActionDocument>): (string & import("zod").$brand<"DocumentPath">) | null;
13
13
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
14
14
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
15
15
  } : T extends UUID ? T : T extends DocumentPath ? T : T extends string ? NonNullable<T> : T extends (infer U)[] ? NonNullableDeep<U>[] : T extends object ? {
@@ -104,6 +104,7 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
104
104
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
105
105
  updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
106
106
  assignedTo?: string | null | undefined;
107
+ assignedToSignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
107
108
  updatedBy?: string | null | undefined;
108
109
  };
109
110
  /**
@@ -1414,28 +1414,20 @@ 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
+ );
1417
1420
  return z12.any().superRefine((val, ctx) => {
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
- });
1421
+ for (const schema of sortedSchemas) {
1422
+ if (schema.safeParse(val).success) {
1423
+ return;
1424
+ }
1438
1425
  }
1426
+ ctx.addIssue({
1427
+ code: "invalid_type",
1428
+ expected: "custom",
1429
+ message: "Value does not match any schema"
1430
+ });
1439
1431
  }).meta({
1440
1432
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1441
1433
  });
@@ -1812,6 +1804,9 @@ var EventMetadata = z16.object({
1812
1804
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1813
1805
  ),
1814
1806
  assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
1807
+ assignedToSignature: DocumentPath.nullish().describe(
1808
+ "Signature of the user who is currently assigned to the event."
1809
+ ),
1815
1810
  updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
1816
1811
  trackingId: z16.string().describe(
1817
1812
  "System-generated tracking ID used by informants or registrars to look up the event."
@@ -5900,6 +5895,7 @@ var BaseActionInput = z38.object({
5900
5895
  originalActionId: UUID.optional(),
5901
5896
  // should not be part of base action.
5902
5897
  keepAssignment: z38.boolean().optional(),
5898
+ waitFor: z38.boolean().optional(),
5903
5899
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5904
5900
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
5905
5901
  createdAtLocation: UUID.nullish().describe(
@@ -1,5 +1,5 @@
1
1
  export declare const UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
2
- export declare const UPSTREAM_BRANCH = "develop";
2
+ export declare const UPSTREAM_BRANCH = "release-v2.0.0";
3
3
  /**
4
4
  * Runs a git command in the country config working directory.
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,2DACiC,CAAA;AAG1D,eAAO,MAAM,eAAe,YAAY,CAAA;AAcxC;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,MAAc,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAO9C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAID,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,2DACiC,CAAA;AAE1D,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAc/C;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,MAAc,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAO9C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAID,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -59,8 +59,7 @@ exports.main = main;
59
59
  */
60
60
  const child_process_1 = require("child_process");
61
61
  exports.UPSTREAM_URL = 'https://github.com/opencrvs/opencrvs-countryconfig.git';
62
- // @TODO: This needs to be changed to 'release-v2.0.0' once the branch is created
63
- exports.UPSTREAM_BRANCH = 'develop';
62
+ exports.UPSTREAM_BRANCH = 'release-v2.0.0';
64
63
  // Remote name used only for the duration of this codemod. Prefixed to avoid
65
64
  // clashing with remotes the user may have (origin, upstream, etc.).
66
65
  const TEMP_REMOTE = 'opencrvs-upgrade-v19-v20-codemod';
@@ -1,3 +1,11 @@
1
- declare function main(): Promise<void>;
1
+ interface DeleteInfrastructureOptions {
2
+ /**
3
+ * Top-level entries directly under `infrastructure/` to preserve. Names
4
+ * match against the basename of each entry (file or directory). When
5
+ * empty (the default), the whole `infrastructure/` directory is deleted.
6
+ */
7
+ keep?: string[];
8
+ }
9
+ declare function main({ keep }?: DeleteInfrastructureOptions): Promise<void>;
2
10
  export { main };
3
11
  //# sourceMappingURL=delete-infrastructure-directory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delete-infrastructure-directory.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/delete-infrastructure-directory.ts"],"names":[],"mappings":"AA4CA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAgCnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"delete-infrastructure-directory.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/delete-infrastructure-directory.ts"],"names":[],"mappings":"AAoDA,UAAU,2BAA2B;IACnC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,iBAAe,IAAI,CAAC,EAClB,IAAS,EACV,GAAE,2BAAgC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FlD;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -27,20 +27,28 @@ exports.main = main;
27
27
  * via Docker Swarm. In that case the `infrastructure/` directory shipped
28
28
  * with opencrvs-countryconfig is no longer needed and can be removed.
29
29
  *
30
+ * Some non-Swarm deployments still need a small subset of
31
+ * `infrastructure/` (e.g. `postgres/` and `metabase/`). Pass `keep` to
32
+ * preserve those top-level subdirectories — everything else under
33
+ * `infrastructure/` is deleted, and the kept subdirectories can then be
34
+ * refreshed from upstream by `merge-infrastructure-directory.ts` with the
35
+ * matching `subdirs` option.
36
+ *
30
37
  * Usage:
31
38
  * ts-node -r tsconfig-paths/register src/migrations/v2.0/delete-infrastructure-directory.ts
32
39
  *
33
40
  * What it does:
34
41
  * 1. Stages deletion of all tracked files under `infrastructure/` via
35
- * `git rm -rf --ignore-unmatch -- infrastructure/`. This both removes
36
- * the files from the working tree and records the deletion in the
42
+ * `git rm -rf --ignore-unmatch -- <path>`. This both removes the
43
+ * files from the working tree and records the deletion in the
37
44
  * index, so it shows up in the upgrade commit alongside the other
38
- * codemod changes.
45
+ * codemod changes. When `keep` is provided, deletion is scoped to
46
+ * the top-level entries that are NOT in `keep`.
39
47
  * 2. Cleans up any untracked files / empty directory that `git rm` left
40
- * behind, so the path is fully gone from the working tree.
48
+ * behind, so the deleted paths are fully gone from the working tree.
41
49
  *
42
50
  * Caveats:
43
- * - Destructive: any local edits to `infrastructure/` are lost. Run on a
51
+ * - Destructive: any local edits to deleted paths are lost. Run on a
44
52
  * clean working tree (or after committing your local changes).
45
53
  * - If `infrastructure/` doesn't exist, this codemod is a no-op.
46
54
  * - Requires git to be installed and the country config working directory
@@ -51,27 +59,65 @@ const path_1 = require("path");
51
59
  const checkout_upstream_files_1 = require("./checkout-upstream-files");
52
60
  const INFRASTRUCTURE_DIR = 'infrastructure';
53
61
  function main() {
54
- return __awaiter(this, void 0, void 0, function* () {
62
+ return __awaiter(this, arguments, void 0, function* ({ keep = [] } = {}) {
55
63
  const fullPath = (0, path_1.join)(process.cwd(), INFRASTRUCTURE_DIR);
56
64
  if (!(0, fs_1.existsSync)(fullPath)) {
57
65
  console.log(`'${INFRASTRUCTURE_DIR}/' not found in ${process.cwd()} — nothing to delete.`);
58
66
  return;
59
67
  }
60
- console.log(`Deleting '${INFRASTRUCTURE_DIR}/'...\n`);
61
68
  (0, checkout_upstream_files_1.assertIsGitRepo)();
62
- // `git rm -rf --ignore-unmatch` removes tracked files (working tree + index)
63
- // and is a no-op for paths with no tracked entries, so it's safe to run
64
- // even when `infrastructure/` exists only as untracked files.
65
- (0, checkout_upstream_files_1.runGit)(['rm', '-rf', '--ignore-unmatch', '--', `${INFRASTRUCTURE_DIR}/`], {
66
- silent: true
67
- });
68
- console.log(` Staged deletion of tracked files under '${INFRASTRUCTURE_DIR}/'.`);
69
- // `git rm` leaves untracked files (and any now-empty directory) on disk;
70
- // remove whatever's left so the path is fully gone.
71
- if ((0, fs_1.existsSync)(fullPath)) {
72
- (0, fs_1.rmSync)(fullPath, { recursive: true, force: true });
73
- console.log(` Removed remaining untracked files under '${INFRASTRUCTURE_DIR}/'.`);
69
+ // ─── Whole-directory delete (legacy behavior) ────────────────────────
70
+ if (keep.length === 0) {
71
+ console.log(`Deleting '${INFRASTRUCTURE_DIR}/'...\n`);
72
+ // `git rm -rf --ignore-unmatch` removes tracked files (working tree +
73
+ // index) and is a no-op for paths with no tracked entries, so it's
74
+ // safe to run even when `infrastructure/` exists only as untracked
75
+ // files.
76
+ (0, checkout_upstream_files_1.runGit)(['rm', '-rf', '--ignore-unmatch', '--', `${INFRASTRUCTURE_DIR}/`], {
77
+ silent: true
78
+ });
79
+ console.log(` Staged deletion of tracked files under '${INFRASTRUCTURE_DIR}/'.`);
80
+ // `git rm` leaves untracked files (and any now-empty directory) on
81
+ // disk; remove whatever's left so the path is fully gone.
82
+ if ((0, fs_1.existsSync)(fullPath)) {
83
+ (0, fs_1.rmSync)(fullPath, { recursive: true, force: true });
84
+ console.log(` Removed remaining untracked files under '${INFRASTRUCTURE_DIR}/'.`);
85
+ }
86
+ console.log(`\n Done. Review the staged deletion with: git diff --cached -- '${INFRASTRUCTURE_DIR}/'`);
87
+ return;
88
+ }
89
+ // ─── Selective delete: keep listed top-level entries ─────────────────
90
+ const keepSet = new Set(keep);
91
+ console.log(`Deleting contents of '${INFRASTRUCTURE_DIR}/' except: ${[...keepSet]
92
+ .map((name) => `'${name}'`)
93
+ .join(', ')}\n`);
94
+ const topLevelEntries = (0, fs_1.readdirSync)(fullPath, { withFileTypes: true });
95
+ let deleted = 0;
96
+ for (const entry of topLevelEntries) {
97
+ if (keepSet.has(entry.name)) {
98
+ console.log(` Keeping '${INFRASTRUCTURE_DIR}/${entry.name}'.`);
99
+ continue;
100
+ }
101
+ // Append a trailing slash for directories so git treats it as a tree
102
+ // pathspec (matches the recursive behavior of `git rm -rf`).
103
+ const relPath = `${INFRASTRUCTURE_DIR}/${entry.name}${entry.isDirectory() ? '/' : ''}`;
104
+ (0, checkout_upstream_files_1.runGit)(['rm', '-rf', '--ignore-unmatch', '--', relPath], { silent: true });
105
+ const fullEntryPath = (0, path_1.join)(fullPath, entry.name);
106
+ if ((0, fs_1.existsSync)(fullEntryPath)) {
107
+ (0, fs_1.rmSync)(fullEntryPath, { recursive: true, force: true });
108
+ }
109
+ console.log(` Deleted '${relPath}'.`);
110
+ deleted++;
111
+ }
112
+ // Note any requested keeps that weren't actually present, so the dev
113
+ // notices typos / missing directories.
114
+ const presentNames = new Set(topLevelEntries.map((e) => e.name));
115
+ const missingKeeps = [...keepSet].filter((name) => !presentNames.has(name));
116
+ if (missingKeeps.length > 0) {
117
+ console.warn(` [warn] Requested to keep ${missingKeeps
118
+ .map((n) => `'${n}'`)
119
+ .join(', ')} but they don't exist under '${INFRASTRUCTURE_DIR}/'.`);
74
120
  }
75
- console.log(`\n Done. Review the staged deletion with: git diff --cached -- '${INFRASTRUCTURE_DIR}/'`);
121
+ console.log(`\n Done. Deleted ${deleted} top-level entr${deleted === 1 ? 'y' : 'ies'}. Review the staged deletions with: git diff --cached -- '${INFRASTRUCTURE_DIR}/'`);
76
122
  });
77
123
  }
@@ -3,9 +3,11 @@
3
3
  * directory.
4
4
  *
5
5
  * @param dockerSwarm - When true, the local `infrastructure/` directory is
6
- * merged with upstream changes (Docker Swarm deployments still need it).
7
- * When false (the default), `infrastructure/` is deleted entirely, since
8
- * non-Swarm deployments no longer ship it.
6
+ * merged with upstream changes in its entirety (Docker Swarm deployments
7
+ * still need it all). When false (the default), everything under
8
+ * `infrastructure/` is deleted EXCEPT the subdirectories listed in
9
+ * `NON_SWARM_INFRA_SUBDIRS`, and those preserved subdirectories are then
10
+ * merged with upstream.
9
11
  */
10
12
  export declare function runUpgrade(dockerSwarm: boolean): Promise<void>;
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AAqCA;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBA+BpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBAgCpD"}