@opencrvs/toolkit 2.1.0-rc.505668e → 2.1.0-rc.50fdb5f
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.
- package/README.md +1 -0
- package/create-countryconfig/index.js +114 -66
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +228 -196
- package/dist/cli.js +174 -58
- package/dist/commons/api/router.d.ts +295 -18
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionDocument.d.ts +1 -7
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/FieldConfig.d.ts +70 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +191 -11
- package/dist/commons/events/mocks.test.utils.d.ts +46 -2
- package/dist/commons/events/test.utils.d.ts +5 -5
- package/dist/conditionals/index.js +303 -55
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +12 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/setup-environment.js +2 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +17 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/events/index.js +3627 -3289
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/notification/index.js +1925 -1102
- package/dist/scopes/index.d.ts +251 -26
- package/dist/scopes/index.js +304 -55
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.50fdb5f.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.505668e.tgz +0 -0
|
@@ -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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UUID } from '../uuid';
|
|
2
2
|
import * as z from 'zod/v4';
|
|
3
|
+
import { PlainDate } from './PlainDate';
|
|
3
4
|
import { EventIndex } from './EventIndex';
|
|
4
5
|
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
5
6
|
import { RecordScopeV2, UserScopeV2 } from '../scopes';
|
|
@@ -11,12 +12,46 @@ export declare const LocationTypeV1: z.ZodEnum<{
|
|
|
11
12
|
HEALTH_FACILITY: "HEALTH_FACILITY";
|
|
12
13
|
}>;
|
|
13
14
|
export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
|
|
15
|
+
export declare const LocationStatus: z.ZodEnum<{
|
|
16
|
+
active: "active";
|
|
17
|
+
inactive: "inactive";
|
|
18
|
+
}>;
|
|
19
|
+
export type LocationStatus = z.infer<typeof LocationStatus>;
|
|
20
|
+
/**
|
|
21
|
+
* A single element of the append-only `versions` history of a location or
|
|
22
|
+
* administrative area. Versions are sorted ascending by `effectiveFrom`
|
|
23
|
+
* ('0001-01-01' is used as the beginning-of-time sentinel).
|
|
24
|
+
*/
|
|
25
|
+
export declare const LocationVersion: z.ZodObject<{
|
|
26
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
27
|
+
effectiveFrom: z.ZodISODate;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
status: z.ZodEnum<{
|
|
31
|
+
active: "active";
|
|
32
|
+
inactive: "inactive";
|
|
33
|
+
}>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type LocationVersion = z.infer<typeof LocationVersion>;
|
|
14
36
|
export declare const AdministrativeArea: z.ZodObject<{
|
|
15
37
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
16
38
|
name: z.ZodString;
|
|
17
39
|
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
40
|
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
19
|
-
|
|
41
|
+
status: z.ZodEnum<{
|
|
42
|
+
active: "active";
|
|
43
|
+
inactive: "inactive";
|
|
44
|
+
}>;
|
|
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,121 @@ 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
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
68
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
69
|
+
effectiveFrom: z.ZodISODate;
|
|
70
|
+
name: z.ZodString;
|
|
71
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
status: z.ZodEnum<{
|
|
73
|
+
active: "active";
|
|
74
|
+
inactive: "inactive";
|
|
75
|
+
}>;
|
|
76
|
+
}, z.core.$strip>>;
|
|
29
77
|
}, z.core.$strip>;
|
|
30
78
|
export type Location = z.infer<typeof Location>;
|
|
79
|
+
/**
|
|
80
|
+
* TEMPORARY — client-side view of {@link AdministrativeArea} with the
|
|
81
|
+
* server-flattened `name`, `status` and `externalId` removed, leaving exactly
|
|
82
|
+
* identity + versions. Every name/status read is thereby forced through the
|
|
83
|
+
* anchored resolution utilities ({@link resolveVersion}, {@link resolvePath})
|
|
84
|
+
* at compile time. Delete this type when the contract migration removes the
|
|
85
|
+
* flat fields from the server schema, at which point the wire type itself
|
|
86
|
+
* becomes identity + versions.
|
|
87
|
+
*/
|
|
88
|
+
export declare const ClientAdministrativeArea: z.ZodObject<{
|
|
89
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
90
|
+
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
91
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
92
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
93
|
+
effectiveFrom: z.ZodISODate;
|
|
94
|
+
name: z.ZodString;
|
|
95
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
status: z.ZodEnum<{
|
|
97
|
+
active: "active";
|
|
98
|
+
inactive: "inactive";
|
|
99
|
+
}>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
export type ClientAdministrativeArea = z.infer<typeof ClientAdministrativeArea>;
|
|
103
|
+
/**
|
|
104
|
+
* TEMPORARY — client-side view of {@link Location} with the server-flattened
|
|
105
|
+
* `name`, `status` and `externalId` removed, leaving exactly identity +
|
|
106
|
+
* versions. See {@link ClientAdministrativeArea} for the full rationale and
|
|
107
|
+
* deletion condition.
|
|
108
|
+
*/
|
|
109
|
+
export declare const ClientLocation: z.ZodObject<{
|
|
110
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
111
|
+
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
112
|
+
locationType: z.ZodNullable<z.ZodString>;
|
|
113
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
114
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
115
|
+
effectiveFrom: z.ZodISODate;
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
status: z.ZodEnum<{
|
|
119
|
+
active: "active";
|
|
120
|
+
inactive: "inactive";
|
|
121
|
+
}>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export type ClientLocation = z.infer<typeof ClientLocation>;
|
|
125
|
+
/**
|
|
126
|
+
* Strips the server-flattened fields from a location as it enters the
|
|
127
|
+
* client's cached maps. The wire format keeps the flat fields for
|
|
128
|
+
* compatibility; the cache must not, or devices would keep rendering names
|
|
129
|
+
* flattened before a future-dated version takes effect.
|
|
130
|
+
*/
|
|
131
|
+
export declare function toClientLocation(location: Location): ClientLocation;
|
|
132
|
+
/** See {@link toClientLocation}. */
|
|
133
|
+
export declare function toClientAdministrativeArea(area: AdministrativeArea): ClientAdministrativeArea;
|
|
134
|
+
/**
|
|
135
|
+
* Input payload for the locations `set` mutation. Carries only the seedable
|
|
136
|
+
* identity and hierarchy fields — version history is managed by the server.
|
|
137
|
+
*/
|
|
138
|
+
export declare const SetLocationPayload: z.ZodObject<{
|
|
139
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
140
|
+
name: z.ZodString;
|
|
141
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
|
+
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
143
|
+
locationType: z.ZodNullable<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
|
|
146
|
+
/**
|
|
147
|
+
* Input payload for the administrative areas `set` mutation. Carries only the
|
|
148
|
+
* seedable identity and hierarchy fields — version history is managed by the
|
|
149
|
+
* server.
|
|
150
|
+
*/
|
|
151
|
+
export declare const SetAdministrativeAreaPayload: z.ZodObject<{
|
|
152
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
|
+
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
|
|
158
|
+
/**
|
|
159
|
+
* Resolves the version in effect at the given anchor date.
|
|
160
|
+
*
|
|
161
|
+
* Returns the element with the greatest `effectiveFrom` that is less than or
|
|
162
|
+
* equal to `anchor`, falling back to the earliest element when the anchor
|
|
163
|
+
* precedes all versions. Assumes `versions` is sorted ascending by
|
|
164
|
+
* `effectiveFrom`. Both `effectiveFrom` and `anchor` are 'YYYY-MM-DD' strings,
|
|
165
|
+
* so plain string comparison is correct.
|
|
166
|
+
*/
|
|
167
|
+
export declare function resolveVersion<T extends {
|
|
168
|
+
effectiveFrom: string;
|
|
169
|
+
}>(versions: T[], anchor: string): T;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the entity holds the given externalId with active status at the
|
|
172
|
+
* anchor date or at any point after it. Used for point-in-time uniqueness of
|
|
173
|
+
* external codes: a new holder starting at `anchor` collides when an existing
|
|
174
|
+
* holder is (or is scheduled to be) active with the code from then on.
|
|
175
|
+
*/
|
|
176
|
+
export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
|
|
31
177
|
type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
|
|
32
178
|
/**
|
|
33
179
|
* For type T, convert fields K to arrays. If field is string, convert to string[].
|
|
@@ -74,13 +220,10 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
|
|
|
74
220
|
* One of the scopes must allow access for the event to be accessible.
|
|
75
221
|
*/
|
|
76
222
|
export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
77
|
-
export declare function getAdministrativeAreaHierarchy
|
|
78
|
-
id:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
parentId: (string & z.$brand<"UUID">) | null;
|
|
82
|
-
validUntil: string | null;
|
|
83
|
-
}[];
|
|
223
|
+
export declare function getAdministrativeAreaHierarchy<A extends {
|
|
224
|
+
id: UUID;
|
|
225
|
+
parentId: UUID | null;
|
|
226
|
+
}>(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, A>): A[];
|
|
84
227
|
/**
|
|
85
228
|
* Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
|
|
86
229
|
*
|
|
@@ -92,8 +235,45 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
|
|
|
92
235
|
* so the result is reversed to match the root-first convention used by the server.
|
|
93
236
|
*/
|
|
94
237
|
export declare function getLocationHierarchy(selectedId: UUID, context: {
|
|
95
|
-
administrativeAreas: Map<UUID,
|
|
96
|
-
|
|
238
|
+
administrativeAreas: Map<UUID, {
|
|
239
|
+
id: UUID;
|
|
240
|
+
parentId: UUID | null;
|
|
241
|
+
}>;
|
|
242
|
+
locations: Map<UUID, {
|
|
243
|
+
id: UUID;
|
|
244
|
+
administrativeAreaId: UUID | null;
|
|
245
|
+
}>;
|
|
97
246
|
}): UUID[];
|
|
247
|
+
/**
|
|
248
|
+
* A node of an anchored hierarchy path: the identity id plus the name and
|
|
249
|
+
* status in effect at the anchor date.
|
|
250
|
+
*/
|
|
251
|
+
export type ResolvedPathNode = {
|
|
252
|
+
id: UUID;
|
|
253
|
+
name: string;
|
|
254
|
+
status: LocationStatus;
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Resolves a location or administrative area id into its root-first
|
|
258
|
+
* hierarchy path — leaf included — with every node's name and status
|
|
259
|
+
* resolved at the anchor date.
|
|
260
|
+
*
|
|
261
|
+
* The parent chain is identity-level and fixed for life, so the chain is
|
|
262
|
+
* constant and only each node's name/status varies with the anchor. Status is
|
|
263
|
+
* returned for callers that filter on it; an inactive node still resolves to
|
|
264
|
+
* its name. Returns an empty array for an unknown id.
|
|
265
|
+
*/
|
|
266
|
+
export declare function resolvePath(locationId: UUID, anchor: PlainDate, context: {
|
|
267
|
+
administrativeAreas: Map<UUID, {
|
|
268
|
+
id: UUID;
|
|
269
|
+
parentId: UUID | null;
|
|
270
|
+
versions: LocationVersion[];
|
|
271
|
+
}>;
|
|
272
|
+
locations: Map<UUID, {
|
|
273
|
+
id: UUID;
|
|
274
|
+
administrativeAreaId: UUID | null;
|
|
275
|
+
versions: LocationVersion[];
|
|
276
|
+
}>;
|
|
277
|
+
}): ResolvedPathNode[];
|
|
98
278
|
export {};
|
|
99
279
|
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -6,14 +6,58 @@ 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
|
-
|
|
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
|
+
}[];
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Stripped view of {@link V2_DEFAULT_MOCK_LOCATIONS_MAP} matching what the
|
|
35
|
+
* client's cached location map actually holds at runtime (identity +
|
|
36
|
+
* versions only). Use this — not the wire-format map above — wherever a test
|
|
37
|
+
* stands in for `useLocations().getLocations.useSuspenseQuery()`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
40
|
+
id: string & import("zod").$brand<"UUID">;
|
|
41
|
+
administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
|
|
42
|
+
locationType: string | null;
|
|
43
|
+
versions: {
|
|
44
|
+
versionId: string & import("zod").$brand<"UUID">;
|
|
45
|
+
effectiveFrom: string;
|
|
46
|
+
name: string;
|
|
47
|
+
externalId?: string | null | undefined;
|
|
48
|
+
status: "active" | "inactive";
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
/** See {@link V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP}. */
|
|
52
|
+
export declare const V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
53
|
+
id: string & import("zod").$brand<"UUID">;
|
|
54
|
+
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
55
|
+
versions: {
|
|
56
|
+
versionId: string & import("zod").$brand<"UUID">;
|
|
57
|
+
effectiveFrom: string;
|
|
58
|
+
name: string;
|
|
59
|
+
externalId?: string | null | undefined;
|
|
60
|
+
status: "active" | "inactive";
|
|
61
|
+
}[];
|
|
18
62
|
}>;
|
|
19
63
|
//# 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 {
|
|
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:
|
|
52
|
-
locations:
|
|
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:
|
|
60
|
-
locations:
|
|
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): {
|