@opencrvs/toolkit 2.1.0-rc.1dde62b → 2.1.0-rc.1f4b4ad

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 (66) hide show
  1. package/dist/application-config/index.js +3 -1
  2. package/dist/commons/api/router.d.ts +3428 -3360
  3. package/dist/commons/application-config/index.d.ts +6 -6
  4. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  5. package/dist/commons/events/ActionConfig.d.ts +112 -105
  6. package/dist/commons/events/ActionDocument.d.ts +119 -119
  7. package/dist/commons/events/ActionInput.d.ts +0 -6
  8. package/dist/commons/events/ActionType.d.ts +62 -62
  9. package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -507
  10. package/dist/commons/events/AuditLog.d.ts +79 -42
  11. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  12. package/dist/commons/events/Conditional.d.ts +3 -3
  13. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  14. package/dist/commons/events/Draft.d.ts +37 -37
  15. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  16. package/dist/commons/events/EventConfig.d.ts +5 -5
  17. package/dist/commons/events/EventDocument.d.ts +48 -48
  18. package/dist/commons/events/EventIndex.d.ts +62 -62
  19. package/dist/commons/events/EventMetadata.d.ts +40 -40
  20. package/dist/commons/events/FieldConfig.d.ts +341 -336
  21. package/dist/commons/events/FieldType.d.ts +51 -51
  22. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  23. package/dist/commons/events/FieldValue.d.ts +12 -12
  24. package/dist/commons/events/Flag.d.ts +15 -15
  25. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  26. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  27. package/dist/commons/events/WorkqueueConfig.d.ts +826 -826
  28. package/dist/commons/events/deduplication.d.ts +1 -1
  29. package/dist/commons/events/event.d.ts +2 -2
  30. package/dist/commons/events/field.d.ts +69 -198
  31. package/dist/commons/events/index.d.ts +1 -0
  32. package/dist/commons/events/locationPayloads.d.ts +95 -0
  33. package/dist/commons/events/locations.d.ts +103 -6
  34. package/dist/commons/events/mocks.test.utils.d.ts +18 -4
  35. package/dist/commons/events/scopes.d.ts +4 -4
  36. package/dist/commons/events/state/index.d.ts +17 -17
  37. package/dist/commons/events/state/utils.d.ts +7 -7
  38. package/dist/commons/events/test.utils.d.ts +40 -43
  39. package/dist/commons/events/utils.d.ts +122 -114
  40. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  41. package/dist/conditionals/index.js +1 -0
  42. package/dist/environment/derived-variables.d.ts +119 -119
  43. package/dist/environment/derived-variables.d.ts.map +1 -1
  44. package/dist/environment/logger.d.ts +3 -12
  45. package/dist/environment/logger.d.ts.map +1 -1
  46. package/dist/environment/manage-users.js +17 -7
  47. package/dist/environment/questions.d.ts +75 -74
  48. package/dist/environment/questions.d.ts.map +1 -1
  49. package/dist/environment/setup-environment.js +8 -14
  50. package/dist/environment/swarm-to-k8s.js +17 -7
  51. package/dist/environment/update-workflows.js +17 -7
  52. package/dist/environment/users.js +17 -7
  53. package/dist/environment/utils.d.ts +1 -1
  54. package/dist/environment/utils.js +17 -7
  55. package/dist/events/deduplication.d.ts +1 -1
  56. package/dist/events/index.js +179 -70
  57. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  58. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  59. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  60. package/dist/notification/index.js +162 -93
  61. package/dist/scopes/index.d.ts +148 -146
  62. package/dist/scopes/index.js +1 -0
  63. package/opencrvs-toolkit-2.1.0-rc.1f4b4ad.tgz +0 -0
  64. package/package.json +5 -5
  65. package/tsconfig.tsbuildinfo +1 -1
  66. package/opencrvs-toolkit-2.1.0-rc.1dde62b.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) {
@@ -96,6 +96,7 @@ var PlainScopeType = z2.enum([
96
96
  "integration.create",
97
97
  "record.import",
98
98
  "config.update-all",
99
+ "location.edit",
99
100
  "attachment.upload",
100
101
  "profile.electronic-signature",
101
102
  "user.read-only-my-audit",
@@ -530,6 +531,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
530
531
  requestData: z5.object({ id: z5.string() }),
531
532
  responseSummary: z5.object({ clientId: z5.string() })
532
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
+ });
533
557
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
534
558
  operation: z5.literal("attachments.upload"),
535
559
  requestData: z5.object({
@@ -605,6 +629,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
605
629
  IntegrationActivateEntrySchema,
606
630
  IntegrationDeleteEntrySchema,
607
631
  IntegrationRefreshSecretEntrySchema,
632
+ LocationCreateEntrySchema,
633
+ AdministrativeAreaCreateEntrySchema,
608
634
  AttachmentUploadEntrySchema,
609
635
  UserCreateEntrySchema,
610
636
  UserReasonEntrySchema,
@@ -1216,9 +1242,10 @@ var NotifiedAction = ActionBase.extend(
1216
1242
  var EditAction = ActionBase.extend(
1217
1243
  z14.object({
1218
1244
  type: z14.literal(ActionType.EDIT),
1245
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1219
1246
  content: z14.object({
1220
1247
  comment: z14.string().describe("Comment for the edit action.").optional()
1221
- })
1248
+ }).optional()
1222
1249
  }).shape
1223
1250
  );
1224
1251
  var PrintContent = z14.object({
@@ -2694,6 +2721,9 @@ var ActionConfigBase = z24.object({
2694
2721
  var DeclarationActionBase = ActionConfigBase.extend({
2695
2722
  deduplication: DeduplicationConfig.optional()
2696
2723
  });
2724
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2725
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2726
+ );
2697
2727
  var ReadActionConfig = ActionConfigBase.extend(
2698
2728
  z24.object({
2699
2729
  type: z24.literal(ActionType.READ),
@@ -2705,7 +2735,8 @@ var ReadActionConfig = ActionConfigBase.extend(
2705
2735
  );
2706
2736
  var NotifyConfig = ActionConfigBase.extend(
2707
2737
  z24.object({
2708
- type: z24.literal(ActionType.NOTIFY)
2738
+ type: z24.literal(ActionType.NOTIFY),
2739
+ form: actionConfirmationForm
2709
2740
  }).shape
2710
2741
  );
2711
2742
  var DuplicateDetectedConfig = ActionConfigBase.extend(
@@ -2760,6 +2791,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2760
2791
  review: DeclarationReviewConfig.describe(
2761
2792
  "Configuration of the review page fields."
2762
2793
  ),
2794
+ form: actionConfirmationForm,
2763
2795
  dialogCopy: z24.object({
2764
2796
  notify: TranslationConfig.describe(
2765
2797
  "Confirmation text for the notify action"
@@ -2775,7 +2807,8 @@ var DeclareConfig = DeclarationActionBase.extend(
2775
2807
  );
2776
2808
  var ArchiveConfig = ActionConfigBase.extend(
2777
2809
  z24.object({
2778
- type: z24.literal(ActionType.ARCHIVE)
2810
+ type: z24.literal(ActionType.ARCHIVE),
2811
+ form: actionConfirmationForm
2779
2812
  }).shape
2780
2813
  );
2781
2814
  var UnarchiveConfig = ActionConfigBase.extend(
@@ -2801,12 +2834,14 @@ var EditActionConfig = ActionConfigBase.extend(
2801
2834
  );
2802
2835
  var RejectConfig = ActionConfigBase.extend(
2803
2836
  z24.object({
2804
- type: z24.literal(ActionType.REJECT)
2837
+ type: z24.literal(ActionType.REJECT),
2838
+ form: actionConfirmationForm
2805
2839
  }).shape
2806
2840
  );
2807
2841
  var RegisterConfig = DeclarationActionBase.extend(
2808
2842
  z24.object({
2809
- type: z24.literal(ActionType.REGISTER)
2843
+ type: z24.literal(ActionType.REGISTER),
2844
+ form: actionConfirmationForm
2810
2845
  }).shape
2811
2846
  );
2812
2847
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3326,13 +3361,9 @@ var getActionAnnotationFields = (actionConfig) => {
3326
3361
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3327
3362
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3328
3363
  }
3329
- if (actionConfig.type === ActionType.CUSTOM) {
3330
- return actionConfig.form;
3331
- }
3332
- if ("review" in actionConfig && actionConfig.review != null) {
3333
- return actionConfig.review.fields;
3334
- }
3335
- return [];
3364
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3365
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3366
+ return [...reviewFields, ...formFields];
3336
3367
  };
3337
3368
  function getAllAnnotationFields(config) {
3338
3369
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -4648,10 +4679,7 @@ var DeclareActionInput = BaseActionInput.extend(
4648
4679
  );
4649
4680
  var EditActionInput = BaseActionInput.extend(
4650
4681
  z38.object({
4651
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
4652
- content: z38.object({
4653
- comment: z38.string().describe("Comment for the edit action.").optional()
4654
- })
4682
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4655
4683
  }).shape
4656
4684
  );
4657
4685
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -7357,21 +7385,44 @@ var LocationTypeV1 = z43.enum([
7357
7385
  "CRVS_OFFICE",
7358
7386
  "HEALTH_FACILITY"
7359
7387
  ]);
7388
+ var LocationStatus = z43.enum(["active", "inactive"]);
7389
+ var LocationVersion = z43.object({
7390
+ versionId: UUID,
7391
+ effectiveFrom: z43.iso.date(),
7392
+ name: z43.string(),
7393
+ externalId: z43.string().nullish(),
7394
+ status: LocationStatus
7395
+ });
7360
7396
  var AdministrativeArea = z43.object({
7361
7397
  id: UUID,
7362
7398
  name: z43.string(),
7363
7399
  externalId: z43.string().nullish(),
7364
7400
  parentId: UUID.nullable(),
7365
- validUntil: z43.iso.datetime().nullable()
7401
+ status: LocationStatus,
7402
+ versions: z43.array(LocationVersion)
7366
7403
  });
7367
7404
  var Location = z43.object({
7368
7405
  id: UUID,
7369
7406
  name: z43.string(),
7370
7407
  externalId: z43.string().nullish(),
7371
7408
  administrativeAreaId: UUID.nullable(),
7372
- validUntil: z43.iso.datetime().nullable(),
7409
+ locationType: z43.string().nullable(),
7410
+ status: LocationStatus,
7411
+ versions: z43.array(LocationVersion)
7412
+ });
7413
+ var SetLocationPayload = z43.object({
7414
+ id: UUID,
7415
+ name: z43.string(),
7416
+ externalId: z43.string().nullish(),
7417
+ administrativeAreaId: UUID.nullable(),
7373
7418
  locationType: z43.string().nullable()
7374
7419
  });
7420
+ var SetAdministrativeAreaPayload = z43.object({
7421
+ id: UUID,
7422
+ name: z43.string(),
7423
+ externalId: z43.string().nullish(),
7424
+ parentId: UUID.nullable()
7425
+ });
7375
7426
 
7376
7427
  // ../commons/src/events/scopes.ts
7377
7428
  var ACTION_SCOPE_MAP = {
@@ -7470,75 +7521,80 @@ var REJECTED_ACTIONS = [
7470
7521
  var import_lodash7 = require("lodash");
7471
7522
 
7472
7523
  // ../commons/src/events/mocks.test.utils.ts
7473
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7524
+ function withVersionFields(entity) {
7525
+ return {
7526
+ ...entity,
7527
+ status: "active",
7528
+ versions: [
7529
+ {
7530
+ versionId: entity.id,
7531
+ effectiveFrom: "0001-01-01",
7532
+ name: entity.name,
7533
+ externalId: entity.externalId ?? null,
7534
+ status: "active"
7535
+ }
7536
+ ]
7537
+ };
7538
+ }
7539
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7474
7540
  {
7475
7541
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7476
7542
  name: "Central",
7477
7543
  parentId: null,
7478
- validUntil: null,
7479
7544
  externalId: "ydyJb1RAy4U1"
7480
7545
  },
7481
7546
  {
7482
7547
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7483
7548
  name: "Sulaka",
7484
7549
  parentId: null,
7485
- validUntil: null,
7486
7550
  externalId: "pQ8nGxWmZ2Q3"
7487
7551
  },
7488
7552
  {
7489
7553
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7490
7554
  name: "Pualula",
7491
7555
  parentId: null,
7492
- validUntil: null,
7493
7556
  externalId: "Aq91DweLmT8k"
7494
7557
  },
7495
7558
  {
7496
7559
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7497
7560
  name: "Chuminga",
7498
7561
  parentId: null,
7499
- validUntil: null,
7500
7562
  externalId: "Rw0fYNh2Xk9a"
7501
7563
  },
7502
7564
  {
7503
7565
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7504
7566
  name: "Ibombo",
7505
7567
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7506
- validUntil: null,
7507
7568
  externalId: "k7DsP4vbN1Qe"
7508
7569
  },
7509
7570
  {
7510
7571
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7511
7572
  name: "Isango",
7512
7573
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7513
- validUntil: null,
7514
7574
  externalId: "Gm3Z9eQpHw4L"
7515
7575
  },
7516
7576
  {
7517
7577
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7518
7578
  name: "Isamba",
7519
7579
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7520
- validUntil: null,
7521
7580
  externalId: "sT0xVu1KqJ7r"
7522
7581
  },
7523
7582
  {
7524
7583
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7525
7584
  name: "Itambo",
7526
7585
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7527
- validUntil: null,
7528
7586
  externalId: "Nq6Bv2HpL9Te"
7529
7587
  },
7530
7588
  {
7531
7589
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7532
7590
  name: "Ezhi",
7533
7591
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7534
- validUntil: null,
7535
7592
  externalId: "xK8cQ0ZRy5Wd"
7536
7593
  },
7537
7594
  {
7538
7595
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7539
7596
  name: "Ilanga",
7540
7597
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7541
- validUntil: null,
7542
7598
  externalId: "Cq4Jm1XvN8Ls"
7543
7599
  },
7544
7600
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7546,49 +7602,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7546
7602
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7547
7603
  name: "Klow",
7548
7604
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7549
- validUntil: null,
7550
7605
  externalId: "IkYcYBUcyY2"
7551
7606
  },
7552
7607
  {
7553
7608
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7554
7609
  name: "Mbondo",
7555
7610
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7556
- validUntil: null,
7557
7611
  externalId: "Qhvv5hvo3mY"
7558
7612
  },
7559
7613
  {
7560
7614
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7561
7615
  name: "Ndara",
7562
7616
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7563
- validUntil: null,
7564
7617
  externalId: "crXh068O9TR"
7565
7618
  },
7566
7619
  {
7567
7620
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7568
7621
  name: "Olani",
7569
7622
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
- validUntil: null,
7571
7623
  externalId: "r00It8Tvvp7"
7572
7624
  },
7573
7625
  {
7574
7626
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7575
7627
  name: "Pemba",
7576
7628
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7577
- validUntil: null,
7578
7629
  externalId: "ZnUWsbONIaH"
7579
7630
  },
7580
7631
  {
7581
7632
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7582
7633
  name: "Quanza",
7583
7634
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7584
- validUntil: null,
7585
7635
  externalId: "fDZycvQTa7l"
7586
7636
  },
7587
7637
  {
7588
7638
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7589
7639
  name: "Rivka",
7590
7640
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7591
- validUntil: null,
7592
7641
  externalId: "KqswxCGTELa"
7593
7642
  },
7594
7643
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7596,35 +7645,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7596
7645
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7597
7646
  name: "Mbula",
7598
7647
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7599
- validUntil: null,
7600
7648
  externalId: "osEbKjRc9Kg"
7601
7649
  },
7602
7650
  {
7603
7651
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7604
7652
  name: "Ndoki",
7605
7653
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7606
- validUntil: null,
7607
7654
  externalId: "aq4daBUAGr3"
7608
7655
  },
7609
7656
  {
7610
7657
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7611
7658
  name: "Tsanga",
7612
7659
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7613
- validUntil: null,
7614
7660
  externalId: "cqis6Y8trbJ"
7615
7661
  },
7616
7662
  {
7617
7663
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7618
7664
  name: "Waziri",
7619
7665
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7620
- validUntil: null,
7621
7666
  externalId: "LMijHPyyx6d"
7622
7667
  },
7623
7668
  {
7624
7669
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7625
7670
  name: "Zimbi",
7626
7671
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7627
- validUntil: null,
7628
7672
  externalId: "pcQYbPuKGZ7"
7629
7673
  },
7630
7674
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7632,67 +7676,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7632
7676
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7633
7677
  name: "Felani",
7634
7678
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7635
- validUntil: null,
7636
7679
  externalId: "gSqpoCGdMXp"
7637
7680
  },
7638
7681
  {
7639
7682
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7640
7683
  name: "Goroma",
7641
7684
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7642
- validUntil: null,
7643
7685
  externalId: "KvAAIaNqVrp"
7644
7686
  },
7645
7687
  {
7646
7688
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7647
7689
  name: "Halifu",
7648
7690
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7649
- validUntil: null,
7650
7691
  externalId: "qe4UnEVt1hv"
7651
7692
  },
7652
7693
  {
7653
7694
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7654
7695
  name: "Jabari",
7655
7696
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7656
- validUntil: null,
7657
7697
  externalId: "yHH9Nz4rLOt"
7658
7698
  },
7659
7699
  {
7660
7700
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7661
7701
  name: "Kifani",
7662
7702
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7663
- validUntil: null,
7664
7703
  externalId: "eSWmXIGeu1I"
7665
7704
  },
7666
7705
  {
7667
7706
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7668
7707
  name: "Lumela",
7669
7708
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7670
- validUntil: null,
7671
7709
  externalId: "bh0b3aI1uP3"
7672
7710
  }
7673
7711
  ];
7674
- var V2_DEFAULT_MOCK_LOCATIONS = [
7712
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7713
+ var MOCK_LOCATIONS_BASE = [
7675
7714
  {
7676
7715
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7677
7716
  name: "Central Provincial Office",
7678
7717
  locationType: "CRVS_OFFICE",
7679
7718
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7680
- validUntil: null,
7681
7719
  externalId: "Xr3Df8WpK6Ys"
7682
7720
  },
7683
7721
  {
7684
7722
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7685
7723
  name: "Central Health Post",
7686
7724
  locationType: "HEALTH_FACILITY",
7687
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7688
- validUntil: null
7725
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7689
7726
  },
7690
7727
  {
7691
7728
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7692
7729
  name: "Ibombo District Office",
7693
7730
  locationType: "CRVS_OFFICE",
7694
7731
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7695
- validUntil: null,
7696
7732
  externalId: "Sm4Nw7GrD2Vy"
7697
7733
  },
7698
7734
  {
@@ -7700,7 +7736,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7700
7736
  name: "Isamba District Office",
7701
7737
  locationType: "CRVS_OFFICE",
7702
7738
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7703
- validUntil: null,
7704
7739
  externalId: "Vg1Bq5XeH9Lt"
7705
7740
  },
7706
7741
  {
@@ -7708,7 +7743,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7708
7743
  name: "Isango District Office",
7709
7744
  locationType: "CRVS_OFFICE",
7710
7745
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7711
- validUntil: null,
7712
7746
  externalId: "Je7Lm2XqN9Vz"
7713
7747
  },
7714
7748
  {
@@ -7716,7 +7750,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7716
7750
  name: "Sulaka Provincial Office",
7717
7751
  locationType: "CRVS_OFFICE",
7718
7752
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7719
- validUntil: null,
7720
7753
  externalId: "Ht2Wp9KcX5Qv"
7721
7754
  },
7722
7755
  {
@@ -7724,7 +7757,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7724
7757
  name: "Ilanga District Office",
7725
7758
  locationType: "CRVS_OFFICE",
7726
7759
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7727
- validUntil: null,
7728
7760
  externalId: "Yp6Ds1WqN3Xz"
7729
7761
  },
7730
7762
  {
@@ -7732,7 +7764,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7732
7764
  name: "Chamakubi Health Post",
7733
7765
  locationType: "HEALTH_FACILITY",
7734
7766
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7735
- validUntil: null,
7736
7767
  externalId: "M1nFr8LbC2Qy"
7737
7768
  },
7738
7769
  {
@@ -7740,7 +7771,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7740
7771
  name: "Ibombo Rural Health Centre",
7741
7772
  locationType: "HEALTH_FACILITY",
7742
7773
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7743
- validUntil: null,
7744
7774
  externalId: "bT7pV6YrW0Xc"
7745
7775
  },
7746
7776
  {
@@ -7748,7 +7778,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7748
7778
  name: "Chikobo Rural Health Centre",
7749
7779
  locationType: "HEALTH_FACILITY",
7750
7780
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7751
- validUntil: null,
7752
7781
  externalId: "zE4qPn2SgJ5d"
7753
7782
  },
7754
7783
  {
@@ -7756,7 +7785,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7756
7785
  name: "Chilochabalenje Health Post",
7757
7786
  locationType: "HEALTH_FACILITY",
7758
7787
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7759
- validUntil: null,
7760
7788
  externalId: "H8vDs1MqR4Uf"
7761
7789
  },
7762
7790
  {
@@ -7764,7 +7792,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7764
7792
  name: "Chipeso Rural Health Centre",
7765
7793
  locationType: "HEALTH_FACILITY",
7766
7794
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7767
- validUntil: null,
7768
7795
  externalId: "Qw3uZ9KfX6Lm"
7769
7796
  },
7770
7797
  {
@@ -7772,7 +7799,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7772
7799
  name: "Chisamba Rural Health Centre",
7773
7800
  locationType: "HEALTH_FACILITY",
7774
7801
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7775
- validUntil: null,
7776
7802
  externalId: "Yr0pCg8LdM2s"
7777
7803
  },
7778
7804
  {
@@ -7780,7 +7806,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7780
7806
  name: "Chitanda Rural Health Centre",
7781
7807
  locationType: "HEALTH_FACILITY",
7782
7808
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7783
- validUntil: null,
7784
7809
  externalId: "tS9gJ4PwB1Qx"
7785
7810
  },
7786
7811
  {
@@ -7788,7 +7813,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7788
7813
  name: "Golden Valley Rural Health Centre",
7789
7814
  locationType: "HEALTH_FACILITY",
7790
7815
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7791
- validUntil: null,
7792
7816
  externalId: "Ld7Qm3XsA8Vr"
7793
7817
  },
7794
7818
  {
@@ -7796,7 +7820,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7796
7820
  name: "Ipongo Rural Health Centre",
7797
7821
  locationType: "HEALTH_FACILITY",
7798
7822
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7799
- validUntil: null,
7800
7823
  externalId: "kF2sW9DmH0Bt"
7801
7824
  },
7802
7825
  {
@@ -7804,7 +7827,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7804
7827
  name: "Itumbwe Health Post",
7805
7828
  locationType: "HEALTH_FACILITY",
7806
7829
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7807
- validUntil: null,
7808
7830
  externalId: "Ue5Xb3VaC7Pq"
7809
7831
  },
7810
7832
  {
@@ -7812,7 +7834,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7812
7834
  name: "Kabangalala Rural Health Centre",
7813
7835
  locationType: "HEALTH_FACILITY",
7814
7836
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7815
- validUntil: null,
7816
7837
  externalId: "Pz8Kc1TqH6Jn"
7817
7838
  },
7818
7839
  // Village offices
@@ -7821,10 +7842,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7821
7842
  name: "Klow Village Office",
7822
7843
  locationType: "CRVS_OFFICE",
7823
7844
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7824
- validUntil: null,
7825
7845
  externalId: "PmAyxAJkxiJ"
7826
7846
  }
7827
7847
  ];
7848
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7828
7849
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7829
7850
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7830
7851
  );
@@ -7832,8 +7853,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7832
7853
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7833
7854
  );
7834
7855
 
7835
- // ../commons/src/notification/UserNotifications.ts
7856
+ // ../commons/src/events/locationPayloads.ts
7836
7857
  var z44 = __toESM(require("zod/v4"));
7858
+ var CreateLocationPayload = z44.object({
7859
+ id: UUID.optional(),
7860
+ versionId: UUID.optional(),
7861
+ name: z44.string(),
7862
+ externalId: z44.string().nullish(),
7863
+ administrativeAreaId: UUID.nullable(),
7864
+ locationType: z44.string().nullable(),
7865
+ effectiveFrom: z44.iso.date().optional(),
7866
+ status: LocationStatus.default("active")
7867
+ });
7868
+ var UpdateLocationPayload = z44.strictObject({
7869
+ id: UUID,
7870
+ versionId: UUID.optional(),
7871
+ name: z44.string(),
7872
+ externalId: z44.string().nullish(),
7873
+ status: LocationStatus,
7874
+ effectiveFrom: z44.iso.date().optional(),
7875
+ lastVersionId: UUID
7876
+ });
7877
+ var WithdrawLocationVersionPayload = z44.object({
7878
+ id: UUID,
7879
+ versionId: UUID
7880
+ });
7881
+ var CreateAdministrativeAreaPayload = z44.object({
7882
+ id: UUID.optional(),
7883
+ versionId: UUID.optional(),
7884
+ name: z44.string(),
7885
+ externalId: z44.string().nullish(),
7886
+ parentId: UUID.nullable(),
7887
+ effectiveFrom: z44.iso.date().optional(),
7888
+ status: LocationStatus.default("active")
7889
+ });
7890
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7891
+ id: UUID,
7892
+ versionId: UUID.optional(),
7893
+ name: z44.string(),
7894
+ externalId: z44.string().nullish(),
7895
+ status: LocationStatus,
7896
+ effectiveFrom: z44.iso.date().optional(),
7897
+ lastVersionId: UUID
7898
+ });
7899
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7900
+ id: UUID,
7901
+ versionId: UUID
7902
+ });
7903
+
7904
+ // ../commons/src/notification/UserNotifications.ts
7905
+ var z45 = __toESM(require("zod/v4"));
7837
7906
  var TriggerEvent = {
7838
7907
  USER_CREATED: "user-created",
7839
7908
  USER_UPDATED: "user-updated",
@@ -7846,54 +7915,54 @@ var TriggerEvent = {
7846
7915
  CHANGE_PHONE_NUMBER: "change-phone-number",
7847
7916
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7848
7917
  };
7849
- var Recipient = z44.object({
7918
+ var Recipient = z45.object({
7850
7919
  name: NameFieldValue.optional(),
7851
- mobile: z44.string().optional(),
7852
- email: z44.string().optional(),
7853
- bcc: z44.array(z44.string()).optional()
7920
+ mobile: z45.string().optional(),
7921
+ email: z45.string().optional(),
7922
+ bcc: z45.array(z45.string()).optional()
7854
7923
  });
7855
- var BasePayload = z44.object({
7924
+ var BasePayload = z45.object({
7856
7925
  recipient: Recipient
7857
7926
  });
7858
7927
  var TriggerPayload = {
7859
7928
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7860
- username: z44.string(),
7861
- temporaryPassword: z44.string()
7929
+ username: z45.string(),
7930
+ temporaryPassword: z45.string()
7862
7931
  }),
7863
7932
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7864
- oldUsername: z44.string(),
7865
- newUsername: z44.string()
7933
+ oldUsername: z45.string(),
7934
+ newUsername: z45.string()
7866
7935
  }),
7867
7936
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7868
- username: z44.string()
7937
+ username: z45.string()
7869
7938
  }),
7870
7939
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7871
- code: z44.string()
7940
+ code: z45.string()
7872
7941
  }),
7873
7942
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7874
- temporaryPassword: z44.string(),
7875
- admin: z44.object({
7876
- id: z44.string(),
7943
+ temporaryPassword: z45.string(),
7944
+ admin: z45.object({
7945
+ id: z45.string(),
7877
7946
  name: NameFieldValue,
7878
- role: z44.string()
7947
+ role: z45.string()
7879
7948
  })
7880
7949
  }),
7881
7950
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7882
- username: z44.string(),
7883
- temporaryPassword: z44.string()
7951
+ username: z45.string(),
7952
+ temporaryPassword: z45.string()
7884
7953
  }),
7885
7954
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7886
- code: z44.string()
7955
+ code: z45.string()
7887
7956
  }),
7888
7957
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7889
- subject: z44.string(),
7890
- body: z44.string()
7958
+ subject: z45.string(),
7959
+ body: z45.string()
7891
7960
  }),
7892
7961
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7893
- code: z44.string()
7962
+ code: z45.string()
7894
7963
  }),
7895
7964
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7896
- code: z44.string()
7965
+ code: z45.string()
7897
7966
  })
7898
7967
  };
7899
7968
  async function triggerUserEventNotification({
@@ -7917,4 +7986,4 @@ function parseUserEventTrigger(event2, body) {
7917
7986
  }
7918
7987
 
7919
7988
  // src/notification/index.ts
7920
- z45.globalRegistry.clear();
7989
+ z46.globalRegistry.clear();