@opencrvs/toolkit 2.1.0-rc.36dcafa → 2.1.0-rc.3ee9858

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.
@@ -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;
7838
- skip: number;
7837
+ count?: number | undefined;
7838
+ skip?: number | undefined;
7839
7839
  sortBy?: "createdAt" | "email" | "firstname" | "role" | "status" | "surname" | "username" | undefined;
7840
7840
  sortOrder: "asc" | "desc";
7841
7841
  };
@@ -8351,8 +8351,15 @@ 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
+ versions: {
8357
+ versionId: string & import("zod").$brand<"UUID">;
8358
+ effectiveFrom: string;
8359
+ name: string;
8360
+ externalId?: string | null | undefined;
8361
+ status: "active" | "inactive";
8362
+ }[];
8356
8363
  }[];
8357
8364
  meta: object;
8358
8365
  }>;
@@ -8362,7 +8369,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8362
8369
  name: string;
8363
8370
  externalId?: string | null | undefined;
8364
8371
  administrativeAreaId: string | null;
8365
- validUntil: string | null;
8366
8372
  locationType: string | null;
8367
8373
  }[];
8368
8374
  output: void;
@@ -8377,8 +8383,15 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8377
8383
  name: string;
8378
8384
  externalId?: string | null | undefined;
8379
8385
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8380
- validUntil: string | null;
8381
8386
  locationType: string | null;
8387
+ status: "active" | "inactive";
8388
+ versions: {
8389
+ versionId: string & import("zod").$brand<"UUID">;
8390
+ effectiveFrom: string;
8391
+ name: string;
8392
+ externalId?: string | null | undefined;
8393
+ status: "active" | "inactive";
8394
+ }[];
8382
8395
  };
8383
8396
  meta: import("trpc-to-openapi").OpenApiMeta;
8384
8397
  }>;
@@ -8786,7 +8799,14 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8786
8799
  name: string;
8787
8800
  externalId?: string | null | undefined;
8788
8801
  parentId: (string & import("zod").$brand<"UUID">) | null;
8789
- validUntil: string | null;
8802
+ status: "active" | "inactive";
8803
+ versions: {
8804
+ versionId: string & import("zod").$brand<"UUID">;
8805
+ effectiveFrom: string;
8806
+ name: string;
8807
+ externalId?: string | null | undefined;
8808
+ status: "active" | "inactive";
8809
+ }[];
8790
8810
  }[];
8791
8811
  meta: import("trpc-to-openapi").OpenApiMeta;
8792
8812
  }>;
@@ -8796,7 +8816,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8796
8816
  name: string;
8797
8817
  externalId?: string | null | undefined;
8798
8818
  parentId: string | null;
8799
- validUntil: string | null;
8800
8819
  }[];
8801
8820
  output: void;
8802
8821
  meta: object;
@@ -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,59 @@ 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;
31
114
  type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
32
115
  /**
33
116
  * For type T, convert fields K to arrays. If field is string, convert to string[].
@@ -79,7 +162,14 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
79
162
  name: string;
80
163
  externalId?: string | null | undefined;
81
164
  parentId: (string & z.$brand<"UUID">) | null;
82
- validUntil: string | null;
165
+ status: "active" | "inactive";
166
+ versions: {
167
+ versionId: string & z.$brand<"UUID">;
168
+ effectiveFrom: string;
169
+ name: string;
170
+ externalId?: string | null | undefined;
171
+ status: "active" | "inactive";
172
+ }[];
83
173
  }[];
84
174
  /**
85
175
  * 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): {