@opencrvs/toolkit 2.1.0-rc.4308e66 → 2.1.0-rc.468b2be

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 (60) hide show
  1. package/dist/application-config/index.js +3 -1
  2. package/dist/commons/api/router.d.ts +3382 -3314
  3. package/dist/commons/application-config/index.d.ts +6 -6
  4. package/dist/commons/conditionals/conditionals.d.ts +259 -2102
  5. package/dist/commons/conditionals/validate.d.ts +3 -3
  6. package/dist/commons/events/ActionConfig.d.ts +105 -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 +79 -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 +14 -14
  25. package/dist/commons/events/Flag.d.ts +15 -15
  26. package/dist/commons/events/PlainDate.d.ts +8 -0
  27. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  28. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  29. package/dist/commons/events/WorkqueueConfig.d.ts +826 -826
  30. package/dist/commons/events/deduplication.d.ts +1 -1
  31. package/dist/commons/events/event.d.ts +2 -2
  32. package/dist/commons/events/field.d.ts +78 -895
  33. package/dist/commons/events/index.d.ts +1 -0
  34. package/dist/commons/events/locationPayloads.d.ts +95 -0
  35. package/dist/commons/events/locations.d.ts +192 -12
  36. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  37. package/dist/commons/events/scopes.d.ts +4 -4
  38. package/dist/commons/events/state/index.d.ts +17 -17
  39. package/dist/commons/events/state/utils.d.ts +7 -7
  40. package/dist/commons/events/test.utils.d.ts +40 -43
  41. package/dist/commons/events/utils.d.ts +114 -114
  42. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  43. package/dist/conditionals/index.js +1 -0
  44. package/dist/environment/derived-variables.d.ts +119 -119
  45. package/dist/environment/derived-variables.d.ts.map +1 -1
  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 -14
  50. package/dist/environment/utils.d.ts +1 -1
  51. package/dist/events/deduplication.d.ts +1 -1
  52. package/dist/events/index.js +205 -58
  53. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  54. package/dist/notification/index.js +181 -82
  55. package/dist/scopes/index.d.ts +148 -146
  56. package/dist/scopes/index.js +1 -0
  57. package/opencrvs-toolkit-2.1.0-rc.468b2be.tgz +0 -0
  58. package/package.json +5 -5
  59. package/tsconfig.tsbuildinfo +1 -1
  60. package/opencrvs-toolkit-2.1.0-rc.4308e66.tgz +0 -0
@@ -92,9 +92,10 @@ const FUNCTION_LIKE_KINDS = [
92
92
  * Falls back to `<anonymous>` when nothing useful can be derived.
93
93
  */
94
94
  function describeFunction(node) {
95
- var _a, _b, _c;
95
+ var _a;
96
+ var _b, _c;
96
97
  if (ts_morph_1.Node.isFunctionDeclaration(node) || ts_morph_1.Node.isMethodDeclaration(node)) {
97
- return (_a = node.getName()) !== null && _a !== void 0 ? _a : '<anonymous>';
98
+ return (_b = node.getName()) !== null && _b !== void 0 ? _b : '<anonymous>';
98
99
  }
99
100
  // FunctionExpression / ArrowFunction: try to pick up the assignment target.
100
101
  const parent = node.getParent();
@@ -106,7 +107,7 @@ function describeFunction(node) {
106
107
  }
107
108
  if (ts_morph_1.Node.isFunctionExpression(node) &&
108
109
  node.getNameNode() !== undefined) {
109
- return (_c = (_b = node.getNameNode()) === null || _b === void 0 ? void 0 : _b.getText()) !== null && _c !== void 0 ? _c : '<anonymous>';
110
+ return (_c = (_a = node.getNameNode()) === null || _a === void 0 ? void 0 : _a.getText()) !== null && _c !== void 0 ? _c : '<anonymous>';
110
111
  }
111
112
  return '<anonymous>';
112
113
  }
@@ -38,7 +38,7 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z45 = __toESM(require("zod/v4"));
41
+ var z46 = __toESM(require("zod/v4"));
42
42
 
43
43
  // ../commons/src/url.ts
44
44
  function joinUrl(base, path) {
@@ -96,6 +96,7 @@ var PlainScopeType = z2.enum([
96
96
  "integration.create",
97
97
  "record.import",
98
98
  "config.update-all",
99
+ "location.edit",
99
100
  "attachment.upload",
100
101
  "profile.electronic-signature",
101
102
  "user.read-only-my-audit",
@@ -530,6 +531,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
530
531
  requestData: z5.object({ id: z5.string() }),
531
532
  responseSummary: z5.object({ clientId: z5.string() })
532
533
  });
534
+ var createdVersionFields = {
535
+ id: z5.string(),
536
+ versionId: z5.string(),
537
+ name: z5.string(),
538
+ externalId: z5.string().nullish(),
539
+ effectiveFrom: z5.string(),
540
+ status: z5.string()
541
+ };
542
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
543
+ operation: z5.literal("locations.create"),
544
+ requestData: z5.object({
545
+ ...createdVersionFields,
546
+ administrativeAreaId: z5.string().nullish(),
547
+ locationType: z5.string().nullish()
548
+ })
549
+ });
550
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
551
+ operation: z5.literal("administrativeAreas.create"),
552
+ requestData: z5.object({
553
+ ...createdVersionFields,
554
+ parentId: z5.string().nullish()
555
+ })
556
+ });
533
557
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
534
558
  operation: z5.literal("attachments.upload"),
535
559
  requestData: z5.object({
@@ -605,6 +629,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
605
629
  IntegrationActivateEntrySchema,
606
630
  IntegrationDeleteEntrySchema,
607
631
  IntegrationRefreshSecretEntrySchema,
632
+ LocationCreateEntrySchema,
633
+ AdministrativeAreaCreateEntrySchema,
608
634
  AttachmentUploadEntrySchema,
609
635
  UserCreateEntrySchema,
610
636
  UserReasonEntrySchema,
@@ -1216,9 +1242,10 @@ var NotifiedAction = ActionBase.extend(
1216
1242
  var EditAction = ActionBase.extend(
1217
1243
  z14.object({
1218
1244
  type: z14.literal(ActionType.EDIT),
1245
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1219
1246
  content: z14.object({
1220
1247
  comment: z14.string().describe("Comment for the edit action.").optional()
1221
- })
1248
+ }).optional()
1222
1249
  }).shape
1223
1250
  );
1224
1251
  var PrintContent = z14.object({
@@ -4652,10 +4679,7 @@ var DeclareActionInput = BaseActionInput.extend(
4652
4679
  );
4653
4680
  var EditActionInput = BaseActionInput.extend(
4654
4681
  z38.object({
4655
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
4656
- content: z38.object({
4657
- comment: z38.string().describe("Comment for the edit action.").optional()
4658
- })
4682
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4659
4683
  }).shape
4660
4684
  );
4661
4685
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -7361,21 +7385,69 @@ var LocationTypeV1 = z43.enum([
7361
7385
  "CRVS_OFFICE",
7362
7386
  "HEALTH_FACILITY"
7363
7387
  ]);
7388
+ var LocationStatus = z43.enum(["active", "inactive"]);
7389
+ var LocationVersion = z43.object({
7390
+ versionId: UUID,
7391
+ effectiveFrom: z43.iso.date(),
7392
+ name: z43.string(),
7393
+ externalId: z43.string().nullish(),
7394
+ status: LocationStatus
7395
+ });
7364
7396
  var AdministrativeArea = z43.object({
7365
7397
  id: UUID,
7366
7398
  name: z43.string(),
7367
7399
  externalId: z43.string().nullish(),
7368
7400
  parentId: UUID.nullable(),
7369
- validUntil: z43.iso.datetime().nullable()
7401
+ status: LocationStatus,
7402
+ versions: z43.array(LocationVersion)
7370
7403
  });
7371
7404
  var Location = z43.object({
7372
7405
  id: UUID,
7373
7406
  name: z43.string(),
7374
7407
  externalId: z43.string().nullish(),
7375
7408
  administrativeAreaId: UUID.nullable(),
7376
- validUntil: z43.iso.datetime().nullable(),
7409
+ locationType: z43.string().nullable(),
7410
+ status: LocationStatus,
7411
+ versions: z43.array(LocationVersion)
7412
+ });
7413
+ var ClientAdministrativeArea = AdministrativeArea.omit({
7414
+ name: true,
7415
+ status: true,
7416
+ externalId: true
7417
+ });
7418
+ var ClientLocation = Location.omit({
7419
+ name: true,
7420
+ status: true,
7421
+ externalId: true
7422
+ });
7423
+ function toClientLocation(location) {
7424
+ return {
7425
+ id: location.id,
7426
+ administrativeAreaId: location.administrativeAreaId,
7427
+ locationType: location.locationType,
7428
+ versions: location.versions
7429
+ };
7430
+ }
7431
+ function toClientAdministrativeArea(area) {
7432
+ return {
7433
+ id: area.id,
7434
+ parentId: area.parentId,
7435
+ versions: area.versions
7436
+ };
7437
+ }
7438
+ var SetLocationPayload = z43.object({
7439
+ id: UUID,
7440
+ name: z43.string(),
7441
+ externalId: z43.string().nullish(),
7442
+ administrativeAreaId: UUID.nullable(),
7377
7443
  locationType: z43.string().nullable()
7378
7444
  });
7445
+ var SetAdministrativeAreaPayload = z43.object({
7446
+ id: UUID,
7447
+ name: z43.string(),
7448
+ externalId: z43.string().nullish(),
7449
+ parentId: UUID.nullable()
7450
+ });
7379
7451
 
7380
7452
  // ../commons/src/events/scopes.ts
7381
7453
  var ACTION_SCOPE_MAP = {
@@ -7474,75 +7546,80 @@ var REJECTED_ACTIONS = [
7474
7546
  var import_lodash7 = require("lodash");
7475
7547
 
7476
7548
  // ../commons/src/events/mocks.test.utils.ts
7477
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7549
+ function withVersionFields(entity) {
7550
+ return {
7551
+ ...entity,
7552
+ status: "active",
7553
+ versions: [
7554
+ {
7555
+ versionId: entity.id,
7556
+ effectiveFrom: "0001-01-01",
7557
+ name: entity.name,
7558
+ externalId: entity.externalId ?? null,
7559
+ status: "active"
7560
+ }
7561
+ ]
7562
+ };
7563
+ }
7564
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7478
7565
  {
7479
7566
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7480
7567
  name: "Central",
7481
7568
  parentId: null,
7482
- validUntil: null,
7483
7569
  externalId: "ydyJb1RAy4U1"
7484
7570
  },
7485
7571
  {
7486
7572
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7487
7573
  name: "Sulaka",
7488
7574
  parentId: null,
7489
- validUntil: null,
7490
7575
  externalId: "pQ8nGxWmZ2Q3"
7491
7576
  },
7492
7577
  {
7493
7578
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7494
7579
  name: "Pualula",
7495
7580
  parentId: null,
7496
- validUntil: null,
7497
7581
  externalId: "Aq91DweLmT8k"
7498
7582
  },
7499
7583
  {
7500
7584
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7501
7585
  name: "Chuminga",
7502
7586
  parentId: null,
7503
- validUntil: null,
7504
7587
  externalId: "Rw0fYNh2Xk9a"
7505
7588
  },
7506
7589
  {
7507
7590
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7508
7591
  name: "Ibombo",
7509
7592
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7510
- validUntil: null,
7511
7593
  externalId: "k7DsP4vbN1Qe"
7512
7594
  },
7513
7595
  {
7514
7596
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7515
7597
  name: "Isango",
7516
7598
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7517
- validUntil: null,
7518
7599
  externalId: "Gm3Z9eQpHw4L"
7519
7600
  },
7520
7601
  {
7521
7602
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7522
7603
  name: "Isamba",
7523
7604
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7524
- validUntil: null,
7525
7605
  externalId: "sT0xVu1KqJ7r"
7526
7606
  },
7527
7607
  {
7528
7608
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7529
7609
  name: "Itambo",
7530
7610
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7531
- validUntil: null,
7532
7611
  externalId: "Nq6Bv2HpL9Te"
7533
7612
  },
7534
7613
  {
7535
7614
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7536
7615
  name: "Ezhi",
7537
7616
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7538
- validUntil: null,
7539
7617
  externalId: "xK8cQ0ZRy5Wd"
7540
7618
  },
7541
7619
  {
7542
7620
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7543
7621
  name: "Ilanga",
7544
7622
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7545
- validUntil: null,
7546
7623
  externalId: "Cq4Jm1XvN8Ls"
7547
7624
  },
7548
7625
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7550,49 +7627,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7550
7627
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7551
7628
  name: "Klow",
7552
7629
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7553
- validUntil: null,
7554
7630
  externalId: "IkYcYBUcyY2"
7555
7631
  },
7556
7632
  {
7557
7633
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7558
7634
  name: "Mbondo",
7559
7635
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7560
- validUntil: null,
7561
7636
  externalId: "Qhvv5hvo3mY"
7562
7637
  },
7563
7638
  {
7564
7639
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7565
7640
  name: "Ndara",
7566
7641
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7567
- validUntil: null,
7568
7642
  externalId: "crXh068O9TR"
7569
7643
  },
7570
7644
  {
7571
7645
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7572
7646
  name: "Olani",
7573
7647
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7574
- validUntil: null,
7575
7648
  externalId: "r00It8Tvvp7"
7576
7649
  },
7577
7650
  {
7578
7651
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7579
7652
  name: "Pemba",
7580
7653
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7581
- validUntil: null,
7582
7654
  externalId: "ZnUWsbONIaH"
7583
7655
  },
7584
7656
  {
7585
7657
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7586
7658
  name: "Quanza",
7587
7659
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7588
- validUntil: null,
7589
7660
  externalId: "fDZycvQTa7l"
7590
7661
  },
7591
7662
  {
7592
7663
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7593
7664
  name: "Rivka",
7594
7665
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7595
- validUntil: null,
7596
7666
  externalId: "KqswxCGTELa"
7597
7667
  },
7598
7668
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7600,35 +7670,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7600
7670
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7601
7671
  name: "Mbula",
7602
7672
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7603
- validUntil: null,
7604
7673
  externalId: "osEbKjRc9Kg"
7605
7674
  },
7606
7675
  {
7607
7676
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7608
7677
  name: "Ndoki",
7609
7678
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7610
- validUntil: null,
7611
7679
  externalId: "aq4daBUAGr3"
7612
7680
  },
7613
7681
  {
7614
7682
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7615
7683
  name: "Tsanga",
7616
7684
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7617
- validUntil: null,
7618
7685
  externalId: "cqis6Y8trbJ"
7619
7686
  },
7620
7687
  {
7621
7688
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7622
7689
  name: "Waziri",
7623
7690
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7624
- validUntil: null,
7625
7691
  externalId: "LMijHPyyx6d"
7626
7692
  },
7627
7693
  {
7628
7694
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7629
7695
  name: "Zimbi",
7630
7696
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7631
- validUntil: null,
7632
7697
  externalId: "pcQYbPuKGZ7"
7633
7698
  },
7634
7699
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7636,67 +7701,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7636
7701
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7637
7702
  name: "Felani",
7638
7703
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7639
- validUntil: null,
7640
7704
  externalId: "gSqpoCGdMXp"
7641
7705
  },
7642
7706
  {
7643
7707
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7644
7708
  name: "Goroma",
7645
7709
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7646
- validUntil: null,
7647
7710
  externalId: "KvAAIaNqVrp"
7648
7711
  },
7649
7712
  {
7650
7713
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7651
7714
  name: "Halifu",
7652
7715
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7653
- validUntil: null,
7654
7716
  externalId: "qe4UnEVt1hv"
7655
7717
  },
7656
7718
  {
7657
7719
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7658
7720
  name: "Jabari",
7659
7721
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7660
- validUntil: null,
7661
7722
  externalId: "yHH9Nz4rLOt"
7662
7723
  },
7663
7724
  {
7664
7725
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7665
7726
  name: "Kifani",
7666
7727
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7667
- validUntil: null,
7668
7728
  externalId: "eSWmXIGeu1I"
7669
7729
  },
7670
7730
  {
7671
7731
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7672
7732
  name: "Lumela",
7673
7733
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7674
- validUntil: null,
7675
7734
  externalId: "bh0b3aI1uP3"
7676
7735
  }
7677
7736
  ];
7678
- var V2_DEFAULT_MOCK_LOCATIONS = [
7737
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7738
+ var MOCK_LOCATIONS_BASE = [
7679
7739
  {
7680
7740
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7681
7741
  name: "Central Provincial Office",
7682
7742
  locationType: "CRVS_OFFICE",
7683
7743
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7684
- validUntil: null,
7685
7744
  externalId: "Xr3Df8WpK6Ys"
7686
7745
  },
7687
7746
  {
7688
7747
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7689
7748
  name: "Central Health Post",
7690
7749
  locationType: "HEALTH_FACILITY",
7691
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7692
- validUntil: null
7750
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7693
7751
  },
7694
7752
  {
7695
7753
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7696
7754
  name: "Ibombo District Office",
7697
7755
  locationType: "CRVS_OFFICE",
7698
7756
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7699
- validUntil: null,
7700
7757
  externalId: "Sm4Nw7GrD2Vy"
7701
7758
  },
7702
7759
  {
@@ -7704,7 +7761,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7704
7761
  name: "Isamba District Office",
7705
7762
  locationType: "CRVS_OFFICE",
7706
7763
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7707
- validUntil: null,
7708
7764
  externalId: "Vg1Bq5XeH9Lt"
7709
7765
  },
7710
7766
  {
@@ -7712,7 +7768,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7712
7768
  name: "Isango District Office",
7713
7769
  locationType: "CRVS_OFFICE",
7714
7770
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7715
- validUntil: null,
7716
7771
  externalId: "Je7Lm2XqN9Vz"
7717
7772
  },
7718
7773
  {
@@ -7720,7 +7775,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7720
7775
  name: "Sulaka Provincial Office",
7721
7776
  locationType: "CRVS_OFFICE",
7722
7777
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7723
- validUntil: null,
7724
7778
  externalId: "Ht2Wp9KcX5Qv"
7725
7779
  },
7726
7780
  {
@@ -7728,7 +7782,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7728
7782
  name: "Ilanga District Office",
7729
7783
  locationType: "CRVS_OFFICE",
7730
7784
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7731
- validUntil: null,
7732
7785
  externalId: "Yp6Ds1WqN3Xz"
7733
7786
  },
7734
7787
  {
@@ -7736,7 +7789,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7736
7789
  name: "Chamakubi Health Post",
7737
7790
  locationType: "HEALTH_FACILITY",
7738
7791
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7739
- validUntil: null,
7740
7792
  externalId: "M1nFr8LbC2Qy"
7741
7793
  },
7742
7794
  {
@@ -7744,7 +7796,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7744
7796
  name: "Ibombo Rural Health Centre",
7745
7797
  locationType: "HEALTH_FACILITY",
7746
7798
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7747
- validUntil: null,
7748
7799
  externalId: "bT7pV6YrW0Xc"
7749
7800
  },
7750
7801
  {
@@ -7752,7 +7803,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7752
7803
  name: "Chikobo Rural Health Centre",
7753
7804
  locationType: "HEALTH_FACILITY",
7754
7805
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7755
- validUntil: null,
7756
7806
  externalId: "zE4qPn2SgJ5d"
7757
7807
  },
7758
7808
  {
@@ -7760,7 +7810,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7760
7810
  name: "Chilochabalenje Health Post",
7761
7811
  locationType: "HEALTH_FACILITY",
7762
7812
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7763
- validUntil: null,
7764
7813
  externalId: "H8vDs1MqR4Uf"
7765
7814
  },
7766
7815
  {
@@ -7768,7 +7817,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7768
7817
  name: "Chipeso Rural Health Centre",
7769
7818
  locationType: "HEALTH_FACILITY",
7770
7819
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7771
- validUntil: null,
7772
7820
  externalId: "Qw3uZ9KfX6Lm"
7773
7821
  },
7774
7822
  {
@@ -7776,7 +7824,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7776
7824
  name: "Chisamba Rural Health Centre",
7777
7825
  locationType: "HEALTH_FACILITY",
7778
7826
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7779
- validUntil: null,
7780
7827
  externalId: "Yr0pCg8LdM2s"
7781
7828
  },
7782
7829
  {
@@ -7784,7 +7831,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7784
7831
  name: "Chitanda Rural Health Centre",
7785
7832
  locationType: "HEALTH_FACILITY",
7786
7833
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7787
- validUntil: null,
7788
7834
  externalId: "tS9gJ4PwB1Qx"
7789
7835
  },
7790
7836
  {
@@ -7792,7 +7838,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7792
7838
  name: "Golden Valley Rural Health Centre",
7793
7839
  locationType: "HEALTH_FACILITY",
7794
7840
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7795
- validUntil: null,
7796
7841
  externalId: "Ld7Qm3XsA8Vr"
7797
7842
  },
7798
7843
  {
@@ -7800,7 +7845,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7800
7845
  name: "Ipongo Rural Health Centre",
7801
7846
  locationType: "HEALTH_FACILITY",
7802
7847
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7803
- validUntil: null,
7804
7848
  externalId: "kF2sW9DmH0Bt"
7805
7849
  },
7806
7850
  {
@@ -7808,7 +7852,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7808
7852
  name: "Itumbwe Health Post",
7809
7853
  locationType: "HEALTH_FACILITY",
7810
7854
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7811
- validUntil: null,
7812
7855
  externalId: "Ue5Xb3VaC7Pq"
7813
7856
  },
7814
7857
  {
@@ -7816,7 +7859,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7816
7859
  name: "Kabangalala Rural Health Centre",
7817
7860
  locationType: "HEALTH_FACILITY",
7818
7861
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7819
- validUntil: null,
7820
7862
  externalId: "Pz8Kc1TqH6Jn"
7821
7863
  },
7822
7864
  // Village offices
@@ -7825,19 +7867,76 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7825
7867
  name: "Klow Village Office",
7826
7868
  locationType: "CRVS_OFFICE",
7827
7869
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7828
- validUntil: null,
7829
7870
  externalId: "PmAyxAJkxiJ"
7830
7871
  }
7831
7872
  ];
7873
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7832
7874
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7833
7875
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7834
7876
  );
7835
7877
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7836
7878
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7837
7879
  );
7880
+ var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
7881
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
7882
+ );
7883
+ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
7884
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
7885
+ a.id,
7886
+ toClientAdministrativeArea(a)
7887
+ ])
7888
+ );
7838
7889
 
7839
- // ../commons/src/notification/UserNotifications.ts
7890
+ // ../commons/src/events/locationPayloads.ts
7840
7891
  var z44 = __toESM(require("zod/v4"));
7892
+ var CreateLocationPayload = z44.object({
7893
+ id: UUID.optional(),
7894
+ versionId: UUID.optional(),
7895
+ name: z44.string(),
7896
+ externalId: z44.string().nullish(),
7897
+ administrativeAreaId: UUID.nullable(),
7898
+ locationType: z44.string().nullable(),
7899
+ effectiveFrom: z44.iso.date().optional(),
7900
+ status: LocationStatus.default("active")
7901
+ });
7902
+ var UpdateLocationPayload = z44.strictObject({
7903
+ id: UUID,
7904
+ versionId: UUID.optional(),
7905
+ name: z44.string(),
7906
+ externalId: z44.string().nullish(),
7907
+ status: LocationStatus,
7908
+ effectiveFrom: z44.iso.date().optional(),
7909
+ lastVersionId: UUID
7910
+ });
7911
+ var WithdrawLocationVersionPayload = z44.object({
7912
+ id: UUID,
7913
+ versionId: UUID
7914
+ });
7915
+ var CreateAdministrativeAreaPayload = z44.object({
7916
+ id: UUID.optional(),
7917
+ versionId: UUID.optional(),
7918
+ name: z44.string(),
7919
+ externalId: z44.string().nullish(),
7920
+ parentId: UUID.nullable(),
7921
+ effectiveFrom: z44.iso.date().optional(),
7922
+ status: LocationStatus.default("active")
7923
+ });
7924
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7925
+ id: UUID,
7926
+ versionId: UUID.optional(),
7927
+ name: z44.string(),
7928
+ externalId: z44.string().nullish(),
7929
+ status: LocationStatus,
7930
+ effectiveFrom: z44.iso.date().optional(),
7931
+ lastVersionId: UUID
7932
+ });
7933
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7934
+ id: UUID,
7935
+ versionId: UUID
7936
+ });
7937
+
7938
+ // ../commons/src/notification/UserNotifications.ts
7939
+ var z45 = __toESM(require("zod/v4"));
7841
7940
  var TriggerEvent = {
7842
7941
  USER_CREATED: "user-created",
7843
7942
  USER_UPDATED: "user-updated",
@@ -7850,54 +7949,54 @@ var TriggerEvent = {
7850
7949
  CHANGE_PHONE_NUMBER: "change-phone-number",
7851
7950
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7852
7951
  };
7853
- var Recipient = z44.object({
7952
+ var Recipient = z45.object({
7854
7953
  name: NameFieldValue.optional(),
7855
- mobile: z44.string().optional(),
7856
- email: z44.string().optional(),
7857
- bcc: z44.array(z44.string()).optional()
7954
+ mobile: z45.string().optional(),
7955
+ email: z45.string().optional(),
7956
+ bcc: z45.array(z45.string()).optional()
7858
7957
  });
7859
- var BasePayload = z44.object({
7958
+ var BasePayload = z45.object({
7860
7959
  recipient: Recipient
7861
7960
  });
7862
7961
  var TriggerPayload = {
7863
7962
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7864
- username: z44.string(),
7865
- temporaryPassword: z44.string()
7963
+ username: z45.string(),
7964
+ temporaryPassword: z45.string()
7866
7965
  }),
7867
7966
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7868
- oldUsername: z44.string(),
7869
- newUsername: z44.string()
7967
+ oldUsername: z45.string(),
7968
+ newUsername: z45.string()
7870
7969
  }),
7871
7970
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7872
- username: z44.string()
7971
+ username: z45.string()
7873
7972
  }),
7874
7973
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7875
- code: z44.string()
7974
+ code: z45.string()
7876
7975
  }),
7877
7976
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7878
- temporaryPassword: z44.string(),
7879
- admin: z44.object({
7880
- id: z44.string(),
7977
+ temporaryPassword: z45.string(),
7978
+ admin: z45.object({
7979
+ id: z45.string(),
7881
7980
  name: NameFieldValue,
7882
- role: z44.string()
7981
+ role: z45.string()
7883
7982
  })
7884
7983
  }),
7885
7984
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7886
- username: z44.string(),
7887
- temporaryPassword: z44.string()
7985
+ username: z45.string(),
7986
+ temporaryPassword: z45.string()
7888
7987
  }),
7889
7988
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7890
- code: z44.string()
7989
+ code: z45.string()
7891
7990
  }),
7892
7991
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7893
- subject: z44.string(),
7894
- body: z44.string()
7992
+ subject: z45.string(),
7993
+ body: z45.string()
7895
7994
  }),
7896
7995
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7897
- code: z44.string()
7996
+ code: z45.string()
7898
7997
  }),
7899
7998
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7900
- code: z44.string()
7999
+ code: z45.string()
7901
8000
  })
7902
8001
  };
7903
8002
  async function triggerUserEventNotification({
@@ -7921,4 +8020,4 @@ function parseUserEventTrigger(event2, body) {
7921
8020
  }
7922
8021
 
7923
8022
  // src/notification/index.ts
7924
- z45.globalRegistry.clear();
8023
+ z46.globalRegistry.clear();