@opencrvs/toolkit 2.1.0-rc.03f553a → 2.1.0-rc.05b7761

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 (116) hide show
  1. package/README.md +3 -12
  2. package/build.sh +12 -4
  3. package/create-countryconfig/index.js +441 -59
  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 +347 -281
  7. package/dist/authentication/index.d.ts +67 -0
  8. package/dist/authentication/index.d.ts.map +1 -0
  9. package/dist/authentication/index.js +751 -0
  10. package/dist/cli.js +2082 -283
  11. package/dist/commons/api/router.d.ts +689 -110
  12. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  13. package/dist/commons/conditionals/validate.d.ts +16 -5
  14. package/dist/commons/events/ActionConfig.d.ts +4 -0
  15. package/dist/commons/events/ActionDocument.d.ts +5 -11
  16. package/dist/commons/events/ActionInput.d.ts +4 -4
  17. package/dist/commons/events/ActionStatus.d.ts +14 -0
  18. package/dist/commons/events/AdvancedSearchConfig.d.ts +36 -12
  19. package/dist/commons/events/AuditLog.d.ts +147 -0
  20. package/dist/commons/events/EventConfig.d.ts +3 -0
  21. package/dist/commons/events/EventDocument.d.ts +470 -2
  22. package/dist/commons/events/EventIndex.d.ts +3 -26
  23. package/dist/commons/events/EventMetadata.d.ts +1 -11
  24. package/dist/commons/events/EventStatus.d.ts +19 -0
  25. package/dist/commons/events/FieldConfig.d.ts +99 -63
  26. package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
  27. package/dist/commons/events/FieldValue.d.ts +2 -2
  28. package/dist/commons/events/Flag.d.ts +42 -0
  29. package/dist/commons/events/FormConfig.d.ts +6 -0
  30. package/dist/commons/events/PageConfig.d.ts +4 -0
  31. package/dist/commons/events/PlainDate.d.ts +8 -0
  32. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  33. package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
  34. package/dist/commons/events/event.d.ts +12 -0
  35. package/dist/commons/events/index.d.ts +1 -0
  36. package/dist/commons/events/locationPayloads.d.ts +95 -0
  37. package/dist/commons/events/locations.d.ts +169 -26
  38. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  39. package/dist/commons/events/test.utils.d.ts +25 -4
  40. package/dist/commons/events/utils.d.ts +17 -2
  41. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  42. package/dist/commons/notification/dispatch.d.ts +10 -0
  43. package/dist/commons/notification/index.d.ts +1 -0
  44. package/dist/conditionals/index.js +335 -64
  45. package/dist/csv.d.ts +25 -0
  46. package/dist/csv.d.ts.map +1 -0
  47. package/dist/csv.js +120 -0
  48. package/dist/environment/index.d.ts +1 -0
  49. package/dist/environment/index.d.ts.map +1 -1
  50. package/dist/environment/index.js +10 -0
  51. package/dist/environment/logger.d.ts +15 -3
  52. package/dist/environment/logger.d.ts.map +1 -1
  53. package/dist/environment/manage-users.js +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.map +1 -1
  58. package/dist/environment/questions.js +20 -14
  59. package/dist/environment/setup-environment.js +47 -28
  60. package/dist/environment/templates.d.ts +0 -1
  61. package/dist/environment/templates.d.ts.map +1 -1
  62. package/dist/environment/templates.js +5 -9
  63. package/dist/environment/update-workflows.d.ts.map +1 -1
  64. package/dist/environment/update-workflows.js +21 -5
  65. package/dist/environment/upgrade.d.ts +2 -0
  66. package/dist/environment/upgrade.d.ts.map +1 -0
  67. package/dist/environment/upgrade.js +82 -0
  68. package/dist/environment/users.js +11 -13
  69. package/dist/environment/utils.d.ts +0 -12
  70. package/dist/environment/utils.d.ts.map +1 -1
  71. package/dist/environment/utils.js +1 -28
  72. package/dist/events/index.js +7660 -7156
  73. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  74. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  75. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  76. package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
  77. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  78. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  79. package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
  80. package/dist/migrations/v2.1/add-translations.d.ts +9 -0
  81. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
  82. package/dist/migrations/v2.1/add-translations.js +213 -0
  83. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  84. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  85. package/dist/migrations/v2.1/enable-telemetry.js +455 -0
  86. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  87. package/dist/migrations/v2.1/index.js +1219 -0
  88. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +3 -0
  89. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  90. package/dist/migrations/v2.1/rename-trigger-paths.js +216 -0
  91. package/dist/notification/index.js +1845 -1426
  92. package/dist/scopes/index.d.ts +435 -36
  93. package/dist/scopes/index.js +336 -64
  94. package/dist/telemetry/index.d.ts +45 -0
  95. package/dist/telemetry/index.d.ts.map +1 -0
  96. package/dist/telemetry/index.js +43 -0
  97. package/dist/templates/charts-values/dependencies/values.yaml +2 -0
  98. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  99. package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
  100. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  101. package/dist/templates/inventory/inventory.template.yml +1 -3
  102. package/dist/translations/check.d.ts +21 -0
  103. package/dist/translations/check.d.ts.map +1 -0
  104. package/dist/translations/check.js +132 -0
  105. package/dist/verify/endpoints.d.ts +2 -0
  106. package/dist/verify/endpoints.d.ts.map +1 -0
  107. package/dist/verify/endpoints.js +345 -0
  108. package/opencrvs-toolkit-2.1.0-rc.05b7761.tgz +0 -0
  109. package/package.json +13 -7
  110. package/tsconfig.build.json +11 -0
  111. package/tsconfig.build.tsbuildinfo +1 -0
  112. package/tsconfig.json +3 -0
  113. package/dist/templates/inventory/production.example.yml +0 -77
  114. package/dist/templates/inventory/qa.example.yml +0 -48
  115. package/opencrvs-toolkit-2.1.0-rc.03f553a.tgz +0 -0
  116. package/tsconfig.tsbuildinfo +0 -1
@@ -1,6 +1,8 @@
1
1
  import { NonSearchableEventMetadataTimeFieldIdInput, AdvancedSearchConfig } from '../event-config/event-configuration';
2
2
  import { ActionType } from './ActionType';
3
3
  import { EventFieldIdInput } from './AdvancedSearchConfig';
4
+ import { EventStatus } from './EventMetadata';
5
+ import { Flag } from './Flag';
4
6
  import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
5
7
  /**
6
8
  * Creates a function that acts like a callable + static method container.
@@ -75,6 +77,16 @@ declare const event: typeof eventFn & {
75
77
  };
76
78
  };
77
79
  field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
80
+ /**
81
+ * Checks if the event currently has the given status.
82
+ * @param eventStatus - The status to check for.
83
+ */
84
+ hasStatus: (eventStatus: EventStatus) => import("../conditionals/conditionals").JSONSchema;
85
+ /**
86
+ * Checks if the event currently carries the given flag.
87
+ * @param flagValue - The flag to check for.
88
+ */
89
+ hasFlag: (flagValue: Flag) => import("../conditionals/conditionals").JSONSchema;
78
90
  };
79
91
  export { event };
80
92
  //# sourceMappingURL=event.d.ts.map
@@ -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';
@@ -16,10 +17,16 @@ export declare const LocationStatus: z.ZodEnum<{
16
17
  inactive: "inactive";
17
18
  }>;
18
19
  export type LocationStatus = z.infer<typeof LocationStatus>;
20
+ /** Thrown when a user's assigned office is inactive and must not be allowed to authenticate. */
21
+ export declare class InactiveOfficeError extends Error {
22
+ constructor(message?: string);
23
+ }
19
24
  /**
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).
25
+ * A single element of the `versions` history of a location or administrative
26
+ * area. Versions are sorted ascending by `effectiveFrom` ('0001-01-01' is used
27
+ * as the beginning-of-time sentinel). Updates only ever append, but a
28
+ * not-yet-effective version can be withdrawn and seeding replaces a history
29
+ * wholesale, so the array is not append-only.
23
30
  */
24
31
  export declare const LocationVersion: z.ZodObject<{
25
32
  versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
@@ -76,8 +83,79 @@ export declare const Location: z.ZodObject<{
76
83
  }, z.core.$strip>;
77
84
  export type Location = z.infer<typeof Location>;
78
85
  /**
79
- * Input payload for the locations `set` mutation. Carries only the seedable
80
- * identity and hierarchy fields — version history is managed by the server.
86
+ * TEMPORARY — client-side view of {@link AdministrativeArea} with the
87
+ * server-flattened `name`, `status` and `externalId` removed, leaving exactly
88
+ * identity + versions. Every name/status read is thereby forced through the
89
+ * anchored resolution utilities ({@link resolveVersion}, {@link resolvePath})
90
+ * at compile time. Delete this type when the contract migration removes the
91
+ * flat fields from the server schema, at which point the wire type itself
92
+ * becomes identity + versions.
93
+ */
94
+ export declare const ClientAdministrativeArea: z.ZodObject<{
95
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
96
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
97
+ versions: z.ZodArray<z.ZodObject<{
98
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
99
+ effectiveFrom: z.ZodISODate;
100
+ name: z.ZodString;
101
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ status: z.ZodEnum<{
103
+ active: "active";
104
+ inactive: "inactive";
105
+ }>;
106
+ }, z.core.$strip>>;
107
+ }, z.core.$strip>;
108
+ export type ClientAdministrativeArea = z.infer<typeof ClientAdministrativeArea>;
109
+ /**
110
+ * TEMPORARY — client-side view of {@link Location} with the server-flattened
111
+ * `name`, `status` and `externalId` removed, leaving exactly identity +
112
+ * versions. See {@link ClientAdministrativeArea} for the full rationale and
113
+ * deletion condition.
114
+ */
115
+ export declare const ClientLocation: z.ZodObject<{
116
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
117
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
118
+ locationType: z.ZodNullable<z.ZodString>;
119
+ versions: z.ZodArray<z.ZodObject<{
120
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
121
+ effectiveFrom: z.ZodISODate;
122
+ name: z.ZodString;
123
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ status: z.ZodEnum<{
125
+ active: "active";
126
+ inactive: "inactive";
127
+ }>;
128
+ }, z.core.$strip>>;
129
+ }, z.core.$strip>;
130
+ export type ClientLocation = z.infer<typeof ClientLocation>;
131
+ /**
132
+ * Strips the server-flattened fields from a location as it enters the
133
+ * client's cached maps. The wire format keeps the flat fields for
134
+ * compatibility; the cache must not, or devices would keep rendering names
135
+ * flattened before a future-dated version takes effect.
136
+ */
137
+ export declare function toClientLocation(location: Location): ClientLocation;
138
+ /** See {@link toClientLocation}. */
139
+ export declare function toClientAdministrativeArea(area: AdministrativeArea): ClientAdministrativeArea;
140
+ export declare const SeededLocationVersions: z.ZodArray<z.ZodObject<{
141
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
142
+ effectiveFrom: z.ZodISODate;
143
+ name: z.ZodString;
144
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
+ status: z.ZodEnum<{
146
+ active: "active";
147
+ inactive: "inactive";
148
+ }>;
149
+ }, z.core.$strip>>;
150
+ export type SeededLocationVersions = z.infer<typeof SeededLocationVersions>;
151
+ /**
152
+ * Input payload for the locations `set` mutation. Carries the seedable
153
+ * identity and hierarchy fields, plus an optional pre-built history.
154
+ *
155
+ * Last-write-wins on history: a repeated seed of the same row replaces its
156
+ * stored `versions`, so a caller that means to keep one has to send it every
157
+ * time. Seeding is only reachable while system initialisation is incomplete,
158
+ * so this replaces what an earlier seed attempt wrote, never a live history.
81
159
  */
82
160
  export declare const SetLocationPayload: z.ZodObject<{
83
161
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
@@ -85,18 +163,38 @@ export declare const SetLocationPayload: z.ZodObject<{
85
163
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
164
  administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
87
165
  locationType: z.ZodNullable<z.ZodString>;
166
+ versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
167
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
168
+ effectiveFrom: z.ZodISODate;
169
+ name: z.ZodString;
170
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ status: z.ZodEnum<{
172
+ active: "active";
173
+ inactive: "inactive";
174
+ }>;
175
+ }, z.core.$strip>>>;
88
176
  }, z.core.$strip>;
89
177
  export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
90
178
  /**
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.
179
+ * Input payload for the administrative areas `set` mutation. Twin of
180
+ * {@link SetLocationPayload}, including the optional pre-built `versions`
181
+ * history and the same semantics for omitting it.
94
182
  */
95
183
  export declare const SetAdministrativeAreaPayload: z.ZodObject<{
96
184
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
97
185
  name: z.ZodString;
98
186
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
187
  parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
188
+ versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
189
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
190
+ effectiveFrom: z.ZodISODate;
191
+ name: z.ZodString;
192
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
+ status: z.ZodEnum<{
194
+ active: "active";
195
+ inactive: "inactive";
196
+ }>;
197
+ }, z.core.$strip>>>;
100
198
  }, z.core.$strip>;
101
199
  export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
102
200
  /**
@@ -111,6 +209,24 @@ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaP
111
209
  export declare function resolveVersion<T extends {
112
210
  effectiveFrom: string;
113
211
  }>(versions: T[], anchor: string): T;
212
+ /**
213
+ * Whether the entity is selectable at `anchor`: it must already have a
214
+ * version effective by then, and the version that resolves at `anchor` must
215
+ * be active. `resolveVersion` alone is not enough for this — when `anchor`
216
+ * precedes every version it falls back to the earliest one, which would
217
+ * otherwise make a location created after `anchor` look selectable.
218
+ */
219
+ export declare function isSelectableAtAnchor<T extends {
220
+ effectiveFrom: string;
221
+ status: string;
222
+ }>(versions: T[], anchor: string): boolean;
223
+ /**
224
+ * Whether the entity holds the given externalId with active status at the
225
+ * anchor date or at any point after it. Used for point-in-time uniqueness of
226
+ * external codes: a new holder starting at `anchor` collides when an existing
227
+ * holder is (or is scheduled to be) active with the code from then on.
228
+ */
229
+ export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
114
230
  type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
115
231
  /**
116
232
  * For type T, convert fields K to arrays. If field is string, convert to string[].
@@ -135,7 +251,7 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
135
251
  * 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.
136
252
  *
137
253
  */
138
- export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
254
+ export declare function canAccessEventWithScope(event: EventIndexWithAdministrativeHierarchy, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
139
255
  export type UserWithResolvedHierarchy = {
140
256
  role: string;
141
257
  administrativeHierarchy: UUID[];
@@ -156,21 +272,11 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
156
272
  *
157
273
  * One of the scopes must allow access for the event to be accessible.
158
274
  */
159
- export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
160
- export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
161
- id: string & z.$brand<"UUID">;
162
- name: string;
163
- externalId?: string | null | undefined;
164
- parentId: (string & z.$brand<"UUID">) | 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
- }[];
173
- }[];
275
+ export declare function userCanAccessEventWithScopes(event: EventIndexWithAdministrativeHierarchy, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
276
+ export declare function getAdministrativeAreaHierarchy<A extends {
277
+ id: UUID;
278
+ parentId: UUID | null;
279
+ }>(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, A>): A[];
174
280
  /**
175
281
  * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
176
282
  *
@@ -182,8 +288,45 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
182
288
  * so the result is reversed to match the root-first convention used by the server.
183
289
  */
184
290
  export declare function getLocationHierarchy(selectedId: UUID, context: {
185
- administrativeAreas: Map<UUID, AdministrativeArea>;
186
- locations: Map<UUID, Location>;
291
+ administrativeAreas: Map<UUID, {
292
+ id: UUID;
293
+ parentId: UUID | null;
294
+ }>;
295
+ locations: Map<UUID, {
296
+ id: UUID;
297
+ administrativeAreaId: UUID | null;
298
+ }>;
187
299
  }): UUID[];
300
+ /**
301
+ * A node of an anchored hierarchy path: the identity id plus the name and
302
+ * status in effect at the anchor date.
303
+ */
304
+ export type ResolvedPathNode = {
305
+ id: UUID;
306
+ name: string;
307
+ status: LocationStatus;
308
+ };
309
+ /**
310
+ * Resolves a location or administrative area id into its root-first
311
+ * hierarchy path — leaf included — with every node's name and status
312
+ * resolved at the anchor date.
313
+ *
314
+ * The parent chain is identity-level and fixed for life, so the chain is
315
+ * constant and only each node's name/status varies with the anchor. Status is
316
+ * returned for callers that filter on it; an inactive node still resolves to
317
+ * its name. Returns an empty array for an unknown id.
318
+ */
319
+ export declare function resolvePath(locationId: UUID, anchor: PlainDate, context: {
320
+ administrativeAreas: Map<UUID, {
321
+ id: UUID;
322
+ parentId: UUID | null;
323
+ versions: LocationVersion[];
324
+ }>;
325
+ locations: Map<UUID, {
326
+ id: UUID;
327
+ administrativeAreaId: UUID | null;
328
+ versions: LocationVersion[];
329
+ }>;
330
+ }): ResolvedPathNode[];
188
331
  export {};
189
332
  //# sourceMappingURL=locations.d.ts.map
@@ -30,4 +30,34 @@ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & impo
30
30
  status: "active" | "inactive";
31
31
  }[];
32
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
+ }[];
62
+ }>;
33
63
  //# sourceMappingURL=mocks.test.utils.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { UUID } from '../uuid';
2
2
  import { ActionDocument, ActionUpdate } from './ActionDocument';
3
+ import { ValidatorContext } from '../conditionals/validate';
3
4
  import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput } from './ActionInput';
4
5
  import { ActionType } from './ActionType';
5
6
  import { Draft } from './Draft';
@@ -9,7 +10,7 @@ import { EventIndex } from './EventIndex';
9
10
  import { EventInput } from './EventInput';
10
11
  import { TranslationConfig } from './TranslationConfig';
11
12
  import { FieldConfig } from './FieldConfig';
12
- import { SetLocationPayload, SetAdministrativeAreaPayload } from './locations';
13
+ import { LocationVersion, SetLocationPayload, SetAdministrativeAreaPayload, ClientAdministrativeArea } from './locations';
13
14
  import { WorkqueueConfig } from './WorkqueueConfig';
14
15
  import * as z from 'zod/v4';
15
16
  import { DocumentPath } from '../documents';
@@ -43,6 +44,13 @@ export declare function generateUuid(rng?: () => number): UUID;
43
44
  export declare function generateTrackingId(rng: () => number): string;
44
45
  export declare function generateRegistrationNumber(rng: () => number): string;
45
46
  export declare function generateRandomSignature(rng: () => number): DocumentPath;
47
+ /**
48
+ * Builds one element of a location / administrative area `versions` history.
49
+ * Every field is defaulted so a call names only what its assertion is about —
50
+ * an `effectiveFrom`, a `name`, or an explicit `versionId` when the test needs
51
+ * to control version identity.
52
+ */
53
+ export declare function locationVersion(overrides?: Partial<LocationVersion>, rng?: () => number): LocationVersion;
46
54
  export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng: () => number,
47
55
  /**
48
56
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
@@ -124,9 +132,6 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
124
132
  declaration: {};
125
133
  annotation: {};
126
134
  eventId: string;
127
- content: {
128
- reason: string;
129
- };
130
135
  };
131
136
  unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
132
137
  keepAssignment?: boolean | undefined;
@@ -291,4 +296,20 @@ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfE
291
296
  placeOfEventId?: string;
292
297
  dateOfEventId?: string;
293
298
  }) => EventConfig;
299
+ /**
300
+ * Get the leaf administrative area IDs from a list of administrative areas.
301
+ *
302
+ * A leaf administrative area is defined as an administrative area that does not have any children in the provided list.
303
+ * AdministrativeArea might have a CRVS_OFFICE as children, but is still considered to be a leaf administrative area.
304
+ *
305
+ * @param administrativeAreas - The list of administrative areas to search.
306
+ * @returns The list of leaf administrative area IDs.
307
+ */
308
+ export declare function getLeafAdministrativeAreaIds(administrativeAreas: Map<UUID, ClientAdministrativeArea>): Array<{
309
+ id: UUID;
310
+ }>;
311
+ export declare function generateTestValidatorContext(userRole?: TestUserRole, eventWithConfig?: {
312
+ event: EventDocument;
313
+ eventConfig: EventConfig;
314
+ }): ValidatorContext;
294
315
  //# sourceMappingURL=test.utils.d.ts.map
@@ -10,6 +10,7 @@ import { UUID } from '../uuid';
10
10
  import { ActionConfig, ActionConfigTypes } from './ActionConfig';
11
11
  import { FormConfig } from './FormConfig';
12
12
  import { PlainDate, SelectDateRangeValue } from './FieldValue';
13
+ import { EventIndex } from './EventIndex';
13
14
  export declare function ageToDate(age: number, asOfDate: PlainDate): string & import("zod").$brand<"PlainDate">;
14
15
  export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
15
16
  export declare function getDeclarationPages(configuration: EventConfig): {
@@ -20,6 +21,7 @@ export declare function getDeclarationPages(configuration: EventConfig): {
20
21
  description: string;
21
22
  };
22
23
  requireCompletionToContinue: boolean;
24
+ showClearButton?: boolean | undefined;
23
25
  fields: FieldConfig[];
24
26
  conditional?: any;
25
27
  type: "FORM";
@@ -38,6 +40,7 @@ export declare function getDeclaration(configuration: EventConfig): {
38
40
  description: string;
39
41
  };
40
42
  requireCompletionToContinue: boolean;
43
+ showClearButton?: boolean | undefined;
41
44
  fields: FieldConfig[];
42
45
  conditional?: any;
43
46
  type: "FORM";
@@ -66,6 +69,7 @@ export declare function getPrintCertificatePages(configuration: EventConfig): ({
66
69
  description: string;
67
70
  };
68
71
  requireCompletionToContinue: boolean;
72
+ showClearButton?: boolean | undefined;
69
73
  fields: FieldConfig[];
70
74
  conditional?: any;
71
75
  type: "FORM";
@@ -77,6 +81,7 @@ export declare function getPrintCertificatePages(configuration: EventConfig): ({
77
81
  description: string;
78
82
  };
79
83
  requireCompletionToContinue: boolean;
84
+ showClearButton?: boolean | undefined;
80
85
  fields: FieldConfig[];
81
86
  conditional?: any;
82
87
  type: "VERIFICATION";
@@ -255,9 +260,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
255
260
  status: "Accepted" | "Rejected" | "Requested";
256
261
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
257
262
  type: "ARCHIVE";
258
- content: {
263
+ content?: {
259
264
  reason: string;
260
- };
265
+ } | undefined;
261
266
  } | {
262
267
  id: string & import("zod").$brand<"UUID">;
263
268
  transactionId: string;
@@ -597,4 +602,14 @@ export declare function getCompleteActionDeclaration<T extends EventState | Acti
597
602
  export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
598
603
  export declare function aggregateActionDeclarations(event: EventDocument): EventState;
599
604
  export declare function aggregateActionAnnotations(event: EventDocument): EventState;
605
+ /**
606
+ * 2.1. onwards secured fields have accepted conditionals.
607
+ * Secured fields are not present in EventIndex payload.
608
+ * When we derive @see EventIndex from @see EventDocument, we will have all the fields present.
609
+ *
610
+ * To keep the views consistent, and not to change if event.get gets triggered, we need to clean out the secured fields.
611
+ *
612
+ * @returns EventIndex without values that evaluate to secured: true.
613
+ */
614
+ export declare function dropSecuredDeclarationFields(eventConfig: EventConfig, eventIndex: EventIndex, validatorContext: ValidatorContext): EventIndex;
600
615
  //# sourceMappingURL=utils.d.ts.map
@@ -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,10 @@
1
+ import { TriggerEvent, TriggerPayload } from './UserNotifications';
2
+ export declare function triggerUserEventNotification<T extends TriggerEvent>({ event, payload, countryConfigUrl, authHeader }: {
3
+ event: T;
4
+ payload: TriggerPayload[T];
5
+ countryConfigUrl: string;
6
+ authHeader: {
7
+ Authorization: string;
8
+ };
9
+ }): Promise<Response>;
10
+ //# 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