@opencrvs/toolkit 2.1.0-rc.5396c75 → 2.1.0-rc.5617d8e

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.
@@ -8351,8 +8351,16 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8351
8351
  name: string;
8352
8352
  externalId?: string | null | undefined;
8353
8353
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8354
- validUntil: string | null;
8355
8354
  locationType: string | null;
8355
+ status: "active" | "inactive";
8356
+ effectiveFrom: string;
8357
+ versions: {
8358
+ versionId: string & import("zod").$brand<"UUID">;
8359
+ effectiveFrom: string;
8360
+ name: string;
8361
+ externalId?: string | null | undefined;
8362
+ status: "active" | "inactive";
8363
+ }[];
8356
8364
  }[];
8357
8365
  meta: object;
8358
8366
  }>;
@@ -8362,7 +8370,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8362
8370
  name: string;
8363
8371
  externalId?: string | null | undefined;
8364
8372
  administrativeAreaId: string | null;
8365
- validUntil: string | null;
8366
8373
  locationType: string | null;
8367
8374
  }[];
8368
8375
  output: void;
@@ -8377,8 +8384,16 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8377
8384
  name: string;
8378
8385
  externalId?: string | null | undefined;
8379
8386
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8380
- validUntil: string | null;
8381
8387
  locationType: string | null;
8388
+ status: "active" | "inactive";
8389
+ effectiveFrom: string;
8390
+ versions: {
8391
+ versionId: string & import("zod").$brand<"UUID">;
8392
+ effectiveFrom: string;
8393
+ name: string;
8394
+ externalId?: string | null | undefined;
8395
+ status: "active" | "inactive";
8396
+ }[];
8382
8397
  };
8383
8398
  meta: import("trpc-to-openapi").OpenApiMeta;
8384
8399
  }>;
@@ -8786,7 +8801,15 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8786
8801
  name: string;
8787
8802
  externalId?: string | null | undefined;
8788
8803
  parentId: (string & import("zod").$brand<"UUID">) | null;
8789
- validUntil: string | null;
8804
+ status: "active" | "inactive";
8805
+ effectiveFrom: string;
8806
+ versions: {
8807
+ versionId: string & import("zod").$brand<"UUID">;
8808
+ effectiveFrom: string;
8809
+ name: string;
8810
+ externalId?: string | null | undefined;
8811
+ status: "active" | "inactive";
8812
+ }[];
8790
8813
  }[];
8791
8814
  meta: import("trpc-to-openapi").OpenApiMeta;
8792
8815
  }>;
@@ -8796,7 +8819,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8796
8819
  name: string;
8797
8820
  externalId?: string | null | undefined;
8798
8821
  parentId: string | null;
8799
- validUntil: string | null;
8800
8822
  }[];
8801
8823
  output: void;
8802
8824
  meta: object;
@@ -11,12 +11,47 @@ 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
+ effectiveFrom: z.ZodISODate;
45
+ versions: z.ZodArray<z.ZodObject<{
46
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
47
+ effectiveFrom: z.ZodISODate;
48
+ name: z.ZodString;
49
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ status: z.ZodEnum<{
51
+ active: "active";
52
+ inactive: "inactive";
53
+ }>;
54
+ }, z.core.$strip>>;
20
55
  }, z.core.$strip>;
21
56
  export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
22
57
  export declare const Location: z.ZodObject<{
@@ -24,10 +59,60 @@ export declare const Location: z.ZodObject<{
24
59
  name: z.ZodString;
25
60
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
61
  administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
27
- validUntil: z.ZodNullable<z.ZodISODateTime>;
28
62
  locationType: z.ZodNullable<z.ZodString>;
63
+ status: z.ZodEnum<{
64
+ active: "active";
65
+ inactive: "inactive";
66
+ }>;
67
+ effectiveFrom: z.ZodISODate;
68
+ versions: z.ZodArray<z.ZodObject<{
69
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
70
+ effectiveFrom: z.ZodISODate;
71
+ name: z.ZodString;
72
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ status: z.ZodEnum<{
74
+ active: "active";
75
+ inactive: "inactive";
76
+ }>;
77
+ }, z.core.$strip>>;
29
78
  }, z.core.$strip>;
30
79
  export type Location = z.infer<typeof Location>;
80
+ /**
81
+ * Input payload for the locations `set` mutation. Carries only the seedable
82
+ * identity and hierarchy fields — version history is managed by the server.
83
+ */
84
+ export declare const SetLocationPayload: z.ZodObject<{
85
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
86
+ name: z.ZodString;
87
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
89
+ locationType: z.ZodNullable<z.ZodString>;
90
+ }, z.core.$strip>;
91
+ export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
92
+ /**
93
+ * Input payload for the administrative areas `set` mutation. Carries only the
94
+ * seedable identity and hierarchy fields — version history is managed by the
95
+ * server.
96
+ */
97
+ export declare const SetAdministrativeAreaPayload: z.ZodObject<{
98
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
99
+ name: z.ZodString;
100
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
102
+ }, z.core.$strip>;
103
+ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
104
+ /**
105
+ * Resolves the version in effect at the given anchor date.
106
+ *
107
+ * Returns the element with the greatest `effectiveFrom` that is less than or
108
+ * equal to `anchor`, falling back to the earliest element when the anchor
109
+ * precedes all versions. Assumes `versions` is sorted ascending by
110
+ * `effectiveFrom`. Both `effectiveFrom` and `anchor` are 'YYYY-MM-DD' strings,
111
+ * so plain string comparison is correct.
112
+ */
113
+ export declare function resolveVersion<T extends {
114
+ effectiveFrom: string;
115
+ }>(versions: T[], anchor: string): T;
31
116
  type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
32
117
  /**
33
118
  * For type T, convert fields K to arrays. If field is string, convert to string[].
@@ -79,7 +164,15 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
79
164
  name: string;
80
165
  externalId?: string | null | undefined;
81
166
  parentId: (string & z.$brand<"UUID">) | null;
82
- validUntil: string | null;
167
+ status: "active" | "inactive";
168
+ effectiveFrom: string;
169
+ versions: {
170
+ versionId: string & z.$brand<"UUID">;
171
+ effectiveFrom: string;
172
+ name: string;
173
+ externalId?: string | null | undefined;
174
+ status: "active" | "inactive";
175
+ }[];
83
176
  }[];
84
177
  /**
85
178
  * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
@@ -6,14 +6,30 @@ 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
+ effectiveFrom: string;
12
+ versions: {
13
+ versionId: string & import("zod").$brand<"UUID">;
14
+ effectiveFrom: string;
15
+ name: string;
16
+ externalId?: string | null | undefined;
17
+ status: "active" | "inactive";
18
+ }[];
11
19
  }>;
12
20
  export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
13
21
  id: string & import("zod").$brand<"UUID">;
14
22
  name: string;
15
23
  externalId?: string | null | undefined;
16
24
  parentId: (string & import("zod").$brand<"UUID">) | null;
17
- validUntil: string | null;
25
+ status: "active" | "inactive";
26
+ effectiveFrom: string;
27
+ versions: {
28
+ versionId: string & import("zod").$brand<"UUID">;
29
+ effectiveFrom: string;
30
+ name: string;
31
+ externalId?: string | null | undefined;
32
+ status: "active" | "inactive";
33
+ }[];
18
34
  }>;
19
35
  //# 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): {