@opencrvs/toolkit 2.0.0-rc.408d6cf → 2.0.0-rc.414b16c

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.
@@ -85,6 +85,58 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
85
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
86
86
  }, z.core.$strip>;
87
87
  conditionals: z.ZodOptional<z.ZodNever>;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
91
+ icon: z.ZodOptional<z.ZodString>;
92
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
93
+ type: z.ZodLiteral<"SHOW">;
94
+ conditional: z.ZodAny;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ type: z.ZodLiteral<"ENABLE">;
97
+ conditional: z.ZodAny;
98
+ }, z.core.$strip>], "type">>>;
99
+ type: z.ZodLiteral<"ASSIGN">;
100
+ flags: z.ZodOptional<z.ZodNever>;
101
+ }, z.core.$strip>, z.ZodObject<{
102
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
103
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
104
+ icon: z.ZodOptional<z.ZodString>;
105
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
106
+ type: z.ZodLiteral<"SHOW">;
107
+ conditional: z.ZodAny;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ type: z.ZodLiteral<"ENABLE">;
110
+ conditional: z.ZodAny;
111
+ }, z.core.$strip>], "type">>>;
112
+ type: z.ZodLiteral<"UNASSIGN">;
113
+ flags: z.ZodOptional<z.ZodNever>;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
116
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
117
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
118
+ readonly INCOMPLETE: "incomplete";
119
+ readonly REJECTED: "rejected";
120
+ readonly CORRECTION_REQUESTED: "correction-requested";
121
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
122
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
123
+ }>]>, z.ZodString]>;
124
+ operation: z.ZodEnum<{
125
+ add: "add";
126
+ remove: "remove";
127
+ }>;
128
+ conditional: z.ZodOptional<z.ZodAny>;
129
+ }, z.core.$strip>>>>;
130
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
131
+ icon: z.ZodOptional<z.ZodString>;
132
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
133
+ type: z.ZodLiteral<"SHOW">;
134
+ conditional: z.ZodAny;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ type: z.ZodLiteral<"ENABLE">;
137
+ conditional: z.ZodAny;
138
+ }, z.core.$strip>], "type">>>;
139
+ type: z.ZodLiteral<"DELETE">;
88
140
  }, z.core.$strip>, z.ZodObject<{
89
141
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
90
142
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -151,6 +203,78 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
151
203
  declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
152
204
  register: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
153
205
  }, z.core.$strip>>;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
208
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
209
+ readonly INCOMPLETE: "incomplete";
210
+ readonly REJECTED: "rejected";
211
+ readonly CORRECTION_REQUESTED: "correction-requested";
212
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
213
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
214
+ }>]>, z.ZodString]>;
215
+ operation: z.ZodEnum<{
216
+ add: "add";
217
+ remove: "remove";
218
+ }>;
219
+ conditional: z.ZodOptional<z.ZodAny>;
220
+ }, z.core.$strip>>>>;
221
+ type: z.ZodLiteral<"DUPLICATE_DETECTED">;
222
+ label: z.ZodOptional<z.ZodNever>;
223
+ supportingCopy: z.ZodOptional<z.ZodNever>;
224
+ icon: z.ZodOptional<z.ZodNever>;
225
+ conditionals: z.ZodOptional<z.ZodNever>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
228
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
229
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
230
+ readonly INCOMPLETE: "incomplete";
231
+ readonly REJECTED: "rejected";
232
+ readonly CORRECTION_REQUESTED: "correction-requested";
233
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
234
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
235
+ }>]>, z.ZodString]>;
236
+ operation: z.ZodEnum<{
237
+ add: "add";
238
+ remove: "remove";
239
+ }>;
240
+ conditional: z.ZodOptional<z.ZodAny>;
241
+ }, z.core.$strip>>>>;
242
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
243
+ icon: z.ZodOptional<z.ZodString>;
244
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
245
+ type: z.ZodLiteral<"SHOW">;
246
+ conditional: z.ZodAny;
247
+ }, z.core.$strip>, z.ZodObject<{
248
+ type: z.ZodLiteral<"ENABLE">;
249
+ conditional: z.ZodAny;
250
+ }, z.core.$strip>], "type">>>;
251
+ type: z.ZodLiteral<"MARK_AS_DUPLICATE">;
252
+ }, z.core.$strip>, z.ZodObject<{
253
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
254
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
255
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
256
+ readonly INCOMPLETE: "incomplete";
257
+ readonly REJECTED: "rejected";
258
+ readonly CORRECTION_REQUESTED: "correction-requested";
259
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
260
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
261
+ }>]>, z.ZodString]>;
262
+ operation: z.ZodEnum<{
263
+ add: "add";
264
+ remove: "remove";
265
+ }>;
266
+ conditional: z.ZodOptional<z.ZodAny>;
267
+ }, z.core.$strip>>>>;
268
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
269
+ icon: z.ZodOptional<z.ZodString>;
270
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
271
+ type: z.ZodLiteral<"SHOW">;
272
+ conditional: z.ZodAny;
273
+ }, z.core.$strip>, z.ZodObject<{
274
+ type: z.ZodLiteral<"ENABLE">;
275
+ conditional: z.ZodAny;
276
+ }, z.core.$strip>], "type">>>;
277
+ type: z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">;
154
278
  }, z.core.$strip>, z.ZodObject<{
155
279
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
156
280
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -320,6 +444,58 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
320
444
  }, z.core.$strip>;
321
445
  }, z.core.$strip>], "type">>;
322
446
  }, z.core.$strip>;
447
+ }, z.core.$strip>, z.ZodObject<{
448
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
449
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
450
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
451
+ readonly INCOMPLETE: "incomplete";
452
+ readonly REJECTED: "rejected";
453
+ readonly CORRECTION_REQUESTED: "correction-requested";
454
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
455
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
456
+ }>]>, z.ZodString]>;
457
+ operation: z.ZodEnum<{
458
+ add: "add";
459
+ remove: "remove";
460
+ }>;
461
+ conditional: z.ZodOptional<z.ZodAny>;
462
+ }, z.core.$strip>>>>;
463
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
464
+ icon: z.ZodOptional<z.ZodString>;
465
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
466
+ type: z.ZodLiteral<"SHOW">;
467
+ conditional: z.ZodAny;
468
+ }, z.core.$strip>, z.ZodObject<{
469
+ type: z.ZodLiteral<"ENABLE">;
470
+ conditional: z.ZodAny;
471
+ }, z.core.$strip>], "type">>>;
472
+ type: z.ZodLiteral<"APPROVE_CORRECTION">;
473
+ }, z.core.$strip>, z.ZodObject<{
474
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
475
+ flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
476
+ id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
477
+ readonly INCOMPLETE: "incomplete";
478
+ readonly REJECTED: "rejected";
479
+ readonly CORRECTION_REQUESTED: "correction-requested";
480
+ readonly POTENTIAL_DUPLICATE: "potential-duplicate";
481
+ readonly EDIT_IN_PROGRESS: "edit-in-progress";
482
+ }>]>, z.ZodString]>;
483
+ operation: z.ZodEnum<{
484
+ add: "add";
485
+ remove: "remove";
486
+ }>;
487
+ conditional: z.ZodOptional<z.ZodAny>;
488
+ }, z.core.$strip>>>>;
489
+ supportingCopy: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
490
+ icon: z.ZodOptional<z.ZodString>;
491
+ conditionals: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
492
+ type: z.ZodLiteral<"SHOW">;
493
+ conditional: z.ZodAny;
494
+ }, z.core.$strip>, z.ZodObject<{
495
+ type: z.ZodLiteral<"ENABLE">;
496
+ conditional: z.ZodAny;
497
+ }, z.core.$strip>], "type">>>;
498
+ type: z.ZodLiteral<"REJECT_CORRECTION">;
323
499
  }, z.core.$strip>, z.ZodObject<{
324
500
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
325
501
  flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -3228,6 +3228,52 @@ var NotifyConfig = ActionConfigBase.extend(
3228
3228
  type: z24.literal(ActionType.NOTIFY)
3229
3229
  }).shape
3230
3230
  );
3231
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
3232
+ z24.object({
3233
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
3234
+ label: z24.never().optional().describe(
3235
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
3236
+ ),
3237
+ supportingCopy: z24.never().optional(),
3238
+ icon: z24.never().optional().describe(
3239
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
3240
+ ),
3241
+ conditionals: z24.never().optional().describe(
3242
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
3243
+ )
3244
+ }).shape
3245
+ );
3246
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
3247
+ z24.object({
3248
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
3249
+ }).shape
3250
+ );
3251
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
3252
+ z24.object({
3253
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
3254
+ }).shape
3255
+ );
3256
+ var AssignConfig = ActionConfigBase.extend(
3257
+ z24.object({
3258
+ type: z24.literal(ActionType.ASSIGN),
3259
+ flags: z24.never().optional().describe(
3260
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3261
+ )
3262
+ }).shape
3263
+ );
3264
+ var UnassignConfig = ActionConfigBase.extend(
3265
+ z24.object({
3266
+ type: z24.literal(ActionType.UNASSIGN),
3267
+ flags: z24.never().optional().describe(
3268
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3269
+ )
3270
+ }).shape
3271
+ );
3272
+ var DeleteConfig = ActionConfigBase.extend(
3273
+ z24.object({
3274
+ type: z24.literal(ActionType.DELETE)
3275
+ }).shape
3276
+ );
3231
3277
  var DeclareConfig = DeclarationActionBase.extend(
3232
3278
  z24.object({
3233
3279
  type: z24.literal(ActionType.DECLARE),
@@ -3290,7 +3336,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
3290
3336
  correctionForm: ActionFormConfig
3291
3337
  }).shape
3292
3338
  );
3293
- var CustomActionConfig = ActionConfigBase.merge(
3339
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
3340
+ z24.object({
3341
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
3342
+ }).shape
3343
+ );
3344
+ var RejectCorrectionConfig = ActionConfigBase.extend(
3345
+ z24.object({
3346
+ type: z24.literal(ActionType.REJECT_CORRECTION)
3347
+ }).shape
3348
+ );
3349
+ var CustomActionConfig = ActionConfigBase.extend(
3294
3350
  z24.object({
3295
3351
  type: z24.literal(ActionType.CUSTOM),
3296
3352
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -3301,7 +3357,7 @@ var CustomActionConfig = ActionConfigBase.merge(
3301
3357
  auditHistoryLabel: TranslationConfig.describe(
3302
3358
  'The label to show in audit history for this action. For example "Approved".'
3303
3359
  )
3304
- })
3360
+ }).shape
3305
3361
  );
3306
3362
  var ActionConfig = z24.discriminatedUnion("type", [
3307
3363
  /*
@@ -3312,6 +3368,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
3312
3368
  id: "ReadActionConfig",
3313
3369
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3314
3370
  }),
3371
+ AssignConfig.meta({
3372
+ id: "AssignActionConfig",
3373
+ description: "Configuration for assigning a record to the current user."
3374
+ }),
3375
+ UnassignConfig.meta({
3376
+ id: "UnassignActionConfig",
3377
+ description: "Configuration for unassigning a record from its current assignee."
3378
+ }),
3379
+ DeleteConfig.meta({
3380
+ id: "DeleteActionConfig",
3381
+ description: "Configuration for deleting a draft record."
3382
+ }),
3315
3383
  NotifyConfig.meta({
3316
3384
  id: "NotifyActionConfig",
3317
3385
  description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
@@ -3320,6 +3388,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
3320
3388
  id: "DeclareActionConfig",
3321
3389
  description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3322
3390
  }),
3391
+ DuplicateDetectedConfig.meta({
3392
+ id: "DuplicateDetectedActionConfig",
3393
+ 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."
3394
+ }),
3395
+ MarkAsDuplicateConfig.meta({
3396
+ id: "MarkAsDuplicateActionConfig",
3397
+ description: "Configuration for marking a record as a duplicate."
3398
+ }),
3399
+ MarkAsNotDuplicateConfig.meta({
3400
+ id: "MarkAsNotDuplicateActionConfig",
3401
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
3402
+ }),
3323
3403
  RejectConfig.meta({
3324
3404
  id: "RejectActionConfig",
3325
3405
  description: "Configuration for rejecting a record before registration."
@@ -3336,6 +3416,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
3336
3416
  id: "RequestCorrectionActionConfig",
3337
3417
  description: "Configuration for requesting a correction on a registered record."
3338
3418
  }),
3419
+ ApproveCorrectionConfig.meta({
3420
+ id: "ApproveCorrectionActionConfig",
3421
+ description: "Configuration for approving a requested correction."
3422
+ }),
3423
+ RejectCorrectionConfig.meta({
3424
+ id: "RejectCorrectionActionConfig",
3425
+ description: "Configuration for rejecting a requested correction."
3426
+ }),
3339
3427
  EditActionConfig.meta({
3340
3428
  id: "EditActionConfig",
3341
3429
  description: "Configuration for editing a record before registration."
@@ -4494,9 +4582,6 @@ function getActionConfig({
4494
4582
  if (a.type === ActionType.CUSTOM && customActionType) {
4495
4583
  return a.customActionType === customActionType;
4496
4584
  }
4497
- if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4498
- return a.type === ActionType.REQUEST_CORRECTION;
4499
- }
4500
4585
  return a.type === actionType;
4501
4586
  });
4502
4587
  }
@@ -5650,7 +5735,7 @@ function validateActionFlags(event2, ctx) {
5650
5735
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
5651
5736
  const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
5652
5737
  const actionFlagIds = event2.actions.flatMap(
5653
- (action) => action.flags.map((flag2) => flag2.id)
5738
+ (action) => (action.flags ?? []).map((flag2) => flag2.id)
5654
5739
  );
5655
5740
  for (const actionFlagId of actionFlagIds) {
5656
5741
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -6689,7 +6774,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6689
6774
  const declaration = aggregateActionDeclarations(eventUpToThisAction);
6690
6775
  const annotation = aggregateActionAnnotations(eventUpToThisAction);
6691
6776
  const form = { ...declaration, ...annotation };
6692
- const flagsWithMetConditions = actionConfig.flags.filter(
6777
+ const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
6693
6778
  ({ conditional }) => (
6694
6779
  // If conditional is not provided, the flag is resolved
6695
6780
  conditional ? isFlagConditionMet(conditional, form, action) : true
@@ -2685,6 +2685,52 @@ var NotifyConfig = ActionConfigBase.extend(
2685
2685
  type: z24.literal(ActionType.NOTIFY)
2686
2686
  }).shape
2687
2687
  );
2688
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2689
+ z24.object({
2690
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2691
+ label: z24.never().optional().describe(
2692
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2693
+ ),
2694
+ supportingCopy: z24.never().optional(),
2695
+ icon: z24.never().optional().describe(
2696
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2697
+ ),
2698
+ conditionals: z24.never().optional().describe(
2699
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2700
+ )
2701
+ }).shape
2702
+ );
2703
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2704
+ z24.object({
2705
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2706
+ }).shape
2707
+ );
2708
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2709
+ z24.object({
2710
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2711
+ }).shape
2712
+ );
2713
+ var AssignConfig = ActionConfigBase.extend(
2714
+ z24.object({
2715
+ type: z24.literal(ActionType.ASSIGN),
2716
+ flags: z24.never().optional().describe(
2717
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2718
+ )
2719
+ }).shape
2720
+ );
2721
+ var UnassignConfig = ActionConfigBase.extend(
2722
+ z24.object({
2723
+ type: z24.literal(ActionType.UNASSIGN),
2724
+ flags: z24.never().optional().describe(
2725
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2726
+ )
2727
+ }).shape
2728
+ );
2729
+ var DeleteConfig = ActionConfigBase.extend(
2730
+ z24.object({
2731
+ type: z24.literal(ActionType.DELETE)
2732
+ }).shape
2733
+ );
2688
2734
  var DeclareConfig = DeclarationActionBase.extend(
2689
2735
  z24.object({
2690
2736
  type: z24.literal(ActionType.DECLARE),
@@ -2747,7 +2793,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2747
2793
  correctionForm: ActionFormConfig
2748
2794
  }).shape
2749
2795
  );
2750
- var CustomActionConfig = ActionConfigBase.merge(
2796
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2797
+ z24.object({
2798
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2799
+ }).shape
2800
+ );
2801
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2802
+ z24.object({
2803
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2804
+ }).shape
2805
+ );
2806
+ var CustomActionConfig = ActionConfigBase.extend(
2751
2807
  z24.object({
2752
2808
  type: z24.literal(ActionType.CUSTOM),
2753
2809
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2758,7 +2814,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2758
2814
  auditHistoryLabel: TranslationConfig.describe(
2759
2815
  'The label to show in audit history for this action. For example "Approved".'
2760
2816
  )
2761
- })
2817
+ }).shape
2762
2818
  );
2763
2819
  var ActionConfig = z24.discriminatedUnion("type", [
2764
2820
  /*
@@ -2769,6 +2825,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
2769
2825
  id: "ReadActionConfig",
2770
2826
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2771
2827
  }),
2828
+ AssignConfig.meta({
2829
+ id: "AssignActionConfig",
2830
+ description: "Configuration for assigning a record to the current user."
2831
+ }),
2832
+ UnassignConfig.meta({
2833
+ id: "UnassignActionConfig",
2834
+ description: "Configuration for unassigning a record from its current assignee."
2835
+ }),
2836
+ DeleteConfig.meta({
2837
+ id: "DeleteActionConfig",
2838
+ description: "Configuration for deleting a draft record."
2839
+ }),
2772
2840
  NotifyConfig.meta({
2773
2841
  id: "NotifyActionConfig",
2774
2842
  description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
@@ -2777,6 +2845,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
2777
2845
  id: "DeclareActionConfig",
2778
2846
  description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2779
2847
  }),
2848
+ DuplicateDetectedConfig.meta({
2849
+ id: "DuplicateDetectedActionConfig",
2850
+ 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."
2851
+ }),
2852
+ MarkAsDuplicateConfig.meta({
2853
+ id: "MarkAsDuplicateActionConfig",
2854
+ description: "Configuration for marking a record as a duplicate."
2855
+ }),
2856
+ MarkAsNotDuplicateConfig.meta({
2857
+ id: "MarkAsNotDuplicateActionConfig",
2858
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2859
+ }),
2780
2860
  RejectConfig.meta({
2781
2861
  id: "RejectActionConfig",
2782
2862
  description: "Configuration for rejecting a record before registration."
@@ -2793,6 +2873,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2793
2873
  id: "RequestCorrectionActionConfig",
2794
2874
  description: "Configuration for requesting a correction on a registered record."
2795
2875
  }),
2876
+ ApproveCorrectionConfig.meta({
2877
+ id: "ApproveCorrectionActionConfig",
2878
+ description: "Configuration for approving a requested correction."
2879
+ }),
2880
+ RejectCorrectionConfig.meta({
2881
+ id: "RejectCorrectionActionConfig",
2882
+ description: "Configuration for rejecting a requested correction."
2883
+ }),
2796
2884
  EditActionConfig.meta({
2797
2885
  id: "EditActionConfig",
2798
2886
  description: "Configuration for editing a record before registration."
@@ -3920,7 +4008,7 @@ function validateActionFlags(event2, ctx) {
3920
4008
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3921
4009
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3922
4010
  const actionFlagIds = event2.actions.flatMap(
3923
- (action) => action.flags.map((flag) => flag.id)
4011
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3924
4012
  );
3925
4013
  for (const actionFlagId of actionFlagIds) {
3926
4014
  const isConfigured = configuredFlagIds.includes(actionFlagId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.408d6cf",
3
+ "version": "2.0.0-rc.414b16c",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {