@opencrvs/toolkit 2.1.0-rc.69ab488 → 2.1.0-rc.6a144d4

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 (70) 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 +3546 -3359
  4. package/dist/commons/application-config/index.d.ts +6 -6
  5. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  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 +151 -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 +69 -198
  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 +3 -12
  47. package/dist/environment/logger.d.ts.map +1 -1
  48. package/dist/environment/manage-users.js +17 -7
  49. package/dist/environment/questions.d.ts +75 -74
  50. package/dist/environment/questions.d.ts.map +1 -1
  51. package/dist/environment/setup-environment.js +8 -28
  52. package/dist/environment/swarm-to-k8s.js +17 -7
  53. package/dist/environment/update-workflows.js +17 -7
  54. package/dist/environment/users.js +17 -7
  55. package/dist/environment/utils.d.ts +1 -1
  56. package/dist/environment/utils.js +17 -7
  57. package/dist/events/deduplication.d.ts +1 -1
  58. package/dist/events/index.js +214 -70
  59. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  60. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  61. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  62. package/dist/notification/index.js +197 -93
  63. package/dist/scopes/index.d.ts +148 -146
  64. package/dist/scopes/index.js +1 -0
  65. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  66. package/dist/templates/charts-values/opencrvs-services/values.yaml +0 -4
  67. package/opencrvs-toolkit-2.1.0-rc.6a144d4.tgz +0 -0
  68. package/package.json +5 -5
  69. package/tsconfig.tsbuildinfo +1 -1
  70. package/opencrvs-toolkit-2.1.0-rc.69ab488.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,62 @@ 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
+ });
533
590
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
534
591
  operation: z5.literal("attachments.upload"),
535
592
  requestData: z5.object({
@@ -605,6 +662,10 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
605
662
  IntegrationActivateEntrySchema,
606
663
  IntegrationDeleteEntrySchema,
607
664
  IntegrationRefreshSecretEntrySchema,
665
+ LocationCreateEntrySchema,
666
+ LocationUpdateEntrySchema,
667
+ AdministrativeAreaUpdateEntrySchema,
668
+ AdministrativeAreaCreateEntrySchema,
608
669
  AttachmentUploadEntrySchema,
609
670
  UserCreateEntrySchema,
610
671
  UserReasonEntrySchema,
@@ -1216,9 +1277,10 @@ var NotifiedAction = ActionBase.extend(
1216
1277
  var EditAction = ActionBase.extend(
1217
1278
  z14.object({
1218
1279
  type: z14.literal(ActionType.EDIT),
1280
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1219
1281
  content: z14.object({
1220
1282
  comment: z14.string().describe("Comment for the edit action.").optional()
1221
- })
1283
+ }).optional()
1222
1284
  }).shape
1223
1285
  );
1224
1286
  var PrintContent = z14.object({
@@ -2694,6 +2756,9 @@ var ActionConfigBase = z24.object({
2694
2756
  var DeclarationActionBase = ActionConfigBase.extend({
2695
2757
  deduplication: DeduplicationConfig.optional()
2696
2758
  });
2759
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2760
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2761
+ );
2697
2762
  var ReadActionConfig = ActionConfigBase.extend(
2698
2763
  z24.object({
2699
2764
  type: z24.literal(ActionType.READ),
@@ -2705,7 +2770,8 @@ var ReadActionConfig = ActionConfigBase.extend(
2705
2770
  );
2706
2771
  var NotifyConfig = ActionConfigBase.extend(
2707
2772
  z24.object({
2708
- type: z24.literal(ActionType.NOTIFY)
2773
+ type: z24.literal(ActionType.NOTIFY),
2774
+ form: actionConfirmationForm
2709
2775
  }).shape
2710
2776
  );
2711
2777
  var DuplicateDetectedConfig = ActionConfigBase.extend(
@@ -2760,6 +2826,7 @@ var DeclareConfig = DeclarationActionBase.extend(
2760
2826
  review: DeclarationReviewConfig.describe(
2761
2827
  "Configuration of the review page fields."
2762
2828
  ),
2829
+ form: actionConfirmationForm,
2763
2830
  dialogCopy: z24.object({
2764
2831
  notify: TranslationConfig.describe(
2765
2832
  "Confirmation text for the notify action"
@@ -2775,7 +2842,8 @@ var DeclareConfig = DeclarationActionBase.extend(
2775
2842
  );
2776
2843
  var ArchiveConfig = ActionConfigBase.extend(
2777
2844
  z24.object({
2778
- type: z24.literal(ActionType.ARCHIVE)
2845
+ type: z24.literal(ActionType.ARCHIVE),
2846
+ form: actionConfirmationForm
2779
2847
  }).shape
2780
2848
  );
2781
2849
  var UnarchiveConfig = ActionConfigBase.extend(
@@ -2801,12 +2869,14 @@ var EditActionConfig = ActionConfigBase.extend(
2801
2869
  );
2802
2870
  var RejectConfig = ActionConfigBase.extend(
2803
2871
  z24.object({
2804
- type: z24.literal(ActionType.REJECT)
2872
+ type: z24.literal(ActionType.REJECT),
2873
+ form: actionConfirmationForm
2805
2874
  }).shape
2806
2875
  );
2807
2876
  var RegisterConfig = DeclarationActionBase.extend(
2808
2877
  z24.object({
2809
- type: z24.literal(ActionType.REGISTER)
2878
+ type: z24.literal(ActionType.REGISTER),
2879
+ form: actionConfirmationForm
2810
2880
  }).shape
2811
2881
  );
2812
2882
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3326,13 +3396,9 @@ var getActionAnnotationFields = (actionConfig) => {
3326
3396
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3327
3397
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3328
3398
  }
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 [];
3399
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3400
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3401
+ return [...reviewFields, ...formFields];
3336
3402
  };
3337
3403
  function getAllAnnotationFields(config) {
3338
3404
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -4648,10 +4714,7 @@ var DeclareActionInput = BaseActionInput.extend(
4648
4714
  );
4649
4715
  var EditActionInput = BaseActionInput.extend(
4650
4716
  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
- })
4717
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4655
4718
  }).shape
4656
4719
  );
4657
4720
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -7357,21 +7420,44 @@ var LocationTypeV1 = z43.enum([
7357
7420
  "CRVS_OFFICE",
7358
7421
  "HEALTH_FACILITY"
7359
7422
  ]);
7423
+ var LocationStatus = z43.enum(["active", "inactive"]);
7424
+ var LocationVersion = z43.object({
7425
+ versionId: UUID,
7426
+ effectiveFrom: z43.iso.date(),
7427
+ name: z43.string(),
7428
+ externalId: z43.string().nullish(),
7429
+ status: LocationStatus
7430
+ });
7360
7431
  var AdministrativeArea = z43.object({
7361
7432
  id: UUID,
7362
7433
  name: z43.string(),
7363
7434
  externalId: z43.string().nullish(),
7364
7435
  parentId: UUID.nullable(),
7365
- validUntil: z43.iso.datetime().nullable()
7436
+ status: LocationStatus,
7437
+ versions: z43.array(LocationVersion)
7366
7438
  });
7367
7439
  var Location = z43.object({
7368
7440
  id: UUID,
7369
7441
  name: z43.string(),
7370
7442
  externalId: z43.string().nullish(),
7371
7443
  administrativeAreaId: UUID.nullable(),
7372
- validUntil: z43.iso.datetime().nullable(),
7444
+ locationType: z43.string().nullable(),
7445
+ status: LocationStatus,
7446
+ versions: z43.array(LocationVersion)
7447
+ });
7448
+ var SetLocationPayload = z43.object({
7449
+ id: UUID,
7450
+ name: z43.string(),
7451
+ externalId: z43.string().nullish(),
7452
+ administrativeAreaId: UUID.nullable(),
7373
7453
  locationType: z43.string().nullable()
7374
7454
  });
7455
+ var SetAdministrativeAreaPayload = z43.object({
7456
+ id: UUID,
7457
+ name: z43.string(),
7458
+ externalId: z43.string().nullish(),
7459
+ parentId: UUID.nullable()
7460
+ });
7375
7461
 
7376
7462
  // ../commons/src/events/scopes.ts
7377
7463
  var ACTION_SCOPE_MAP = {
@@ -7470,75 +7556,80 @@ var REJECTED_ACTIONS = [
7470
7556
  var import_lodash7 = require("lodash");
7471
7557
 
7472
7558
  // ../commons/src/events/mocks.test.utils.ts
7473
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7559
+ function withVersionFields(entity) {
7560
+ return {
7561
+ ...entity,
7562
+ status: "active",
7563
+ versions: [
7564
+ {
7565
+ versionId: entity.id,
7566
+ effectiveFrom: "0001-01-01",
7567
+ name: entity.name,
7568
+ externalId: entity.externalId ?? null,
7569
+ status: "active"
7570
+ }
7571
+ ]
7572
+ };
7573
+ }
7574
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7474
7575
  {
7475
7576
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7476
7577
  name: "Central",
7477
7578
  parentId: null,
7478
- validUntil: null,
7479
7579
  externalId: "ydyJb1RAy4U1"
7480
7580
  },
7481
7581
  {
7482
7582
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7483
7583
  name: "Sulaka",
7484
7584
  parentId: null,
7485
- validUntil: null,
7486
7585
  externalId: "pQ8nGxWmZ2Q3"
7487
7586
  },
7488
7587
  {
7489
7588
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7490
7589
  name: "Pualula",
7491
7590
  parentId: null,
7492
- validUntil: null,
7493
7591
  externalId: "Aq91DweLmT8k"
7494
7592
  },
7495
7593
  {
7496
7594
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7497
7595
  name: "Chuminga",
7498
7596
  parentId: null,
7499
- validUntil: null,
7500
7597
  externalId: "Rw0fYNh2Xk9a"
7501
7598
  },
7502
7599
  {
7503
7600
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7504
7601
  name: "Ibombo",
7505
7602
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7506
- validUntil: null,
7507
7603
  externalId: "k7DsP4vbN1Qe"
7508
7604
  },
7509
7605
  {
7510
7606
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7511
7607
  name: "Isango",
7512
7608
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7513
- validUntil: null,
7514
7609
  externalId: "Gm3Z9eQpHw4L"
7515
7610
  },
7516
7611
  {
7517
7612
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7518
7613
  name: "Isamba",
7519
7614
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7520
- validUntil: null,
7521
7615
  externalId: "sT0xVu1KqJ7r"
7522
7616
  },
7523
7617
  {
7524
7618
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7525
7619
  name: "Itambo",
7526
7620
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7527
- validUntil: null,
7528
7621
  externalId: "Nq6Bv2HpL9Te"
7529
7622
  },
7530
7623
  {
7531
7624
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7532
7625
  name: "Ezhi",
7533
7626
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7534
- validUntil: null,
7535
7627
  externalId: "xK8cQ0ZRy5Wd"
7536
7628
  },
7537
7629
  {
7538
7630
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7539
7631
  name: "Ilanga",
7540
7632
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7541
- validUntil: null,
7542
7633
  externalId: "Cq4Jm1XvN8Ls"
7543
7634
  },
7544
7635
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7546,49 +7637,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7546
7637
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7547
7638
  name: "Klow",
7548
7639
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7549
- validUntil: null,
7550
7640
  externalId: "IkYcYBUcyY2"
7551
7641
  },
7552
7642
  {
7553
7643
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7554
7644
  name: "Mbondo",
7555
7645
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7556
- validUntil: null,
7557
7646
  externalId: "Qhvv5hvo3mY"
7558
7647
  },
7559
7648
  {
7560
7649
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7561
7650
  name: "Ndara",
7562
7651
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7563
- validUntil: null,
7564
7652
  externalId: "crXh068O9TR"
7565
7653
  },
7566
7654
  {
7567
7655
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7568
7656
  name: "Olani",
7569
7657
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
- validUntil: null,
7571
7658
  externalId: "r00It8Tvvp7"
7572
7659
  },
7573
7660
  {
7574
7661
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7575
7662
  name: "Pemba",
7576
7663
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7577
- validUntil: null,
7578
7664
  externalId: "ZnUWsbONIaH"
7579
7665
  },
7580
7666
  {
7581
7667
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7582
7668
  name: "Quanza",
7583
7669
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7584
- validUntil: null,
7585
7670
  externalId: "fDZycvQTa7l"
7586
7671
  },
7587
7672
  {
7588
7673
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7589
7674
  name: "Rivka",
7590
7675
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7591
- validUntil: null,
7592
7676
  externalId: "KqswxCGTELa"
7593
7677
  },
7594
7678
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7596,35 +7680,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7596
7680
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7597
7681
  name: "Mbula",
7598
7682
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7599
- validUntil: null,
7600
7683
  externalId: "osEbKjRc9Kg"
7601
7684
  },
7602
7685
  {
7603
7686
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7604
7687
  name: "Ndoki",
7605
7688
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7606
- validUntil: null,
7607
7689
  externalId: "aq4daBUAGr3"
7608
7690
  },
7609
7691
  {
7610
7692
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7611
7693
  name: "Tsanga",
7612
7694
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7613
- validUntil: null,
7614
7695
  externalId: "cqis6Y8trbJ"
7615
7696
  },
7616
7697
  {
7617
7698
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7618
7699
  name: "Waziri",
7619
7700
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7620
- validUntil: null,
7621
7701
  externalId: "LMijHPyyx6d"
7622
7702
  },
7623
7703
  {
7624
7704
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7625
7705
  name: "Zimbi",
7626
7706
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7627
- validUntil: null,
7628
7707
  externalId: "pcQYbPuKGZ7"
7629
7708
  },
7630
7709
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7632,67 +7711,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7632
7711
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7633
7712
  name: "Felani",
7634
7713
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7635
- validUntil: null,
7636
7714
  externalId: "gSqpoCGdMXp"
7637
7715
  },
7638
7716
  {
7639
7717
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7640
7718
  name: "Goroma",
7641
7719
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7642
- validUntil: null,
7643
7720
  externalId: "KvAAIaNqVrp"
7644
7721
  },
7645
7722
  {
7646
7723
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7647
7724
  name: "Halifu",
7648
7725
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7649
- validUntil: null,
7650
7726
  externalId: "qe4UnEVt1hv"
7651
7727
  },
7652
7728
  {
7653
7729
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7654
7730
  name: "Jabari",
7655
7731
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7656
- validUntil: null,
7657
7732
  externalId: "yHH9Nz4rLOt"
7658
7733
  },
7659
7734
  {
7660
7735
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7661
7736
  name: "Kifani",
7662
7737
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7663
- validUntil: null,
7664
7738
  externalId: "eSWmXIGeu1I"
7665
7739
  },
7666
7740
  {
7667
7741
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7668
7742
  name: "Lumela",
7669
7743
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7670
- validUntil: null,
7671
7744
  externalId: "bh0b3aI1uP3"
7672
7745
  }
7673
7746
  ];
7674
- var V2_DEFAULT_MOCK_LOCATIONS = [
7747
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7748
+ var MOCK_LOCATIONS_BASE = [
7675
7749
  {
7676
7750
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7677
7751
  name: "Central Provincial Office",
7678
7752
  locationType: "CRVS_OFFICE",
7679
7753
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7680
- validUntil: null,
7681
7754
  externalId: "Xr3Df8WpK6Ys"
7682
7755
  },
7683
7756
  {
7684
7757
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7685
7758
  name: "Central Health Post",
7686
7759
  locationType: "HEALTH_FACILITY",
7687
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7688
- validUntil: null
7760
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7689
7761
  },
7690
7762
  {
7691
7763
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7692
7764
  name: "Ibombo District Office",
7693
7765
  locationType: "CRVS_OFFICE",
7694
7766
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7695
- validUntil: null,
7696
7767
  externalId: "Sm4Nw7GrD2Vy"
7697
7768
  },
7698
7769
  {
@@ -7700,7 +7771,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7700
7771
  name: "Isamba District Office",
7701
7772
  locationType: "CRVS_OFFICE",
7702
7773
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7703
- validUntil: null,
7704
7774
  externalId: "Vg1Bq5XeH9Lt"
7705
7775
  },
7706
7776
  {
@@ -7708,7 +7778,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7708
7778
  name: "Isango District Office",
7709
7779
  locationType: "CRVS_OFFICE",
7710
7780
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7711
- validUntil: null,
7712
7781
  externalId: "Je7Lm2XqN9Vz"
7713
7782
  },
7714
7783
  {
@@ -7716,7 +7785,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7716
7785
  name: "Sulaka Provincial Office",
7717
7786
  locationType: "CRVS_OFFICE",
7718
7787
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7719
- validUntil: null,
7720
7788
  externalId: "Ht2Wp9KcX5Qv"
7721
7789
  },
7722
7790
  {
@@ -7724,7 +7792,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7724
7792
  name: "Ilanga District Office",
7725
7793
  locationType: "CRVS_OFFICE",
7726
7794
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7727
- validUntil: null,
7728
7795
  externalId: "Yp6Ds1WqN3Xz"
7729
7796
  },
7730
7797
  {
@@ -7732,7 +7799,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7732
7799
  name: "Chamakubi Health Post",
7733
7800
  locationType: "HEALTH_FACILITY",
7734
7801
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7735
- validUntil: null,
7736
7802
  externalId: "M1nFr8LbC2Qy"
7737
7803
  },
7738
7804
  {
@@ -7740,7 +7806,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7740
7806
  name: "Ibombo Rural Health Centre",
7741
7807
  locationType: "HEALTH_FACILITY",
7742
7808
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7743
- validUntil: null,
7744
7809
  externalId: "bT7pV6YrW0Xc"
7745
7810
  },
7746
7811
  {
@@ -7748,7 +7813,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7748
7813
  name: "Chikobo Rural Health Centre",
7749
7814
  locationType: "HEALTH_FACILITY",
7750
7815
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7751
- validUntil: null,
7752
7816
  externalId: "zE4qPn2SgJ5d"
7753
7817
  },
7754
7818
  {
@@ -7756,7 +7820,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7756
7820
  name: "Chilochabalenje Health Post",
7757
7821
  locationType: "HEALTH_FACILITY",
7758
7822
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7759
- validUntil: null,
7760
7823
  externalId: "H8vDs1MqR4Uf"
7761
7824
  },
7762
7825
  {
@@ -7764,7 +7827,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7764
7827
  name: "Chipeso Rural Health Centre",
7765
7828
  locationType: "HEALTH_FACILITY",
7766
7829
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7767
- validUntil: null,
7768
7830
  externalId: "Qw3uZ9KfX6Lm"
7769
7831
  },
7770
7832
  {
@@ -7772,7 +7834,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7772
7834
  name: "Chisamba Rural Health Centre",
7773
7835
  locationType: "HEALTH_FACILITY",
7774
7836
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7775
- validUntil: null,
7776
7837
  externalId: "Yr0pCg8LdM2s"
7777
7838
  },
7778
7839
  {
@@ -7780,7 +7841,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7780
7841
  name: "Chitanda Rural Health Centre",
7781
7842
  locationType: "HEALTH_FACILITY",
7782
7843
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7783
- validUntil: null,
7784
7844
  externalId: "tS9gJ4PwB1Qx"
7785
7845
  },
7786
7846
  {
@@ -7788,7 +7848,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7788
7848
  name: "Golden Valley Rural Health Centre",
7789
7849
  locationType: "HEALTH_FACILITY",
7790
7850
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7791
- validUntil: null,
7792
7851
  externalId: "Ld7Qm3XsA8Vr"
7793
7852
  },
7794
7853
  {
@@ -7796,7 +7855,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7796
7855
  name: "Ipongo Rural Health Centre",
7797
7856
  locationType: "HEALTH_FACILITY",
7798
7857
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7799
- validUntil: null,
7800
7858
  externalId: "kF2sW9DmH0Bt"
7801
7859
  },
7802
7860
  {
@@ -7804,7 +7862,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7804
7862
  name: "Itumbwe Health Post",
7805
7863
  locationType: "HEALTH_FACILITY",
7806
7864
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7807
- validUntil: null,
7808
7865
  externalId: "Ue5Xb3VaC7Pq"
7809
7866
  },
7810
7867
  {
@@ -7812,7 +7869,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7812
7869
  name: "Kabangalala Rural Health Centre",
7813
7870
  locationType: "HEALTH_FACILITY",
7814
7871
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7815
- validUntil: null,
7816
7872
  externalId: "Pz8Kc1TqH6Jn"
7817
7873
  },
7818
7874
  // Village offices
@@ -7821,10 +7877,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7821
7877
  name: "Klow Village Office",
7822
7878
  locationType: "CRVS_OFFICE",
7823
7879
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7824
- validUntil: null,
7825
7880
  externalId: "PmAyxAJkxiJ"
7826
7881
  }
7827
7882
  ];
7883
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7828
7884
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7829
7885
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7830
7886
  );
@@ -7832,8 +7888,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7832
7888
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7833
7889
  );
7834
7890
 
7835
- // ../commons/src/notification/UserNotifications.ts
7891
+ // ../commons/src/events/locationPayloads.ts
7836
7892
  var z44 = __toESM(require("zod/v4"));
7893
+ var CreateLocationPayload = z44.object({
7894
+ id: UUID.optional(),
7895
+ versionId: UUID.optional(),
7896
+ name: z44.string(),
7897
+ externalId: z44.string().nullish(),
7898
+ administrativeAreaId: UUID.nullable(),
7899
+ locationType: z44.string().nullable(),
7900
+ effectiveFrom: z44.iso.date().optional(),
7901
+ status: LocationStatus.default("active")
7902
+ });
7903
+ var UpdateLocationPayload = z44.strictObject({
7904
+ id: UUID,
7905
+ versionId: UUID.optional(),
7906
+ name: z44.string(),
7907
+ externalId: z44.string().nullish(),
7908
+ status: LocationStatus,
7909
+ effectiveFrom: z44.iso.date().optional(),
7910
+ lastVersionId: UUID
7911
+ });
7912
+ var WithdrawLocationVersionPayload = z44.object({
7913
+ id: UUID,
7914
+ versionId: UUID
7915
+ });
7916
+ var CreateAdministrativeAreaPayload = z44.object({
7917
+ id: UUID.optional(),
7918
+ versionId: UUID.optional(),
7919
+ name: z44.string(),
7920
+ externalId: z44.string().nullish(),
7921
+ parentId: UUID.nullable(),
7922
+ effectiveFrom: z44.iso.date().optional(),
7923
+ status: LocationStatus.default("active")
7924
+ });
7925
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7926
+ id: UUID,
7927
+ versionId: UUID.optional(),
7928
+ name: z44.string(),
7929
+ externalId: z44.string().nullish(),
7930
+ status: LocationStatus,
7931
+ effectiveFrom: z44.iso.date().optional(),
7932
+ lastVersionId: UUID
7933
+ });
7934
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7935
+ id: UUID,
7936
+ versionId: UUID
7937
+ });
7938
+
7939
+ // ../commons/src/notification/UserNotifications.ts
7940
+ var z45 = __toESM(require("zod/v4"));
7837
7941
  var TriggerEvent = {
7838
7942
  USER_CREATED: "user-created",
7839
7943
  USER_UPDATED: "user-updated",
@@ -7846,54 +7950,54 @@ var TriggerEvent = {
7846
7950
  CHANGE_PHONE_NUMBER: "change-phone-number",
7847
7951
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7848
7952
  };
7849
- var Recipient = z44.object({
7953
+ var Recipient = z45.object({
7850
7954
  name: NameFieldValue.optional(),
7851
- mobile: z44.string().optional(),
7852
- email: z44.string().optional(),
7853
- bcc: z44.array(z44.string()).optional()
7955
+ mobile: z45.string().optional(),
7956
+ email: z45.string().optional(),
7957
+ bcc: z45.array(z45.string()).optional()
7854
7958
  });
7855
- var BasePayload = z44.object({
7959
+ var BasePayload = z45.object({
7856
7960
  recipient: Recipient
7857
7961
  });
7858
7962
  var TriggerPayload = {
7859
7963
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7860
- username: z44.string(),
7861
- temporaryPassword: z44.string()
7964
+ username: z45.string(),
7965
+ temporaryPassword: z45.string()
7862
7966
  }),
7863
7967
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7864
- oldUsername: z44.string(),
7865
- newUsername: z44.string()
7968
+ oldUsername: z45.string(),
7969
+ newUsername: z45.string()
7866
7970
  }),
7867
7971
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7868
- username: z44.string()
7972
+ username: z45.string()
7869
7973
  }),
7870
7974
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7871
- code: z44.string()
7975
+ code: z45.string()
7872
7976
  }),
7873
7977
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7874
- temporaryPassword: z44.string(),
7875
- admin: z44.object({
7876
- id: z44.string(),
7978
+ temporaryPassword: z45.string(),
7979
+ admin: z45.object({
7980
+ id: z45.string(),
7877
7981
  name: NameFieldValue,
7878
- role: z44.string()
7982
+ role: z45.string()
7879
7983
  })
7880
7984
  }),
7881
7985
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7882
- username: z44.string(),
7883
- temporaryPassword: z44.string()
7986
+ username: z45.string(),
7987
+ temporaryPassword: z45.string()
7884
7988
  }),
7885
7989
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7886
- code: z44.string()
7990
+ code: z45.string()
7887
7991
  }),
7888
7992
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7889
- subject: z44.string(),
7890
- body: z44.string()
7993
+ subject: z45.string(),
7994
+ body: z45.string()
7891
7995
  }),
7892
7996
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7893
- code: z44.string()
7997
+ code: z45.string()
7894
7998
  }),
7895
7999
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7896
- code: z44.string()
8000
+ code: z45.string()
7897
8001
  })
7898
8002
  };
7899
8003
  async function triggerUserEventNotification({
@@ -7917,4 +8021,4 @@ function parseUserEventTrigger(event2, body) {
7917
8021
  }
7918
8022
 
7919
8023
  // src/notification/index.ts
7920
- z45.globalRegistry.clear();
8024
+ z46.globalRegistry.clear();