@opencrvs/toolkit 2.1.0-rc.7d9a8f9 → 2.1.0-rc.7f423f1

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 (62) hide show
  1. package/dist/application-config/index.js +3 -1
  2. package/dist/cli.js +0 -48
  3. package/dist/commons/api/router.d.ts +3453 -3313
  4. package/dist/commons/application-config/index.d.ts +6 -6
  5. package/dist/commons/conditionals/conditionals.d.ts +259 -2102
  6. package/dist/commons/events/ActionConfig.d.ts +112 -105
  7. package/dist/commons/events/ActionDocument.d.ts +119 -119
  8. package/dist/commons/events/ActionInput.d.ts +0 -6
  9. package/dist/commons/events/ActionType.d.ts +62 -62
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -507
  11. package/dist/commons/events/AuditLog.d.ts +104 -42
  12. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  13. package/dist/commons/events/Conditional.d.ts +3 -3
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  15. package/dist/commons/events/Draft.d.ts +37 -37
  16. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  17. package/dist/commons/events/EventConfig.d.ts +5 -5
  18. package/dist/commons/events/EventDocument.d.ts +48 -48
  19. package/dist/commons/events/EventIndex.d.ts +62 -62
  20. package/dist/commons/events/EventMetadata.d.ts +40 -40
  21. package/dist/commons/events/FieldConfig.d.ts +341 -336
  22. package/dist/commons/events/FieldType.d.ts +51 -51
  23. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  24. package/dist/commons/events/FieldValue.d.ts +12 -12
  25. package/dist/commons/events/Flag.d.ts +15 -15
  26. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  28. package/dist/commons/events/WorkqueueConfig.d.ts +826 -826
  29. package/dist/commons/events/deduplication.d.ts +1 -1
  30. package/dist/commons/events/event.d.ts +2 -2
  31. package/dist/commons/events/field.d.ts +78 -895
  32. package/dist/commons/events/index.d.ts +1 -0
  33. package/dist/commons/events/locationPayloads.d.ts +95 -0
  34. package/dist/commons/events/locations.d.ts +103 -6
  35. package/dist/commons/events/mocks.test.utils.d.ts +18 -4
  36. package/dist/commons/events/scopes.d.ts +4 -4
  37. package/dist/commons/events/state/index.d.ts +17 -17
  38. package/dist/commons/events/state/utils.d.ts +7 -7
  39. package/dist/commons/events/test.utils.d.ts +40 -43
  40. package/dist/commons/events/utils.d.ts +122 -114
  41. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  42. package/dist/conditionals/index.js +1 -0
  43. package/dist/environment/derived-variables.d.ts +119 -131
  44. package/dist/environment/derived-variables.d.ts.map +1 -1
  45. package/dist/environment/derived-variables.js +0 -14
  46. package/dist/environment/logger.d.ts.map +1 -1
  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 -28
  50. package/dist/environment/utils.d.ts +1 -1
  51. package/dist/events/deduplication.d.ts +1 -1
  52. package/dist/events/index.js +201 -70
  53. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  54. package/dist/notification/index.js +184 -93
  55. package/dist/scopes/index.d.ts +148 -146
  56. package/dist/scopes/index.js +1 -0
  57. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  58. package/dist/templates/charts-values/opencrvs-services/values.yaml +0 -4
  59. package/opencrvs-toolkit-2.1.0-rc.7f423f1.tgz +0 -0
  60. package/package.json +3 -4
  61. package/tsconfig.tsbuildinfo +1 -1
  62. package/opencrvs-toolkit-2.1.0-rc.7d9a8f9.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,51 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
530
531
  requestData: z5.object({ id: z5.string() }),
531
532
  responseSummary: z5.object({ clientId: z5.string() })
532
533
  });
534
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
535
+ operation: z5.enum(["locations.create", "administrativeAreas.create"]),
536
+ requestData: z5.object({
537
+ id: z5.string(),
538
+ versionId: z5.string(),
539
+ name: z5.string(),
540
+ externalId: z5.string().nullish(),
541
+ administrativeAreaId: z5.string().nullish(),
542
+ // locations only
543
+ parentId: z5.string().nullish(),
544
+ // administrative areas only
545
+ locationType: z5.string().nullish(),
546
+ // locations only
547
+ effectiveFrom: z5.string(),
548
+ status: z5.string()
549
+ })
550
+ });
551
+ var ChangedStringField = z5.object({ from: z5.string(), to: z5.string() });
552
+ var ChangedNullableStringField = z5.object({
553
+ from: z5.string().nullable(),
554
+ to: z5.string().nullable()
555
+ });
556
+ var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
557
+ operation: z5.enum(["locations.update", "administrativeAreas.update"]),
558
+ /** The submitted snapshot, with server-resolved `versionId`/`effectiveFrom`. */
559
+ requestData: z5.object({
560
+ id: z5.string(),
561
+ versionId: z5.string(),
562
+ name: z5.string(),
563
+ externalId: z5.string().nullish(),
564
+ status: z5.string(),
565
+ effectiveFrom: z5.string(),
566
+ lastVersionId: z5.string()
567
+ }),
568
+ /** The diff against the previous version — only fields that changed. */
569
+ responseSummary: z5.object({
570
+ previousVersionId: z5.string(),
571
+ versionId: z5.string(),
572
+ changed: z5.object({
573
+ name: ChangedStringField.optional(),
574
+ externalId: ChangedNullableStringField.optional(),
575
+ status: ChangedStringField.optional()
576
+ })
577
+ })
578
+ });
533
579
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
534
580
  operation: z5.literal("attachments.upload"),
535
581
  requestData: z5.object({
@@ -605,6 +651,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
605
651
  IntegrationActivateEntrySchema,
606
652
  IntegrationDeleteEntrySchema,
607
653
  IntegrationRefreshSecretEntrySchema,
654
+ LocationCreateEntrySchema,
655
+ LocationUpdateEntrySchema,
608
656
  AttachmentUploadEntrySchema,
609
657
  UserCreateEntrySchema,
610
658
  UserReasonEntrySchema,
@@ -1216,9 +1264,10 @@ var NotifiedAction = ActionBase.extend(
1216
1264
  var EditAction = ActionBase.extend(
1217
1265
  z14.object({
1218
1266
  type: z14.literal(ActionType.EDIT),
1267
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1219
1268
  content: z14.object({
1220
1269
  comment: z14.string().describe("Comment for the edit action.").optional()
1221
- })
1270
+ }).optional()
1222
1271
  }).shape
1223
1272
  );
1224
1273
  var PrintContent = z14.object({
@@ -2694,6 +2743,9 @@ var ActionConfigBase = z24.object({
2694
2743
  var DeclarationActionBase = ActionConfigBase.extend({
2695
2744
  deduplication: DeduplicationConfig.optional()
2696
2745
  });
2746
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2747
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2748
+ );
2697
2749
  var ReadActionConfig = ActionConfigBase.extend(
2698
2750
  z24.object({
2699
2751
  type: z24.literal(ActionType.READ),
@@ -2705,7 +2757,8 @@ var ReadActionConfig = ActionConfigBase.extend(
2705
2757
  );
2706
2758
  var NotifyConfig = ActionConfigBase.extend(
2707
2759
  z24.object({
2708
- type: z24.literal(ActionType.NOTIFY)
2760
+ type: z24.literal(ActionType.NOTIFY),
2761
+ form: actionConfirmationForm
2709
2762
  }).shape
2710
2763
  );
2711
2764
  var DuplicateDetectedConfig = ActionConfigBase.extend(
@@ -2760,6 +2813,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2760
2813
  review: DeclarationReviewConfig.describe(
2761
2814
  "Configuration of the review page fields."
2762
2815
  ),
2816
+ form: actionConfirmationForm,
2763
2817
  dialogCopy: z24.object({
2764
2818
  notify: TranslationConfig.describe(
2765
2819
  "Confirmation text for the notify action"
@@ -2775,7 +2829,8 @@ var DeclareConfig = DeclarationActionBase.extend(
2775
2829
  );
2776
2830
  var ArchiveConfig = ActionConfigBase.extend(
2777
2831
  z24.object({
2778
- type: z24.literal(ActionType.ARCHIVE)
2832
+ type: z24.literal(ActionType.ARCHIVE),
2833
+ form: actionConfirmationForm
2779
2834
  }).shape
2780
2835
  );
2781
2836
  var UnarchiveConfig = ActionConfigBase.extend(
@@ -2801,12 +2856,14 @@ var EditActionConfig = ActionConfigBase.extend(
2801
2856
  );
2802
2857
  var RejectConfig = ActionConfigBase.extend(
2803
2858
  z24.object({
2804
- type: z24.literal(ActionType.REJECT)
2859
+ type: z24.literal(ActionType.REJECT),
2860
+ form: actionConfirmationForm
2805
2861
  }).shape
2806
2862
  );
2807
2863
  var RegisterConfig = DeclarationActionBase.extend(
2808
2864
  z24.object({
2809
- type: z24.literal(ActionType.REGISTER)
2865
+ type: z24.literal(ActionType.REGISTER),
2866
+ form: actionConfirmationForm
2810
2867
  }).shape
2811
2868
  );
2812
2869
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3326,13 +3383,9 @@ var getActionAnnotationFields = (actionConfig) => {
3326
3383
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3327
3384
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3328
3385
  }
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 [];
3386
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3387
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3388
+ return [...reviewFields, ...formFields];
3336
3389
  };
3337
3390
  function getAllAnnotationFields(config) {
3338
3391
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -4648,10 +4701,7 @@ var DeclareActionInput = BaseActionInput.extend(
4648
4701
  );
4649
4702
  var EditActionInput = BaseActionInput.extend(
4650
4703
  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
- })
4704
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4655
4705
  }).shape
4656
4706
  );
4657
4707
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -7357,21 +7407,44 @@ var LocationTypeV1 = z43.enum([
7357
7407
  "CRVS_OFFICE",
7358
7408
  "HEALTH_FACILITY"
7359
7409
  ]);
7410
+ var LocationStatus = z43.enum(["active", "inactive"]);
7411
+ var LocationVersion = z43.object({
7412
+ versionId: UUID,
7413
+ effectiveFrom: z43.iso.date(),
7414
+ name: z43.string(),
7415
+ externalId: z43.string().nullish(),
7416
+ status: LocationStatus
7417
+ });
7360
7418
  var AdministrativeArea = z43.object({
7361
7419
  id: UUID,
7362
7420
  name: z43.string(),
7363
7421
  externalId: z43.string().nullish(),
7364
7422
  parentId: UUID.nullable(),
7365
- validUntil: z43.iso.datetime().nullable()
7423
+ status: LocationStatus,
7424
+ versions: z43.array(LocationVersion)
7366
7425
  });
7367
7426
  var Location = z43.object({
7368
7427
  id: UUID,
7369
7428
  name: z43.string(),
7370
7429
  externalId: z43.string().nullish(),
7371
7430
  administrativeAreaId: UUID.nullable(),
7372
- validUntil: z43.iso.datetime().nullable(),
7431
+ locationType: z43.string().nullable(),
7432
+ status: LocationStatus,
7433
+ versions: z43.array(LocationVersion)
7434
+ });
7435
+ var SetLocationPayload = z43.object({
7436
+ id: UUID,
7437
+ name: z43.string(),
7438
+ externalId: z43.string().nullish(),
7439
+ administrativeAreaId: UUID.nullable(),
7373
7440
  locationType: z43.string().nullable()
7374
7441
  });
7442
+ var SetAdministrativeAreaPayload = z43.object({
7443
+ id: UUID,
7444
+ name: z43.string(),
7445
+ externalId: z43.string().nullish(),
7446
+ parentId: UUID.nullable()
7447
+ });
7375
7448
 
7376
7449
  // ../commons/src/events/scopes.ts
7377
7450
  var ACTION_SCOPE_MAP = {
@@ -7470,75 +7543,80 @@ var REJECTED_ACTIONS = [
7470
7543
  var import_lodash7 = require("lodash");
7471
7544
 
7472
7545
  // ../commons/src/events/mocks.test.utils.ts
7473
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7546
+ function withVersionFields(entity) {
7547
+ return {
7548
+ ...entity,
7549
+ status: "active",
7550
+ versions: [
7551
+ {
7552
+ versionId: entity.id,
7553
+ effectiveFrom: "0001-01-01",
7554
+ name: entity.name,
7555
+ externalId: entity.externalId ?? null,
7556
+ status: "active"
7557
+ }
7558
+ ]
7559
+ };
7560
+ }
7561
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7474
7562
  {
7475
7563
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7476
7564
  name: "Central",
7477
7565
  parentId: null,
7478
- validUntil: null,
7479
7566
  externalId: "ydyJb1RAy4U1"
7480
7567
  },
7481
7568
  {
7482
7569
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7483
7570
  name: "Sulaka",
7484
7571
  parentId: null,
7485
- validUntil: null,
7486
7572
  externalId: "pQ8nGxWmZ2Q3"
7487
7573
  },
7488
7574
  {
7489
7575
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7490
7576
  name: "Pualula",
7491
7577
  parentId: null,
7492
- validUntil: null,
7493
7578
  externalId: "Aq91DweLmT8k"
7494
7579
  },
7495
7580
  {
7496
7581
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7497
7582
  name: "Chuminga",
7498
7583
  parentId: null,
7499
- validUntil: null,
7500
7584
  externalId: "Rw0fYNh2Xk9a"
7501
7585
  },
7502
7586
  {
7503
7587
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7504
7588
  name: "Ibombo",
7505
7589
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7506
- validUntil: null,
7507
7590
  externalId: "k7DsP4vbN1Qe"
7508
7591
  },
7509
7592
  {
7510
7593
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7511
7594
  name: "Isango",
7512
7595
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7513
- validUntil: null,
7514
7596
  externalId: "Gm3Z9eQpHw4L"
7515
7597
  },
7516
7598
  {
7517
7599
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7518
7600
  name: "Isamba",
7519
7601
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7520
- validUntil: null,
7521
7602
  externalId: "sT0xVu1KqJ7r"
7522
7603
  },
7523
7604
  {
7524
7605
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7525
7606
  name: "Itambo",
7526
7607
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7527
- validUntil: null,
7528
7608
  externalId: "Nq6Bv2HpL9Te"
7529
7609
  },
7530
7610
  {
7531
7611
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7532
7612
  name: "Ezhi",
7533
7613
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7534
- validUntil: null,
7535
7614
  externalId: "xK8cQ0ZRy5Wd"
7536
7615
  },
7537
7616
  {
7538
7617
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7539
7618
  name: "Ilanga",
7540
7619
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7541
- validUntil: null,
7542
7620
  externalId: "Cq4Jm1XvN8Ls"
7543
7621
  },
7544
7622
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7546,49 +7624,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7546
7624
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7547
7625
  name: "Klow",
7548
7626
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7549
- validUntil: null,
7550
7627
  externalId: "IkYcYBUcyY2"
7551
7628
  },
7552
7629
  {
7553
7630
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7554
7631
  name: "Mbondo",
7555
7632
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7556
- validUntil: null,
7557
7633
  externalId: "Qhvv5hvo3mY"
7558
7634
  },
7559
7635
  {
7560
7636
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7561
7637
  name: "Ndara",
7562
7638
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7563
- validUntil: null,
7564
7639
  externalId: "crXh068O9TR"
7565
7640
  },
7566
7641
  {
7567
7642
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7568
7643
  name: "Olani",
7569
7644
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
- validUntil: null,
7571
7645
  externalId: "r00It8Tvvp7"
7572
7646
  },
7573
7647
  {
7574
7648
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7575
7649
  name: "Pemba",
7576
7650
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7577
- validUntil: null,
7578
7651
  externalId: "ZnUWsbONIaH"
7579
7652
  },
7580
7653
  {
7581
7654
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7582
7655
  name: "Quanza",
7583
7656
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7584
- validUntil: null,
7585
7657
  externalId: "fDZycvQTa7l"
7586
7658
  },
7587
7659
  {
7588
7660
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7589
7661
  name: "Rivka",
7590
7662
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7591
- validUntil: null,
7592
7663
  externalId: "KqswxCGTELa"
7593
7664
  },
7594
7665
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7596,35 +7667,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7596
7667
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7597
7668
  name: "Mbula",
7598
7669
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7599
- validUntil: null,
7600
7670
  externalId: "osEbKjRc9Kg"
7601
7671
  },
7602
7672
  {
7603
7673
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7604
7674
  name: "Ndoki",
7605
7675
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7606
- validUntil: null,
7607
7676
  externalId: "aq4daBUAGr3"
7608
7677
  },
7609
7678
  {
7610
7679
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7611
7680
  name: "Tsanga",
7612
7681
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7613
- validUntil: null,
7614
7682
  externalId: "cqis6Y8trbJ"
7615
7683
  },
7616
7684
  {
7617
7685
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7618
7686
  name: "Waziri",
7619
7687
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7620
- validUntil: null,
7621
7688
  externalId: "LMijHPyyx6d"
7622
7689
  },
7623
7690
  {
7624
7691
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7625
7692
  name: "Zimbi",
7626
7693
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7627
- validUntil: null,
7628
7694
  externalId: "pcQYbPuKGZ7"
7629
7695
  },
7630
7696
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7632,67 +7698,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7632
7698
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7633
7699
  name: "Felani",
7634
7700
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7635
- validUntil: null,
7636
7701
  externalId: "gSqpoCGdMXp"
7637
7702
  },
7638
7703
  {
7639
7704
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7640
7705
  name: "Goroma",
7641
7706
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7642
- validUntil: null,
7643
7707
  externalId: "KvAAIaNqVrp"
7644
7708
  },
7645
7709
  {
7646
7710
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7647
7711
  name: "Halifu",
7648
7712
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7649
- validUntil: null,
7650
7713
  externalId: "qe4UnEVt1hv"
7651
7714
  },
7652
7715
  {
7653
7716
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7654
7717
  name: "Jabari",
7655
7718
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7656
- validUntil: null,
7657
7719
  externalId: "yHH9Nz4rLOt"
7658
7720
  },
7659
7721
  {
7660
7722
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7661
7723
  name: "Kifani",
7662
7724
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7663
- validUntil: null,
7664
7725
  externalId: "eSWmXIGeu1I"
7665
7726
  },
7666
7727
  {
7667
7728
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7668
7729
  name: "Lumela",
7669
7730
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7670
- validUntil: null,
7671
7731
  externalId: "bh0b3aI1uP3"
7672
7732
  }
7673
7733
  ];
7674
- var V2_DEFAULT_MOCK_LOCATIONS = [
7734
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7735
+ var MOCK_LOCATIONS_BASE = [
7675
7736
  {
7676
7737
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7677
7738
  name: "Central Provincial Office",
7678
7739
  locationType: "CRVS_OFFICE",
7679
7740
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7680
- validUntil: null,
7681
7741
  externalId: "Xr3Df8WpK6Ys"
7682
7742
  },
7683
7743
  {
7684
7744
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7685
7745
  name: "Central Health Post",
7686
7746
  locationType: "HEALTH_FACILITY",
7687
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7688
- validUntil: null
7747
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7689
7748
  },
7690
7749
  {
7691
7750
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7692
7751
  name: "Ibombo District Office",
7693
7752
  locationType: "CRVS_OFFICE",
7694
7753
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7695
- validUntil: null,
7696
7754
  externalId: "Sm4Nw7GrD2Vy"
7697
7755
  },
7698
7756
  {
@@ -7700,7 +7758,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7700
7758
  name: "Isamba District Office",
7701
7759
  locationType: "CRVS_OFFICE",
7702
7760
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7703
- validUntil: null,
7704
7761
  externalId: "Vg1Bq5XeH9Lt"
7705
7762
  },
7706
7763
  {
@@ -7708,7 +7765,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7708
7765
  name: "Isango District Office",
7709
7766
  locationType: "CRVS_OFFICE",
7710
7767
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7711
- validUntil: null,
7712
7768
  externalId: "Je7Lm2XqN9Vz"
7713
7769
  },
7714
7770
  {
@@ -7716,7 +7772,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7716
7772
  name: "Sulaka Provincial Office",
7717
7773
  locationType: "CRVS_OFFICE",
7718
7774
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7719
- validUntil: null,
7720
7775
  externalId: "Ht2Wp9KcX5Qv"
7721
7776
  },
7722
7777
  {
@@ -7724,7 +7779,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7724
7779
  name: "Ilanga District Office",
7725
7780
  locationType: "CRVS_OFFICE",
7726
7781
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7727
- validUntil: null,
7728
7782
  externalId: "Yp6Ds1WqN3Xz"
7729
7783
  },
7730
7784
  {
@@ -7732,7 +7786,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7732
7786
  name: "Chamakubi Health Post",
7733
7787
  locationType: "HEALTH_FACILITY",
7734
7788
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7735
- validUntil: null,
7736
7789
  externalId: "M1nFr8LbC2Qy"
7737
7790
  },
7738
7791
  {
@@ -7740,7 +7793,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7740
7793
  name: "Ibombo Rural Health Centre",
7741
7794
  locationType: "HEALTH_FACILITY",
7742
7795
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7743
- validUntil: null,
7744
7796
  externalId: "bT7pV6YrW0Xc"
7745
7797
  },
7746
7798
  {
@@ -7748,7 +7800,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7748
7800
  name: "Chikobo Rural Health Centre",
7749
7801
  locationType: "HEALTH_FACILITY",
7750
7802
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7751
- validUntil: null,
7752
7803
  externalId: "zE4qPn2SgJ5d"
7753
7804
  },
7754
7805
  {
@@ -7756,7 +7807,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7756
7807
  name: "Chilochabalenje Health Post",
7757
7808
  locationType: "HEALTH_FACILITY",
7758
7809
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7759
- validUntil: null,
7760
7810
  externalId: "H8vDs1MqR4Uf"
7761
7811
  },
7762
7812
  {
@@ -7764,7 +7814,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7764
7814
  name: "Chipeso Rural Health Centre",
7765
7815
  locationType: "HEALTH_FACILITY",
7766
7816
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7767
- validUntil: null,
7768
7817
  externalId: "Qw3uZ9KfX6Lm"
7769
7818
  },
7770
7819
  {
@@ -7772,7 +7821,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7772
7821
  name: "Chisamba Rural Health Centre",
7773
7822
  locationType: "HEALTH_FACILITY",
7774
7823
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7775
- validUntil: null,
7776
7824
  externalId: "Yr0pCg8LdM2s"
7777
7825
  },
7778
7826
  {
@@ -7780,7 +7828,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7780
7828
  name: "Chitanda Rural Health Centre",
7781
7829
  locationType: "HEALTH_FACILITY",
7782
7830
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7783
- validUntil: null,
7784
7831
  externalId: "tS9gJ4PwB1Qx"
7785
7832
  },
7786
7833
  {
@@ -7788,7 +7835,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7788
7835
  name: "Golden Valley Rural Health Centre",
7789
7836
  locationType: "HEALTH_FACILITY",
7790
7837
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7791
- validUntil: null,
7792
7838
  externalId: "Ld7Qm3XsA8Vr"
7793
7839
  },
7794
7840
  {
@@ -7796,7 +7842,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7796
7842
  name: "Ipongo Rural Health Centre",
7797
7843
  locationType: "HEALTH_FACILITY",
7798
7844
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7799
- validUntil: null,
7800
7845
  externalId: "kF2sW9DmH0Bt"
7801
7846
  },
7802
7847
  {
@@ -7804,7 +7849,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7804
7849
  name: "Itumbwe Health Post",
7805
7850
  locationType: "HEALTH_FACILITY",
7806
7851
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7807
- validUntil: null,
7808
7852
  externalId: "Ue5Xb3VaC7Pq"
7809
7853
  },
7810
7854
  {
@@ -7812,7 +7856,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7812
7856
  name: "Kabangalala Rural Health Centre",
7813
7857
  locationType: "HEALTH_FACILITY",
7814
7858
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7815
- validUntil: null,
7816
7859
  externalId: "Pz8Kc1TqH6Jn"
7817
7860
  },
7818
7861
  // Village offices
@@ -7821,10 +7864,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7821
7864
  name: "Klow Village Office",
7822
7865
  locationType: "CRVS_OFFICE",
7823
7866
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7824
- validUntil: null,
7825
7867
  externalId: "PmAyxAJkxiJ"
7826
7868
  }
7827
7869
  ];
7870
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7828
7871
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7829
7872
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7830
7873
  );
@@ -7832,8 +7875,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7832
7875
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7833
7876
  );
7834
7877
 
7835
- // ../commons/src/notification/UserNotifications.ts
7878
+ // ../commons/src/events/locationPayloads.ts
7836
7879
  var z44 = __toESM(require("zod/v4"));
7880
+ var CreateLocationPayload = z44.object({
7881
+ id: UUID.optional(),
7882
+ versionId: UUID.optional(),
7883
+ name: z44.string(),
7884
+ externalId: z44.string().nullish(),
7885
+ administrativeAreaId: UUID.nullable(),
7886
+ locationType: z44.string().nullable(),
7887
+ effectiveFrom: z44.iso.date().optional(),
7888
+ status: LocationStatus.default("active")
7889
+ });
7890
+ var UpdateLocationPayload = 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 WithdrawLocationVersionPayload = z44.object({
7900
+ id: UUID,
7901
+ versionId: UUID
7902
+ });
7903
+ var CreateAdministrativeAreaPayload = z44.object({
7904
+ id: UUID.optional(),
7905
+ versionId: UUID.optional(),
7906
+ name: z44.string(),
7907
+ externalId: z44.string().nullish(),
7908
+ parentId: UUID.nullable(),
7909
+ effectiveFrom: z44.iso.date().optional(),
7910
+ status: LocationStatus.default("active")
7911
+ });
7912
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7913
+ id: UUID,
7914
+ versionId: UUID.optional(),
7915
+ name: z44.string(),
7916
+ externalId: z44.string().nullish(),
7917
+ status: LocationStatus,
7918
+ effectiveFrom: z44.iso.date().optional(),
7919
+ lastVersionId: UUID
7920
+ });
7921
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7922
+ id: UUID,
7923
+ versionId: UUID
7924
+ });
7925
+
7926
+ // ../commons/src/notification/UserNotifications.ts
7927
+ var z45 = __toESM(require("zod/v4"));
7837
7928
  var TriggerEvent = {
7838
7929
  USER_CREATED: "user-created",
7839
7930
  USER_UPDATED: "user-updated",
@@ -7846,54 +7937,54 @@ var TriggerEvent = {
7846
7937
  CHANGE_PHONE_NUMBER: "change-phone-number",
7847
7938
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7848
7939
  };
7849
- var Recipient = z44.object({
7940
+ var Recipient = z45.object({
7850
7941
  name: NameFieldValue.optional(),
7851
- mobile: z44.string().optional(),
7852
- email: z44.string().optional(),
7853
- bcc: z44.array(z44.string()).optional()
7942
+ mobile: z45.string().optional(),
7943
+ email: z45.string().optional(),
7944
+ bcc: z45.array(z45.string()).optional()
7854
7945
  });
7855
- var BasePayload = z44.object({
7946
+ var BasePayload = z45.object({
7856
7947
  recipient: Recipient
7857
7948
  });
7858
7949
  var TriggerPayload = {
7859
7950
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7860
- username: z44.string(),
7861
- temporaryPassword: z44.string()
7951
+ username: z45.string(),
7952
+ temporaryPassword: z45.string()
7862
7953
  }),
7863
7954
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7864
- oldUsername: z44.string(),
7865
- newUsername: z44.string()
7955
+ oldUsername: z45.string(),
7956
+ newUsername: z45.string()
7866
7957
  }),
7867
7958
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7868
- username: z44.string()
7959
+ username: z45.string()
7869
7960
  }),
7870
7961
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7871
- code: z44.string()
7962
+ code: z45.string()
7872
7963
  }),
7873
7964
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7874
- temporaryPassword: z44.string(),
7875
- admin: z44.object({
7876
- id: z44.string(),
7965
+ temporaryPassword: z45.string(),
7966
+ admin: z45.object({
7967
+ id: z45.string(),
7877
7968
  name: NameFieldValue,
7878
- role: z44.string()
7969
+ role: z45.string()
7879
7970
  })
7880
7971
  }),
7881
7972
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7882
- username: z44.string(),
7883
- temporaryPassword: z44.string()
7973
+ username: z45.string(),
7974
+ temporaryPassword: z45.string()
7884
7975
  }),
7885
7976
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7886
- code: z44.string()
7977
+ code: z45.string()
7887
7978
  }),
7888
7979
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7889
- subject: z44.string(),
7890
- body: z44.string()
7980
+ subject: z45.string(),
7981
+ body: z45.string()
7891
7982
  }),
7892
7983
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7893
- code: z44.string()
7984
+ code: z45.string()
7894
7985
  }),
7895
7986
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7896
- code: z44.string()
7987
+ code: z45.string()
7897
7988
  })
7898
7989
  };
7899
7990
  async function triggerUserEventNotification({
@@ -7917,4 +8008,4 @@ function parseUserEventTrigger(event2, body) {
7917
8008
  }
7918
8009
 
7919
8010
  // src/notification/index.ts
7920
- z45.globalRegistry.clear();
8011
+ z46.globalRegistry.clear();