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

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 +3623 -3361
  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 +189 -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 +236 -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 +219 -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.1f71eca.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,82 @@ 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
+ });
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
+ });
590
+ var withdrawVersionRequestData = z5.object({
591
+ id: z5.string(),
592
+ versionId: z5.string()
593
+ });
594
+ var withdrawVersionResponseSummary = z5.object({
595
+ effectiveFrom: z5.string(),
596
+ name: z5.string(),
597
+ externalId: z5.string().nullish(),
598
+ status: z5.string()
599
+ });
600
+ var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
601
+ operation: z5.literal("locations.withdrawVersion"),
602
+ requestData: withdrawVersionRequestData,
603
+ responseSummary: withdrawVersionResponseSummary
604
+ });
605
+ var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
606
+ operation: z5.literal("administrativeAreas.withdrawVersion"),
607
+ requestData: withdrawVersionRequestData,
608
+ responseSummary: withdrawVersionResponseSummary
609
+ });
533
610
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
534
611
  operation: z5.literal("attachments.upload"),
535
612
  requestData: z5.object({
@@ -605,6 +682,12 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
605
682
  IntegrationActivateEntrySchema,
606
683
  IntegrationDeleteEntrySchema,
607
684
  IntegrationRefreshSecretEntrySchema,
685
+ LocationCreateEntrySchema,
686
+ LocationUpdateEntrySchema,
687
+ AdministrativeAreaUpdateEntrySchema,
688
+ LocationWithdrawEntrySchema,
689
+ AdministrativeAreaWithdrawEntrySchema,
690
+ AdministrativeAreaCreateEntrySchema,
608
691
  AttachmentUploadEntrySchema,
609
692
  UserCreateEntrySchema,
610
693
  UserReasonEntrySchema,
@@ -1216,9 +1299,10 @@ var NotifiedAction = ActionBase.extend(
1216
1299
  var EditAction = ActionBase.extend(
1217
1300
  z14.object({
1218
1301
  type: z14.literal(ActionType.EDIT),
1302
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1219
1303
  content: z14.object({
1220
1304
  comment: z14.string().describe("Comment for the edit action.").optional()
1221
- })
1305
+ }).optional()
1222
1306
  }).shape
1223
1307
  );
1224
1308
  var PrintContent = z14.object({
@@ -2694,6 +2778,9 @@ var ActionConfigBase = z24.object({
2694
2778
  var DeclarationActionBase = ActionConfigBase.extend({
2695
2779
  deduplication: DeduplicationConfig.optional()
2696
2780
  });
2781
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2782
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2783
+ );
2697
2784
  var ReadActionConfig = ActionConfigBase.extend(
2698
2785
  z24.object({
2699
2786
  type: z24.literal(ActionType.READ),
@@ -2705,7 +2792,8 @@ var ReadActionConfig = ActionConfigBase.extend(
2705
2792
  );
2706
2793
  var NotifyConfig = ActionConfigBase.extend(
2707
2794
  z24.object({
2708
- type: z24.literal(ActionType.NOTIFY)
2795
+ type: z24.literal(ActionType.NOTIFY),
2796
+ form: actionConfirmationForm
2709
2797
  }).shape
2710
2798
  );
2711
2799
  var DuplicateDetectedConfig = ActionConfigBase.extend(
@@ -2760,6 +2848,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2760
2848
  review: DeclarationReviewConfig.describe(
2761
2849
  "Configuration of the review page fields."
2762
2850
  ),
2851
+ form: actionConfirmationForm,
2763
2852
  dialogCopy: z24.object({
2764
2853
  notify: TranslationConfig.describe(
2765
2854
  "Confirmation text for the notify action"
@@ -2775,7 +2864,8 @@ var DeclareConfig = DeclarationActionBase.extend(
2775
2864
  );
2776
2865
  var ArchiveConfig = ActionConfigBase.extend(
2777
2866
  z24.object({
2778
- type: z24.literal(ActionType.ARCHIVE)
2867
+ type: z24.literal(ActionType.ARCHIVE),
2868
+ form: actionConfirmationForm
2779
2869
  }).shape
2780
2870
  );
2781
2871
  var UnarchiveConfig = ActionConfigBase.extend(
@@ -2801,12 +2891,14 @@ var EditActionConfig = ActionConfigBase.extend(
2801
2891
  );
2802
2892
  var RejectConfig = ActionConfigBase.extend(
2803
2893
  z24.object({
2804
- type: z24.literal(ActionType.REJECT)
2894
+ type: z24.literal(ActionType.REJECT),
2895
+ form: actionConfirmationForm
2805
2896
  }).shape
2806
2897
  );
2807
2898
  var RegisterConfig = DeclarationActionBase.extend(
2808
2899
  z24.object({
2809
- type: z24.literal(ActionType.REGISTER)
2900
+ type: z24.literal(ActionType.REGISTER),
2901
+ form: actionConfirmationForm
2810
2902
  }).shape
2811
2903
  );
2812
2904
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3326,13 +3418,9 @@ var getActionAnnotationFields = (actionConfig) => {
3326
3418
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3327
3419
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3328
3420
  }
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 [];
3421
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3422
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3423
+ return [...reviewFields, ...formFields];
3336
3424
  };
3337
3425
  function getAllAnnotationFields(config) {
3338
3426
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -4648,10 +4736,7 @@ var DeclareActionInput = BaseActionInput.extend(
4648
4736
  );
4649
4737
  var EditActionInput = BaseActionInput.extend(
4650
4738
  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
- })
4739
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4655
4740
  }).shape
4656
4741
  );
4657
4742
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -7357,21 +7442,44 @@ var LocationTypeV1 = z43.enum([
7357
7442
  "CRVS_OFFICE",
7358
7443
  "HEALTH_FACILITY"
7359
7444
  ]);
7445
+ var LocationStatus = z43.enum(["active", "inactive"]);
7446
+ var LocationVersion = z43.object({
7447
+ versionId: UUID,
7448
+ effectiveFrom: z43.iso.date(),
7449
+ name: z43.string(),
7450
+ externalId: z43.string().nullish(),
7451
+ status: LocationStatus
7452
+ });
7360
7453
  var AdministrativeArea = z43.object({
7361
7454
  id: UUID,
7362
7455
  name: z43.string(),
7363
7456
  externalId: z43.string().nullish(),
7364
7457
  parentId: UUID.nullable(),
7365
- validUntil: z43.iso.datetime().nullable()
7458
+ status: LocationStatus,
7459
+ versions: z43.array(LocationVersion)
7366
7460
  });
7367
7461
  var Location = z43.object({
7368
7462
  id: UUID,
7369
7463
  name: z43.string(),
7370
7464
  externalId: z43.string().nullish(),
7371
7465
  administrativeAreaId: UUID.nullable(),
7372
- validUntil: z43.iso.datetime().nullable(),
7466
+ locationType: z43.string().nullable(),
7467
+ status: LocationStatus,
7468
+ versions: z43.array(LocationVersion)
7469
+ });
7470
+ var SetLocationPayload = z43.object({
7471
+ id: UUID,
7472
+ name: z43.string(),
7473
+ externalId: z43.string().nullish(),
7474
+ administrativeAreaId: UUID.nullable(),
7373
7475
  locationType: z43.string().nullable()
7374
7476
  });
7477
+ var SetAdministrativeAreaPayload = z43.object({
7478
+ id: UUID,
7479
+ name: z43.string(),
7480
+ externalId: z43.string().nullish(),
7481
+ parentId: UUID.nullable()
7482
+ });
7375
7483
 
7376
7484
  // ../commons/src/events/scopes.ts
7377
7485
  var ACTION_SCOPE_MAP = {
@@ -7470,75 +7578,80 @@ var REJECTED_ACTIONS = [
7470
7578
  var import_lodash7 = require("lodash");
7471
7579
 
7472
7580
  // ../commons/src/events/mocks.test.utils.ts
7473
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7581
+ function withVersionFields(entity) {
7582
+ return {
7583
+ ...entity,
7584
+ status: "active",
7585
+ versions: [
7586
+ {
7587
+ versionId: entity.id,
7588
+ effectiveFrom: "0001-01-01",
7589
+ name: entity.name,
7590
+ externalId: entity.externalId ?? null,
7591
+ status: "active"
7592
+ }
7593
+ ]
7594
+ };
7595
+ }
7596
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7474
7597
  {
7475
7598
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7476
7599
  name: "Central",
7477
7600
  parentId: null,
7478
- validUntil: null,
7479
7601
  externalId: "ydyJb1RAy4U1"
7480
7602
  },
7481
7603
  {
7482
7604
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7483
7605
  name: "Sulaka",
7484
7606
  parentId: null,
7485
- validUntil: null,
7486
7607
  externalId: "pQ8nGxWmZ2Q3"
7487
7608
  },
7488
7609
  {
7489
7610
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7490
7611
  name: "Pualula",
7491
7612
  parentId: null,
7492
- validUntil: null,
7493
7613
  externalId: "Aq91DweLmT8k"
7494
7614
  },
7495
7615
  {
7496
7616
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7497
7617
  name: "Chuminga",
7498
7618
  parentId: null,
7499
- validUntil: null,
7500
7619
  externalId: "Rw0fYNh2Xk9a"
7501
7620
  },
7502
7621
  {
7503
7622
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7504
7623
  name: "Ibombo",
7505
7624
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7506
- validUntil: null,
7507
7625
  externalId: "k7DsP4vbN1Qe"
7508
7626
  },
7509
7627
  {
7510
7628
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7511
7629
  name: "Isango",
7512
7630
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7513
- validUntil: null,
7514
7631
  externalId: "Gm3Z9eQpHw4L"
7515
7632
  },
7516
7633
  {
7517
7634
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7518
7635
  name: "Isamba",
7519
7636
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7520
- validUntil: null,
7521
7637
  externalId: "sT0xVu1KqJ7r"
7522
7638
  },
7523
7639
  {
7524
7640
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7525
7641
  name: "Itambo",
7526
7642
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7527
- validUntil: null,
7528
7643
  externalId: "Nq6Bv2HpL9Te"
7529
7644
  },
7530
7645
  {
7531
7646
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7532
7647
  name: "Ezhi",
7533
7648
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7534
- validUntil: null,
7535
7649
  externalId: "xK8cQ0ZRy5Wd"
7536
7650
  },
7537
7651
  {
7538
7652
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7539
7653
  name: "Ilanga",
7540
7654
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7541
- validUntil: null,
7542
7655
  externalId: "Cq4Jm1XvN8Ls"
7543
7656
  },
7544
7657
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7546,49 +7659,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7546
7659
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7547
7660
  name: "Klow",
7548
7661
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7549
- validUntil: null,
7550
7662
  externalId: "IkYcYBUcyY2"
7551
7663
  },
7552
7664
  {
7553
7665
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7554
7666
  name: "Mbondo",
7555
7667
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7556
- validUntil: null,
7557
7668
  externalId: "Qhvv5hvo3mY"
7558
7669
  },
7559
7670
  {
7560
7671
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7561
7672
  name: "Ndara",
7562
7673
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7563
- validUntil: null,
7564
7674
  externalId: "crXh068O9TR"
7565
7675
  },
7566
7676
  {
7567
7677
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7568
7678
  name: "Olani",
7569
7679
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
- validUntil: null,
7571
7680
  externalId: "r00It8Tvvp7"
7572
7681
  },
7573
7682
  {
7574
7683
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7575
7684
  name: "Pemba",
7576
7685
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7577
- validUntil: null,
7578
7686
  externalId: "ZnUWsbONIaH"
7579
7687
  },
7580
7688
  {
7581
7689
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7582
7690
  name: "Quanza",
7583
7691
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7584
- validUntil: null,
7585
7692
  externalId: "fDZycvQTa7l"
7586
7693
  },
7587
7694
  {
7588
7695
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7589
7696
  name: "Rivka",
7590
7697
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7591
- validUntil: null,
7592
7698
  externalId: "KqswxCGTELa"
7593
7699
  },
7594
7700
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7596,35 +7702,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7596
7702
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7597
7703
  name: "Mbula",
7598
7704
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7599
- validUntil: null,
7600
7705
  externalId: "osEbKjRc9Kg"
7601
7706
  },
7602
7707
  {
7603
7708
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7604
7709
  name: "Ndoki",
7605
7710
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7606
- validUntil: null,
7607
7711
  externalId: "aq4daBUAGr3"
7608
7712
  },
7609
7713
  {
7610
7714
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7611
7715
  name: "Tsanga",
7612
7716
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7613
- validUntil: null,
7614
7717
  externalId: "cqis6Y8trbJ"
7615
7718
  },
7616
7719
  {
7617
7720
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7618
7721
  name: "Waziri",
7619
7722
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7620
- validUntil: null,
7621
7723
  externalId: "LMijHPyyx6d"
7622
7724
  },
7623
7725
  {
7624
7726
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7625
7727
  name: "Zimbi",
7626
7728
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7627
- validUntil: null,
7628
7729
  externalId: "pcQYbPuKGZ7"
7629
7730
  },
7630
7731
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7632,67 +7733,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7632
7733
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7633
7734
  name: "Felani",
7634
7735
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7635
- validUntil: null,
7636
7736
  externalId: "gSqpoCGdMXp"
7637
7737
  },
7638
7738
  {
7639
7739
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7640
7740
  name: "Goroma",
7641
7741
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7642
- validUntil: null,
7643
7742
  externalId: "KvAAIaNqVrp"
7644
7743
  },
7645
7744
  {
7646
7745
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7647
7746
  name: "Halifu",
7648
7747
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7649
- validUntil: null,
7650
7748
  externalId: "qe4UnEVt1hv"
7651
7749
  },
7652
7750
  {
7653
7751
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7654
7752
  name: "Jabari",
7655
7753
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7656
- validUntil: null,
7657
7754
  externalId: "yHH9Nz4rLOt"
7658
7755
  },
7659
7756
  {
7660
7757
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7661
7758
  name: "Kifani",
7662
7759
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7663
- validUntil: null,
7664
7760
  externalId: "eSWmXIGeu1I"
7665
7761
  },
7666
7762
  {
7667
7763
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7668
7764
  name: "Lumela",
7669
7765
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7670
- validUntil: null,
7671
7766
  externalId: "bh0b3aI1uP3"
7672
7767
  }
7673
7768
  ];
7674
- var V2_DEFAULT_MOCK_LOCATIONS = [
7769
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7770
+ var MOCK_LOCATIONS_BASE = [
7675
7771
  {
7676
7772
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7677
7773
  name: "Central Provincial Office",
7678
7774
  locationType: "CRVS_OFFICE",
7679
7775
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7680
- validUntil: null,
7681
7776
  externalId: "Xr3Df8WpK6Ys"
7682
7777
  },
7683
7778
  {
7684
7779
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7685
7780
  name: "Central Health Post",
7686
7781
  locationType: "HEALTH_FACILITY",
7687
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7688
- validUntil: null
7782
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7689
7783
  },
7690
7784
  {
7691
7785
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7692
7786
  name: "Ibombo District Office",
7693
7787
  locationType: "CRVS_OFFICE",
7694
7788
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7695
- validUntil: null,
7696
7789
  externalId: "Sm4Nw7GrD2Vy"
7697
7790
  },
7698
7791
  {
@@ -7700,7 +7793,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7700
7793
  name: "Isamba District Office",
7701
7794
  locationType: "CRVS_OFFICE",
7702
7795
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7703
- validUntil: null,
7704
7796
  externalId: "Vg1Bq5XeH9Lt"
7705
7797
  },
7706
7798
  {
@@ -7708,7 +7800,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7708
7800
  name: "Isango District Office",
7709
7801
  locationType: "CRVS_OFFICE",
7710
7802
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7711
- validUntil: null,
7712
7803
  externalId: "Je7Lm2XqN9Vz"
7713
7804
  },
7714
7805
  {
@@ -7716,7 +7807,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7716
7807
  name: "Sulaka Provincial Office",
7717
7808
  locationType: "CRVS_OFFICE",
7718
7809
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7719
- validUntil: null,
7720
7810
  externalId: "Ht2Wp9KcX5Qv"
7721
7811
  },
7722
7812
  {
@@ -7724,7 +7814,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7724
7814
  name: "Ilanga District Office",
7725
7815
  locationType: "CRVS_OFFICE",
7726
7816
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7727
- validUntil: null,
7728
7817
  externalId: "Yp6Ds1WqN3Xz"
7729
7818
  },
7730
7819
  {
@@ -7732,7 +7821,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7732
7821
  name: "Chamakubi Health Post",
7733
7822
  locationType: "HEALTH_FACILITY",
7734
7823
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7735
- validUntil: null,
7736
7824
  externalId: "M1nFr8LbC2Qy"
7737
7825
  },
7738
7826
  {
@@ -7740,7 +7828,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7740
7828
  name: "Ibombo Rural Health Centre",
7741
7829
  locationType: "HEALTH_FACILITY",
7742
7830
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7743
- validUntil: null,
7744
7831
  externalId: "bT7pV6YrW0Xc"
7745
7832
  },
7746
7833
  {
@@ -7748,7 +7835,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7748
7835
  name: "Chikobo Rural Health Centre",
7749
7836
  locationType: "HEALTH_FACILITY",
7750
7837
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7751
- validUntil: null,
7752
7838
  externalId: "zE4qPn2SgJ5d"
7753
7839
  },
7754
7840
  {
@@ -7756,7 +7842,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7756
7842
  name: "Chilochabalenje Health Post",
7757
7843
  locationType: "HEALTH_FACILITY",
7758
7844
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7759
- validUntil: null,
7760
7845
  externalId: "H8vDs1MqR4Uf"
7761
7846
  },
7762
7847
  {
@@ -7764,7 +7849,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7764
7849
  name: "Chipeso Rural Health Centre",
7765
7850
  locationType: "HEALTH_FACILITY",
7766
7851
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7767
- validUntil: null,
7768
7852
  externalId: "Qw3uZ9KfX6Lm"
7769
7853
  },
7770
7854
  {
@@ -7772,7 +7856,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7772
7856
  name: "Chisamba Rural Health Centre",
7773
7857
  locationType: "HEALTH_FACILITY",
7774
7858
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7775
- validUntil: null,
7776
7859
  externalId: "Yr0pCg8LdM2s"
7777
7860
  },
7778
7861
  {
@@ -7780,7 +7863,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7780
7863
  name: "Chitanda Rural Health Centre",
7781
7864
  locationType: "HEALTH_FACILITY",
7782
7865
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7783
- validUntil: null,
7784
7866
  externalId: "tS9gJ4PwB1Qx"
7785
7867
  },
7786
7868
  {
@@ -7788,7 +7870,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7788
7870
  name: "Golden Valley Rural Health Centre",
7789
7871
  locationType: "HEALTH_FACILITY",
7790
7872
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7791
- validUntil: null,
7792
7873
  externalId: "Ld7Qm3XsA8Vr"
7793
7874
  },
7794
7875
  {
@@ -7796,7 +7877,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7796
7877
  name: "Ipongo Rural Health Centre",
7797
7878
  locationType: "HEALTH_FACILITY",
7798
7879
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7799
- validUntil: null,
7800
7880
  externalId: "kF2sW9DmH0Bt"
7801
7881
  },
7802
7882
  {
@@ -7804,7 +7884,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7804
7884
  name: "Itumbwe Health Post",
7805
7885
  locationType: "HEALTH_FACILITY",
7806
7886
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7807
- validUntil: null,
7808
7887
  externalId: "Ue5Xb3VaC7Pq"
7809
7888
  },
7810
7889
  {
@@ -7812,7 +7891,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7812
7891
  name: "Kabangalala Rural Health Centre",
7813
7892
  locationType: "HEALTH_FACILITY",
7814
7893
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7815
- validUntil: null,
7816
7894
  externalId: "Pz8Kc1TqH6Jn"
7817
7895
  },
7818
7896
  // Village offices
@@ -7821,10 +7899,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7821
7899
  name: "Klow Village Office",
7822
7900
  locationType: "CRVS_OFFICE",
7823
7901
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7824
- validUntil: null,
7825
7902
  externalId: "PmAyxAJkxiJ"
7826
7903
  }
7827
7904
  ];
7905
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7828
7906
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7829
7907
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7830
7908
  );
@@ -7832,8 +7910,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7832
7910
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7833
7911
  );
7834
7912
 
7835
- // ../commons/src/notification/UserNotifications.ts
7913
+ // ../commons/src/events/locationPayloads.ts
7836
7914
  var z44 = __toESM(require("zod/v4"));
7915
+ var CreateLocationPayload = z44.object({
7916
+ id: UUID.optional(),
7917
+ versionId: UUID.optional(),
7918
+ name: z44.string(),
7919
+ externalId: z44.string().nullish(),
7920
+ administrativeAreaId: UUID.nullable(),
7921
+ locationType: z44.string().nullable(),
7922
+ effectiveFrom: z44.iso.date().optional(),
7923
+ status: LocationStatus.default("active")
7924
+ });
7925
+ var UpdateLocationPayload = 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 WithdrawLocationVersionPayload = z44.object({
7935
+ id: UUID,
7936
+ versionId: UUID
7937
+ });
7938
+ var CreateAdministrativeAreaPayload = z44.object({
7939
+ id: UUID.optional(),
7940
+ versionId: UUID.optional(),
7941
+ name: z44.string(),
7942
+ externalId: z44.string().nullish(),
7943
+ parentId: UUID.nullable(),
7944
+ effectiveFrom: z44.iso.date().optional(),
7945
+ status: LocationStatus.default("active")
7946
+ });
7947
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7948
+ id: UUID,
7949
+ versionId: UUID.optional(),
7950
+ name: z44.string(),
7951
+ externalId: z44.string().nullish(),
7952
+ status: LocationStatus,
7953
+ effectiveFrom: z44.iso.date().optional(),
7954
+ lastVersionId: UUID
7955
+ });
7956
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7957
+ id: UUID,
7958
+ versionId: UUID
7959
+ });
7960
+
7961
+ // ../commons/src/notification/UserNotifications.ts
7962
+ var z45 = __toESM(require("zod/v4"));
7837
7963
  var TriggerEvent = {
7838
7964
  USER_CREATED: "user-created",
7839
7965
  USER_UPDATED: "user-updated",
@@ -7846,54 +7972,54 @@ var TriggerEvent = {
7846
7972
  CHANGE_PHONE_NUMBER: "change-phone-number",
7847
7973
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7848
7974
  };
7849
- var Recipient = z44.object({
7975
+ var Recipient = z45.object({
7850
7976
  name: NameFieldValue.optional(),
7851
- mobile: z44.string().optional(),
7852
- email: z44.string().optional(),
7853
- bcc: z44.array(z44.string()).optional()
7977
+ mobile: z45.string().optional(),
7978
+ email: z45.string().optional(),
7979
+ bcc: z45.array(z45.string()).optional()
7854
7980
  });
7855
- var BasePayload = z44.object({
7981
+ var BasePayload = z45.object({
7856
7982
  recipient: Recipient
7857
7983
  });
7858
7984
  var TriggerPayload = {
7859
7985
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7860
- username: z44.string(),
7861
- temporaryPassword: z44.string()
7986
+ username: z45.string(),
7987
+ temporaryPassword: z45.string()
7862
7988
  }),
7863
7989
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7864
- oldUsername: z44.string(),
7865
- newUsername: z44.string()
7990
+ oldUsername: z45.string(),
7991
+ newUsername: z45.string()
7866
7992
  }),
7867
7993
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7868
- username: z44.string()
7994
+ username: z45.string()
7869
7995
  }),
7870
7996
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7871
- code: z44.string()
7997
+ code: z45.string()
7872
7998
  }),
7873
7999
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7874
- temporaryPassword: z44.string(),
7875
- admin: z44.object({
7876
- id: z44.string(),
8000
+ temporaryPassword: z45.string(),
8001
+ admin: z45.object({
8002
+ id: z45.string(),
7877
8003
  name: NameFieldValue,
7878
- role: z44.string()
8004
+ role: z45.string()
7879
8005
  })
7880
8006
  }),
7881
8007
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7882
- username: z44.string(),
7883
- temporaryPassword: z44.string()
8008
+ username: z45.string(),
8009
+ temporaryPassword: z45.string()
7884
8010
  }),
7885
8011
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7886
- code: z44.string()
8012
+ code: z45.string()
7887
8013
  }),
7888
8014
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7889
- subject: z44.string(),
7890
- body: z44.string()
8015
+ subject: z45.string(),
8016
+ body: z45.string()
7891
8017
  }),
7892
8018
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7893
- code: z44.string()
8019
+ code: z45.string()
7894
8020
  }),
7895
8021
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7896
- code: z44.string()
8022
+ code: z45.string()
7897
8023
  })
7898
8024
  };
7899
8025
  async function triggerUserEventNotification({
@@ -7917,4 +8043,4 @@ function parseUserEventTrigger(event2, body) {
7917
8043
  }
7918
8044
 
7919
8045
  // src/notification/index.ts
7920
- z45.globalRegistry.clear();
8046
+ z46.globalRegistry.clear();