@opencrvs/toolkit 2.0.0-rc.99921a2 → 2.0.0-rc.99b8626
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/build.sh +2 -2
- package/dist/application-config/index.js +0 -12
- package/dist/cli.js +5108 -167
- package/dist/commons/api/router.d.ts +75 -668
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionConfig.d.ts +0 -202
- package/dist/commons/events/ActionDocument.d.ts +0 -44
- package/dist/commons/events/ActionInput.d.ts +0 -26
- package/dist/commons/events/ActionType.d.ts +1 -6
- package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -6
- package/dist/commons/events/AuditLog.d.ts +0 -2
- package/dist/commons/events/Draft.d.ts +0 -2
- package/dist/commons/events/EventDocument.d.ts +0 -22
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/WorkqueueConfig.d.ts +2 -5
- package/dist/commons/events/scopes.d.ts +0 -1
- package/dist/commons/events/test.utils.d.ts +1 -9
- package/dist/commons/events/utils.d.ts +1 -15
- package/dist/conditionals/index.js +0 -2
- package/dist/events/index.js +18 -166
- package/dist/migrations/v2.0/index.js +5144 -88
- package/dist/notification/index.js +11 -131
- package/dist/scopes/index.d.ts +1 -7
- package/dist/scopes/index.js +0 -2
- package/opencrvs-toolkit-2.0.0-rc.99b8626.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
- package/dist/migrations/v2.1/index.d.ts +0 -6
- package/dist/migrations/v2.1/index.d.ts.map +0 -1
- package/dist/migrations/v2.1/index.js +0 -218
- package/opencrvs-toolkit-2.0.0-rc.99921a2.tgz +0 -0
|
@@ -79,7 +79,6 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
79
79
|
"record.edit",
|
|
80
80
|
"record.reject",
|
|
81
81
|
"record.archive",
|
|
82
|
-
"record.unarchive",
|
|
83
82
|
"record.review-duplicates",
|
|
84
83
|
"record.register",
|
|
85
84
|
"record.print-certified-copies",
|
|
@@ -185,7 +184,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
185
184
|
"record.edit",
|
|
186
185
|
"record.reject",
|
|
187
186
|
"record.archive",
|
|
188
|
-
"record.unarchive",
|
|
189
187
|
"record.review-duplicates",
|
|
190
188
|
"record.register"
|
|
191
189
|
]);
|
|
@@ -327,7 +325,6 @@ var ActionType = {
|
|
|
327
325
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
328
326
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
329
327
|
ARCHIVE: "ARCHIVE",
|
|
330
|
-
UNARCHIVE: "UNARCHIVE",
|
|
331
328
|
// Record actions
|
|
332
329
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
333
330
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -347,7 +344,6 @@ var ConfirmableActions = [
|
|
|
347
344
|
ActionType.REGISTER,
|
|
348
345
|
ActionType.REJECT,
|
|
349
346
|
ActionType.ARCHIVE,
|
|
350
|
-
ActionType.UNARCHIVE,
|
|
351
347
|
ActionType.PRINT_CERTIFICATE,
|
|
352
348
|
ActionType.REQUEST_CORRECTION,
|
|
353
349
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -366,7 +362,6 @@ var ActionTypes = z4.enum([
|
|
|
366
362
|
"MARK_AS_DUPLICATE",
|
|
367
363
|
"MARK_AS_NOT_DUPLICATE",
|
|
368
364
|
"ARCHIVE",
|
|
369
|
-
"UNARCHIVE",
|
|
370
365
|
"PRINT_CERTIFICATE",
|
|
371
366
|
"REQUEST_CORRECTION",
|
|
372
367
|
"REJECT_CORRECTION",
|
|
@@ -410,7 +405,6 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
410
405
|
ActionType.REJECT,
|
|
411
406
|
ActionType.MARK_AS_DUPLICATE,
|
|
412
407
|
ActionType.ARCHIVE,
|
|
413
|
-
ActionType.UNARCHIVE,
|
|
414
408
|
ActionType.PRINT_CERTIFICATE,
|
|
415
409
|
ActionType.REQUEST_CORRECTION
|
|
416
410
|
]);
|
|
@@ -472,7 +466,6 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
472
466
|
"event.actions.unassign.request",
|
|
473
467
|
"event.actions.read.request",
|
|
474
468
|
"event.actions.archive.request",
|
|
475
|
-
"event.actions.unarchive.request",
|
|
476
469
|
"event.actions.reinstate.request",
|
|
477
470
|
"event.actions.print_certificate.request",
|
|
478
471
|
"event.actions.correction.request.request",
|
|
@@ -1198,11 +1191,6 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1198
1191
|
content: ReasonContent
|
|
1199
1192
|
}).shape
|
|
1200
1193
|
);
|
|
1201
|
-
var UnarchiveAction = ActionBase.extend(
|
|
1202
|
-
z14.object({
|
|
1203
|
-
type: z14.literal(ActionType.UNARCHIVE)
|
|
1204
|
-
}).shape
|
|
1205
|
-
);
|
|
1206
1194
|
var CreatedAction = ActionBase.extend(
|
|
1207
1195
|
z14.object({
|
|
1208
1196
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1269,7 +1257,6 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1269
1257
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1270
1258
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1271
1259
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1272
|
-
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1273
1260
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1274
1261
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1275
1262
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -2708,52 +2695,6 @@ var NotifyConfig = ActionConfigBase.extend(
|
|
|
2708
2695
|
type: z24.literal(ActionType.NOTIFY)
|
|
2709
2696
|
}).shape
|
|
2710
2697
|
);
|
|
2711
|
-
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2712
|
-
z24.object({
|
|
2713
|
-
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
2714
|
-
label: z24.never().optional().describe(
|
|
2715
|
-
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2716
|
-
),
|
|
2717
|
-
supportingCopy: z24.never().optional(),
|
|
2718
|
-
icon: z24.never().optional().describe(
|
|
2719
|
-
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2720
|
-
),
|
|
2721
|
-
conditionals: z24.never().optional().describe(
|
|
2722
|
-
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2723
|
-
)
|
|
2724
|
-
}).shape
|
|
2725
|
-
);
|
|
2726
|
-
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2727
|
-
z24.object({
|
|
2728
|
-
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2729
|
-
}).shape
|
|
2730
|
-
);
|
|
2731
|
-
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2732
|
-
z24.object({
|
|
2733
|
-
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2734
|
-
}).shape
|
|
2735
|
-
);
|
|
2736
|
-
var AssignConfig = ActionConfigBase.extend(
|
|
2737
|
-
z24.object({
|
|
2738
|
-
type: z24.literal(ActionType.ASSIGN),
|
|
2739
|
-
flags: z24.never().optional().describe(
|
|
2740
|
-
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2741
|
-
)
|
|
2742
|
-
}).shape
|
|
2743
|
-
);
|
|
2744
|
-
var UnassignConfig = ActionConfigBase.extend(
|
|
2745
|
-
z24.object({
|
|
2746
|
-
type: z24.literal(ActionType.UNASSIGN),
|
|
2747
|
-
flags: z24.never().optional().describe(
|
|
2748
|
-
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2749
|
-
)
|
|
2750
|
-
}).shape
|
|
2751
|
-
);
|
|
2752
|
-
var DeleteConfig = ActionConfigBase.extend(
|
|
2753
|
-
z24.object({
|
|
2754
|
-
type: z24.literal(ActionType.DELETE)
|
|
2755
|
-
}).shape
|
|
2756
|
-
);
|
|
2757
2698
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2758
2699
|
z24.object({
|
|
2759
2700
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -2778,11 +2719,6 @@ var ArchiveConfig = ActionConfigBase.extend(
|
|
|
2778
2719
|
type: z24.literal(ActionType.ARCHIVE)
|
|
2779
2720
|
}).shape
|
|
2780
2721
|
);
|
|
2781
|
-
var UnarchiveConfig = ActionConfigBase.extend(
|
|
2782
|
-
z24.object({
|
|
2783
|
-
type: z24.literal(ActionType.UNARCHIVE)
|
|
2784
|
-
}).shape
|
|
2785
|
-
);
|
|
2786
2722
|
var EditActionConfig = ActionConfigBase.extend(
|
|
2787
2723
|
z24.object({
|
|
2788
2724
|
type: z24.literal(ActionType.EDIT),
|
|
@@ -2821,17 +2757,7 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
2821
2757
|
correctionForm: ActionFormConfig
|
|
2822
2758
|
}).shape
|
|
2823
2759
|
);
|
|
2824
|
-
var
|
|
2825
|
-
z24.object({
|
|
2826
|
-
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
2827
|
-
}).shape
|
|
2828
|
-
);
|
|
2829
|
-
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2830
|
-
z24.object({
|
|
2831
|
-
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
2832
|
-
}).shape
|
|
2833
|
-
);
|
|
2834
|
-
var CustomActionConfig = ActionConfigBase.extend(
|
|
2760
|
+
var CustomActionConfig = ActionConfigBase.merge(
|
|
2835
2761
|
z24.object({
|
|
2836
2762
|
type: z24.literal(ActionType.CUSTOM),
|
|
2837
2763
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -2842,7 +2768,7 @@ var CustomActionConfig = ActionConfigBase.extend(
|
|
|
2842
2768
|
auditHistoryLabel: TranslationConfig.describe(
|
|
2843
2769
|
'The label to show in audit history for this action. For example "Approved".'
|
|
2844
2770
|
)
|
|
2845
|
-
})
|
|
2771
|
+
})
|
|
2846
2772
|
);
|
|
2847
2773
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
2848
2774
|
/*
|
|
@@ -2853,18 +2779,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2853
2779
|
id: "ReadActionConfig",
|
|
2854
2780
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
2855
2781
|
}),
|
|
2856
|
-
AssignConfig.meta({
|
|
2857
|
-
id: "AssignActionConfig",
|
|
2858
|
-
description: "Configuration for assigning a record to the current user."
|
|
2859
|
-
}),
|
|
2860
|
-
UnassignConfig.meta({
|
|
2861
|
-
id: "UnassignActionConfig",
|
|
2862
|
-
description: "Configuration for unassigning a record from its current assignee."
|
|
2863
|
-
}),
|
|
2864
|
-
DeleteConfig.meta({
|
|
2865
|
-
id: "DeleteActionConfig",
|
|
2866
|
-
description: "Configuration for deleting a draft record."
|
|
2867
|
-
}),
|
|
2868
2782
|
NotifyConfig.meta({
|
|
2869
2783
|
id: "NotifyActionConfig",
|
|
2870
2784
|
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
@@ -2873,18 +2787,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2873
2787
|
id: "DeclareActionConfig",
|
|
2874
2788
|
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
2875
2789
|
}),
|
|
2876
|
-
DuplicateDetectedConfig.meta({
|
|
2877
|
-
id: "DuplicateDetectedActionConfig",
|
|
2878
|
-
description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
|
|
2879
|
-
}),
|
|
2880
|
-
MarkAsDuplicateConfig.meta({
|
|
2881
|
-
id: "MarkAsDuplicateActionConfig",
|
|
2882
|
-
description: "Configuration for marking a record as a duplicate."
|
|
2883
|
-
}),
|
|
2884
|
-
MarkAsNotDuplicateConfig.meta({
|
|
2885
|
-
id: "MarkAsNotDuplicateActionConfig",
|
|
2886
|
-
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
2887
|
-
}),
|
|
2888
2790
|
RejectConfig.meta({
|
|
2889
2791
|
id: "RejectActionConfig",
|
|
2890
2792
|
description: "Configuration for rejecting a record before registration."
|
|
@@ -2901,14 +2803,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2901
2803
|
id: "RequestCorrectionActionConfig",
|
|
2902
2804
|
description: "Configuration for requesting a correction on a registered record."
|
|
2903
2805
|
}),
|
|
2904
|
-
ApproveCorrectionConfig.meta({
|
|
2905
|
-
id: "ApproveCorrectionActionConfig",
|
|
2906
|
-
description: "Configuration for approving a requested correction."
|
|
2907
|
-
}),
|
|
2908
|
-
RejectCorrectionConfig.meta({
|
|
2909
|
-
id: "RejectCorrectionActionConfig",
|
|
2910
|
-
description: "Configuration for rejecting a requested correction."
|
|
2911
|
-
}),
|
|
2912
2806
|
EditActionConfig.meta({
|
|
2913
2807
|
id: "EditActionConfig",
|
|
2914
2808
|
description: "Configuration for editing a record before registration."
|
|
@@ -2917,10 +2811,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2917
2811
|
id: "ArchiveActionConfig",
|
|
2918
2812
|
description: "Configuration for archiving a record."
|
|
2919
2813
|
}),
|
|
2920
|
-
UnarchiveConfig.meta({
|
|
2921
|
-
id: "UnarchiveActionConfig",
|
|
2922
|
-
description: "Configuration for unarchiving a record."
|
|
2923
|
-
}),
|
|
2924
2814
|
CustomActionConfig.meta({
|
|
2925
2815
|
id: "CustomActionConfig",
|
|
2926
2816
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -4040,7 +3930,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
4040
3930
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4041
3931
|
const configuredFlagIds = event2.flags.map((flag) => flag.id);
|
|
4042
3932
|
const actionFlagIds = event2.actions.flatMap(
|
|
4043
|
-
(action) =>
|
|
3933
|
+
(action) => action.flags.map((flag) => flag.id)
|
|
4044
3934
|
);
|
|
4045
3935
|
for (const actionFlagId of actionFlagIds) {
|
|
4046
3936
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4693,11 +4583,6 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
4693
4583
|
content: ReasonContent
|
|
4694
4584
|
}).shape
|
|
4695
4585
|
);
|
|
4696
|
-
var UnarchiveActionInput = BaseActionInput.extend(
|
|
4697
|
-
z38.object({
|
|
4698
|
-
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
4699
|
-
}).shape
|
|
4700
|
-
);
|
|
4701
4586
|
var AssignActionInput = BaseActionInput.extend(
|
|
4702
4587
|
z38.object({
|
|
4703
4588
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -4759,7 +4644,6 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
4759
4644
|
id: "MarkNotDuplicateActionInput"
|
|
4760
4645
|
}),
|
|
4761
4646
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
4762
|
-
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
4763
4647
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
4764
4648
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
4765
4649
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -4837,7 +4721,6 @@ var updateActions = ActionTypes.extract([
|
|
|
4837
4721
|
ActionType.REGISTER,
|
|
4838
4722
|
ActionType.REJECT,
|
|
4839
4723
|
ActionType.ARCHIVE,
|
|
4840
|
-
ActionType.UNARCHIVE,
|
|
4841
4724
|
ActionType.PRINT_CERTIFICATE,
|
|
4842
4725
|
ActionType.REQUEST_CORRECTION,
|
|
4843
4726
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -4856,12 +4739,15 @@ var INHERENT_FLAG_RULES = [
|
|
|
4856
4739
|
},
|
|
4857
4740
|
{
|
|
4858
4741
|
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4859
|
-
// other status-changing action (see getStatusFromActions).
|
|
4860
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4861
|
-
// round trip and comes back exactly as it was.
|
|
4742
|
+
// other status-changing action (see getStatusFromActions).
|
|
4862
4743
|
flag: InherentFlags.INCOMPLETE,
|
|
4863
4744
|
setOn: [ActionType.NOTIFY],
|
|
4864
|
-
resetOn: [
|
|
4745
|
+
resetOn: [
|
|
4746
|
+
ActionType.CREATE,
|
|
4747
|
+
ActionType.DECLARE,
|
|
4748
|
+
ActionType.REGISTER,
|
|
4749
|
+
ActionType.ARCHIVE
|
|
4750
|
+
]
|
|
4865
4751
|
},
|
|
4866
4752
|
{
|
|
4867
4753
|
flag: InherentFlags.REJECTED,
|
|
@@ -7393,7 +7279,6 @@ var ACTION_SCOPE_MAP = {
|
|
|
7393
7279
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
7394
7280
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
7395
7281
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
7396
|
-
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
7397
7282
|
[ActionType.REJECT]: ["record.reject"],
|
|
7398
7283
|
[ActionType.ASSIGN]: null,
|
|
7399
7284
|
[ActionType.UNASSIGN]: null,
|
|
@@ -7436,11 +7321,7 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
7436
7321
|
ActionType.CUSTOM,
|
|
7437
7322
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
7438
7323
|
],
|
|
7439
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
7440
|
-
ActionType.READ,
|
|
7441
|
-
ActionType.CUSTOM,
|
|
7442
|
-
ActionType.UNARCHIVE
|
|
7443
|
-
]
|
|
7324
|
+
[EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
|
|
7444
7325
|
};
|
|
7445
7326
|
var ACTION_FILTERS = {
|
|
7446
7327
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
@@ -7453,7 +7334,6 @@ var ACTION_FILTERS = {
|
|
|
7453
7334
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7454
7335
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7455
7336
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7456
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7457
7337
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7458
7338
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7459
7339
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
package/dist/scopes/index.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export declare const RecordScopeTypeV2: z.ZodEnum<{
|
|
|
25
25
|
"record.edit": "record.edit";
|
|
26
26
|
"record.reject": "record.reject";
|
|
27
27
|
"record.archive": "record.archive";
|
|
28
|
-
"record.unarchive": "record.unarchive";
|
|
29
28
|
"record.review-duplicates": "record.review-duplicates";
|
|
30
29
|
"record.register": "record.register";
|
|
31
30
|
"record.print-certified-copies": "record.print-certified-copies";
|
|
@@ -98,7 +97,6 @@ export declare const ScopesWithDeclaredOptions: z.ZodEnum<{
|
|
|
98
97
|
"record.edit": "record.edit";
|
|
99
98
|
"record.reject": "record.reject";
|
|
100
99
|
"record.archive": "record.archive";
|
|
101
|
-
"record.unarchive": "record.unarchive";
|
|
102
100
|
"record.review-duplicates": "record.review-duplicates";
|
|
103
101
|
"record.register": "record.register";
|
|
104
102
|
}>;
|
|
@@ -128,7 +126,6 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
128
126
|
"record.edit": "record.edit";
|
|
129
127
|
"record.reject": "record.reject";
|
|
130
128
|
"record.archive": "record.archive";
|
|
131
|
-
"record.unarchive": "record.unarchive";
|
|
132
129
|
"record.review-duplicates": "record.review-duplicates";
|
|
133
130
|
"record.register": "record.register";
|
|
134
131
|
}>;
|
|
@@ -344,7 +341,6 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
344
341
|
"record.edit": "record.edit";
|
|
345
342
|
"record.reject": "record.reject";
|
|
346
343
|
"record.archive": "record.archive";
|
|
347
|
-
"record.unarchive": "record.unarchive";
|
|
348
344
|
"record.review-duplicates": "record.review-duplicates";
|
|
349
345
|
"record.register": "record.register";
|
|
350
346
|
}>;
|
|
@@ -427,7 +423,6 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
427
423
|
"record.edit": "record.edit";
|
|
428
424
|
"record.reject": "record.reject";
|
|
429
425
|
"record.archive": "record.archive";
|
|
430
|
-
"record.unarchive": "record.unarchive";
|
|
431
426
|
"record.review-duplicates": "record.review-duplicates";
|
|
432
427
|
"record.register": "record.register";
|
|
433
428
|
}>;
|
|
@@ -620,7 +615,6 @@ export declare const ScopeType: z.ZodEnum<{
|
|
|
620
615
|
"record.edit": "record.edit";
|
|
621
616
|
"record.reject": "record.reject";
|
|
622
617
|
"record.archive": "record.archive";
|
|
623
|
-
"record.unarchive": "record.unarchive";
|
|
624
618
|
"record.review-duplicates": "record.review-duplicates";
|
|
625
619
|
"record.register": "record.register";
|
|
626
620
|
"record.print-certified-copies": "record.print-certified-copies";
|
|
@@ -678,7 +672,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
678
672
|
placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
|
|
679
673
|
} | undefined;
|
|
680
674
|
} | {
|
|
681
|
-
type: "record.edit" | "record.reject" | "record.archive" | "record.
|
|
675
|
+
type: "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register";
|
|
682
676
|
options?: {
|
|
683
677
|
event?: string[] | undefined;
|
|
684
678
|
placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
|
package/dist/scopes/index.js
CHANGED
|
@@ -110,7 +110,6 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
110
110
|
"record.edit",
|
|
111
111
|
"record.reject",
|
|
112
112
|
"record.archive",
|
|
113
|
-
"record.unarchive",
|
|
114
113
|
"record.review-duplicates",
|
|
115
114
|
"record.register",
|
|
116
115
|
"record.print-certified-copies",
|
|
@@ -216,7 +215,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
216
215
|
"record.edit",
|
|
217
216
|
"record.reject",
|
|
218
217
|
"record.archive",
|
|
219
|
-
"record.unarchive",
|
|
220
218
|
"record.review-duplicates",
|
|
221
219
|
"record.register"
|
|
222
220
|
]);
|
|
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/environment/custom-types.ts","./src/environment/derived-variables.ts","./src/environment/editor-questions.ts","./src/environment/git.ts","./src/environment/github.ts","./src/environment/index.ts","./src/environment/logger.ts","./src/environment/manage-users.ts","./src/environment/questions-helper.ts","./src/environment/questions.ts","./src/environment/setup-environment.ts","./src/environment/ssh-keygen.ts","./src/environment/swarm-to-k8s.ts","./src/environment/templates.ts","./src/environment/update-workflows.ts","./src/environment/users.ts","./src/environment/utils.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/
|
|
1
|
+
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/environment/custom-types.ts","./src/environment/derived-variables.ts","./src/environment/editor-questions.ts","./src/environment/git.ts","./src/environment/github.ts","./src/environment/index.ts","./src/environment/logger.ts","./src/environment/manage-users.ts","./src/environment/questions-helper.ts","./src/environment/questions.ts","./src/environment/setup-environment.ts","./src/environment/ssh-keygen.ts","./src/environment/swarm-to-k8s.ts","./src/environment/templates.ts","./src/environment/update-workflows.ts","./src/environment/users.ts","./src/environment/utils.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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-explicit-correction-flags.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/add-explicit-correction-flags.ts"],"names":[],"mappings":"AAyPA,iBAAe,IAAI,kBA+ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -1,234 +0,0 @@
|
|
|
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: Add explicit `APPROVE_CORRECTION` / `REJECT_CORRECTION` action
|
|
28
|
-
* configs when `REQUEST_CORRECTION` has `flags` and/or `conditionals`.
|
|
29
|
-
*
|
|
30
|
-
* Usage:
|
|
31
|
-
* ts-node -r tsconfig-paths/register src/migrations/v2.1/add-explicit-correction-flags.ts
|
|
32
|
-
*
|
|
33
|
-
* Why:
|
|
34
|
-
* `getActionConfig()` used to alias `APPROVE_CORRECTION` and
|
|
35
|
-
* `REJECT_CORRECTION` to whatever was configured on `REQUEST_CORRECTION`
|
|
36
|
-
* (label, flags, conditionals). As of v2.1, each resolves to its own
|
|
37
|
-
* independent config, so `flags`/`conditionals` configured only on
|
|
38
|
-
* `REQUEST_CORRECTION` would silently stop applying when an
|
|
39
|
-
* `APPROVE_CORRECTION`/`REJECT_CORRECTION` action is accepted. See
|
|
40
|
-
* CHANGELOG.md ("APPROVE_CORRECTION / REJECT_CORRECTION no longer inherit
|
|
41
|
-
* REQUEST_CORRECTION's config").
|
|
42
|
-
*
|
|
43
|
-
* What it does:
|
|
44
|
-
* - Scans all TypeScript files under `src/`
|
|
45
|
-
* - Finds every `defineConfig({ ... })` call expression
|
|
46
|
-
* - Inside the `actions` array, locates the `REQUEST_CORRECTION` action
|
|
47
|
-
* - If it has a non-empty `flags` and/or `conditionals` array, inserts
|
|
48
|
-
* sibling `APPROVE_CORRECTION` and `REJECT_CORRECTION` action objects
|
|
49
|
-
* (carrying over the same `flags`/`conditionals`) immediately after it,
|
|
50
|
-
* unless an action of that type already exists in the array
|
|
51
|
-
* - Saves the modified files in-place
|
|
52
|
-
*/
|
|
53
|
-
const ts_morph_1 = require("ts-morph");
|
|
54
|
-
const path_1 = __importDefault(require("path"));
|
|
55
|
-
const DEFINE_CONFIG_NAME = 'defineConfig';
|
|
56
|
-
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
57
|
-
const TYPE_PROPERTY_NAME = 'type';
|
|
58
|
-
const FLAGS_PROPERTY_NAME = 'flags';
|
|
59
|
-
const CONDITIONALS_PROPERTY_NAME = 'conditionals';
|
|
60
|
-
const ACTION_TYPE_ENUM_NAME = 'ActionType';
|
|
61
|
-
const REQUEST_CORRECTION_TYPE = 'REQUEST_CORRECTION';
|
|
62
|
-
const CORRECTION_ACTIONS_TO_ADD = [
|
|
63
|
-
{
|
|
64
|
-
actionType: 'APPROVE_CORRECTION',
|
|
65
|
-
labelId: 'v2.events.correction.approve.label',
|
|
66
|
-
defaultMessage: 'Approve correction',
|
|
67
|
-
description: 'Label for the approve correction action'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
actionType: 'REJECT_CORRECTION',
|
|
71
|
-
labelId: 'v2.events.correction.reject.label',
|
|
72
|
-
defaultMessage: 'Reject correction',
|
|
73
|
-
description: 'Label for the reject correction action'
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
|
-
/**
|
|
77
|
-
* Returns true if the object's `type` property matches the given type name.
|
|
78
|
-
* Handles both `ActionType.X` and the string literal `'X'` forms.
|
|
79
|
-
*/
|
|
80
|
-
function isActionOfType(obj, typeName) {
|
|
81
|
-
const typeProperty = obj.getProperty(TYPE_PROPERTY_NAME);
|
|
82
|
-
if (!typeProperty || !ts_morph_1.Node.isPropertyAssignment(typeProperty))
|
|
83
|
-
return false;
|
|
84
|
-
const typeInit = typeProperty.getInitializer();
|
|
85
|
-
if (!typeInit)
|
|
86
|
-
return false;
|
|
87
|
-
if (ts_morph_1.Node.isPropertyAccessExpression(typeInit)) {
|
|
88
|
-
return (typeInit.getExpression().getText() === ACTION_TYPE_ENUM_NAME &&
|
|
89
|
-
typeInit.getName() === typeName);
|
|
90
|
-
}
|
|
91
|
-
if (ts_morph_1.Node.isStringLiteral(typeInit)) {
|
|
92
|
-
return typeInit.getLiteralValue() === typeName;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Returns whether `type` is written as `ActionType.X` (enum access) or as a
|
|
98
|
-
* bare string literal, so newly inserted actions can mirror the same style.
|
|
99
|
-
*/
|
|
100
|
-
function getTypeInitializerStyle(obj) {
|
|
101
|
-
const typeProperty = obj.getProperty(TYPE_PROPERTY_NAME);
|
|
102
|
-
if (typeProperty && ts_morph_1.Node.isPropertyAssignment(typeProperty)) {
|
|
103
|
-
const typeInit = typeProperty.getInitializer();
|
|
104
|
-
if (typeInit && ts_morph_1.Node.isPropertyAccessExpression(typeInit))
|
|
105
|
-
return 'enum';
|
|
106
|
-
}
|
|
107
|
-
return 'string';
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Returns the source text of `obj[propName]` if it's an array literal with
|
|
111
|
-
* at least one element, otherwise undefined.
|
|
112
|
-
*/
|
|
113
|
-
function getNonEmptyArrayPropertyText(obj, propName) {
|
|
114
|
-
const prop = obj.getProperty(propName);
|
|
115
|
-
if (!prop || !ts_morph_1.Node.isPropertyAssignment(prop))
|
|
116
|
-
return undefined;
|
|
117
|
-
const init = prop.getInitializer();
|
|
118
|
-
if (!init || !ts_morph_1.Node.isArrayLiteralExpression(init))
|
|
119
|
-
return undefined;
|
|
120
|
-
if (init.getElements().length === 0)
|
|
121
|
-
return undefined;
|
|
122
|
-
return init.getText();
|
|
123
|
-
}
|
|
124
|
-
function buildCorrectionActionText(spec, typeStyle, flagsText, conditionalsText) {
|
|
125
|
-
const typeText = typeStyle === 'enum'
|
|
126
|
-
? `${ACTION_TYPE_ENUM_NAME}.${spec.actionType}`
|
|
127
|
-
: `'${spec.actionType}'`;
|
|
128
|
-
const lines = [
|
|
129
|
-
`type: ${typeText}`,
|
|
130
|
-
`label: {
|
|
131
|
-
id: '${spec.labelId}',
|
|
132
|
-
defaultMessage: '${spec.defaultMessage}',
|
|
133
|
-
description: '${spec.description}'
|
|
134
|
-
}`
|
|
135
|
-
];
|
|
136
|
-
if (flagsText) {
|
|
137
|
-
lines.push(`${FLAGS_PROPERTY_NAME}: ${flagsText}`);
|
|
138
|
-
}
|
|
139
|
-
if (conditionalsText) {
|
|
140
|
-
lines.push(`${CONDITIONALS_PROPERTY_NAME}: ${conditionalsText}`);
|
|
141
|
-
}
|
|
142
|
-
return `{\n ${lines.join(',\n ')}\n}`;
|
|
143
|
-
}
|
|
144
|
-
function processFile(filePath, project) {
|
|
145
|
-
const sourceFile = project.getSourceFile(filePath);
|
|
146
|
-
if (!sourceFile)
|
|
147
|
-
return 0;
|
|
148
|
-
let changes = 0;
|
|
149
|
-
const relPath = path_1.default.relative(process.cwd(), filePath);
|
|
150
|
-
const callExpressions = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.CallExpression);
|
|
151
|
-
for (const call of callExpressions) {
|
|
152
|
-
const expression = call.getExpression();
|
|
153
|
-
if (!ts_morph_1.Node.isIdentifier(expression) ||
|
|
154
|
-
expression.getText() !== DEFINE_CONFIG_NAME) {
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
const args = call.getArguments();
|
|
158
|
-
if (args.length === 0)
|
|
159
|
-
continue;
|
|
160
|
-
const configArg = args[0];
|
|
161
|
-
if (!ts_morph_1.Node.isObjectLiteralExpression(configArg))
|
|
162
|
-
continue;
|
|
163
|
-
const actionsProperty = configArg.getProperty(ACTIONS_PROPERTY_NAME);
|
|
164
|
-
if (!actionsProperty || !ts_morph_1.Node.isPropertyAssignment(actionsProperty))
|
|
165
|
-
continue;
|
|
166
|
-
const actionsInitializer = actionsProperty.getInitializer();
|
|
167
|
-
if (!actionsInitializer ||
|
|
168
|
-
!ts_morph_1.Node.isArrayLiteralExpression(actionsInitializer))
|
|
169
|
-
continue;
|
|
170
|
-
const elements = actionsInitializer.getElements();
|
|
171
|
-
const requestCorrectionIndex = elements.findIndex((el) => ts_morph_1.Node.isObjectLiteralExpression(el) &&
|
|
172
|
-
isActionOfType(el, REQUEST_CORRECTION_TYPE));
|
|
173
|
-
if (requestCorrectionIndex === -1)
|
|
174
|
-
continue;
|
|
175
|
-
const requestCorrection = elements[requestCorrectionIndex];
|
|
176
|
-
const flagsText = getNonEmptyArrayPropertyText(requestCorrection, FLAGS_PROPERTY_NAME);
|
|
177
|
-
const conditionalsText = getNonEmptyArrayPropertyText(requestCorrection, CONDITIONALS_PROPERTY_NAME);
|
|
178
|
-
// Nothing on REQUEST_CORRECTION that approve/reject would need to inherit.
|
|
179
|
-
if (!flagsText && !conditionalsText)
|
|
180
|
-
continue;
|
|
181
|
-
const typeStyle = getTypeInitializerStyle(requestCorrection);
|
|
182
|
-
let insertAt = requestCorrectionIndex + 1;
|
|
183
|
-
for (const spec of CORRECTION_ACTIONS_TO_ADD) {
|
|
184
|
-
const alreadyPresent = actionsInitializer
|
|
185
|
-
.getElements()
|
|
186
|
-
.some((el) => ts_morph_1.Node.isObjectLiteralExpression(el) &&
|
|
187
|
-
isActionOfType(el, spec.actionType));
|
|
188
|
-
if (alreadyPresent)
|
|
189
|
-
continue;
|
|
190
|
-
const text = buildCorrectionActionText(spec, typeStyle, flagsText, conditionalsText);
|
|
191
|
-
actionsInitializer.insertElement(insertAt, text);
|
|
192
|
-
insertAt++;
|
|
193
|
-
changes++;
|
|
194
|
-
console.log(` [${relPath}] Added ${spec.actionType} action carrying over REQUEST_CORRECTION's flags/conditionals`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return changes;
|
|
198
|
-
}
|
|
199
|
-
function main() {
|
|
200
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
202
|
-
console.log(`Scanning for defineConfig calls in: ${srcDir}\n`);
|
|
203
|
-
const project = new ts_morph_1.Project({
|
|
204
|
-
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
205
|
-
skipAddingFilesFromTsConfig: false
|
|
206
|
-
});
|
|
207
|
-
const sourceFiles = project.getSourceFiles().filter((sf) => {
|
|
208
|
-
const fp = sf.getFilePath();
|
|
209
|
-
return fp.includes('/src/') && !fp.includes('/node_modules/');
|
|
210
|
-
});
|
|
211
|
-
console.log(`Found ${sourceFiles.length} source file(s) to analyse.\n`);
|
|
212
|
-
let totalChanges = 0;
|
|
213
|
-
const modifiedFiles = [];
|
|
214
|
-
for (const sourceFile of sourceFiles) {
|
|
215
|
-
const filePath = sourceFile.getFilePath();
|
|
216
|
-
const changes = processFile(filePath, project);
|
|
217
|
-
if (changes > 0) {
|
|
218
|
-
totalChanges += changes;
|
|
219
|
-
modifiedFiles.push(filePath);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (modifiedFiles.length === 0) {
|
|
223
|
-
console.log('No REQUEST_CORRECTION actions with flags/conditionals found. Nothing to do.');
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
|
|
227
|
-
for (const filePath of modifiedFiles) {
|
|
228
|
-
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
229
|
-
yield sourceFile.save();
|
|
230
|
-
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
231
|
-
}
|
|
232
|
-
console.log(`\nDone. Added ${totalChanges} correction action config(s) across ${modifiedFiles.length} file(s).`);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.1/index.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBAEpD"}
|