@opencrvs/toolkit 2.1.0-rc.35e0e39 → 2.1.0-rc.3e7e77b

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/.nx/cache/file-map.json +360 -0
  2. package/.nx/cache/project-graph.json +6 -0
  3. package/dist/application-config/index.js +1 -0
  4. package/dist/commons/api/router.d.ts +3349 -3245
  5. package/dist/commons/application-config/index.d.ts +6 -6
  6. package/dist/commons/conditionals/conditionals.d.ts +259 -2102
  7. package/dist/commons/events/ActionConfig.d.ts +105 -105
  8. package/dist/commons/events/ActionDocument.d.ts +113 -113
  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 +46 -46
  19. package/dist/commons/events/EventIndex.d.ts +63 -63
  20. package/dist/commons/events/EventMetadata.d.ts +40 -40
  21. package/dist/commons/events/FieldConfig.d.ts +342 -337
  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 +114 -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 -119
  44. package/dist/environment/derived-variables.d.ts.map +1 -1
  45. package/dist/environment/logger.d.ts +12 -3
  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 +147 -53
  53. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  54. package/dist/notification/index.js +144 -77
  55. package/dist/scopes/index.d.ts +171 -169
  56. package/dist/scopes/index.js +1 -0
  57. package/opencrvs-toolkit-2.1.0-rc.3e7e77b.tgz +0 -0
  58. package/package.json +6 -6
  59. package/tsconfig.tsbuildinfo +1 -1
  60. package/opencrvs-toolkit-2.1.0-rc.35e0e39.tgz +0 -0
@@ -80,6 +80,8 @@ __export(events_exports, {
80
80
  ConditionalType: () => ConditionalType,
81
81
  ConfirmableActions: () => ConfirmableActions,
82
82
  ContainsFlags: () => ContainsFlags,
83
+ CreateAdministrativeAreaPayload: () => CreateAdministrativeAreaPayload,
84
+ CreateLocationPayload: () => CreateLocationPayload,
83
85
  CustomActionInput: () => CustomActionInput,
84
86
  CustomFieldValue: () => CustomFieldValue,
85
87
  CustomFlag: () => CustomFlag,
@@ -161,7 +163,9 @@ __export(events_exports, {
161
163
  LanguageConfig: () => LanguageConfig,
162
164
  LegalStatuses: () => LegalStatuses,
163
165
  Location: () => Location,
166
+ LocationStatus: () => LocationStatus,
164
167
  LocationTypeV1: () => LocationTypeV1,
168
+ LocationVersion: () => LocationVersion,
165
169
  METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
166
170
  MarkAsDuplicateActionInput: () => MarkAsDuplicateActionInput,
167
171
  MarkNotDuplicateActionInput: () => MarkNotDuplicateActionInput,
@@ -201,6 +205,8 @@ __export(events_exports, {
201
205
  SelectDateRangeOption: () => SelectDateRangeOption,
202
206
  SelectDateRangeValue: () => SelectDateRangeValue,
203
207
  SelectOption: () => SelectOption,
208
+ SetAdministrativeAreaPayload: () => SetAdministrativeAreaPayload,
209
+ SetLocationPayload: () => SetLocationPayload,
204
210
  ShowConditional: () => ShowConditional,
205
211
  SignatureFieldValue: () => SignatureFieldValue,
206
212
  StaticDataEntry: () => StaticDataEntry,
@@ -216,6 +222,8 @@ __export(events_exports, {
216
222
  UUID: () => UUID,
217
223
  UnarchiveActionInput: () => UnarchiveActionInput,
218
224
  UnassignActionInput: () => UnassignActionInput,
225
+ UpdateAdministrativeAreaPayload: () => UpdateAdministrativeAreaPayload,
226
+ UpdateLocationPayload: () => UpdateLocationPayload,
219
227
  UserAuditRecordInput: () => UserAuditRecordInput,
220
228
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
221
229
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
@@ -225,6 +233,8 @@ __export(events_exports, {
225
233
  VerificationActionConfig: () => VerificationActionConfig,
226
234
  VerificationPageConfig: () => VerificationPageConfig,
227
235
  VerificationStatusValue: () => VerificationStatusValue,
236
+ WithdrawAdministrativeAreaVersionPayload: () => WithdrawAdministrativeAreaVersionPayload,
237
+ WithdrawLocationVersionPayload: () => WithdrawLocationVersionPayload,
228
238
  Within: () => Within,
229
239
  WorkqueueActionType: () => WorkqueueActionType,
230
240
  WorkqueueColumn: () => WorkqueueColumn,
@@ -343,6 +353,7 @@ __export(events_exports, {
343
353
  getStatusFromActions: () => getStatusFromActions,
344
354
  getValidatorsForField: () => getValidatorsForField,
345
355
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
356
+ hasActiveExternalIdOnOrAfter: () => hasActiveExternalIdOnOrAfter,
346
357
  hasAnyOfScopes: () => hasAnyOfScopes,
347
358
  isActionAvailable: () => isActionAvailable,
348
359
  isActionConfigType: () => isActionConfigType,
@@ -433,6 +444,7 @@ __export(events_exports, {
433
444
  resolveDateOfEvent: () => resolveDateOfEvent,
434
445
  resolveEventCustomFlags: () => resolveEventCustomFlags,
435
446
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
447
+ resolveVersion: () => resolveVersion,
436
448
  runClientFunction: () => runClientFunction,
437
449
  runFieldValidations: () => runFieldValidations,
438
450
  runStructuralValidations: () => runStructuralValidations,
@@ -500,6 +512,7 @@ var PlainScopeType = z2.enum([
500
512
  "integration.create",
501
513
  "record.import",
502
514
  "config.update-all",
515
+ "location.edit",
503
516
  "attachment.upload",
504
517
  "profile.electronic-signature",
505
518
  "user.read-only-my-audit",
@@ -982,6 +995,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
982
995
  requestData: z5.object({ id: z5.string() }),
983
996
  responseSummary: z5.object({ clientId: z5.string() })
984
997
  });
998
+ var createdVersionFields = {
999
+ id: z5.string(),
1000
+ versionId: z5.string(),
1001
+ name: z5.string(),
1002
+ externalId: z5.string().nullish(),
1003
+ effectiveFrom: z5.string(),
1004
+ status: z5.string()
1005
+ };
1006
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
1007
+ operation: z5.literal("locations.create"),
1008
+ requestData: z5.object({
1009
+ ...createdVersionFields,
1010
+ administrativeAreaId: z5.string().nullish(),
1011
+ locationType: z5.string().nullish()
1012
+ })
1013
+ });
1014
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
1015
+ operation: z5.literal("administrativeAreas.create"),
1016
+ requestData: z5.object({
1017
+ ...createdVersionFields,
1018
+ parentId: z5.string().nullish()
1019
+ })
1020
+ });
985
1021
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
986
1022
  operation: z5.literal("attachments.upload"),
987
1023
  requestData: z5.object({
@@ -1057,6 +1093,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
1057
1093
  IntegrationActivateEntrySchema,
1058
1094
  IntegrationDeleteEntrySchema,
1059
1095
  IntegrationRefreshSecretEntrySchema,
1096
+ LocationCreateEntrySchema,
1097
+ AdministrativeAreaCreateEntrySchema,
1060
1098
  AttachmentUploadEntrySchema,
1061
1099
  UserCreateEntrySchema,
1062
1100
  UserReasonEntrySchema,
@@ -9961,7 +9999,6 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
9961
9999
  },
9962
10000
  edit: (eventId, input = {}) => ({
9963
10001
  type: ActionType.EDIT,
9964
- content: { comment: "Test comment" },
9965
10002
  transactionId: input.transactionId ?? getUUID(),
9966
10003
  declaration: input.declaration ?? generateActionDeclarationInput(configuration, ActionType.EDIT, rng),
9967
10004
  annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.EDIT, rng),
@@ -10467,21 +10504,60 @@ var LocationTypeV1 = z43.enum([
10467
10504
  "CRVS_OFFICE",
10468
10505
  "HEALTH_FACILITY"
10469
10506
  ]);
10507
+ var LocationStatus = z43.enum(["active", "inactive"]);
10508
+ var LocationVersion = z43.object({
10509
+ versionId: UUID,
10510
+ effectiveFrom: z43.iso.date(),
10511
+ name: z43.string(),
10512
+ externalId: z43.string().nullish(),
10513
+ status: LocationStatus
10514
+ });
10470
10515
  var AdministrativeArea = z43.object({
10471
10516
  id: UUID,
10472
10517
  name: z43.string(),
10473
10518
  externalId: z43.string().nullish(),
10474
10519
  parentId: UUID.nullable(),
10475
- validUntil: z43.iso.datetime().nullable()
10520
+ status: LocationStatus,
10521
+ versions: z43.array(LocationVersion)
10476
10522
  });
10477
10523
  var Location = z43.object({
10478
10524
  id: UUID,
10479
10525
  name: z43.string(),
10480
10526
  externalId: z43.string().nullish(),
10481
10527
  administrativeAreaId: UUID.nullable(),
10482
- validUntil: z43.iso.datetime().nullable(),
10528
+ locationType: z43.string().nullable(),
10529
+ status: LocationStatus,
10530
+ versions: z43.array(LocationVersion)
10531
+ });
10532
+ var SetLocationPayload = z43.object({
10533
+ id: UUID,
10534
+ name: z43.string(),
10535
+ externalId: z43.string().nullish(),
10536
+ administrativeAreaId: UUID.nullable(),
10483
10537
  locationType: z43.string().nullable()
10484
10538
  });
10539
+ var SetAdministrativeAreaPayload = z43.object({
10540
+ id: UUID,
10541
+ name: z43.string(),
10542
+ externalId: z43.string().nullish(),
10543
+ parentId: UUID.nullable()
10544
+ });
10545
+ function resolveVersion(versions, anchor) {
10546
+ let resolved = versions[0];
10547
+ for (const version of versions) {
10548
+ if (version.effectiveFrom <= anchor) {
10549
+ resolved = version;
10550
+ }
10551
+ }
10552
+ return resolved;
10553
+ }
10554
+ function hasActiveExternalIdOnOrAfter(versions, externalId, anchor) {
10555
+ const inEffectAtAnchor = resolveVersion(versions, anchor);
10556
+ const laterVersions = versions.filter((v) => v.effectiveFrom > anchor);
10557
+ return [inEffectAtAnchor, ...laterVersions].some(
10558
+ (v) => v.externalId === externalId && v.status === "active"
10559
+ );
10560
+ }
10485
10561
  function matchesJurisdictionFilter(locationIds, filter, user2) {
10486
10562
  if (!locationIds) {
10487
10563
  return false;
@@ -10961,75 +11037,80 @@ function getFilePathsFromEvent(event2) {
10961
11037
  }
10962
11038
 
10963
11039
  // ../commons/src/events/mocks.test.utils.ts
10964
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11040
+ function withVersionFields(entity) {
11041
+ return {
11042
+ ...entity,
11043
+ status: "active",
11044
+ versions: [
11045
+ {
11046
+ versionId: entity.id,
11047
+ effectiveFrom: "0001-01-01",
11048
+ name: entity.name,
11049
+ externalId: entity.externalId ?? null,
11050
+ status: "active"
11051
+ }
11052
+ ]
11053
+ };
11054
+ }
11055
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
10965
11056
  {
10966
11057
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10967
11058
  name: "Central",
10968
11059
  parentId: null,
10969
- validUntil: null,
10970
11060
  externalId: "ydyJb1RAy4U1"
10971
11061
  },
10972
11062
  {
10973
11063
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10974
11064
  name: "Sulaka",
10975
11065
  parentId: null,
10976
- validUntil: null,
10977
11066
  externalId: "pQ8nGxWmZ2Q3"
10978
11067
  },
10979
11068
  {
10980
11069
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
10981
11070
  name: "Pualula",
10982
11071
  parentId: null,
10983
- validUntil: null,
10984
11072
  externalId: "Aq91DweLmT8k"
10985
11073
  },
10986
11074
  {
10987
11075
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
10988
11076
  name: "Chuminga",
10989
11077
  parentId: null,
10990
- validUntil: null,
10991
11078
  externalId: "Rw0fYNh2Xk9a"
10992
11079
  },
10993
11080
  {
10994
11081
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10995
11082
  name: "Ibombo",
10996
11083
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10997
- validUntil: null,
10998
11084
  externalId: "k7DsP4vbN1Qe"
10999
11085
  },
11000
11086
  {
11001
11087
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
11002
11088
  name: "Isango",
11003
11089
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11004
- validUntil: null,
11005
11090
  externalId: "Gm3Z9eQpHw4L"
11006
11091
  },
11007
11092
  {
11008
11093
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
11009
11094
  name: "Isamba",
11010
11095
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11011
- validUntil: null,
11012
11096
  externalId: "sT0xVu1KqJ7r"
11013
11097
  },
11014
11098
  {
11015
11099
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
11016
11100
  name: "Itambo",
11017
11101
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11018
- validUntil: null,
11019
11102
  externalId: "Nq6Bv2HpL9Te"
11020
11103
  },
11021
11104
  {
11022
11105
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
11023
11106
  name: "Ezhi",
11024
11107
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11025
- validUntil: null,
11026
11108
  externalId: "xK8cQ0ZRy5Wd"
11027
11109
  },
11028
11110
  {
11029
11111
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
11030
11112
  name: "Ilanga",
11031
11113
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
11032
- validUntil: null,
11033
11114
  externalId: "Cq4Jm1XvN8Ls"
11034
11115
  },
11035
11116
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -11037,49 +11118,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11037
11118
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11038
11119
  name: "Klow",
11039
11120
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11040
- validUntil: null,
11041
11121
  externalId: "IkYcYBUcyY2"
11042
11122
  },
11043
11123
  {
11044
11124
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
11045
11125
  name: "Mbondo",
11046
11126
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11047
- validUntil: null,
11048
11127
  externalId: "Qhvv5hvo3mY"
11049
11128
  },
11050
11129
  {
11051
11130
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
11052
11131
  name: "Ndara",
11053
11132
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11054
- validUntil: null,
11055
11133
  externalId: "crXh068O9TR"
11056
11134
  },
11057
11135
  {
11058
11136
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
11059
11137
  name: "Olani",
11060
11138
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11061
- validUntil: null,
11062
11139
  externalId: "r00It8Tvvp7"
11063
11140
  },
11064
11141
  {
11065
11142
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
11066
11143
  name: "Pemba",
11067
11144
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11068
- validUntil: null,
11069
11145
  externalId: "ZnUWsbONIaH"
11070
11146
  },
11071
11147
  {
11072
11148
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
11073
11149
  name: "Quanza",
11074
11150
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11075
- validUntil: null,
11076
11151
  externalId: "fDZycvQTa7l"
11077
11152
  },
11078
11153
  {
11079
11154
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
11080
11155
  name: "Rivka",
11081
11156
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11082
- validUntil: null,
11083
11157
  externalId: "KqswxCGTELa"
11084
11158
  },
11085
11159
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -11087,35 +11161,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11087
11161
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
11088
11162
  name: "Mbula",
11089
11163
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11090
- validUntil: null,
11091
11164
  externalId: "osEbKjRc9Kg"
11092
11165
  },
11093
11166
  {
11094
11167
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
11095
11168
  name: "Ndoki",
11096
11169
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11097
- validUntil: null,
11098
11170
  externalId: "aq4daBUAGr3"
11099
11171
  },
11100
11172
  {
11101
11173
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
11102
11174
  name: "Tsanga",
11103
11175
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11104
- validUntil: null,
11105
11176
  externalId: "cqis6Y8trbJ"
11106
11177
  },
11107
11178
  {
11108
11179
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
11109
11180
  name: "Waziri",
11110
11181
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11111
- validUntil: null,
11112
11182
  externalId: "LMijHPyyx6d"
11113
11183
  },
11114
11184
  {
11115
11185
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
11116
11186
  name: "Zimbi",
11117
11187
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11118
- validUntil: null,
11119
11188
  externalId: "pcQYbPuKGZ7"
11120
11189
  },
11121
11190
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -11123,67 +11192,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11123
11192
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
11124
11193
  name: "Felani",
11125
11194
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11126
- validUntil: null,
11127
11195
  externalId: "gSqpoCGdMXp"
11128
11196
  },
11129
11197
  {
11130
11198
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
11131
11199
  name: "Goroma",
11132
11200
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11133
- validUntil: null,
11134
11201
  externalId: "KvAAIaNqVrp"
11135
11202
  },
11136
11203
  {
11137
11204
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
11138
11205
  name: "Halifu",
11139
11206
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11140
- validUntil: null,
11141
11207
  externalId: "qe4UnEVt1hv"
11142
11208
  },
11143
11209
  {
11144
11210
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
11145
11211
  name: "Jabari",
11146
11212
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11147
- validUntil: null,
11148
11213
  externalId: "yHH9Nz4rLOt"
11149
11214
  },
11150
11215
  {
11151
11216
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
11152
11217
  name: "Kifani",
11153
11218
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11154
- validUntil: null,
11155
11219
  externalId: "eSWmXIGeu1I"
11156
11220
  },
11157
11221
  {
11158
11222
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
11159
11223
  name: "Lumela",
11160
11224
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11161
- validUntil: null,
11162
11225
  externalId: "bh0b3aI1uP3"
11163
11226
  }
11164
11227
  ];
11165
- var V2_DEFAULT_MOCK_LOCATIONS = [
11228
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
11229
+ var MOCK_LOCATIONS_BASE = [
11166
11230
  {
11167
11231
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
11168
11232
  name: "Central Provincial Office",
11169
11233
  locationType: "CRVS_OFFICE",
11170
11234
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11171
- validUntil: null,
11172
11235
  externalId: "Xr3Df8WpK6Ys"
11173
11236
  },
11174
11237
  {
11175
11238
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
11176
11239
  name: "Central Health Post",
11177
11240
  locationType: "HEALTH_FACILITY",
11178
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11179
- validUntil: null
11241
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
11180
11242
  },
11181
11243
  {
11182
11244
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
11183
11245
  name: "Ibombo District Office",
11184
11246
  locationType: "CRVS_OFFICE",
11185
11247
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11186
- validUntil: null,
11187
11248
  externalId: "Sm4Nw7GrD2Vy"
11188
11249
  },
11189
11250
  {
@@ -11191,7 +11252,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11191
11252
  name: "Isamba District Office",
11192
11253
  locationType: "CRVS_OFFICE",
11193
11254
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11194
- validUntil: null,
11195
11255
  externalId: "Vg1Bq5XeH9Lt"
11196
11256
  },
11197
11257
  {
@@ -11199,7 +11259,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11199
11259
  name: "Isango District Office",
11200
11260
  locationType: "CRVS_OFFICE",
11201
11261
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
11202
- validUntil: null,
11203
11262
  externalId: "Je7Lm2XqN9Vz"
11204
11263
  },
11205
11264
  {
@@ -11207,7 +11266,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11207
11266
  name: "Sulaka Provincial Office",
11208
11267
  locationType: "CRVS_OFFICE",
11209
11268
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
11210
- validUntil: null,
11211
11269
  externalId: "Ht2Wp9KcX5Qv"
11212
11270
  },
11213
11271
  {
@@ -11215,7 +11273,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11215
11273
  name: "Ilanga District Office",
11216
11274
  locationType: "CRVS_OFFICE",
11217
11275
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
11218
- validUntil: null,
11219
11276
  externalId: "Yp6Ds1WqN3Xz"
11220
11277
  },
11221
11278
  {
@@ -11223,7 +11280,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11223
11280
  name: "Chamakubi Health Post",
11224
11281
  locationType: "HEALTH_FACILITY",
11225
11282
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11226
- validUntil: null,
11227
11283
  externalId: "M1nFr8LbC2Qy"
11228
11284
  },
11229
11285
  {
@@ -11231,7 +11287,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11231
11287
  name: "Ibombo Rural Health Centre",
11232
11288
  locationType: "HEALTH_FACILITY",
11233
11289
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11234
- validUntil: null,
11235
11290
  externalId: "bT7pV6YrW0Xc"
11236
11291
  },
11237
11292
  {
@@ -11239,7 +11294,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11239
11294
  name: "Chikobo Rural Health Centre",
11240
11295
  locationType: "HEALTH_FACILITY",
11241
11296
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11242
- validUntil: null,
11243
11297
  externalId: "zE4qPn2SgJ5d"
11244
11298
  },
11245
11299
  {
@@ -11247,7 +11301,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11247
11301
  name: "Chilochabalenje Health Post",
11248
11302
  locationType: "HEALTH_FACILITY",
11249
11303
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11250
- validUntil: null,
11251
11304
  externalId: "H8vDs1MqR4Uf"
11252
11305
  },
11253
11306
  {
@@ -11255,7 +11308,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11255
11308
  name: "Chipeso Rural Health Centre",
11256
11309
  locationType: "HEALTH_FACILITY",
11257
11310
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11258
- validUntil: null,
11259
11311
  externalId: "Qw3uZ9KfX6Lm"
11260
11312
  },
11261
11313
  {
@@ -11263,7 +11315,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11263
11315
  name: "Chisamba Rural Health Centre",
11264
11316
  locationType: "HEALTH_FACILITY",
11265
11317
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11266
- validUntil: null,
11267
11318
  externalId: "Yr0pCg8LdM2s"
11268
11319
  },
11269
11320
  {
@@ -11271,7 +11322,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11271
11322
  name: "Chitanda Rural Health Centre",
11272
11323
  locationType: "HEALTH_FACILITY",
11273
11324
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11274
- validUntil: null,
11275
11325
  externalId: "tS9gJ4PwB1Qx"
11276
11326
  },
11277
11327
  {
@@ -11279,7 +11329,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11279
11329
  name: "Golden Valley Rural Health Centre",
11280
11330
  locationType: "HEALTH_FACILITY",
11281
11331
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11282
- validUntil: null,
11283
11332
  externalId: "Ld7Qm3XsA8Vr"
11284
11333
  },
11285
11334
  {
@@ -11287,7 +11336,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11287
11336
  name: "Ipongo Rural Health Centre",
11288
11337
  locationType: "HEALTH_FACILITY",
11289
11338
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11290
- validUntil: null,
11291
11339
  externalId: "kF2sW9DmH0Bt"
11292
11340
  },
11293
11341
  {
@@ -11295,7 +11343,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11295
11343
  name: "Itumbwe Health Post",
11296
11344
  locationType: "HEALTH_FACILITY",
11297
11345
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11298
- validUntil: null,
11299
11346
  externalId: "Ue5Xb3VaC7Pq"
11300
11347
  },
11301
11348
  {
@@ -11303,7 +11350,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11303
11350
  name: "Kabangalala Rural Health Centre",
11304
11351
  locationType: "HEALTH_FACILITY",
11305
11352
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11306
- validUntil: null,
11307
11353
  externalId: "Pz8Kc1TqH6Jn"
11308
11354
  },
11309
11355
  // Village offices
@@ -11312,13 +11358,61 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11312
11358
  name: "Klow Village Office",
11313
11359
  locationType: "CRVS_OFFICE",
11314
11360
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11315
- validUntil: null,
11316
11361
  externalId: "PmAyxAJkxiJ"
11317
11362
  }
11318
11363
  ];
11364
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
11319
11365
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
11320
11366
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
11321
11367
  );
11322
11368
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
11323
11369
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
11324
11370
  );
11371
+
11372
+ // ../commons/src/events/locationPayloads.ts
11373
+ var z44 = __toESM(require("zod/v4"));
11374
+ var CreateLocationPayload = z44.object({
11375
+ id: UUID.optional(),
11376
+ versionId: UUID.optional(),
11377
+ name: z44.string(),
11378
+ externalId: z44.string().nullish(),
11379
+ administrativeAreaId: UUID.nullable(),
11380
+ locationType: z44.string().nullable(),
11381
+ effectiveFrom: z44.iso.date().optional(),
11382
+ status: LocationStatus.default("active")
11383
+ });
11384
+ var UpdateLocationPayload = z44.strictObject({
11385
+ id: UUID,
11386
+ versionId: UUID.optional(),
11387
+ name: z44.string(),
11388
+ externalId: z44.string().nullish(),
11389
+ status: LocationStatus,
11390
+ effectiveFrom: z44.iso.date().optional(),
11391
+ lastVersionId: UUID
11392
+ });
11393
+ var WithdrawLocationVersionPayload = z44.object({
11394
+ id: UUID,
11395
+ versionId: UUID
11396
+ });
11397
+ var CreateAdministrativeAreaPayload = z44.object({
11398
+ id: UUID.optional(),
11399
+ versionId: UUID.optional(),
11400
+ name: z44.string(),
11401
+ externalId: z44.string().nullish(),
11402
+ parentId: UUID.nullable(),
11403
+ effectiveFrom: z44.iso.date().optional(),
11404
+ status: LocationStatus.default("active")
11405
+ });
11406
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
11407
+ id: UUID,
11408
+ versionId: UUID.optional(),
11409
+ name: z44.string(),
11410
+ externalId: z44.string().nullish(),
11411
+ status: LocationStatus,
11412
+ effectiveFrom: z44.iso.date().optional(),
11413
+ lastVersionId: UUID
11414
+ });
11415
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
11416
+ id: UUID,
11417
+ versionId: UUID
11418
+ });
@@ -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
  }