@opencrvs/toolkit 2.1.0-rc.b0003b1 → 2.1.0-rc.b2f00ee

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 (78) hide show
  1. package/build.sh +2 -2
  2. package/dist/application-config/index.js +15 -1
  3. package/dist/cli.js +165 -5154
  4. package/dist/commons/api/router.d.ts +3667 -2887
  5. package/dist/commons/application-config/index.d.ts +6 -6
  6. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  7. package/dist/commons/events/ActionConfig.d.ts +279 -70
  8. package/dist/commons/events/ActionDocument.d.ts +155 -111
  9. package/dist/commons/events/ActionInput.d.ts +26 -6
  10. package/dist/commons/events/ActionType.d.ts +63 -58
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -501
  12. package/dist/commons/events/AuditLog.d.ts +151 -40
  13. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  14. package/dist/commons/events/Conditional.d.ts +3 -3
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  16. package/dist/commons/events/Draft.d.ts +37 -35
  17. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  18. package/dist/commons/events/EventConfig.d.ts +5 -5
  19. package/dist/commons/events/EventDocument.d.ts +66 -44
  20. package/dist/commons/events/EventIndex.d.ts +62 -62
  21. package/dist/commons/events/EventMetadata.d.ts +40 -40
  22. package/dist/commons/events/FieldConfig.d.ts +341 -331
  23. package/dist/commons/events/FieldType.d.ts +51 -51
  24. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  25. package/dist/commons/events/FieldValue.d.ts +12 -12
  26. package/dist/commons/events/Flag.d.ts +15 -15
  27. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  28. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  29. package/dist/commons/events/WorkqueueConfig.d.ts +827 -824
  30. package/dist/commons/events/deduplication.d.ts +1 -1
  31. package/dist/commons/events/event.d.ts +2 -2
  32. package/dist/commons/events/field.d.ts +69 -198
  33. package/dist/commons/events/index.d.ts +1 -0
  34. package/dist/commons/events/locationPayloads.d.ts +95 -0
  35. package/dist/commons/events/locations.d.ts +103 -6
  36. package/dist/commons/events/mocks.test.utils.d.ts +18 -4
  37. package/dist/commons/events/scopes.d.ts +5 -4
  38. package/dist/commons/events/state/index.d.ts +17 -17
  39. package/dist/commons/events/state/utils.d.ts +7 -7
  40. package/dist/commons/events/test.utils.d.ts +44 -39
  41. package/dist/commons/events/utils.d.ts +127 -105
  42. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  43. package/dist/conditionals/index.js +3 -0
  44. package/dist/environment/derived-variables.d.ts +119 -131
  45. package/dist/environment/derived-variables.d.ts.map +1 -1
  46. package/dist/environment/derived-variables.js +0 -14
  47. package/dist/environment/logger.d.ts +3 -12
  48. package/dist/environment/logger.d.ts.map +1 -1
  49. package/dist/environment/manage-users.js +17 -7
  50. package/dist/environment/questions.d.ts +75 -74
  51. package/dist/environment/questions.d.ts.map +1 -1
  52. package/dist/environment/setup-environment.js +8 -28
  53. package/dist/environment/swarm-to-k8s.js +17 -7
  54. package/dist/environment/update-workflows.js +17 -7
  55. package/dist/environment/users.js +17 -7
  56. package/dist/environment/utils.d.ts +1 -1
  57. package/dist/environment/utils.js +17 -7
  58. package/dist/events/deduplication.d.ts +1 -1
  59. package/dist/events/index.js +380 -88
  60. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  61. package/dist/migrations/v2.0/index.js +88 -5144
  62. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  63. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  64. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  65. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  66. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  67. package/dist/migrations/v2.1/index.d.ts +6 -0
  68. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  69. package/dist/migrations/v2.1/index.js +218 -0
  70. package/dist/notification/index.js +328 -104
  71. package/dist/scopes/index.d.ts +148 -140
  72. package/dist/scopes/index.js +3 -0
  73. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  74. package/dist/templates/charts-values/opencrvs-services/values.yaml +0 -4
  75. package/opencrvs-toolkit-2.1.0-rc.b2f00ee.tgz +0 -0
  76. package/package.json +5 -5
  77. package/tsconfig.tsbuildinfo +1 -1
  78. package/opencrvs-toolkit-2.1.0-rc.b0003b1.tgz +0 -0
@@ -38,7 +38,7 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z45 = __toESM(require("zod/v4"));
41
+ var z46 = __toESM(require("zod/v4"));
42
42
 
43
43
  // ../commons/src/url.ts
44
44
  function joinUrl(base, path) {
@@ -79,6 +79,7 @@ var RecordScopeTypeV2 = z2.enum([
79
79
  "record.edit",
80
80
  "record.reject",
81
81
  "record.archive",
82
+ "record.unarchive",
82
83
  "record.review-duplicates",
83
84
  "record.register",
84
85
  "record.print-certified-copies",
@@ -95,6 +96,7 @@ var PlainScopeType = z2.enum([
95
96
  "integration.create",
96
97
  "record.import",
97
98
  "config.update-all",
99
+ "location.edit",
98
100
  "attachment.upload",
99
101
  "profile.electronic-signature",
100
102
  "user.read-only-my-audit",
@@ -184,6 +186,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
184
186
  "record.edit",
185
187
  "record.reject",
186
188
  "record.archive",
189
+ "record.unarchive",
187
190
  "record.review-duplicates",
188
191
  "record.register"
189
192
  ]);
@@ -325,6 +328,7 @@ var ActionType = {
325
328
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
326
329
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
327
330
  ARCHIVE: "ARCHIVE",
331
+ UNARCHIVE: "UNARCHIVE",
328
332
  // Record actions
329
333
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
330
334
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -344,6 +348,7 @@ var ConfirmableActions = [
344
348
  ActionType.REGISTER,
345
349
  ActionType.REJECT,
346
350
  ActionType.ARCHIVE,
351
+ ActionType.UNARCHIVE,
347
352
  ActionType.PRINT_CERTIFICATE,
348
353
  ActionType.REQUEST_CORRECTION,
349
354
  ActionType.APPROVE_CORRECTION,
@@ -362,6 +367,7 @@ var ActionTypes = z4.enum([
362
367
  "MARK_AS_DUPLICATE",
363
368
  "MARK_AS_NOT_DUPLICATE",
364
369
  "ARCHIVE",
370
+ "UNARCHIVE",
365
371
  "PRINT_CERTIFICATE",
366
372
  "REQUEST_CORRECTION",
367
373
  "REJECT_CORRECTION",
@@ -405,6 +411,7 @@ var WorkqueueActionType = ActionTypes.extract([
405
411
  ActionType.REJECT,
406
412
  ActionType.MARK_AS_DUPLICATE,
407
413
  ActionType.ARCHIVE,
414
+ ActionType.UNARCHIVE,
408
415
  ActionType.PRINT_CERTIFICATE,
409
416
  ActionType.REQUEST_CORRECTION
410
417
  ]);
@@ -466,6 +473,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
466
473
  "event.actions.unassign.request",
467
474
  "event.actions.read.request",
468
475
  "event.actions.archive.request",
476
+ "event.actions.unarchive.request",
469
477
  "event.actions.reinstate.request",
470
478
  "event.actions.print_certificate.request",
471
479
  "event.actions.correction.request.request",
@@ -523,6 +531,62 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
523
531
  requestData: z5.object({ id: z5.string() }),
524
532
  responseSummary: z5.object({ clientId: z5.string() })
525
533
  });
534
+ var createdVersionFields = {
535
+ id: z5.string(),
536
+ versionId: z5.string(),
537
+ name: z5.string(),
538
+ externalId: z5.string().nullish(),
539
+ effectiveFrom: z5.string(),
540
+ status: z5.string()
541
+ };
542
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
543
+ operation: z5.literal("locations.create"),
544
+ requestData: z5.object({
545
+ ...createdVersionFields,
546
+ administrativeAreaId: z5.string().nullish(),
547
+ locationType: z5.string().nullish()
548
+ })
549
+ });
550
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
551
+ operation: z5.literal("administrativeAreas.create"),
552
+ requestData: z5.object({
553
+ ...createdVersionFields,
554
+ parentId: z5.string().nullish()
555
+ })
556
+ });
557
+ var ChangedStringField = z5.object({ from: z5.string(), to: z5.string() });
558
+ var ChangedNullableStringField = z5.object({
559
+ from: z5.string().nullable(),
560
+ to: z5.string().nullable()
561
+ });
562
+ var updatedVersionRequestData = z5.object({
563
+ id: z5.string(),
564
+ versionId: z5.string(),
565
+ name: z5.string(),
566
+ externalId: z5.string().nullish(),
567
+ status: z5.string(),
568
+ effectiveFrom: z5.string(),
569
+ lastVersionId: z5.string()
570
+ });
571
+ var updatedVersionResponseSummary = z5.object({
572
+ previousVersionId: z5.string(),
573
+ versionId: z5.string(),
574
+ changed: z5.object({
575
+ name: ChangedStringField.optional(),
576
+ externalId: ChangedNullableStringField.optional(),
577
+ status: ChangedStringField.optional()
578
+ })
579
+ });
580
+ var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
581
+ operation: z5.literal("locations.update"),
582
+ requestData: updatedVersionRequestData,
583
+ responseSummary: updatedVersionResponseSummary
584
+ });
585
+ var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
586
+ operation: z5.literal("administrativeAreas.update"),
587
+ requestData: updatedVersionRequestData,
588
+ responseSummary: updatedVersionResponseSummary
589
+ });
526
590
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
527
591
  operation: z5.literal("attachments.upload"),
528
592
  requestData: z5.object({
@@ -598,6 +662,10 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
598
662
  IntegrationActivateEntrySchema,
599
663
  IntegrationDeleteEntrySchema,
600
664
  IntegrationRefreshSecretEntrySchema,
665
+ LocationCreateEntrySchema,
666
+ LocationUpdateEntrySchema,
667
+ AdministrativeAreaUpdateEntrySchema,
668
+ AdministrativeAreaCreateEntrySchema,
601
669
  AttachmentUploadEntrySchema,
602
670
  UserCreateEntrySchema,
603
671
  UserReasonEntrySchema,
@@ -1191,6 +1259,11 @@ var ArchiveAction = ActionBase.extend(
1191
1259
  content: ReasonContent
1192
1260
  }).shape
1193
1261
  );
1262
+ var UnarchiveAction = ActionBase.extend(
1263
+ z14.object({
1264
+ type: z14.literal(ActionType.UNARCHIVE)
1265
+ }).shape
1266
+ );
1194
1267
  var CreatedAction = ActionBase.extend(
1195
1268
  z14.object({
1196
1269
  type: z14.literal(ActionType.CREATE)
@@ -1204,9 +1277,10 @@ var NotifiedAction = ActionBase.extend(
1204
1277
  var EditAction = ActionBase.extend(
1205
1278
  z14.object({
1206
1279
  type: z14.literal(ActionType.EDIT),
1280
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1207
1281
  content: z14.object({
1208
1282
  comment: z14.string().describe("Comment for the edit action.").optional()
1209
- })
1283
+ }).optional()
1210
1284
  }).shape
1211
1285
  );
1212
1286
  var PrintContent = z14.object({
@@ -1257,6 +1331,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1257
1331
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1258
1332
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1259
1333
  ArchiveAction.meta({ id: "ArchiveAction" }),
1334
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1260
1335
  NotifiedAction.meta({ id: "NotifiedAction" }),
1261
1336
  RegisterAction.meta({ id: "RegisterAction" }),
1262
1337
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -2681,6 +2756,9 @@ var ActionConfigBase = z24.object({
2681
2756
  var DeclarationActionBase = ActionConfigBase.extend({
2682
2757
  deduplication: DeduplicationConfig.optional()
2683
2758
  });
2759
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2760
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2761
+ );
2684
2762
  var ReadActionConfig = ActionConfigBase.extend(
2685
2763
  z24.object({
2686
2764
  type: z24.literal(ActionType.READ),
@@ -2692,7 +2770,54 @@ var ReadActionConfig = ActionConfigBase.extend(
2692
2770
  );
2693
2771
  var NotifyConfig = ActionConfigBase.extend(
2694
2772
  z24.object({
2695
- type: z24.literal(ActionType.NOTIFY)
2773
+ type: z24.literal(ActionType.NOTIFY),
2774
+ form: actionConfirmationForm
2775
+ }).shape
2776
+ );
2777
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2778
+ z24.object({
2779
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2780
+ label: z24.never().optional().describe(
2781
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2782
+ ),
2783
+ supportingCopy: z24.never().optional(),
2784
+ icon: z24.never().optional().describe(
2785
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2786
+ ),
2787
+ conditionals: z24.never().optional().describe(
2788
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2789
+ )
2790
+ }).shape
2791
+ );
2792
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2793
+ z24.object({
2794
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2795
+ }).shape
2796
+ );
2797
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2798
+ z24.object({
2799
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2800
+ }).shape
2801
+ );
2802
+ var AssignConfig = ActionConfigBase.extend(
2803
+ z24.object({
2804
+ type: z24.literal(ActionType.ASSIGN),
2805
+ flags: z24.never().optional().describe(
2806
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2807
+ )
2808
+ }).shape
2809
+ );
2810
+ var UnassignConfig = ActionConfigBase.extend(
2811
+ z24.object({
2812
+ type: z24.literal(ActionType.UNASSIGN),
2813
+ flags: z24.never().optional().describe(
2814
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2815
+ )
2816
+ }).shape
2817
+ );
2818
+ var DeleteConfig = ActionConfigBase.extend(
2819
+ z24.object({
2820
+ type: z24.literal(ActionType.DELETE)
2696
2821
  }).shape
2697
2822
  );
2698
2823
  var DeclareConfig = DeclarationActionBase.extend(
@@ -2701,6 +2826,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2701
2826
  review: DeclarationReviewConfig.describe(
2702
2827
  "Configuration of the review page fields."
2703
2828
  ),
2829
+ form: actionConfirmationForm,
2704
2830
  dialogCopy: z24.object({
2705
2831
  notify: TranslationConfig.describe(
2706
2832
  "Confirmation text for the notify action"
@@ -2716,7 +2842,13 @@ var DeclareConfig = DeclarationActionBase.extend(
2716
2842
  );
2717
2843
  var ArchiveConfig = ActionConfigBase.extend(
2718
2844
  z24.object({
2719
- type: z24.literal(ActionType.ARCHIVE)
2845
+ type: z24.literal(ActionType.ARCHIVE),
2846
+ form: actionConfirmationForm
2847
+ }).shape
2848
+ );
2849
+ var UnarchiveConfig = ActionConfigBase.extend(
2850
+ z24.object({
2851
+ type: z24.literal(ActionType.UNARCHIVE)
2720
2852
  }).shape
2721
2853
  );
2722
2854
  var EditActionConfig = ActionConfigBase.extend(
@@ -2737,12 +2869,14 @@ var EditActionConfig = ActionConfigBase.extend(
2737
2869
  );
2738
2870
  var RejectConfig = ActionConfigBase.extend(
2739
2871
  z24.object({
2740
- type: z24.literal(ActionType.REJECT)
2872
+ type: z24.literal(ActionType.REJECT),
2873
+ form: actionConfirmationForm
2741
2874
  }).shape
2742
2875
  );
2743
2876
  var RegisterConfig = DeclarationActionBase.extend(
2744
2877
  z24.object({
2745
- type: z24.literal(ActionType.REGISTER)
2878
+ type: z24.literal(ActionType.REGISTER),
2879
+ form: actionConfirmationForm
2746
2880
  }).shape
2747
2881
  );
2748
2882
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -2757,7 +2891,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2757
2891
  correctionForm: ActionFormConfig
2758
2892
  }).shape
2759
2893
  );
2760
- var CustomActionConfig = ActionConfigBase.merge(
2894
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2895
+ z24.object({
2896
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2897
+ }).shape
2898
+ );
2899
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2900
+ z24.object({
2901
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2902
+ }).shape
2903
+ );
2904
+ var CustomActionConfig = ActionConfigBase.extend(
2761
2905
  z24.object({
2762
2906
  type: z24.literal(ActionType.CUSTOM),
2763
2907
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2768,7 +2912,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2768
2912
  auditHistoryLabel: TranslationConfig.describe(
2769
2913
  'The label to show in audit history for this action. For example "Approved".'
2770
2914
  )
2771
- })
2915
+ }).shape
2772
2916
  );
2773
2917
  var ActionConfig = z24.discriminatedUnion("type", [
2774
2918
  /*
@@ -2779,6 +2923,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
2779
2923
  id: "ReadActionConfig",
2780
2924
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2781
2925
  }),
2926
+ AssignConfig.meta({
2927
+ id: "AssignActionConfig",
2928
+ description: "Configuration for assigning a record to the current user."
2929
+ }),
2930
+ UnassignConfig.meta({
2931
+ id: "UnassignActionConfig",
2932
+ description: "Configuration for unassigning a record from its current assignee."
2933
+ }),
2934
+ DeleteConfig.meta({
2935
+ id: "DeleteActionConfig",
2936
+ description: "Configuration for deleting a draft record."
2937
+ }),
2782
2938
  NotifyConfig.meta({
2783
2939
  id: "NotifyActionConfig",
2784
2940
  description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
@@ -2787,6 +2943,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
2787
2943
  id: "DeclareActionConfig",
2788
2944
  description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2789
2945
  }),
2946
+ DuplicateDetectedConfig.meta({
2947
+ id: "DuplicateDetectedActionConfig",
2948
+ 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."
2949
+ }),
2950
+ MarkAsDuplicateConfig.meta({
2951
+ id: "MarkAsDuplicateActionConfig",
2952
+ description: "Configuration for marking a record as a duplicate."
2953
+ }),
2954
+ MarkAsNotDuplicateConfig.meta({
2955
+ id: "MarkAsNotDuplicateActionConfig",
2956
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2957
+ }),
2790
2958
  RejectConfig.meta({
2791
2959
  id: "RejectActionConfig",
2792
2960
  description: "Configuration for rejecting a record before registration."
@@ -2803,6 +2971,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2803
2971
  id: "RequestCorrectionActionConfig",
2804
2972
  description: "Configuration for requesting a correction on a registered record."
2805
2973
  }),
2974
+ ApproveCorrectionConfig.meta({
2975
+ id: "ApproveCorrectionActionConfig",
2976
+ description: "Configuration for approving a requested correction."
2977
+ }),
2978
+ RejectCorrectionConfig.meta({
2979
+ id: "RejectCorrectionActionConfig",
2980
+ description: "Configuration for rejecting a requested correction."
2981
+ }),
2806
2982
  EditActionConfig.meta({
2807
2983
  id: "EditActionConfig",
2808
2984
  description: "Configuration for editing a record before registration."
@@ -2811,6 +2987,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
2811
2987
  id: "ArchiveActionConfig",
2812
2988
  description: "Configuration for archiving a record."
2813
2989
  }),
2990
+ UnarchiveConfig.meta({
2991
+ id: "UnarchiveActionConfig",
2992
+ description: "Configuration for unarchiving a record."
2993
+ }),
2814
2994
  CustomActionConfig.meta({
2815
2995
  id: "CustomActionConfig",
2816
2996
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3216,13 +3396,9 @@ var getActionAnnotationFields = (actionConfig) => {
3216
3396
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3217
3397
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3218
3398
  }
3219
- if (actionConfig.type === ActionType.CUSTOM) {
3220
- return actionConfig.form;
3221
- }
3222
- if ("review" in actionConfig && actionConfig.review != null) {
3223
- return actionConfig.review.fields;
3224
- }
3225
- return [];
3399
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3400
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3401
+ return [...reviewFields, ...formFields];
3226
3402
  };
3227
3403
  function getAllAnnotationFields(config) {
3228
3404
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -3930,7 +4106,7 @@ function validateActionFlags(event2, ctx) {
3930
4106
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3931
4107
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3932
4108
  const actionFlagIds = event2.actions.flatMap(
3933
- (action) => action.flags.map((flag) => flag.id)
4109
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3934
4110
  );
3935
4111
  for (const actionFlagId of actionFlagIds) {
3936
4112
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4538,10 +4714,7 @@ var DeclareActionInput = BaseActionInput.extend(
4538
4714
  );
4539
4715
  var EditActionInput = BaseActionInput.extend(
4540
4716
  z38.object({
4541
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
4542
- content: z38.object({
4543
- comment: z38.string().describe("Comment for the edit action.").optional()
4544
- })
4717
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4545
4718
  }).shape
4546
4719
  );
4547
4720
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -4583,6 +4756,11 @@ var ArchiveActionInput = BaseActionInput.extend(
4583
4756
  content: ReasonContent
4584
4757
  }).shape
4585
4758
  );
4759
+ var UnarchiveActionInput = BaseActionInput.extend(
4760
+ z38.object({
4761
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4762
+ }).shape
4763
+ );
4586
4764
  var AssignActionInput = BaseActionInput.extend(
4587
4765
  z38.object({
4588
4766
  type: z38.literal(ActionType.ASSIGN),
@@ -4644,6 +4822,7 @@ var ActionInput = z38.discriminatedUnion("type", [
4644
4822
  id: "MarkNotDuplicateActionInput"
4645
4823
  }),
4646
4824
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4825
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
4647
4826
  AssignActionInput.meta({ id: "AssignActionInput" }),
4648
4827
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
4649
4828
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -4721,6 +4900,7 @@ var updateActions = ActionTypes.extract([
4721
4900
  ActionType.REGISTER,
4722
4901
  ActionType.REJECT,
4723
4902
  ActionType.ARCHIVE,
4903
+ ActionType.UNARCHIVE,
4724
4904
  ActionType.PRINT_CERTIFICATE,
4725
4905
  ActionType.REQUEST_CORRECTION,
4726
4906
  ActionType.APPROVE_CORRECTION,
@@ -4739,15 +4919,12 @@ var INHERENT_FLAG_RULES = [
4739
4919
  },
4740
4920
  {
4741
4921
  // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4742
- // other status-changing action (see getStatusFromActions).
4922
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4923
+ // are deliberately excluded so the flag freezes across an archive/unarchive
4924
+ // round trip and comes back exactly as it was.
4743
4925
  flag: InherentFlags.INCOMPLETE,
4744
4926
  setOn: [ActionType.NOTIFY],
4745
- resetOn: [
4746
- ActionType.CREATE,
4747
- ActionType.DECLARE,
4748
- ActionType.REGISTER,
4749
- ActionType.ARCHIVE
4750
- ]
4927
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4751
4928
  },
4752
4929
  {
4753
4930
  flag: InherentFlags.REJECTED,
@@ -7243,21 +7420,44 @@ var LocationTypeV1 = z43.enum([
7243
7420
  "CRVS_OFFICE",
7244
7421
  "HEALTH_FACILITY"
7245
7422
  ]);
7423
+ var LocationStatus = z43.enum(["active", "inactive"]);
7424
+ var LocationVersion = z43.object({
7425
+ versionId: UUID,
7426
+ effectiveFrom: z43.iso.date(),
7427
+ name: z43.string(),
7428
+ externalId: z43.string().nullish(),
7429
+ status: LocationStatus
7430
+ });
7246
7431
  var AdministrativeArea = z43.object({
7247
7432
  id: UUID,
7248
7433
  name: z43.string(),
7249
7434
  externalId: z43.string().nullish(),
7250
7435
  parentId: UUID.nullable(),
7251
- validUntil: z43.iso.datetime().nullable()
7436
+ status: LocationStatus,
7437
+ versions: z43.array(LocationVersion)
7252
7438
  });
7253
7439
  var Location = z43.object({
7254
7440
  id: UUID,
7255
7441
  name: z43.string(),
7256
7442
  externalId: z43.string().nullish(),
7257
7443
  administrativeAreaId: UUID.nullable(),
7258
- validUntil: z43.iso.datetime().nullable(),
7444
+ locationType: z43.string().nullable(),
7445
+ status: LocationStatus,
7446
+ versions: z43.array(LocationVersion)
7447
+ });
7448
+ var SetLocationPayload = z43.object({
7449
+ id: UUID,
7450
+ name: z43.string(),
7451
+ externalId: z43.string().nullish(),
7452
+ administrativeAreaId: UUID.nullable(),
7259
7453
  locationType: z43.string().nullable()
7260
7454
  });
7455
+ var SetAdministrativeAreaPayload = z43.object({
7456
+ id: UUID,
7457
+ name: z43.string(),
7458
+ externalId: z43.string().nullish(),
7459
+ parentId: UUID.nullable()
7460
+ });
7261
7461
 
7262
7462
  // ../commons/src/events/scopes.ts
7263
7463
  var ACTION_SCOPE_MAP = {
@@ -7279,6 +7479,7 @@ var ACTION_SCOPE_MAP = {
7279
7479
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7280
7480
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7281
7481
  [ActionType.ARCHIVE]: ["record.archive"],
7482
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
7282
7483
  [ActionType.REJECT]: ["record.reject"],
7283
7484
  [ActionType.ASSIGN]: null,
7284
7485
  [ActionType.UNASSIGN]: null,
@@ -7321,7 +7522,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7321
7522
  ActionType.CUSTOM,
7322
7523
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7323
7524
  ],
7324
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
7525
+ [EventStatus.enum.ARCHIVED]: [
7526
+ ActionType.READ,
7527
+ ActionType.CUSTOM,
7528
+ ActionType.UNARCHIVE
7529
+ ]
7325
7530
  };
7326
7531
  var ACTION_FILTERS = {
7327
7532
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
@@ -7334,6 +7539,7 @@ var ACTION_FILTERS = {
7334
7539
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7335
7540
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
7336
7541
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7542
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7337
7543
  [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7338
7544
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7339
7545
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
@@ -7350,75 +7556,80 @@ var REJECTED_ACTIONS = [
7350
7556
  var import_lodash7 = require("lodash");
7351
7557
 
7352
7558
  // ../commons/src/events/mocks.test.utils.ts
7353
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7559
+ function withVersionFields(entity) {
7560
+ return {
7561
+ ...entity,
7562
+ status: "active",
7563
+ versions: [
7564
+ {
7565
+ versionId: entity.id,
7566
+ effectiveFrom: "0001-01-01",
7567
+ name: entity.name,
7568
+ externalId: entity.externalId ?? null,
7569
+ status: "active"
7570
+ }
7571
+ ]
7572
+ };
7573
+ }
7574
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7354
7575
  {
7355
7576
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7356
7577
  name: "Central",
7357
7578
  parentId: null,
7358
- validUntil: null,
7359
7579
  externalId: "ydyJb1RAy4U1"
7360
7580
  },
7361
7581
  {
7362
7582
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7363
7583
  name: "Sulaka",
7364
7584
  parentId: null,
7365
- validUntil: null,
7366
7585
  externalId: "pQ8nGxWmZ2Q3"
7367
7586
  },
7368
7587
  {
7369
7588
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7370
7589
  name: "Pualula",
7371
7590
  parentId: null,
7372
- validUntil: null,
7373
7591
  externalId: "Aq91DweLmT8k"
7374
7592
  },
7375
7593
  {
7376
7594
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7377
7595
  name: "Chuminga",
7378
7596
  parentId: null,
7379
- validUntil: null,
7380
7597
  externalId: "Rw0fYNh2Xk9a"
7381
7598
  },
7382
7599
  {
7383
7600
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7384
7601
  name: "Ibombo",
7385
7602
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7386
- validUntil: null,
7387
7603
  externalId: "k7DsP4vbN1Qe"
7388
7604
  },
7389
7605
  {
7390
7606
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7391
7607
  name: "Isango",
7392
7608
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7393
- validUntil: null,
7394
7609
  externalId: "Gm3Z9eQpHw4L"
7395
7610
  },
7396
7611
  {
7397
7612
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7398
7613
  name: "Isamba",
7399
7614
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7400
- validUntil: null,
7401
7615
  externalId: "sT0xVu1KqJ7r"
7402
7616
  },
7403
7617
  {
7404
7618
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7405
7619
  name: "Itambo",
7406
7620
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7407
- validUntil: null,
7408
7621
  externalId: "Nq6Bv2HpL9Te"
7409
7622
  },
7410
7623
  {
7411
7624
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7412
7625
  name: "Ezhi",
7413
7626
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7414
- validUntil: null,
7415
7627
  externalId: "xK8cQ0ZRy5Wd"
7416
7628
  },
7417
7629
  {
7418
7630
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7419
7631
  name: "Ilanga",
7420
7632
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7421
- validUntil: null,
7422
7633
  externalId: "Cq4Jm1XvN8Ls"
7423
7634
  },
7424
7635
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7426,49 +7637,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7426
7637
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7427
7638
  name: "Klow",
7428
7639
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7429
- validUntil: null,
7430
7640
  externalId: "IkYcYBUcyY2"
7431
7641
  },
7432
7642
  {
7433
7643
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7434
7644
  name: "Mbondo",
7435
7645
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7436
- validUntil: null,
7437
7646
  externalId: "Qhvv5hvo3mY"
7438
7647
  },
7439
7648
  {
7440
7649
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7441
7650
  name: "Ndara",
7442
7651
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7443
- validUntil: null,
7444
7652
  externalId: "crXh068O9TR"
7445
7653
  },
7446
7654
  {
7447
7655
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7448
7656
  name: "Olani",
7449
7657
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7450
- validUntil: null,
7451
7658
  externalId: "r00It8Tvvp7"
7452
7659
  },
7453
7660
  {
7454
7661
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7455
7662
  name: "Pemba",
7456
7663
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7457
- validUntil: null,
7458
7664
  externalId: "ZnUWsbONIaH"
7459
7665
  },
7460
7666
  {
7461
7667
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7462
7668
  name: "Quanza",
7463
7669
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7464
- validUntil: null,
7465
7670
  externalId: "fDZycvQTa7l"
7466
7671
  },
7467
7672
  {
7468
7673
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7469
7674
  name: "Rivka",
7470
7675
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7471
- validUntil: null,
7472
7676
  externalId: "KqswxCGTELa"
7473
7677
  },
7474
7678
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7476,35 +7680,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7476
7680
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7477
7681
  name: "Mbula",
7478
7682
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7479
- validUntil: null,
7480
7683
  externalId: "osEbKjRc9Kg"
7481
7684
  },
7482
7685
  {
7483
7686
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7484
7687
  name: "Ndoki",
7485
7688
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7486
- validUntil: null,
7487
7689
  externalId: "aq4daBUAGr3"
7488
7690
  },
7489
7691
  {
7490
7692
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7491
7693
  name: "Tsanga",
7492
7694
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7493
- validUntil: null,
7494
7695
  externalId: "cqis6Y8trbJ"
7495
7696
  },
7496
7697
  {
7497
7698
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7498
7699
  name: "Waziri",
7499
7700
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7500
- validUntil: null,
7501
7701
  externalId: "LMijHPyyx6d"
7502
7702
  },
7503
7703
  {
7504
7704
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7505
7705
  name: "Zimbi",
7506
7706
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7507
- validUntil: null,
7508
7707
  externalId: "pcQYbPuKGZ7"
7509
7708
  },
7510
7709
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7512,67 +7711,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7512
7711
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7513
7712
  name: "Felani",
7514
7713
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7515
- validUntil: null,
7516
7714
  externalId: "gSqpoCGdMXp"
7517
7715
  },
7518
7716
  {
7519
7717
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7520
7718
  name: "Goroma",
7521
7719
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7522
- validUntil: null,
7523
7720
  externalId: "KvAAIaNqVrp"
7524
7721
  },
7525
7722
  {
7526
7723
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7527
7724
  name: "Halifu",
7528
7725
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7529
- validUntil: null,
7530
7726
  externalId: "qe4UnEVt1hv"
7531
7727
  },
7532
7728
  {
7533
7729
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7534
7730
  name: "Jabari",
7535
7731
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7536
- validUntil: null,
7537
7732
  externalId: "yHH9Nz4rLOt"
7538
7733
  },
7539
7734
  {
7540
7735
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7541
7736
  name: "Kifani",
7542
7737
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7543
- validUntil: null,
7544
7738
  externalId: "eSWmXIGeu1I"
7545
7739
  },
7546
7740
  {
7547
7741
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7548
7742
  name: "Lumela",
7549
7743
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7550
- validUntil: null,
7551
7744
  externalId: "bh0b3aI1uP3"
7552
7745
  }
7553
7746
  ];
7554
- var V2_DEFAULT_MOCK_LOCATIONS = [
7747
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7748
+ var MOCK_LOCATIONS_BASE = [
7555
7749
  {
7556
7750
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7557
7751
  name: "Central Provincial Office",
7558
7752
  locationType: "CRVS_OFFICE",
7559
7753
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7560
- validUntil: null,
7561
7754
  externalId: "Xr3Df8WpK6Ys"
7562
7755
  },
7563
7756
  {
7564
7757
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7565
7758
  name: "Central Health Post",
7566
7759
  locationType: "HEALTH_FACILITY",
7567
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7568
- validUntil: null
7760
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7569
7761
  },
7570
7762
  {
7571
7763
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7572
7764
  name: "Ibombo District Office",
7573
7765
  locationType: "CRVS_OFFICE",
7574
7766
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7575
- validUntil: null,
7576
7767
  externalId: "Sm4Nw7GrD2Vy"
7577
7768
  },
7578
7769
  {
@@ -7580,7 +7771,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7580
7771
  name: "Isamba District Office",
7581
7772
  locationType: "CRVS_OFFICE",
7582
7773
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7583
- validUntil: null,
7584
7774
  externalId: "Vg1Bq5XeH9Lt"
7585
7775
  },
7586
7776
  {
@@ -7588,7 +7778,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7588
7778
  name: "Isango District Office",
7589
7779
  locationType: "CRVS_OFFICE",
7590
7780
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7591
- validUntil: null,
7592
7781
  externalId: "Je7Lm2XqN9Vz"
7593
7782
  },
7594
7783
  {
@@ -7596,7 +7785,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7596
7785
  name: "Sulaka Provincial Office",
7597
7786
  locationType: "CRVS_OFFICE",
7598
7787
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7599
- validUntil: null,
7600
7788
  externalId: "Ht2Wp9KcX5Qv"
7601
7789
  },
7602
7790
  {
@@ -7604,7 +7792,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7604
7792
  name: "Ilanga District Office",
7605
7793
  locationType: "CRVS_OFFICE",
7606
7794
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7607
- validUntil: null,
7608
7795
  externalId: "Yp6Ds1WqN3Xz"
7609
7796
  },
7610
7797
  {
@@ -7612,7 +7799,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7612
7799
  name: "Chamakubi Health Post",
7613
7800
  locationType: "HEALTH_FACILITY",
7614
7801
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7615
- validUntil: null,
7616
7802
  externalId: "M1nFr8LbC2Qy"
7617
7803
  },
7618
7804
  {
@@ -7620,7 +7806,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7620
7806
  name: "Ibombo Rural Health Centre",
7621
7807
  locationType: "HEALTH_FACILITY",
7622
7808
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7623
- validUntil: null,
7624
7809
  externalId: "bT7pV6YrW0Xc"
7625
7810
  },
7626
7811
  {
@@ -7628,7 +7813,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7628
7813
  name: "Chikobo Rural Health Centre",
7629
7814
  locationType: "HEALTH_FACILITY",
7630
7815
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7631
- validUntil: null,
7632
7816
  externalId: "zE4qPn2SgJ5d"
7633
7817
  },
7634
7818
  {
@@ -7636,7 +7820,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7636
7820
  name: "Chilochabalenje Health Post",
7637
7821
  locationType: "HEALTH_FACILITY",
7638
7822
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7639
- validUntil: null,
7640
7823
  externalId: "H8vDs1MqR4Uf"
7641
7824
  },
7642
7825
  {
@@ -7644,7 +7827,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7644
7827
  name: "Chipeso Rural Health Centre",
7645
7828
  locationType: "HEALTH_FACILITY",
7646
7829
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7647
- validUntil: null,
7648
7830
  externalId: "Qw3uZ9KfX6Lm"
7649
7831
  },
7650
7832
  {
@@ -7652,7 +7834,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7652
7834
  name: "Chisamba Rural Health Centre",
7653
7835
  locationType: "HEALTH_FACILITY",
7654
7836
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7655
- validUntil: null,
7656
7837
  externalId: "Yr0pCg8LdM2s"
7657
7838
  },
7658
7839
  {
@@ -7660,7 +7841,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7660
7841
  name: "Chitanda Rural Health Centre",
7661
7842
  locationType: "HEALTH_FACILITY",
7662
7843
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7663
- validUntil: null,
7664
7844
  externalId: "tS9gJ4PwB1Qx"
7665
7845
  },
7666
7846
  {
@@ -7668,7 +7848,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7668
7848
  name: "Golden Valley Rural Health Centre",
7669
7849
  locationType: "HEALTH_FACILITY",
7670
7850
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7671
- validUntil: null,
7672
7851
  externalId: "Ld7Qm3XsA8Vr"
7673
7852
  },
7674
7853
  {
@@ -7676,7 +7855,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7676
7855
  name: "Ipongo Rural Health Centre",
7677
7856
  locationType: "HEALTH_FACILITY",
7678
7857
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7679
- validUntil: null,
7680
7858
  externalId: "kF2sW9DmH0Bt"
7681
7859
  },
7682
7860
  {
@@ -7684,7 +7862,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7684
7862
  name: "Itumbwe Health Post",
7685
7863
  locationType: "HEALTH_FACILITY",
7686
7864
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7687
- validUntil: null,
7688
7865
  externalId: "Ue5Xb3VaC7Pq"
7689
7866
  },
7690
7867
  {
@@ -7692,7 +7869,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7692
7869
  name: "Kabangalala Rural Health Centre",
7693
7870
  locationType: "HEALTH_FACILITY",
7694
7871
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7695
- validUntil: null,
7696
7872
  externalId: "Pz8Kc1TqH6Jn"
7697
7873
  },
7698
7874
  // Village offices
@@ -7701,10 +7877,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7701
7877
  name: "Klow Village Office",
7702
7878
  locationType: "CRVS_OFFICE",
7703
7879
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7704
- validUntil: null,
7705
7880
  externalId: "PmAyxAJkxiJ"
7706
7881
  }
7707
7882
  ];
7883
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7708
7884
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7709
7885
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7710
7886
  );
@@ -7712,8 +7888,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7712
7888
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7713
7889
  );
7714
7890
 
7715
- // ../commons/src/notification/UserNotifications.ts
7891
+ // ../commons/src/events/locationPayloads.ts
7716
7892
  var z44 = __toESM(require("zod/v4"));
7893
+ var CreateLocationPayload = z44.object({
7894
+ id: UUID.optional(),
7895
+ versionId: UUID.optional(),
7896
+ name: z44.string(),
7897
+ externalId: z44.string().nullish(),
7898
+ administrativeAreaId: UUID.nullable(),
7899
+ locationType: z44.string().nullable(),
7900
+ effectiveFrom: z44.iso.date().optional(),
7901
+ status: LocationStatus.default("active")
7902
+ });
7903
+ var UpdateLocationPayload = z44.strictObject({
7904
+ id: UUID,
7905
+ versionId: UUID.optional(),
7906
+ name: z44.string(),
7907
+ externalId: z44.string().nullish(),
7908
+ status: LocationStatus,
7909
+ effectiveFrom: z44.iso.date().optional(),
7910
+ lastVersionId: UUID
7911
+ });
7912
+ var WithdrawLocationVersionPayload = z44.object({
7913
+ id: UUID,
7914
+ versionId: UUID
7915
+ });
7916
+ var CreateAdministrativeAreaPayload = z44.object({
7917
+ id: UUID.optional(),
7918
+ versionId: UUID.optional(),
7919
+ name: z44.string(),
7920
+ externalId: z44.string().nullish(),
7921
+ parentId: UUID.nullable(),
7922
+ effectiveFrom: z44.iso.date().optional(),
7923
+ status: LocationStatus.default("active")
7924
+ });
7925
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7926
+ id: UUID,
7927
+ versionId: UUID.optional(),
7928
+ name: z44.string(),
7929
+ externalId: z44.string().nullish(),
7930
+ status: LocationStatus,
7931
+ effectiveFrom: z44.iso.date().optional(),
7932
+ lastVersionId: UUID
7933
+ });
7934
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7935
+ id: UUID,
7936
+ versionId: UUID
7937
+ });
7938
+
7939
+ // ../commons/src/notification/UserNotifications.ts
7940
+ var z45 = __toESM(require("zod/v4"));
7717
7941
  var TriggerEvent = {
7718
7942
  USER_CREATED: "user-created",
7719
7943
  USER_UPDATED: "user-updated",
@@ -7726,54 +7950,54 @@ var TriggerEvent = {
7726
7950
  CHANGE_PHONE_NUMBER: "change-phone-number",
7727
7951
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7728
7952
  };
7729
- var Recipient = z44.object({
7953
+ var Recipient = z45.object({
7730
7954
  name: NameFieldValue.optional(),
7731
- mobile: z44.string().optional(),
7732
- email: z44.string().optional(),
7733
- bcc: z44.array(z44.string()).optional()
7955
+ mobile: z45.string().optional(),
7956
+ email: z45.string().optional(),
7957
+ bcc: z45.array(z45.string()).optional()
7734
7958
  });
7735
- var BasePayload = z44.object({
7959
+ var BasePayload = z45.object({
7736
7960
  recipient: Recipient
7737
7961
  });
7738
7962
  var TriggerPayload = {
7739
7963
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7740
- username: z44.string(),
7741
- temporaryPassword: z44.string()
7964
+ username: z45.string(),
7965
+ temporaryPassword: z45.string()
7742
7966
  }),
7743
7967
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7744
- oldUsername: z44.string(),
7745
- newUsername: z44.string()
7968
+ oldUsername: z45.string(),
7969
+ newUsername: z45.string()
7746
7970
  }),
7747
7971
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7748
- username: z44.string()
7972
+ username: z45.string()
7749
7973
  }),
7750
7974
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7751
- code: z44.string()
7975
+ code: z45.string()
7752
7976
  }),
7753
7977
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7754
- temporaryPassword: z44.string(),
7755
- admin: z44.object({
7756
- id: z44.string(),
7978
+ temporaryPassword: z45.string(),
7979
+ admin: z45.object({
7980
+ id: z45.string(),
7757
7981
  name: NameFieldValue,
7758
- role: z44.string()
7982
+ role: z45.string()
7759
7983
  })
7760
7984
  }),
7761
7985
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7762
- username: z44.string(),
7763
- temporaryPassword: z44.string()
7986
+ username: z45.string(),
7987
+ temporaryPassword: z45.string()
7764
7988
  }),
7765
7989
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7766
- code: z44.string()
7990
+ code: z45.string()
7767
7991
  }),
7768
7992
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7769
- subject: z44.string(),
7770
- body: z44.string()
7993
+ subject: z45.string(),
7994
+ body: z45.string()
7771
7995
  }),
7772
7996
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7773
- code: z44.string()
7997
+ code: z45.string()
7774
7998
  }),
7775
7999
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7776
- code: z44.string()
8000
+ code: z45.string()
7777
8001
  })
7778
8002
  };
7779
8003
  async function triggerUserEventNotification({
@@ -7797,4 +8021,4 @@ function parseUserEventTrigger(event2, body) {
7797
8021
  }
7798
8022
 
7799
8023
  // src/notification/index.ts
7800
- z45.globalRegistry.clear();
8024
+ z46.globalRegistry.clear();