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

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 (85) hide show
  1. package/README.md +1 -0
  2. package/build.sh +3 -0
  3. package/create-countryconfig/index.js +281 -62
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +4 -1
  6. package/dist/application-config/index.js +341 -274
  7. package/dist/cli.js +1082 -101
  8. package/dist/commons/api/router.d.ts +702 -68
  9. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  10. package/dist/commons/conditionals/validate.d.ts +16 -5
  11. package/dist/commons/events/ActionDocument.d.ts +5 -11
  12. package/dist/commons/events/ActionInput.d.ts +4 -4
  13. package/dist/commons/events/ActionStatus.d.ts +14 -0
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +24 -0
  15. package/dist/commons/events/AuditLog.d.ts +147 -0
  16. package/dist/commons/events/EventConfig.d.ts +3 -0
  17. package/dist/commons/events/EventDocument.d.ts +470 -2
  18. package/dist/commons/events/EventIndex.d.ts +3 -26
  19. package/dist/commons/events/EventMetadata.d.ts +1 -11
  20. package/dist/commons/events/EventStatus.d.ts +19 -0
  21. package/dist/commons/events/FieldConfig.d.ts +88 -53
  22. package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
  23. package/dist/commons/events/FieldValue.d.ts +2 -2
  24. package/dist/commons/events/Flag.d.ts +42 -0
  25. package/dist/commons/events/PlainDate.d.ts +8 -0
  26. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
  28. package/dist/commons/events/event.d.ts +12 -0
  29. package/dist/commons/events/index.d.ts +1 -0
  30. package/dist/commons/events/locationPayloads.d.ts +95 -0
  31. package/dist/commons/events/locations.d.ts +242 -13
  32. package/dist/commons/events/mocks.test.utils.d.ts +46 -2
  33. package/dist/commons/events/test.utils.d.ts +12 -8
  34. package/dist/commons/events/utils.d.ts +2 -2
  35. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  36. package/dist/commons/notification/dispatch.d.ts +15 -0
  37. package/dist/commons/notification/index.d.ts +1 -0
  38. package/dist/conditionals/index.js +328 -58
  39. package/dist/environment/index.d.ts +1 -0
  40. package/dist/environment/index.d.ts.map +1 -1
  41. package/dist/environment/index.js +10 -0
  42. package/dist/environment/logger.d.ts +12 -3
  43. package/dist/environment/logger.d.ts.map +1 -1
  44. package/dist/environment/paths.d.ts +7 -0
  45. package/dist/environment/paths.d.ts.map +1 -0
  46. package/dist/environment/paths.js +72 -0
  47. package/dist/environment/questions.d.ts.map +1 -1
  48. package/dist/environment/questions.js +20 -14
  49. package/dist/environment/setup-environment.js +3 -2
  50. package/dist/environment/templates.d.ts.map +1 -1
  51. package/dist/environment/templates.js +2 -1
  52. package/dist/environment/update-workflows.d.ts.map +1 -1
  53. package/dist/environment/update-workflows.js +17 -5
  54. package/dist/environment/upgrade.d.ts +2 -0
  55. package/dist/environment/upgrade.d.ts.map +1 -0
  56. package/dist/environment/upgrade.js +82 -0
  57. package/dist/environment/users.js +11 -13
  58. package/dist/events/index.js +3759 -3357
  59. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  60. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  61. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  62. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  63. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  64. package/dist/migrations/v2.1/add-recovery-link-notifications.js +530 -0
  65. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  66. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  67. package/dist/migrations/v2.1/enable-telemetry.js +435 -0
  68. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  69. package/dist/migrations/v2.1/index.js +859 -0
  70. package/dist/notification/index.js +1863 -1463
  71. package/dist/scopes/index.d.ts +327 -32
  72. package/dist/scopes/index.js +329 -58
  73. package/dist/telemetry/index.d.ts +48 -0
  74. package/dist/telemetry/index.d.ts.map +1 -0
  75. package/dist/telemetry/index.js +42 -0
  76. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  77. package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
  78. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  79. package/dist/templates/inventory/inventory.template.yml +1 -3
  80. package/opencrvs-toolkit-2.1.0-rc.3a75e55.tgz +0 -0
  81. package/package.json +7 -5
  82. package/tsconfig.tsbuildinfo +1 -1
  83. package/dist/templates/inventory/production.example.yml +0 -77
  84. package/dist/templates/inventory/qa.example.yml +0 -48
  85. package/opencrvs-toolkit-2.1.0-rc.36dcafa.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,48 @@ 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 `versions` history of a location or administrative
22
+ * area. Versions are sorted ascending by `effectiveFrom` ('0001-01-01' is used
23
+ * as the beginning-of-time sentinel). Updates only ever append, but a
24
+ * not-yet-effective version can be withdrawn and seeding replaces a history
25
+ * wholesale, so the array is not append-only.
26
+ */
27
+ export declare const LocationVersion: z.ZodObject<{
28
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
29
+ effectiveFrom: z.ZodISODate;
30
+ name: z.ZodString;
31
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ status: z.ZodEnum<{
33
+ active: "active";
34
+ inactive: "inactive";
35
+ }>;
36
+ }, z.core.$strip>;
37
+ export type LocationVersion = z.infer<typeof LocationVersion>;
14
38
  export declare const AdministrativeArea: z.ZodObject<{
15
39
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
16
40
  name: z.ZodString;
17
41
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
42
  parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
19
- validUntil: z.ZodNullable<z.ZodISODateTime>;
43
+ status: z.ZodEnum<{
44
+ active: "active";
45
+ inactive: "inactive";
46
+ }>;
47
+ versions: z.ZodArray<z.ZodObject<{
48
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
49
+ effectiveFrom: z.ZodISODate;
50
+ name: z.ZodString;
51
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ status: z.ZodEnum<{
53
+ active: "active";
54
+ inactive: "inactive";
55
+ }>;
56
+ }, z.core.$strip>>;
20
57
  }, z.core.$strip>;
21
58
  export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
22
59
  export declare const Location: z.ZodObject<{
@@ -24,10 +61,168 @@ export declare const Location: z.ZodObject<{
24
61
  name: z.ZodString;
25
62
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
63
  administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
27
- validUntil: z.ZodNullable<z.ZodISODateTime>;
28
64
  locationType: z.ZodNullable<z.ZodString>;
65
+ status: z.ZodEnum<{
66
+ active: "active";
67
+ inactive: "inactive";
68
+ }>;
69
+ versions: z.ZodArray<z.ZodObject<{
70
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
71
+ effectiveFrom: z.ZodISODate;
72
+ name: z.ZodString;
73
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ status: z.ZodEnum<{
75
+ active: "active";
76
+ inactive: "inactive";
77
+ }>;
78
+ }, z.core.$strip>>;
29
79
  }, z.core.$strip>;
30
80
  export type Location = z.infer<typeof Location>;
81
+ /**
82
+ * TEMPORARY — client-side view of {@link AdministrativeArea} with the
83
+ * server-flattened `name`, `status` and `externalId` removed, leaving exactly
84
+ * identity + versions. Every name/status read is thereby forced through the
85
+ * anchored resolution utilities ({@link resolveVersion}, {@link resolvePath})
86
+ * at compile time. Delete this type when the contract migration removes the
87
+ * flat fields from the server schema, at which point the wire type itself
88
+ * becomes identity + versions.
89
+ */
90
+ export declare const ClientAdministrativeArea: z.ZodObject<{
91
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
92
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
93
+ versions: z.ZodArray<z.ZodObject<{
94
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
95
+ effectiveFrom: z.ZodISODate;
96
+ name: z.ZodString;
97
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
+ status: z.ZodEnum<{
99
+ active: "active";
100
+ inactive: "inactive";
101
+ }>;
102
+ }, z.core.$strip>>;
103
+ }, z.core.$strip>;
104
+ export type ClientAdministrativeArea = z.infer<typeof ClientAdministrativeArea>;
105
+ /**
106
+ * TEMPORARY — client-side view of {@link Location} with the server-flattened
107
+ * `name`, `status` and `externalId` removed, leaving exactly identity +
108
+ * versions. See {@link ClientAdministrativeArea} for the full rationale and
109
+ * deletion condition.
110
+ */
111
+ export declare const ClientLocation: z.ZodObject<{
112
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
113
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
114
+ locationType: z.ZodNullable<z.ZodString>;
115
+ versions: z.ZodArray<z.ZodObject<{
116
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
117
+ effectiveFrom: z.ZodISODate;
118
+ name: z.ZodString;
119
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
+ status: z.ZodEnum<{
121
+ active: "active";
122
+ inactive: "inactive";
123
+ }>;
124
+ }, z.core.$strip>>;
125
+ }, z.core.$strip>;
126
+ export type ClientLocation = z.infer<typeof ClientLocation>;
127
+ /**
128
+ * Strips the server-flattened fields from a location as it enters the
129
+ * client's cached maps. The wire format keeps the flat fields for
130
+ * compatibility; the cache must not, or devices would keep rendering names
131
+ * flattened before a future-dated version takes effect.
132
+ */
133
+ export declare function toClientLocation(location: Location): ClientLocation;
134
+ /** See {@link toClientLocation}. */
135
+ export declare function toClientAdministrativeArea(area: AdministrativeArea): ClientAdministrativeArea;
136
+ export declare const SeededLocationVersions: z.ZodArray<z.ZodObject<{
137
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
138
+ effectiveFrom: z.ZodISODate;
139
+ name: z.ZodString;
140
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ status: z.ZodEnum<{
142
+ active: "active";
143
+ inactive: "inactive";
144
+ }>;
145
+ }, z.core.$strip>>;
146
+ export type SeededLocationVersions = z.infer<typeof SeededLocationVersions>;
147
+ /**
148
+ * Input payload for the locations `set` mutation. Carries the seedable
149
+ * identity and hierarchy fields, plus an optional pre-built history.
150
+ *
151
+ * Last-write-wins on history: a repeated seed of the same row replaces its
152
+ * stored `versions`, so a caller that means to keep one has to send it every
153
+ * time. Seeding is only reachable while system initialisation is incomplete,
154
+ * so this replaces what an earlier seed attempt wrote, never a live history.
155
+ */
156
+ export declare const SetLocationPayload: z.ZodObject<{
157
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
158
+ name: z.ZodString;
159
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
160
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
161
+ locationType: z.ZodNullable<z.ZodString>;
162
+ versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
163
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
164
+ effectiveFrom: z.ZodISODate;
165
+ name: z.ZodString;
166
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ status: z.ZodEnum<{
168
+ active: "active";
169
+ inactive: "inactive";
170
+ }>;
171
+ }, z.core.$strip>>>;
172
+ }, z.core.$strip>;
173
+ export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
174
+ /**
175
+ * Input payload for the administrative areas `set` mutation. Twin of
176
+ * {@link SetLocationPayload}, including the optional pre-built `versions`
177
+ * history and the same semantics for omitting it.
178
+ */
179
+ export declare const SetAdministrativeAreaPayload: z.ZodObject<{
180
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
181
+ name: z.ZodString;
182
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
184
+ versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
185
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
186
+ effectiveFrom: z.ZodISODate;
187
+ name: z.ZodString;
188
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
189
+ status: z.ZodEnum<{
190
+ active: "active";
191
+ inactive: "inactive";
192
+ }>;
193
+ }, z.core.$strip>>>;
194
+ }, z.core.$strip>;
195
+ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
196
+ /**
197
+ * Resolves the version in effect at the given anchor date.
198
+ *
199
+ * Returns the element with the greatest `effectiveFrom` that is less than or
200
+ * equal to `anchor`, falling back to the earliest element when the anchor
201
+ * precedes all versions. Assumes `versions` is sorted ascending by
202
+ * `effectiveFrom`. Both `effectiveFrom` and `anchor` are 'YYYY-MM-DD' strings,
203
+ * so plain string comparison is correct.
204
+ */
205
+ export declare function resolveVersion<T extends {
206
+ effectiveFrom: string;
207
+ }>(versions: T[], anchor: string): T;
208
+ /**
209
+ * Whether the entity is selectable at `anchor`: it must already have a
210
+ * version effective by then, and the version that resolves at `anchor` must
211
+ * be active. `resolveVersion` alone is not enough for this — when `anchor`
212
+ * precedes every version it falls back to the earliest one, which would
213
+ * otherwise make a location created after `anchor` look selectable.
214
+ */
215
+ export declare function isSelectableAtAnchor<T extends {
216
+ effectiveFrom: string;
217
+ status: string;
218
+ }>(versions: T[], anchor: string): boolean;
219
+ /**
220
+ * Whether the entity holds the given externalId with active status at the
221
+ * anchor date or at any point after it. Used for point-in-time uniqueness of
222
+ * external codes: a new holder starting at `anchor` collides when an existing
223
+ * holder is (or is scheduled to be) active with the code from then on.
224
+ */
225
+ export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
31
226
  type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
32
227
  /**
33
228
  * For type T, convert fields K to arrays. If field is string, convert to string[].
@@ -52,7 +247,7 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
52
247
  * Return false early to break out of checks as soon as possible - if any option is not satisfied, the scope does not allow access to the event, so no need to check further options.
53
248
  *
54
249
  */
55
- export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
250
+ export declare function canAccessEventWithScope(event: EventIndexWithAdministrativeHierarchy, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
56
251
  export type UserWithResolvedHierarchy = {
57
252
  role: string;
58
253
  administrativeHierarchy: UUID[];
@@ -73,14 +268,11 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
73
268
  *
74
269
  * One of the scopes must allow access for the event to be accessible.
75
270
  */
76
- 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.$brand<"UUID">;
79
- name: string;
80
- externalId?: string | null | undefined;
81
- parentId: (string & z.$brand<"UUID">) | null;
82
- validUntil: string | null;
83
- }[];
271
+ export declare function userCanAccessEventWithScopes(event: EventIndexWithAdministrativeHierarchy, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
272
+ export declare function getAdministrativeAreaHierarchy<A extends {
273
+ id: UUID;
274
+ parentId: UUID | null;
275
+ }>(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, A>): A[];
84
276
  /**
85
277
  * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
86
278
  *
@@ -92,8 +284,45 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
92
284
  * so the result is reversed to match the root-first convention used by the server.
93
285
  */
94
286
  export declare function getLocationHierarchy(selectedId: UUID, context: {
95
- administrativeAreas: Map<UUID, AdministrativeArea>;
96
- locations: Map<UUID, Location>;
287
+ administrativeAreas: Map<UUID, {
288
+ id: UUID;
289
+ parentId: UUID | null;
290
+ }>;
291
+ locations: Map<UUID, {
292
+ id: UUID;
293
+ administrativeAreaId: UUID | null;
294
+ }>;
97
295
  }): UUID[];
296
+ /**
297
+ * A node of an anchored hierarchy path: the identity id plus the name and
298
+ * status in effect at the anchor date.
299
+ */
300
+ export type ResolvedPathNode = {
301
+ id: UUID;
302
+ name: string;
303
+ status: LocationStatus;
304
+ };
305
+ /**
306
+ * Resolves a location or administrative area id into its root-first
307
+ * hierarchy path — leaf included — with every node's name and status
308
+ * resolved at the anchor date.
309
+ *
310
+ * The parent chain is identity-level and fixed for life, so the chain is
311
+ * constant and only each node's name/status varies with the anchor. Status is
312
+ * returned for callers that filter on it; an inactive node still resolves to
313
+ * its name. Returns an empty array for an unknown id.
314
+ */
315
+ export declare function resolvePath(locationId: UUID, anchor: PlainDate, context: {
316
+ administrativeAreas: Map<UUID, {
317
+ id: UUID;
318
+ parentId: UUID | null;
319
+ versions: LocationVersion[];
320
+ }>;
321
+ locations: Map<UUID, {
322
+ id: UUID;
323
+ administrativeAreaId: UUID | null;
324
+ versions: LocationVersion[];
325
+ }>;
326
+ }): ResolvedPathNode[];
98
327
  export {};
99
328
  //# 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
- 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
+ }[];
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 { Location, AdministrativeArea } from './locations';
12
+ import { LocationVersion, SetLocationPayload, SetAdministrativeAreaPayload } from './locations';
13
13
  import { WorkqueueConfig } from './WorkqueueConfig';
14
14
  import * as z from 'zod/v4';
15
15
  import { DocumentPath } from '../documents';
@@ -43,21 +43,28 @@ export declare function generateUuid(rng?: () => number): UUID;
43
43
  export declare function generateTrackingId(rng: () => number): string;
44
44
  export declare function generateRegistrationNumber(rng: () => number): string;
45
45
  export declare function generateRandomSignature(rng: () => number): DocumentPath;
46
+ /**
47
+ * Builds one element of a location / administrative area `versions` history.
48
+ * Every field is defaulted so a call names only what its assertion is about —
49
+ * an `effectiveFrom`, a `name`, or an explicit `versionId` when the test needs
50
+ * to control version identity.
51
+ */
52
+ export declare function locationVersion(overrides?: Partial<LocationVersion>, rng?: () => number): LocationVersion;
46
53
  export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng: () => number,
47
54
  /**
48
55
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
49
56
  */
50
57
  administrativeHierarchy?: {
51
- administrativeAreas: AdministrativeArea[];
52
- locations: Location[];
58
+ administrativeAreas: SetAdministrativeAreaPayload[];
59
+ locations: SetLocationPayload[];
53
60
  }): ActionUpdate;
54
61
  export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number, overrides?: ActionUpdate,
55
62
  /**
56
63
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
57
64
  */
58
65
  administrativeHierarchy?: {
59
- administrativeAreas: AdministrativeArea[];
60
- locations: Location[];
66
+ administrativeAreas: SetAdministrativeAreaPayload[];
67
+ locations: SetLocationPayload[];
61
68
  }): ActionUpdate;
62
69
  export declare function generateActionDuplicateDeclarationInput(...args: Parameters<typeof generateActionDeclarationInput>): ReturnType<typeof generateActionDeclarationInput>;
63
70
  export declare function eventPayloadGenerator(rng: () => number, configuration?: EventConfig): {
@@ -124,9 +131,6 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
124
131
  declaration: {};
125
132
  annotation: {};
126
133
  eventId: string;
127
- content: {
128
- reason: string;
129
- };
130
134
  };
131
135
  unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
132
136
  keepAssignment?: boolean | undefined;
@@ -255,9 +255,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
255
255
  status: "Accepted" | "Rejected" | "Requested";
256
256
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
257
257
  type: "ARCHIVE";
258
- content: {
258
+ content?: {
259
259
  reason: string;
260
- };
260
+ } | undefined;
261
261
  } | {
262
262
  id: string & import("zod").$brand<"UUID">;
263
263
  transactionId: string;
@@ -5,6 +5,8 @@ export declare const TriggerEvent: {
5
5
  readonly USERNAME_REMINDER: 'username-reminder';
6
6
  readonly RESET_PASSWORD: 'reset-password';
7
7
  readonly RESET_PASSWORD_BY_ADMIN: 'reset-password-by-admin';
8
+ readonly PASSWORD_RESET_LINK: 'password-reset-link';
9
+ readonly USERNAME_REMINDER_LINK: 'username-reminder-link';
8
10
  readonly RESEND_INVITE: 'resend-invite';
9
11
  readonly TWO_FA: '2fa';
10
12
  readonly ALL_USER_NOTIFICATION: 'all-user-notification';
@@ -113,6 +115,32 @@ export declare const TriggerPayload: {
113
115
  role: z.ZodString;
114
116
  }, z.core.$strip>;
115
117
  }, z.core.$strip>;
118
+ readonly "password-reset-link": z.ZodObject<{
119
+ recipient: z.ZodObject<{
120
+ name: z.ZodOptional<z.ZodObject<{
121
+ firstname: z.ZodString;
122
+ surname: z.ZodString;
123
+ middlename: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>>;
125
+ mobile: z.ZodOptional<z.ZodString>;
126
+ email: z.ZodOptional<z.ZodString>;
127
+ bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ }, z.core.$strip>;
129
+ token: z.ZodString;
130
+ }, z.core.$strip>;
131
+ readonly "username-reminder-link": z.ZodObject<{
132
+ recipient: z.ZodObject<{
133
+ name: z.ZodOptional<z.ZodObject<{
134
+ firstname: z.ZodString;
135
+ surname: z.ZodString;
136
+ middlename: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ mobile: z.ZodOptional<z.ZodString>;
139
+ email: z.ZodOptional<z.ZodString>;
140
+ bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ }, z.core.$strip>;
142
+ token: z.ZodString;
143
+ }, z.core.$strip>;
116
144
  readonly "resend-invite": z.ZodObject<{
117
145
  recipient: z.ZodObject<{
118
146
  name: z.ZodOptional<z.ZodObject<{
@@ -184,18 +212,5 @@ export declare const TriggerPayload: {
184
212
  export type TriggerPayload = {
185
213
  [K in TriggerEvent]: z.infer<(typeof TriggerPayload)[K]>;
186
214
  };
187
- export declare function triggerUserEventNotification(args: {
188
- event: typeof TriggerEvent.ALL_USER_NOTIFICATION;
189
- payload: TriggerPayload[typeof TriggerEvent.ALL_USER_NOTIFICATION];
190
- countryConfigUrl: string;
191
- }): Promise<Response>;
192
- export declare function triggerUserEventNotification<T extends Exclude<TriggerEvent, typeof TriggerEvent.ALL_USER_NOTIFICATION>>(args: {
193
- event: T;
194
- payload: TriggerPayload[T];
195
- countryConfigUrl: string;
196
- authHeader: {
197
- Authorization: string;
198
- };
199
- }): Promise<Response>;
200
215
  export declare function parseUserEventTrigger<T extends TriggerEvent>(event: T, body: unknown): TriggerPayload[T];
201
216
  //# sourceMappingURL=UserNotifications.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { TriggerEvent, TriggerPayload } from './UserNotifications';
2
+ export declare function triggerUserEventNotification(args: {
3
+ event: typeof TriggerEvent.ALL_USER_NOTIFICATION;
4
+ payload: TriggerPayload[typeof TriggerEvent.ALL_USER_NOTIFICATION];
5
+ countryConfigUrl: string;
6
+ }): Promise<Response>;
7
+ export declare function triggerUserEventNotification<T extends Exclude<TriggerEvent, typeof TriggerEvent.ALL_USER_NOTIFICATION>>(args: {
8
+ event: T;
9
+ payload: TriggerPayload[T];
10
+ countryConfigUrl: string;
11
+ authHeader: {
12
+ Authorization: string;
13
+ };
14
+ }): Promise<Response>;
15
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export * from './UserNotifications';
2
+ export * from './dispatch';
2
3
  //# sourceMappingURL=index.d.ts.map