@opencrvs/toolkit 2.0.0-rc.cf1e33b → 2.0.0-rc.cf3b4c8

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.
@@ -770,6 +770,11 @@ var FieldTypesToHideInReview = [
770
770
  FieldType.ALPHA_PRINT_BUTTON,
771
771
  FieldType.ALPHA_HIDDEN
772
772
  ];
773
+ var HiddenFieldTypes = [
774
+ FieldType.HTTP,
775
+ FieldType.QUERY_PARAM_READER,
776
+ FieldType.ALPHA_HIDDEN
777
+ ];
773
778
 
774
779
  // ../commons/src/events/FieldValue.ts
775
780
  var z12 = __toESM(require("zod/v4"));
@@ -1478,7 +1483,8 @@ var Range = import_v4.z.object({
1478
1483
  });
1479
1484
  var ContainsFlags = import_v4.z.object({
1480
1485
  anyOf: import_v4.z.array(Flag).optional(),
1481
- noneOf: import_v4.z.array(Flag).optional()
1486
+ noneOf: import_v4.z.array(Flag).optional(),
1487
+ allOf: import_v4.z.array(Flag).optional()
1482
1488
  }).meta({
1483
1489
  id: "ContainsFlags"
1484
1490
  });
@@ -1750,6 +1756,7 @@ var NumberField = BaseField.extend({
1750
1756
  configuration: import_v43.default.object({
1751
1757
  min: import_v43.default.number().optional().describe("Minimum value"),
1752
1758
  max: import_v43.default.number().optional().describe("Maximum value"),
1759
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1753
1760
  prefix: TranslationConfig.optional(),
1754
1761
  postfix: TranslationConfig.optional()
1755
1762
  }).optional()
@@ -2673,6 +2680,51 @@ var ReadActionConfig = ActionConfigBase.extend(
2673
2680
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2674
2681
  }).shape
2675
2682
  );
2683
+ var NotifyConfig = ActionConfigBase.extend(
2684
+ z24.object({
2685
+ type: z24.literal(ActionType.NOTIFY)
2686
+ }).shape
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
+ }).shape
2717
+ );
2718
+ var UnassignConfig = ActionConfigBase.extend(
2719
+ z24.object({
2720
+ type: z24.literal(ActionType.UNASSIGN)
2721
+ }).shape
2722
+ );
2723
+ var DeleteConfig = ActionConfigBase.extend(
2724
+ z24.object({
2725
+ type: z24.literal(ActionType.DELETE)
2726
+ }).shape
2727
+ );
2676
2728
  var DeclareConfig = DeclarationActionBase.extend(
2677
2729
  z24.object({
2678
2730
  type: z24.literal(ActionType.DECLARE),
@@ -2735,7 +2787,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2735
2787
  correctionForm: ActionFormConfig
2736
2788
  }).shape
2737
2789
  );
2738
- var CustomActionConfig = ActionConfigBase.merge(
2790
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2791
+ z24.object({
2792
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2793
+ }).shape
2794
+ );
2795
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2796
+ z24.object({
2797
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2798
+ }).shape
2799
+ );
2800
+ var CustomActionConfig = ActionConfigBase.extend(
2739
2801
  z24.object({
2740
2802
  type: z24.literal(ActionType.CUSTOM),
2741
2803
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2746,7 +2808,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2746
2808
  auditHistoryLabel: TranslationConfig.describe(
2747
2809
  'The label to show in audit history for this action. For example "Approved".'
2748
2810
  )
2749
- })
2811
+ }).shape
2750
2812
  );
2751
2813
  var ActionConfig = z24.discriminatedUnion("type", [
2752
2814
  /*
@@ -2757,9 +2819,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
2757
2819
  id: "ReadActionConfig",
2758
2820
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2759
2821
  }),
2822
+ AssignConfig.meta({
2823
+ id: "AssignActionConfig",
2824
+ description: "Configuration for assigning a record to the current user."
2825
+ }),
2826
+ UnassignConfig.meta({
2827
+ id: "UnassignActionConfig",
2828
+ description: "Configuration for unassigning a record from its current assignee."
2829
+ }),
2830
+ DeleteConfig.meta({
2831
+ id: "DeleteActionConfig",
2832
+ description: "Configuration for deleting a draft record."
2833
+ }),
2834
+ NotifyConfig.meta({
2835
+ id: "NotifyActionConfig",
2836
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2837
+ }),
2760
2838
  DeclareConfig.meta({
2761
2839
  id: "DeclareActionConfig",
2762
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2840
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2841
+ }),
2842
+ DuplicateDetectedConfig.meta({
2843
+ id: "DuplicateDetectedActionConfig",
2844
+ 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."
2845
+ }),
2846
+ MarkAsDuplicateConfig.meta({
2847
+ id: "MarkAsDuplicateActionConfig",
2848
+ description: "Configuration for marking a record as a duplicate."
2849
+ }),
2850
+ MarkAsNotDuplicateConfig.meta({
2851
+ id: "MarkAsNotDuplicateActionConfig",
2852
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2763
2853
  }),
2764
2854
  RejectConfig.meta({
2765
2855
  id: "RejectActionConfig",
@@ -2777,6 +2867,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2777
2867
  id: "RequestCorrectionActionConfig",
2778
2868
  description: "Configuration for requesting a correction on a registered record."
2779
2869
  }),
2870
+ ApproveCorrectionConfig.meta({
2871
+ id: "ApproveCorrectionActionConfig",
2872
+ description: "Configuration for approving a requested correction."
2873
+ }),
2874
+ RejectCorrectionConfig.meta({
2875
+ id: "RejectCorrectionActionConfig",
2876
+ description: "Configuration for rejecting a requested correction."
2877
+ }),
2780
2878
  EditActionConfig.meta({
2781
2879
  id: "EditActionConfig",
2782
2880
  description: "Configuration for editing a record before registration."
@@ -3193,7 +3291,7 @@ var getActionAnnotationFields = (actionConfig) => {
3193
3291
  if (actionConfig.type === ActionType.CUSTOM) {
3194
3292
  return actionConfig.form;
3195
3293
  }
3196
- if ("review" in actionConfig) {
3294
+ if ("review" in actionConfig && actionConfig.review != null) {
3197
3295
  return actionConfig.review.fields;
3198
3296
  }
3199
3297
  return [];
@@ -4697,12 +4795,53 @@ var updateActions = ActionTypes.extract([
4697
4795
  ActionType.ARCHIVE,
4698
4796
  ActionType.PRINT_CERTIFICATE,
4699
4797
  ActionType.REQUEST_CORRECTION,
4798
+ ActionType.APPROVE_CORRECTION,
4799
+ ActionType.REJECT_CORRECTION,
4700
4800
  ActionType.CUSTOM
4701
4801
  ]);
4702
4802
 
4703
4803
  // ../commons/src/events/state/flags.ts
4704
4804
  var import_lodash3 = require("lodash");
4705
4805
  var import_date_fns3 = require("date-fns");
4806
+ var INHERENT_FLAG_RULES = [
4807
+ {
4808
+ flag: InherentFlags.CORRECTION_REQUESTED,
4809
+ setOn: [ActionType.REQUEST_CORRECTION],
4810
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4811
+ },
4812
+ {
4813
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4814
+ // other status-changing action (see getStatusFromActions).
4815
+ flag: InherentFlags.INCOMPLETE,
4816
+ setOn: [ActionType.NOTIFY],
4817
+ resetOn: [
4818
+ ActionType.CREATE,
4819
+ ActionType.DECLARE,
4820
+ ActionType.REGISTER,
4821
+ ActionType.ARCHIVE
4822
+ ]
4823
+ },
4824
+ {
4825
+ flag: InherentFlags.REJECTED,
4826
+ setOn: [ActionType.REJECT],
4827
+ resetOn: [
4828
+ ActionType.NOTIFY,
4829
+ ActionType.DECLARE,
4830
+ ActionType.EDIT,
4831
+ ActionType.REGISTER
4832
+ ]
4833
+ },
4834
+ {
4835
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4836
+ setOn: [ActionType.DUPLICATE_DETECTED],
4837
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4838
+ },
4839
+ {
4840
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4841
+ setOn: [ActionType.EDIT],
4842
+ resetOnAnyOtherAction: true
4843
+ }
4844
+ ];
4706
4845
 
4707
4846
  // ../commons/src/events/defineConfig.ts
4708
4847
  var IGNORED_EVENT_TYPES = [
@@ -5448,6 +5587,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5448
5587
  id: "signature.upload.modal.title",
5449
5588
  defaultMessage: "Draw signature",
5450
5589
  description: "Title for the modal to draw signature"
5590
+ },
5591
+ // Zod applies the schema default at parse time, but this fixture bypasses
5592
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5593
+ configuration: {
5594
+ maxFileSize: 5 * 1024 * 1024
5451
5595
  }
5452
5596
  }
5453
5597
  ]
@@ -6004,6 +6148,20 @@ var tennisClubMembershipEvent = defineConfig({
6004
6148
  },
6005
6149
  review: TENNIS_CLUB_DECLARATION_REVIEW
6006
6150
  },
6151
+ {
6152
+ type: ActionType.NOTIFY,
6153
+ label: {
6154
+ defaultMessage: "Notify health worker",
6155
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6156
+ id: "event.tennis-club-membership.action.notify.label"
6157
+ },
6158
+ flags: [
6159
+ {
6160
+ id: "health-worker-notified",
6161
+ operation: "add"
6162
+ }
6163
+ ]
6164
+ },
6007
6165
  {
6008
6166
  type: ActionType.REJECT,
6009
6167
  label: {
@@ -6246,6 +6404,17 @@ var tennisClubMembershipEvent = defineConfig({
6246
6404
  }
6247
6405
  }
6248
6406
  ],
6407
+ flags: [
6408
+ {
6409
+ id: "health-worker-notified",
6410
+ requiresAction: false,
6411
+ label: {
6412
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6413
+ defaultMessage: "Health worker notified",
6414
+ description: "Label for the health-worker-notified flag"
6415
+ }
6416
+ }
6417
+ ],
6249
6418
  advancedSearch: [
6250
6419
  {
6251
6420
  title: {
@@ -7241,6 +7410,13 @@ var ACTION_FILTERS = {
7241
7410
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7242
7411
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7243
7412
  };
7413
+ var REJECTED_ACTIONS = [
7414
+ ActionType.READ,
7415
+ ActionType.NOTIFY,
7416
+ ActionType.CUSTOM,
7417
+ ActionType.EDIT,
7418
+ ActionType.ARCHIVE
7419
+ ];
7244
7420
 
7245
7421
  // ../commons/src/events/FileUtils.ts
7246
7422
  var import_lodash7 = require("lodash");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.cf1e33b",
3
+ "version": "2.0.0-rc.cf3b4c8",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {