@opencrvs/toolkit 2.1.0-rc.1f71eca → 2.1.0-rc.268cfbe

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 (242) hide show
  1. package/README.md +3 -12
  2. package/build.sh +22 -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 +361 -284
  7. package/dist/authentication/index.d.ts +66 -0
  8. package/dist/authentication/index.d.ts.map +1 -0
  9. package/dist/authentication/index.js +765 -0
  10. package/dist/cli.js +3751 -1232
  11. package/dist/commons/api/router.d.ts +663 -365
  12. package/dist/commons/application-config/index.d.ts +0 -2
  13. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  14. package/dist/commons/conditionals/validate.d.ts +34 -8
  15. package/dist/commons/events/ActionConfig.d.ts +5 -14
  16. package/dist/commons/events/ActionDocument.d.ts +35 -15
  17. package/dist/commons/events/ActionInput.d.ts +4 -4
  18. package/dist/commons/events/ActionStatus.d.ts +14 -0
  19. package/dist/commons/events/AdvancedSearchConfig.d.ts +42 -12
  20. package/dist/commons/events/AuditLog.d.ts +1 -0
  21. package/dist/commons/events/Draft.d.ts +1 -21
  22. package/dist/commons/events/EventConfig.d.ts +3 -0
  23. package/dist/commons/events/EventDocument.d.ts +472 -4
  24. package/dist/commons/events/EventIndex.d.ts +3 -26
  25. package/dist/commons/events/EventMetadata.d.ts +1 -11
  26. package/dist/commons/events/EventStatus.d.ts +19 -0
  27. package/dist/commons/events/FieldConfig.d.ts +104 -63
  28. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  29. package/dist/commons/events/FieldValue.d.ts +3 -2
  30. package/dist/commons/events/Flag.d.ts +42 -0
  31. package/dist/commons/events/FormConfig.d.ts +6 -0
  32. package/dist/commons/events/PageConfig.d.ts +4 -0
  33. package/dist/commons/events/PlainDate.d.ts +8 -0
  34. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  35. package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
  36. package/dist/commons/events/event.d.ts +12 -0
  37. package/dist/commons/events/locations.d.ts +162 -26
  38. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  39. package/dist/commons/events/scopes.d.ts +21 -1
  40. package/dist/commons/events/test.utils.d.ts +78 -25
  41. package/dist/commons/events/utils.d.ts +39 -4
  42. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  43. package/dist/commons/notification/dispatch.d.ts +10 -0
  44. package/dist/commons/notification/index.d.ts +1 -0
  45. package/dist/conditionals/index.js +348 -65
  46. package/dist/csv.d.ts +25 -0
  47. package/dist/csv.d.ts.map +1 -0
  48. package/dist/csv.js +120 -0
  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 +12 -1
  52. package/dist/environment/logger.d.ts +15 -3
  53. package/dist/environment/logger.d.ts.map +1 -1
  54. package/dist/environment/manage-users.js +1 -1
  55. package/dist/environment/paths.d.ts +7 -0
  56. package/dist/environment/paths.d.ts.map +1 -0
  57. package/dist/environment/paths.js +72 -0
  58. package/dist/environment/questions.d.ts.map +1 -1
  59. package/dist/environment/questions.js +20 -14
  60. package/dist/environment/setup-environment.d.ts +1 -1
  61. package/dist/environment/setup-environment.d.ts.map +1 -1
  62. package/dist/environment/setup-environment.js +594 -562
  63. package/dist/environment/swarm-to-k8s.js +3 -4
  64. package/dist/environment/templates.d.ts +0 -1
  65. package/dist/environment/templates.d.ts.map +1 -1
  66. package/dist/environment/templates.js +5 -9
  67. package/dist/environment/update-workflows.d.ts.map +1 -1
  68. package/dist/environment/update-workflows.js +21 -5
  69. package/dist/environment/upgrade.d.ts +2 -0
  70. package/dist/environment/upgrade.d.ts.map +1 -0
  71. package/dist/environment/upgrade.js +82 -0
  72. package/dist/environment/users.js +11 -13
  73. package/dist/environment/utils.d.ts +0 -12
  74. package/dist/environment/utils.d.ts.map +1 -1
  75. package/dist/environment/utils.js +1 -28
  76. package/dist/events/index.js +7177 -6696
  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 +149 -0
  83. package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/enable-telemetry.d.ts} +1 -1
  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 +1952 -0
  88. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -0
  89. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  90. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +345 -0
  91. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  92. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  93. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  94. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  95. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  96. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  97. package/dist/migrations/{v2.0/create-events-index.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  98. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  99. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  100. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  101. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  102. package/dist/migrations/v2.1/template-files.js +49 -0
  103. package/dist/migrations/v2.1/upgrade-tilt.d.ts +8 -0
  104. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  105. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  106. package/dist/notification/index.js +1831 -1513
  107. package/dist/scopes/index.d.ts +612 -36
  108. package/dist/scopes/index.js +350 -65
  109. package/dist/telemetry/index.d.ts +45 -0
  110. package/dist/telemetry/index.d.ts.map +1 -0
  111. package/dist/telemetry/index.js +43 -0
  112. package/dist/templates/charts-values/dependencies/values.yaml +8 -0
  113. package/dist/templates/charts-values/opencrvs-services/values.yaml +10 -3
  114. package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
  115. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  116. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  117. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  118. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  119. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  120. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  121. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  122. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  123. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  124. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  125. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  126. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  127. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  128. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  129. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  130. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  131. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  132. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  133. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  134. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  135. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  136. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  137. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  138. package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
  139. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  140. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  141. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  142. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  143. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  144. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  145. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  146. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  147. package/dist/templates/inventory/inventory.template.yml +1 -3
  148. package/dist/translations/template.d.ts +11 -0
  149. package/dist/translations/template.d.ts.map +1 -0
  150. package/dist/translations/template.js +100 -0
  151. package/dist/verify/endpoints.d.ts +2 -0
  152. package/dist/verify/endpoints.d.ts.map +1 -0
  153. package/dist/verify/endpoints.js +510 -0
  154. package/opencrvs-toolkit-2.1.0-rc.268cfbe.tgz +0 -0
  155. package/package.json +13 -7
  156. package/tsconfig.build.json +11 -0
  157. package/tsconfig.build.tsbuildinfo +1 -0
  158. package/tsconfig.json +3 -0
  159. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  160. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  161. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  162. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  163. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  164. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  165. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  166. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  167. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  168. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  169. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  170. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  171. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  172. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  173. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  174. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  175. package/dist/migrations/v2.0/create-events-index.js +0 -325
  176. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  177. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  178. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  179. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  180. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  181. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  182. package/dist/migrations/v2.0/index.d.ts +0 -13
  183. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  184. package/dist/migrations/v2.0/index.js +0 -103
  185. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  186. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  187. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  188. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  189. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  190. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  191. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  192. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  193. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  194. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  195. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  196. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  197. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  198. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  199. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  200. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  201. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  202. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  203. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  204. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  205. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  206. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  207. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  208. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  209. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  210. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  211. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  212. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  213. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  214. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  215. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  216. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  217. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  218. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  219. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  220. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  221. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  222. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  223. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  224. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  225. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  226. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  227. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  228. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  229. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  230. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  231. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  232. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  233. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  234. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  235. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  236. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  237. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  238. package/dist/migrations/v2.0/update-package-json.js +0 -105
  239. package/dist/templates/inventory/production.example.yml +0 -77
  240. package/dist/templates/inventory/qa.example.yml +0 -48
  241. package/opencrvs-toolkit-2.1.0-rc.1f71eca.tgz +0 -0
  242. package/tsconfig.tsbuildinfo +0 -1
@@ -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,17 @@ 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;
114
223
  /**
115
224
  * Whether the entity holds the given externalId with active status at the
116
225
  * anchor date or at any point after it. Used for point-in-time uniqueness of
@@ -142,7 +251,7 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
142
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.
143
252
  *
144
253
  */
145
- 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;
146
255
  export type UserWithResolvedHierarchy = {
147
256
  role: string;
148
257
  administrativeHierarchy: UUID[];
@@ -163,21 +272,11 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
163
272
  *
164
273
  * One of the scopes must allow access for the event to be accessible.
165
274
  */
166
- export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
167
- export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
168
- id: string & z.$brand<"UUID">;
169
- name: string;
170
- externalId?: string | null | undefined;
171
- parentId: (string & z.$brand<"UUID">) | null;
172
- status: "active" | "inactive";
173
- versions: {
174
- versionId: string & z.$brand<"UUID">;
175
- effectiveFrom: string;
176
- name: string;
177
- externalId?: string | null | undefined;
178
- status: "active" | "inactive";
179
- }[];
180
- }[];
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[];
181
280
  /**
182
281
  * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
183
282
  *
@@ -189,8 +288,45 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
189
288
  * so the result is reversed to match the root-first convention used by the server.
190
289
  */
191
290
  export declare function getLocationHierarchy(selectedId: UUID, context: {
192
- administrativeAreas: Map<UUID, AdministrativeArea>;
193
- 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
+ }>;
194
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[];
195
331
  export {};
196
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,5 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope, UserScopeV2 } from '../scopes';
2
+ import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
@@ -27,6 +27,26 @@ export declare const ACTION_SCOPE_MAP: {
27
27
  DUPLICATE_DETECTED: never[];
28
28
  CUSTOM: never[];
29
29
  };
30
+ /**
31
+ * The scopes of every action that can write to a record. Each of them can
32
+ * trigger a sweep of the record's prefix, so each of them has to be able to
33
+ * delete. `record.read` is absent: reading a record is not grounds for erasing
34
+ * it.
35
+ */
36
+ export declare const RECORD_WRITE_SCOPES: RecordScopeTypeV2[];
37
+ /**
38
+ * Scopes that authorize deleting objects held by the documents service.
39
+ *
40
+ * Documents records no link between an object and the record it belongs to, so
41
+ * it cannot check that the caller owns a prefix. It checks instead that the
42
+ * caller holds a scope that lets them change a record or edit a user, and the
43
+ * service that forwarded the request has already checked that this particular
44
+ * record or user is theirs to act on.
45
+ *
46
+ * Listed rather than derived, so that adding an action to `ACTION_SCOPE_MAP`
47
+ * cannot silently grant deletion. `scopes.test.ts` fails when the two drift.
48
+ */
49
+ export declare const DOCUMENT_DELETE_SCOPES: ScopeType[];
30
50
  export declare function hasAnyOfScopes(a: string[], b: string[]): boolean;
31
51
  export declare const AssignmentStatus: {
32
52
  readonly ASSIGNED_TO_SELF: 'ASSIGNED_TO_SELF';
@@ -1,15 +1,16 @@
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';
6
- import { EventConfig } from './EventConfig';
7
+ import { EventConfig, EventConfigInput } from './EventConfig';
7
8
  import { EventDocument } from './EventDocument';
8
9
  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.
@@ -77,8 +85,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
77
85
  omitFields?: string[];
78
86
  }, input?: Partial<Draft>) => Draft;
79
87
  actions: {
80
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
88
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
81
89
  keepAssignment?: boolean | undefined;
90
+ keepAssignmentIfAccepted?: boolean | undefined;
91
+ keepAssignmentIfRejected?: boolean | undefined;
92
+ waitFor?: boolean | undefined;
82
93
  type: "DECLARE";
83
94
  transactionId: string;
84
95
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
@@ -88,56 +99,70 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
88
99
  /**
89
100
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
90
101
  */
91
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
102
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
92
103
  type: "NOTIFY";
93
104
  transactionId: string;
94
105
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
95
106
  eventId: string;
96
107
  keepAssignment: boolean | undefined;
108
+ keepAssignmentIfAccepted: boolean | undefined;
109
+ keepAssignmentIfRejected: boolean | undefined;
110
+ waitFor: boolean | undefined;
97
111
  };
98
- edit: (eventId: string, input?: Partial<Pick<EditActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
112
+ edit: (eventId: string, input?: Partial<Pick<EditActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
99
113
  keepAssignment?: boolean | undefined;
114
+ keepAssignmentIfAccepted?: boolean | undefined;
115
+ keepAssignmentIfRejected?: boolean | undefined;
116
+ waitFor?: boolean | undefined;
100
117
  type: "EDIT";
101
118
  transactionId: string;
102
119
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
103
120
  annotation: {};
104
121
  eventId: string;
105
122
  };
106
- assign: (eventId: string, input?: Partial<Pick<AssignActionInput, 'transactionId' | 'assignedTo'>>) => {
123
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, 'transactionId' | 'assignedTo' | 'waitFor'>>) => {
107
124
  type: "ASSIGN";
108
125
  transactionId: string;
109
126
  declaration: {};
110
127
  assignedTo: string;
111
128
  eventId: string;
129
+ waitFor: boolean | undefined;
112
130
  };
113
- unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, 'transactionId'>>) => {
131
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, 'transactionId' | 'waitFor'>>) => {
114
132
  type: "UNASSIGN";
115
133
  transactionId: string;
116
134
  declaration: {};
117
135
  assignedTo: null;
118
136
  eventId: string;
137
+ waitFor: boolean | undefined;
119
138
  };
120
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
139
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
121
140
  keepAssignment?: boolean | undefined;
141
+ keepAssignmentIfAccepted?: boolean | undefined;
142
+ keepAssignmentIfRejected?: boolean | undefined;
143
+ waitFor?: boolean | undefined;
122
144
  type: "ARCHIVE";
123
145
  transactionId: string;
124
146
  declaration: {};
125
147
  annotation: {};
126
148
  eventId: string;
127
- content: {
128
- reason: string;
129
- };
130
149
  };
131
- unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
150
+ unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
132
151
  keepAssignment?: boolean | undefined;
152
+ keepAssignmentIfAccepted?: boolean | undefined;
153
+ keepAssignmentIfRejected?: boolean | undefined;
154
+ waitFor?: boolean | undefined;
133
155
  type: "UNARCHIVE";
134
156
  transactionId: string;
135
157
  declaration: {};
136
158
  annotation: {};
137
159
  eventId: string;
138
160
  };
139
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
161
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
140
162
  keepAssignment?: boolean | undefined;
163
+ keepAssignmentIfAccepted?: boolean | undefined;
164
+ keepAssignmentIfRejected?: boolean | undefined;
165
+ waitFor?: boolean | undefined;
141
166
  type: "REJECT";
142
167
  transactionId: string;
143
168
  declaration: {};
@@ -147,8 +172,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
147
172
  reason: string;
148
173
  };
149
174
  };
150
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'registrationNumber'>>) => {
175
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'registrationNumber' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
151
176
  keepAssignment?: boolean | undefined;
177
+ keepAssignmentIfAccepted?: boolean | undefined;
178
+ keepAssignmentIfRejected?: boolean | undefined;
179
+ waitFor?: boolean | undefined;
152
180
  registrationNumber?: string | undefined;
153
181
  type: "REGISTER";
154
182
  transactionId: string;
@@ -156,8 +184,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
156
184
  annotation: {};
157
185
  eventId: string;
158
186
  };
159
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
187
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
160
188
  keepAssignment?: boolean | undefined;
189
+ keepAssignmentIfAccepted?: boolean | undefined;
190
+ keepAssignmentIfRejected?: boolean | undefined;
191
+ waitFor?: boolean | undefined;
161
192
  type: "PRINT_CERTIFICATE";
162
193
  transactionId: string;
163
194
  declaration: {};
@@ -165,15 +196,18 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
165
196
  eventId: string;
166
197
  };
167
198
  correction: {
168
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
199
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
169
200
  type: "REQUEST_CORRECTION";
170
201
  transactionId: string;
171
202
  declaration: import("lodash").Omit<Record<string, import("./FieldValue").FieldUpdateValue>, "applicant.email" | "applicant.image">;
172
203
  annotation: {};
173
204
  eventId: string;
174
205
  keepAssignment: boolean | undefined;
206
+ keepAssignmentIfAccepted: boolean | undefined;
207
+ keepAssignmentIfRejected: boolean | undefined;
208
+ waitFor: boolean | undefined;
175
209
  };
176
- approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
210
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
177
211
  type: "APPROVE_CORRECTION";
178
212
  transactionId: string;
179
213
  declaration: {};
@@ -181,18 +215,24 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
181
215
  eventId: string;
182
216
  requestId: string;
183
217
  keepAssignment: boolean | undefined;
218
+ keepAssignmentIfAccepted: boolean | undefined;
219
+ keepAssignmentIfRejected: boolean | undefined;
220
+ waitFor: boolean | undefined;
184
221
  };
185
- reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'content'>>) => {
222
+ reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, 'transactionId' | 'annotation' | 'content' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
186
223
  type: "REJECT_CORRECTION";
187
224
  transactionId: string;
188
225
  declaration: {};
189
226
  annotation: {};
190
227
  eventId: string;
191
228
  requestId: string;
192
- keepAssignment: boolean | undefined;
193
229
  content: {
194
230
  reason: string;
195
231
  };
232
+ keepAssignment: boolean | undefined;
233
+ keepAssignmentIfAccepted: boolean | undefined;
234
+ keepAssignmentIfRejected: boolean | undefined;
235
+ waitFor: boolean | undefined;
196
236
  };
197
237
  };
198
238
  duplicate: {
@@ -271,11 +311,6 @@ export declare function createPrng(seed: number): () => number;
271
311
  */
272
312
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
273
313
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
274
- export declare const BearerTokenByUserType: {
275
- fieldAgent: string;
276
- registrationAgent: string;
277
- localRegistrar: string;
278
- };
279
314
  export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
280
315
  /**
281
316
  * Backend focused event config generator for testing fields in a lightweight way.
@@ -285,10 +320,28 @@ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
285
320
  * @param placeOfEventId - Optional place of event field id.
286
321
  * @param dateOfEventId - Optional date of event field id.
287
322
  */
288
- export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId }: {
323
+ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId, actions }: {
289
324
  id: string;
290
325
  fields: FieldConfig[];
291
326
  placeOfEventId?: string;
292
327
  dateOfEventId?: string;
328
+ /** Extra actions appended to the default READ + DECLARE pair, e.g. a REQUEST_CORRECTION action with its own correctionForm. */
329
+ actions?: EventConfigInput['actions'];
293
330
  }) => EventConfig;
331
+ /**
332
+ * Get the leaf administrative area IDs from a list of administrative areas.
333
+ *
334
+ * A leaf administrative area is defined as an administrative area that does not have any children in the provided list.
335
+ * AdministrativeArea might have a CRVS_OFFICE as children, but is still considered to be a leaf administrative area.
336
+ *
337
+ * @param administrativeAreas - The list of administrative areas to search.
338
+ * @returns The list of leaf administrative area IDs.
339
+ */
340
+ export declare function getLeafAdministrativeAreaIds(administrativeAreas: Map<UUID, ClientAdministrativeArea>): Array<{
341
+ id: UUID;
342
+ }>;
343
+ export declare function generateTestValidatorContext(userRole?: TestUserRole, eventWithConfig?: {
344
+ event: EventDocument;
345
+ eventConfig: EventConfig;
346
+ }): ValidatorContext;
294
347
  //# sourceMappingURL=test.utils.d.ts.map