@opencrvs/toolkit 2.1.0-rc.c498f10 → 2.1.0-rc.ce802f4

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.
@@ -647,6 +647,7 @@ var PlainScopeType = z11.enum([
647
647
  "integration.create",
648
648
  "record.import",
649
649
  "config.update-all",
650
+ "location.edit",
650
651
  "attachment.upload",
651
652
  "profile.electronic-signature",
652
653
  "user.read-only-my-audit",
@@ -7834,8 +7834,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7834
7834
  email?: string | undefined;
7835
7835
  status?: string | undefined;
7836
7836
  primaryOfficeId?: string | undefined;
7837
- count?: number | undefined;
7838
- skip?: number | undefined;
7837
+ count: number;
7838
+ skip: number;
7839
7839
  sortBy?: "createdAt" | "email" | "firstname" | "role" | "status" | "surname" | "username" | undefined;
7840
7840
  sortOrder: "asc" | "desc";
7841
7841
  };
@@ -8242,6 +8242,23 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8242
8242
  responseSummary: {
8243
8243
  clientId: string;
8244
8244
  };
8245
+ } | {
8246
+ id: string;
8247
+ clientId: string;
8248
+ clientType: "system" | "user";
8249
+ createdAt: string;
8250
+ operation: "administrativeAreas.create" | "locations.create";
8251
+ requestData: {
8252
+ id: string;
8253
+ versionId: string;
8254
+ name: string;
8255
+ externalId?: string | null | undefined;
8256
+ administrativeAreaId?: string | null | undefined;
8257
+ parentId?: string | null | undefined;
8258
+ locationType?: string | null | undefined;
8259
+ effectiveFrom: string;
8260
+ status: string;
8261
+ };
8245
8262
  } | {
8246
8263
  id: string;
8247
8264
  clientId: string;
@@ -8351,8 +8368,15 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8351
8368
  name: string;
8352
8369
  externalId?: string | null | undefined;
8353
8370
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8354
- validUntil: string | null;
8355
8371
  locationType: string | null;
8372
+ status: "active" | "inactive";
8373
+ versions: {
8374
+ versionId: string & import("zod").$brand<"UUID">;
8375
+ effectiveFrom: string;
8376
+ name: string;
8377
+ externalId?: string | null | undefined;
8378
+ status: "active" | "inactive";
8379
+ }[];
8356
8380
  }[];
8357
8381
  meta: object;
8358
8382
  }>;
@@ -8362,12 +8386,39 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8362
8386
  name: string;
8363
8387
  externalId?: string | null | undefined;
8364
8388
  administrativeAreaId: string | null;
8365
- validUntil: string | null;
8366
8389
  locationType: string | null;
8367
8390
  }[];
8368
8391
  output: void;
8369
8392
  meta: object;
8370
8393
  }>;
8394
+ create: import("@trpc/server").TRPCMutationProcedure<{
8395
+ input: {
8396
+ id?: string | undefined;
8397
+ versionId?: string | undefined;
8398
+ name: string;
8399
+ externalId?: string | null | undefined;
8400
+ administrativeAreaId: string | null;
8401
+ locationType: string | null;
8402
+ effectiveFrom?: string | undefined;
8403
+ status?: "active" | "inactive" | undefined;
8404
+ };
8405
+ output: {
8406
+ id: string & import("zod").$brand<"UUID">;
8407
+ name: string;
8408
+ externalId?: string | null | undefined;
8409
+ administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8410
+ locationType: string | null;
8411
+ status: "active" | "inactive";
8412
+ versions: {
8413
+ versionId: string & import("zod").$brand<"UUID">;
8414
+ effectiveFrom: string;
8415
+ name: string;
8416
+ externalId?: string | null | undefined;
8417
+ status: "active" | "inactive";
8418
+ }[];
8419
+ };
8420
+ meta: import("trpc-to-openapi").OpenApiMeta;
8421
+ }>;
8371
8422
  get: import("@trpc/server").TRPCQueryProcedure<{
8372
8423
  input: {
8373
8424
  id: string;
@@ -8377,8 +8428,15 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8377
8428
  name: string;
8378
8429
  externalId?: string | null | undefined;
8379
8430
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8380
- validUntil: string | null;
8381
8431
  locationType: string | null;
8432
+ status: "active" | "inactive";
8433
+ versions: {
8434
+ versionId: string & import("zod").$brand<"UUID">;
8435
+ effectiveFrom: string;
8436
+ name: string;
8437
+ externalId?: string | null | undefined;
8438
+ status: "active" | "inactive";
8439
+ }[];
8382
8440
  };
8383
8441
  meta: import("trpc-to-openapi").OpenApiMeta;
8384
8442
  }>;
@@ -8786,7 +8844,14 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8786
8844
  name: string;
8787
8845
  externalId?: string | null | undefined;
8788
8846
  parentId: (string & import("zod").$brand<"UUID">) | null;
8789
- validUntil: string | null;
8847
+ status: "active" | "inactive";
8848
+ versions: {
8849
+ versionId: string & import("zod").$brand<"UUID">;
8850
+ effectiveFrom: string;
8851
+ name: string;
8852
+ externalId?: string | null | undefined;
8853
+ status: "active" | "inactive";
8854
+ }[];
8790
8855
  }[];
8791
8856
  meta: import("trpc-to-openapi").OpenApiMeta;
8792
8857
  }>;
@@ -8796,11 +8861,36 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8796
8861
  name: string;
8797
8862
  externalId?: string | null | undefined;
8798
8863
  parentId: string | null;
8799
- validUntil: string | null;
8800
8864
  }[];
8801
8865
  output: void;
8802
8866
  meta: object;
8803
8867
  }>;
8868
+ create: import("@trpc/server").TRPCMutationProcedure<{
8869
+ input: {
8870
+ id?: string | undefined;
8871
+ versionId?: string | undefined;
8872
+ name: string;
8873
+ externalId?: string | null | undefined;
8874
+ parentId: string | null;
8875
+ effectiveFrom?: string | undefined;
8876
+ status?: "active" | "inactive" | undefined;
8877
+ };
8878
+ output: {
8879
+ id: string & import("zod").$brand<"UUID">;
8880
+ name: string;
8881
+ externalId?: string | null | undefined;
8882
+ parentId: (string & import("zod").$brand<"UUID">) | null;
8883
+ status: "active" | "inactive";
8884
+ versions: {
8885
+ versionId: string & import("zod").$brand<"UUID">;
8886
+ effectiveFrom: string;
8887
+ name: string;
8888
+ externalId?: string | null | undefined;
8889
+ status: "active" | "inactive";
8890
+ }[];
8891
+ };
8892
+ meta: import("trpc-to-openapi").OpenApiMeta;
8893
+ }>;
8804
8894
  }>>;
8805
8895
  integrations: import("@trpc/server").TRPCBuiltRouter<{
8806
8896
  ctx: Partial<{
@@ -85,16 +85,16 @@ export declare const now: typeof todayDateTimeValueSerializer;
85
85
  export declare const user: typeof userSerializer & {
86
86
  scope: (scope: import("../scopes").ScopeType) => {
87
87
  attribute: (option: import("../scopes").ScopeOptionKey) => {
88
- $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
88
+ $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
89
89
  $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
90
90
  };
91
91
  };
92
92
  jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
93
- $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
93
+ $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
94
94
  $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
95
95
  }) => {
96
96
  $jurisdiction: "administrativeArea" | "all" | "location" | {
97
- $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
97
+ $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
98
98
  $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
99
99
  };
100
100
  };
@@ -103,6 +103,7 @@ export declare const FieldConfigSchema: z.ZodObject<{
103
103
  "config.update-all": "config.update-all";
104
104
  "dashboard.view": "dashboard.view";
105
105
  "integration.create": "integration.create";
106
+ "location.edit": "location.edit";
106
107
  "organisation.read-locations": "organisation.read-locations";
107
108
  "performance.read": "performance.read";
108
109
  "performance.read-dashboards": "performance.read-dashboards";
@@ -283,6 +284,7 @@ export declare const EventFieldConfigSchema: z.ZodObject<{
283
284
  "config.update-all": "config.update-all";
284
285
  "dashboard.view": "dashboard.view";
285
286
  "integration.create": "integration.create";
287
+ "location.edit": "location.edit";
286
288
  "organisation.read-locations": "organisation.read-locations";
287
289
  "performance.read": "performance.read";
288
290
  "performance.read-dashboards": "performance.read-dashboards";
@@ -439,6 +441,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
439
441
  "config.update-all": "config.update-all";
440
442
  "dashboard.view": "dashboard.view";
441
443
  "integration.create": "integration.create";
444
+ "location.edit": "location.edit";
442
445
  "organisation.read-locations": "organisation.read-locations";
443
446
  "performance.read": "performance.read";
444
447
  "performance.read-dashboards": "performance.read-dashboards";
@@ -587,6 +590,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
587
590
  "config.update-all": "config.update-all";
588
591
  "dashboard.view": "dashboard.view";
589
592
  "integration.create": "integration.create";
593
+ "location.edit": "location.edit";
590
594
  "organisation.read-locations": "organisation.read-locations";
591
595
  "performance.read": "performance.read";
592
596
  "performance.read-dashboards": "performance.read-dashboards";
@@ -746,6 +750,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
746
750
  "config.update-all": "config.update-all";
747
751
  "dashboard.view": "dashboard.view";
748
752
  "integration.create": "integration.create";
753
+ "location.edit": "location.edit";
749
754
  "organisation.read-locations": "organisation.read-locations";
750
755
  "performance.read": "performance.read";
751
756
  "performance.read-dashboards": "performance.read-dashboards";
@@ -894,6 +899,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
894
899
  "config.update-all": "config.update-all";
895
900
  "dashboard.view": "dashboard.view";
896
901
  "integration.create": "integration.create";
902
+ "location.edit": "location.edit";
897
903
  "organisation.read-locations": "organisation.read-locations";
898
904
  "performance.read": "performance.read";
899
905
  "performance.read-dashboards": "performance.read-dashboards";
@@ -281,6 +281,29 @@ export declare const AuditLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
281
281
  responseSummary: z.ZodObject<{
282
282
  clientId: z.ZodString;
283
283
  }, z.core.$strip>;
284
+ }, z.core.$strip>, z.ZodObject<{
285
+ id: z.ZodString;
286
+ clientId: z.ZodString;
287
+ clientType: z.ZodEnum<{
288
+ system: "system";
289
+ user: "user";
290
+ }>;
291
+ createdAt: z.ZodString;
292
+ operation: z.ZodEnum<{
293
+ "administrativeAreas.create": "administrativeAreas.create";
294
+ "locations.create": "locations.create";
295
+ }>;
296
+ requestData: z.ZodObject<{
297
+ id: z.ZodString;
298
+ versionId: z.ZodString;
299
+ name: z.ZodString;
300
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
301
+ administrativeAreaId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
303
+ locationType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
304
+ effectiveFrom: z.ZodString;
305
+ status: z.ZodString;
306
+ }, z.core.$strip>;
284
307
  }, z.core.$strip>, z.ZodObject<{
285
308
  id: z.ZodString;
286
309
  clientId: z.ZodString;
@@ -1883,6 +1883,7 @@ declare const AdministrativeAreaField: z.ZodObject<{
1883
1883
  "config.update-all": "config.update-all";
1884
1884
  "dashboard.view": "dashboard.view";
1885
1885
  "integration.create": "integration.create";
1886
+ "location.edit": "location.edit";
1886
1887
  "organisation.read-locations": "organisation.read-locations";
1887
1888
  "performance.read": "performance.read";
1888
1889
  "performance.read-dashboards": "performance.read-dashboards";
@@ -2012,6 +2013,7 @@ declare const LocationInput: z.ZodObject<{
2012
2013
  "config.update-all": "config.update-all";
2013
2014
  "dashboard.view": "dashboard.view";
2014
2015
  "integration.create": "integration.create";
2016
+ "location.edit": "location.edit";
2015
2017
  "organisation.read-locations": "organisation.read-locations";
2016
2018
  "performance.read": "performance.read";
2017
2019
  "performance.read-dashboards": "performance.read-dashboards";
@@ -2212,6 +2214,7 @@ declare const Facility: z.ZodObject<{
2212
2214
  "config.update-all": "config.update-all";
2213
2215
  "dashboard.view": "dashboard.view";
2214
2216
  "integration.create": "integration.create";
2217
+ "location.edit": "location.edit";
2215
2218
  "organisation.read-locations": "organisation.read-locations";
2216
2219
  "performance.read": "performance.read";
2217
2220
  "performance.read-dashboards": "performance.read-dashboards";
@@ -2327,6 +2330,7 @@ declare const Office: z.ZodObject<{
2327
2330
  "config.update-all": "config.update-all";
2328
2331
  "dashboard.view": "dashboard.view";
2329
2332
  "integration.create": "integration.create";
2333
+ "location.edit": "location.edit";
2330
2334
  "organisation.read-locations": "organisation.read-locations";
2331
2335
  "performance.read": "performance.read";
2332
2336
  "performance.read-dashboards": "performance.read-dashboards";
@@ -2528,6 +2532,7 @@ declare const Address: z.ZodObject<{
2528
2532
  "config.update-all": "config.update-all";
2529
2533
  "dashboard.view": "dashboard.view";
2530
2534
  "integration.create": "integration.create";
2535
+ "location.edit": "location.edit";
2531
2536
  "organisation.read-locations": "organisation.read-locations";
2532
2537
  "performance.read": "performance.read";
2533
2538
  "performance.read-dashboards": "performance.read-dashboards";
@@ -45,6 +45,7 @@ export * from './field';
45
45
  export * from './Flag';
46
46
  export * from './event';
47
47
  export * from './locations';
48
+ export * from './locationPayloads';
48
49
  export { UUID } from '../uuid';
49
50
  export { DocumentPath } from '../documents';
50
51
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,95 @@
1
+ import * as z from 'zod/v4';
2
+ /**
3
+ * Input payload for creating a location: the identity fields (parent and
4
+ * locationType are set once, immutable thereafter) plus the first version.
5
+ * `id` and `versionId` may be supplied by the caller for idempotent retries.
6
+ * `effectiveFrom` defaults to the beginning-of-time sentinel on the server.
7
+ */
8
+ export declare const CreateLocationPayload: z.ZodObject<{
9
+ id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
10
+ versionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
11
+ name: z.ZodString;
12
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
14
+ locationType: z.ZodNullable<z.ZodString>;
15
+ effectiveFrom: z.ZodOptional<z.ZodISODate>;
16
+ status: z.ZodDefault<z.ZodEnum<{
17
+ active: "active";
18
+ inactive: "inactive";
19
+ }>>;
20
+ }, z.core.$strip>;
21
+ export type CreateLocationPayload = z.infer<typeof CreateLocationPayload>;
22
+ /**
23
+ * Input payload for appending a new version to a location. A full snapshot of
24
+ * every versioned field is required — omitted does not mean unchanged. The
25
+ * schema is strict: identity fields (`administrativeAreaId`, `locationType`)
26
+ * are rejected rather than ignored, as they cannot change. `lastVersionId`
27
+ * is the optimistic-concurrency check: it must be the id of the last element
28
+ * the caller observed. `effectiveFrom` defaults to today on the server;
29
+ * supply it explicitly for idempotent retries.
30
+ */
31
+ export declare const UpdateLocationPayload: z.ZodObject<{
32
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
33
+ versionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
34
+ name: z.ZodString;
35
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ status: z.ZodEnum<{
37
+ active: "active";
38
+ inactive: "inactive";
39
+ }>;
40
+ effectiveFrom: z.ZodOptional<z.ZodISODate>;
41
+ lastVersionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
42
+ }, z.core.$strict>;
43
+ export type UpdateLocationPayload = z.infer<typeof UpdateLocationPayload>;
44
+ /**
45
+ * Input payload for withdrawing a pending (future-dated) version element.
46
+ * Only elements whose `effectiveFrom` has not yet passed can be withdrawn.
47
+ */
48
+ export declare const WithdrawLocationVersionPayload: z.ZodObject<{
49
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
50
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
51
+ }, z.core.$strip>;
52
+ export type WithdrawLocationVersionPayload = z.infer<typeof WithdrawLocationVersionPayload>;
53
+ /**
54
+ * Administrative-area twin of {@link CreateLocationPayload}: `parentId`
55
+ * instead of `administrativeAreaId`, no `locationType`.
56
+ */
57
+ export declare const CreateAdministrativeAreaPayload: z.ZodObject<{
58
+ id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
59
+ versionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
60
+ name: z.ZodString;
61
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
63
+ effectiveFrom: z.ZodOptional<z.ZodISODate>;
64
+ status: z.ZodDefault<z.ZodEnum<{
65
+ active: "active";
66
+ inactive: "inactive";
67
+ }>>;
68
+ }, z.core.$strip>;
69
+ export type CreateAdministrativeAreaPayload = z.infer<typeof CreateAdministrativeAreaPayload>;
70
+ /**
71
+ * Administrative-area twin of {@link UpdateLocationPayload} — strict for the
72
+ * same reason: the identity field (`parentId`) is rejected, not ignored.
73
+ */
74
+ export declare const UpdateAdministrativeAreaPayload: z.ZodObject<{
75
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
76
+ versionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
77
+ name: z.ZodString;
78
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ status: z.ZodEnum<{
80
+ active: "active";
81
+ inactive: "inactive";
82
+ }>;
83
+ effectiveFrom: z.ZodOptional<z.ZodISODate>;
84
+ lastVersionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
85
+ }, z.core.$strict>;
86
+ export type UpdateAdministrativeAreaPayload = z.infer<typeof UpdateAdministrativeAreaPayload>;
87
+ /**
88
+ * Administrative-area twin of {@link WithdrawLocationVersionPayload}.
89
+ */
90
+ export declare const WithdrawAdministrativeAreaVersionPayload: z.ZodObject<{
91
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
92
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
93
+ }, z.core.$strip>;
94
+ export type WithdrawAdministrativeAreaVersionPayload = z.infer<typeof WithdrawAdministrativeAreaVersionPayload>;
95
+ //# sourceMappingURL=locationPayloads.d.ts.map
@@ -11,12 +11,46 @@ export declare const LocationTypeV1: z.ZodEnum<{
11
11
  HEALTH_FACILITY: "HEALTH_FACILITY";
12
12
  }>;
13
13
  export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
14
+ export declare const LocationStatus: z.ZodEnum<{
15
+ active: "active";
16
+ inactive: "inactive";
17
+ }>;
18
+ export type LocationStatus = z.infer<typeof LocationStatus>;
19
+ /**
20
+ * A single element of the append-only `versions` history of a location or
21
+ * administrative area. Versions are sorted ascending by `effectiveFrom`
22
+ * ('0001-01-01' is used as the beginning-of-time sentinel).
23
+ */
24
+ export declare const LocationVersion: z.ZodObject<{
25
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
26
+ effectiveFrom: z.ZodISODate;
27
+ name: z.ZodString;
28
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ status: z.ZodEnum<{
30
+ active: "active";
31
+ inactive: "inactive";
32
+ }>;
33
+ }, z.core.$strip>;
34
+ export type LocationVersion = z.infer<typeof LocationVersion>;
14
35
  export declare const AdministrativeArea: z.ZodObject<{
15
36
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
16
37
  name: z.ZodString;
17
38
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
39
  parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
19
- validUntil: z.ZodNullable<z.ZodISODateTime>;
40
+ status: z.ZodEnum<{
41
+ active: "active";
42
+ inactive: "inactive";
43
+ }>;
44
+ versions: z.ZodArray<z.ZodObject<{
45
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
46
+ effectiveFrom: z.ZodISODate;
47
+ name: z.ZodString;
48
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ status: z.ZodEnum<{
50
+ active: "active";
51
+ inactive: "inactive";
52
+ }>;
53
+ }, z.core.$strip>>;
20
54
  }, z.core.$strip>;
21
55
  export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
22
56
  export declare const Location: z.ZodObject<{
@@ -24,10 +58,66 @@ export declare const Location: z.ZodObject<{
24
58
  name: z.ZodString;
25
59
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
60
  administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
27
- validUntil: z.ZodNullable<z.ZodISODateTime>;
28
61
  locationType: z.ZodNullable<z.ZodString>;
62
+ status: z.ZodEnum<{
63
+ active: "active";
64
+ inactive: "inactive";
65
+ }>;
66
+ versions: z.ZodArray<z.ZodObject<{
67
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
68
+ effectiveFrom: z.ZodISODate;
69
+ name: z.ZodString;
70
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ status: z.ZodEnum<{
72
+ active: "active";
73
+ inactive: "inactive";
74
+ }>;
75
+ }, z.core.$strip>>;
29
76
  }, z.core.$strip>;
30
77
  export type Location = z.infer<typeof Location>;
78
+ /**
79
+ * Input payload for the locations `set` mutation. Carries only the seedable
80
+ * identity and hierarchy fields — version history is managed by the server.
81
+ */
82
+ export declare const SetLocationPayload: z.ZodObject<{
83
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
84
+ name: z.ZodString;
85
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
87
+ locationType: z.ZodNullable<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
90
+ /**
91
+ * Input payload for the administrative areas `set` mutation. Carries only the
92
+ * seedable identity and hierarchy fields — version history is managed by the
93
+ * server.
94
+ */
95
+ export declare const SetAdministrativeAreaPayload: z.ZodObject<{
96
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
97
+ name: z.ZodString;
98
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
100
+ }, z.core.$strip>;
101
+ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
102
+ /**
103
+ * Resolves the version in effect at the given anchor date.
104
+ *
105
+ * Returns the element with the greatest `effectiveFrom` that is less than or
106
+ * equal to `anchor`, falling back to the earliest element when the anchor
107
+ * precedes all versions. Assumes `versions` is sorted ascending by
108
+ * `effectiveFrom`. Both `effectiveFrom` and `anchor` are 'YYYY-MM-DD' strings,
109
+ * so plain string comparison is correct.
110
+ */
111
+ export declare function resolveVersion<T extends {
112
+ effectiveFrom: string;
113
+ }>(versions: T[], anchor: string): T;
114
+ /**
115
+ * Whether the entity holds the given externalId with active status at the
116
+ * anchor date or at any point after it. Used for point-in-time uniqueness of
117
+ * external codes: a new holder starting at `anchor` collides when an existing
118
+ * holder is (or is scheduled to be) active with the code from then on.
119
+ */
120
+ export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
31
121
  type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
32
122
  /**
33
123
  * For type T, convert fields K to arrays. If field is string, convert to string[].
@@ -79,7 +169,14 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
79
169
  name: string;
80
170
  externalId?: string | null | undefined;
81
171
  parentId: (string & z.$brand<"UUID">) | null;
82
- validUntil: string | null;
172
+ status: "active" | "inactive";
173
+ versions: {
174
+ versionId: string & z.$brand<"UUID">;
175
+ effectiveFrom: string;
176
+ name: string;
177
+ externalId?: string | null | undefined;
178
+ status: "active" | "inactive";
179
+ }[];
83
180
  }[];
84
181
  /**
85
182
  * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
@@ -6,14 +6,28 @@ export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$
6
6
  name: string;
7
7
  externalId?: string | null | undefined;
8
8
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
9
- validUntil: string | null;
10
9
  locationType: string | null;
10
+ status: "active" | "inactive";
11
+ versions: {
12
+ versionId: string & import("zod").$brand<"UUID">;
13
+ effectiveFrom: string;
14
+ name: string;
15
+ externalId?: string | null | undefined;
16
+ status: "active" | "inactive";
17
+ }[];
11
18
  }>;
12
19
  export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
13
20
  id: string & import("zod").$brand<"UUID">;
14
21
  name: string;
15
22
  externalId?: string | null | undefined;
16
23
  parentId: (string & import("zod").$brand<"UUID">) | null;
17
- validUntil: string | null;
24
+ status: "active" | "inactive";
25
+ versions: {
26
+ versionId: string & import("zod").$brand<"UUID">;
27
+ effectiveFrom: string;
28
+ name: string;
29
+ externalId?: string | null | undefined;
30
+ status: "active" | "inactive";
31
+ }[];
18
32
  }>;
19
33
  //# sourceMappingURL=mocks.test.utils.d.ts.map
@@ -9,7 +9,7 @@ import { EventIndex } from './EventIndex';
9
9
  import { EventInput } from './EventInput';
10
10
  import { TranslationConfig } from './TranslationConfig';
11
11
  import { FieldConfig } from './FieldConfig';
12
- import { Location, AdministrativeArea } from './locations';
12
+ import { SetLocationPayload, SetAdministrativeAreaPayload } from './locations';
13
13
  import { WorkqueueConfig } from './WorkqueueConfig';
14
14
  import * as z from 'zod/v4';
15
15
  import { DocumentPath } from '../documents';
@@ -48,16 +48,16 @@ export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng:
48
48
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
49
49
  */
50
50
  administrativeHierarchy?: {
51
- administrativeAreas: AdministrativeArea[];
52
- locations: Location[];
51
+ administrativeAreas: SetAdministrativeAreaPayload[];
52
+ locations: SetLocationPayload[];
53
53
  }): ActionUpdate;
54
54
  export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number, overrides?: ActionUpdate,
55
55
  /**
56
56
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
57
57
  */
58
58
  administrativeHierarchy?: {
59
- administrativeAreas: AdministrativeArea[];
60
- locations: Location[];
59
+ administrativeAreas: SetAdministrativeAreaPayload[];
60
+ locations: SetLocationPayload[];
61
61
  }): ActionUpdate;
62
62
  export declare function generateActionDuplicateDeclarationInput(...args: Parameters<typeof generateActionDeclarationInput>): ReturnType<typeof generateActionDeclarationInput>;
63
63
  export declare function eventPayloadGenerator(rng: () => number, configuration?: EventConfig): {
@@ -169,6 +169,7 @@ var PlainScopeType = z6.enum([
169
169
  "integration.create",
170
170
  "record.import",
171
171
  "config.update-all",
172
+ "location.edit",
172
173
  "attachment.upload",
173
174
  "profile.electronic-signature",
174
175
  "user.read-only-my-audit",