@opencrvs/toolkit 2.1.0-rc.b061691 → 2.1.0-rc.b263ac1

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 (80) hide show
  1. package/README.md +1 -0
  2. package/dist/application-config/index.js +34 -11
  3. package/dist/cli.js +174 -58
  4. package/dist/commons/api/router.d.ts +3528 -3251
  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/conditionals/validate.d.ts +9 -3
  8. package/dist/commons/events/ActionConfig.d.ts +105 -126
  9. package/dist/commons/events/ActionDocument.d.ts +110 -110
  10. package/dist/commons/events/ActionStatus.d.ts +3 -3
  11. package/dist/commons/events/ActionType.d.ts +62 -62
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +525 -513
  13. package/dist/commons/events/AuditLog.d.ts +189 -42
  14. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  15. package/dist/commons/events/Conditional.d.ts +3 -3
  16. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -608
  17. package/dist/commons/events/Draft.d.ts +37 -37
  18. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  19. package/dist/commons/events/EventConfig.d.ts +8 -5
  20. package/dist/commons/events/EventDocument.d.ts +46 -46
  21. package/dist/commons/events/EventIndex.d.ts +48 -52
  22. package/dist/commons/events/EventMetadata.d.ts +40 -41
  23. package/dist/commons/events/FieldConfig.d.ts +413 -396
  24. package/dist/commons/events/FieldType.d.ts +51 -51
  25. package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
  26. package/dist/commons/events/FieldValue.d.ts +14 -14
  27. package/dist/commons/events/Flag.d.ts +30 -36
  28. package/dist/commons/events/PlainDate.d.ts +8 -0
  29. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  30. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  31. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  32. package/dist/commons/events/WorkqueueConfig.d.ts +817 -829
  33. package/dist/commons/events/deduplication.d.ts +1 -1
  34. package/dist/commons/events/event.d.ts +14 -2
  35. package/dist/commons/events/field.d.ts +78 -895
  36. package/dist/commons/events/index.d.ts +1 -0
  37. package/dist/commons/events/locationPayloads.d.ts +95 -0
  38. package/dist/commons/events/locations.d.ts +192 -12
  39. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  40. package/dist/commons/events/scopes.d.ts +4 -4
  41. package/dist/commons/events/state/index.d.ts +17 -17
  42. package/dist/commons/events/state/utils.d.ts +7 -7
  43. package/dist/commons/events/test.utils.d.ts +40 -40
  44. package/dist/commons/events/utils.d.ts +114 -114
  45. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  46. package/dist/conditionals/index.js +6 -4
  47. package/dist/environment/derived-variables.d.ts +119 -119
  48. package/dist/environment/derived-variables.d.ts.map +1 -1
  49. package/dist/environment/index.d.ts +1 -0
  50. package/dist/environment/index.d.ts.map +1 -1
  51. package/dist/environment/index.js +10 -0
  52. package/dist/environment/logger.d.ts +12 -3
  53. package/dist/environment/logger.d.ts.map +1 -1
  54. package/dist/environment/paths.d.ts +7 -0
  55. package/dist/environment/paths.d.ts.map +1 -0
  56. package/dist/environment/paths.js +72 -0
  57. package/dist/environment/questions.d.ts +75 -74
  58. package/dist/environment/questions.d.ts.map +1 -1
  59. package/dist/environment/setup-environment.js +10 -15
  60. package/dist/environment/templates.d.ts.map +1 -1
  61. package/dist/environment/templates.js +2 -1
  62. package/dist/environment/update-workflows.d.ts.map +1 -1
  63. package/dist/environment/update-workflows.js +17 -5
  64. package/dist/environment/upgrade.d.ts +2 -0
  65. package/dist/environment/upgrade.d.ts.map +1 -0
  66. package/dist/environment/upgrade.js +82 -0
  67. package/dist/environment/users.js +11 -13
  68. package/dist/environment/utils.d.ts +1 -1
  69. package/dist/events/deduplication.d.ts +1 -1
  70. package/dist/events/index.js +568 -265
  71. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  72. package/dist/notification/index.js +578 -316
  73. package/dist/scopes/index.d.ts +350 -332
  74. package/dist/scopes/index.js +6 -4
  75. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  76. package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
  77. package/opencrvs-toolkit-2.1.0-rc.b263ac1.tgz +0 -0
  78. package/package.json +6 -6
  79. package/tsconfig.tsbuildinfo +1 -1
  80. package/opencrvs-toolkit-2.1.0-rc.b061691.tgz +0 -0
@@ -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
@@ -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';
@@ -7,16 +8,50 @@ import { SystemContext, UserContext } from '../users/User';
7
8
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
8
9
  export declare const LocationTypeV1: z.ZodEnum<{
9
10
  ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
10
- HEALTH_FACILITY: "HEALTH_FACILITY";
11
11
  CRVS_OFFICE: "CRVS_OFFICE";
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
- validUntil: z.ZodNullable<z.ZodISODateTime>;
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(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
78
- id: string & z.core.$brand<"UUID">;
79
- name: string;
80
- parentId: (string & z.core.$brand<"UUID">) | null;
81
- validUntil: string | null;
82
- externalId?: string | null | undefined;
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, AdministrativeArea>;
96
- locations: Map<UUID, Location>;
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
@@ -4,16 +4,60 @@ export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
4
4
  export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
5
5
  id: string & import("zod").$brand<"UUID">;
6
6
  name: string;
7
+ externalId?: string | null | undefined;
7
8
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8
- validUntil: string | null;
9
9
  locationType: string | null;
10
- externalId?: string | null | undefined;
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
- parentId: (string & import("zod").$brand<"UUID">) | null;
16
- validUntil: string | null;
17
22
  externalId?: string | null | undefined;
23
+ parentId: (string & import("zod").$brand<"UUID">) | 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
+ }[];
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
@@ -13,7 +13,7 @@ export declare const ACTION_SCOPE_MAP: {
13
13
  DELETE: ("record.declare" | "record.notify")[];
14
14
  REGISTER: "record.register"[];
15
15
  PRINT_CERTIFICATE: "record.print-certified-copies"[];
16
- REQUEST_CORRECTION: ("record.request-correction" | "record.correct")[];
16
+ REQUEST_CORRECTION: ("record.correct" | "record.request-correction")[];
17
17
  REVIEW_CORRECTION_REQUEST: "record.correct"[];
18
18
  REJECT_CORRECTION: "record.correct"[];
19
19
  APPROVE_CORRECTION: "record.correct"[];
@@ -29,9 +29,9 @@ export declare const ACTION_SCOPE_MAP: {
29
29
  };
30
30
  export declare function hasAnyOfScopes(a: string[], b: string[]): boolean;
31
31
  export declare const AssignmentStatus: {
32
- readonly ASSIGNED_TO_SELF: "ASSIGNED_TO_SELF";
33
- readonly ASSIGNED_TO_OTHERS: "ASSIGNED_TO_OTHERS";
34
- readonly UNASSIGNED: "UNASSIGNED";
32
+ readonly ASSIGNED_TO_SELF: 'ASSIGNED_TO_SELF';
33
+ readonly ASSIGNED_TO_OTHERS: 'ASSIGNED_TO_OTHERS';
34
+ readonly UNASSIGNED: 'UNASSIGNED';
35
35
  };
36
36
  export type AssignmentStatus = (typeof AssignmentStatus)[keyof typeof AssignmentStatus];
37
37
  export declare function getAssignmentStatus(eventState: EventIndex | EventIndexWithAdministrativeHierarchy, userId: string): AssignmentStatus;
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
7
7
  import { EventConfig } from '../EventConfig';
8
8
  import { UUID } from '../../uuid';
9
9
  import { DocumentPath } from '../../documents';
10
- export declare function getStatusFromActions(actions: Array<Action>): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
10
+ export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
11
11
  export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
12
12
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
13
13
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
@@ -63,37 +63,45 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
63
63
  export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
64
64
  id: string & import("zod").$brand<"UUID">;
65
65
  type: string;
66
- status: "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
66
+ status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
67
67
  legalStatuses: {
68
68
  NOTIFIED?: {
69
69
  createdAt: string;
70
70
  createdBy: string;
71
- acceptedAt: string;
72
71
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
73
- createdByUserType?: "user" | "system" | null | undefined;
72
+ createdByUserType?: "system" | "user" | null | undefined;
73
+ acceptedAt: string;
74
74
  createdByRole?: string | undefined;
75
75
  } | null | undefined;
76
76
  DECLARED?: {
77
77
  createdAt: string;
78
78
  createdBy: string;
79
- acceptedAt: string;
80
79
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
81
- createdByUserType?: "user" | "system" | null | undefined;
80
+ createdByUserType?: "system" | "user" | null | undefined;
81
+ acceptedAt: string;
82
82
  createdByRole?: string | undefined;
83
83
  } | null | undefined;
84
84
  REGISTERED?: {
85
85
  createdAt: string;
86
86
  createdBy: string;
87
- acceptedAt: string;
88
- registrationNumber: string;
89
87
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
90
- createdByUserType?: "user" | "system" | null | undefined;
88
+ createdByUserType?: "system" | "user" | null | undefined;
89
+ acceptedAt: string;
91
90
  createdByRole?: string | undefined;
91
+ registrationNumber: string;
92
92
  } | null | undefined;
93
93
  };
94
94
  createdAt: string;
95
+ dateOfEvent?: string | null | undefined;
96
+ placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
95
97
  createdBy: string;
98
+ createdByUserType?: "system" | "user" | null | undefined;
99
+ updatedByUserRole?: string | null | undefined;
100
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
101
+ updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
96
102
  updatedAt: string;
103
+ assignedTo?: string | null | undefined;
104
+ updatedBy?: string | null | undefined;
97
105
  trackingId: string;
98
106
  potentialDuplicates: {
99
107
  id: string & import("zod").$brand<"UUID">;
@@ -101,14 +109,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
101
109
  }[];
102
110
  flags: string[];
103
111
  declaration: Record<string, import("..").FieldValue>;
104
- dateOfEvent?: string | null | undefined;
105
- placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
106
- createdByUserType?: "user" | "system" | null | undefined;
107
- updatedByUserRole?: string | null | undefined;
108
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
109
- updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
110
- assignedTo?: string | null | undefined;
111
- updatedBy?: string | null | undefined;
112
112
  };
113
113
  /**
114
114
  * Annotation is always specific to the action. when action with annotation is triggered multiple times,
@@ -14,17 +14,17 @@ import { Action } from '../ActionDocument';
14
14
  export declare function getActionUpdateMetadata(actions: Action[]): Pick<{
15
15
  id: string & import("zod").$brand<"UUID">;
16
16
  transactionId: string;
17
- createdByUserType: "user" | "system";
17
+ createdByUserType: "system" | "user";
18
18
  createdAt: string;
19
19
  createdBy: string;
20
- declaration: Record<string, import("..").FieldUpdateValue>;
21
- status: "Requested" | "Accepted" | "Rejected";
22
20
  createdByRole?: string | undefined;
23
21
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
24
22
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
23
+ declaration: Record<string, import("..").FieldUpdateValue>;
25
24
  annotation?: Record<string, import("..").FieldUpdateValue> | null | undefined;
25
+ status: "Accepted" | "Rejected" | "Requested";
26
26
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
27
- }, "createdByUserType" | "createdAt" | "createdBy" | "createdByRole" | "createdAtLocation">;
27
+ }, "createdAt" | "createdAtLocation" | "createdBy" | "createdByRole" | "createdByUserType">;
28
28
  /**
29
29
  * @returns the legal statuses of the event. Event is considered legal if it has been accepted.
30
30
  * @see EventIndex for the description of the returned object.
@@ -33,7 +33,7 @@ export declare function getLegalStatuses(actions: Action[]): {
33
33
  NOTIFIED: {
34
34
  createdAt: string;
35
35
  createdBy: string;
36
- createdByUserType: "user" | "system";
36
+ createdByUserType: "system" | "user";
37
37
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
38
38
  acceptedAt: string;
39
39
  createdByRole: string | undefined;
@@ -42,7 +42,7 @@ export declare function getLegalStatuses(actions: Action[]): {
42
42
  DECLARED: {
43
43
  createdAt: string;
44
44
  createdBy: string;
45
- createdByUserType: "user" | "system";
45
+ createdByUserType: "system" | "user";
46
46
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
47
47
  acceptedAt: string;
48
48
  createdByRole: string | undefined;
@@ -51,7 +51,7 @@ export declare function getLegalStatuses(actions: Action[]): {
51
51
  REGISTERED: {
52
52
  createdAt: string;
53
53
  createdBy: string;
54
- createdByUserType: "user" | "system";
54
+ createdByUserType: "system" | "user";
55
55
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
56
56
  acceptedAt: string;
57
57
  createdByRole: string | undefined;