@opencrvs/toolkit 2.2.0-rc.ac299dc → 2.2.0-rc.e6591c5

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 (249) hide show
  1. package/build.sh +17 -14
  2. package/dist/application-config/index.js +21 -11
  3. package/dist/authentication/index.d.ts +2 -1
  4. package/dist/authentication/index.js +20 -13
  5. package/dist/cli.js +2631 -377
  6. package/dist/commons/api/router.d.ts +263 -250
  7. package/dist/commons/application-config/index.d.ts +3 -3
  8. package/dist/commons/conditionals/conditionals.d.ts +4 -4
  9. package/dist/commons/conditionals/index.d.ts +1 -0
  10. package/dist/commons/conditionals/validate.d.ts +6 -1
  11. package/dist/commons/events/ActionConfig.d.ts +16 -23
  12. package/dist/commons/events/ActionDocument.d.ts +1 -0
  13. package/dist/commons/events/ActionInput.d.ts +4 -4
  14. package/dist/commons/events/ActionStatus.d.ts +2 -2
  15. package/dist/commons/events/ActionType.d.ts +2 -0
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -6
  17. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  18. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -18
  19. package/dist/commons/events/Draft.d.ts +34 -1
  20. package/dist/commons/events/EventConfig.d.ts +448 -1
  21. package/dist/commons/events/EventDocument.d.ts +2 -0
  22. package/dist/commons/events/EventIndex.d.ts +3 -6
  23. package/dist/commons/events/EventInput.d.ts +1 -0
  24. package/dist/commons/events/EventMetadata.d.ts +1 -1
  25. package/dist/commons/events/FieldConfig.d.ts +1 -1
  26. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  27. package/dist/commons/events/Flag.d.ts +1 -7
  28. package/dist/commons/events/PlainDate.d.ts +6 -0
  29. package/dist/commons/events/WorkqueueConfig.d.ts +12 -27
  30. package/dist/commons/events/defineConfig.d.ts +7 -2
  31. package/dist/commons/events/event.d.ts +4 -1
  32. package/dist/commons/events/eventConfigValidation.d.ts +9 -0
  33. package/dist/commons/events/field.d.ts +5 -5
  34. package/dist/commons/events/index.d.ts +3 -0
  35. package/dist/commons/events/locations.d.ts +1 -1
  36. package/dist/commons/events/scopes.d.ts +2 -1
  37. package/dist/commons/events/state/flags.d.ts +1 -1
  38. package/dist/commons/events/state/index.d.ts +1 -0
  39. package/dist/commons/events/test.utils.d.ts +62 -7
  40. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  41. package/dist/commons/events/utils.d.ts +59 -7
  42. package/dist/commons/users/Role.d.ts +23 -0
  43. package/dist/commons/users/User.d.ts +263 -0
  44. package/dist/commons/users/authentication.d.ts +67 -0
  45. package/dist/commons/users/index.d.ts +5 -0
  46. package/dist/commons/users/roleValidations.d.ts +15 -0
  47. package/dist/commons/users/scopes.d.ts +1402 -0
  48. package/dist/commons/users/userReferences.d.ts +176 -0
  49. package/dist/conditionals/index.js +5 -6
  50. package/dist/configurator/index.d.ts +24 -0
  51. package/dist/configurator/index.d.ts.map +1 -0
  52. package/dist/configurator/index.js +161 -0
  53. package/dist/configurator/layout.d.ts +29 -0
  54. package/dist/configurator/layout.d.ts.map +1 -0
  55. package/dist/configurator/layout.js +78 -0
  56. package/dist/configurator/paths.d.ts +13 -0
  57. package/dist/configurator/paths.d.ts.map +1 -0
  58. package/dist/configurator/paths.js +48 -0
  59. package/dist/configurator/server/environments.d.ts +20 -0
  60. package/dist/configurator/server/environments.d.ts.map +1 -0
  61. package/dist/configurator/server/environments.js +143 -0
  62. package/dist/configurator/server/files.d.ts +11 -0
  63. package/dist/configurator/server/files.d.ts.map +1 -0
  64. package/dist/configurator/server/files.js +67 -0
  65. package/dist/configurator/server/github.d.ts +56 -0
  66. package/dist/configurator/server/github.d.ts.map +1 -0
  67. package/dist/configurator/server/github.js +239 -0
  68. package/dist/configurator/server/plugin.d.ts +39 -0
  69. package/dist/configurator/server/plugin.d.ts.map +1 -0
  70. package/dist/configurator/server/plugin.js +298 -0
  71. package/dist/configurator/server/seal.d.ts +2 -0
  72. package/dist/configurator/server/seal.d.ts.map +1 -0
  73. package/dist/configurator/server/seal.js +36 -0
  74. package/dist/configurator/server/sshKeys.d.ts +5 -0
  75. package/dist/configurator/server/sshKeys.d.ts.map +1 -0
  76. package/dist/configurator/server/sshKeys.js +28 -0
  77. package/dist/configurator/server/start.d.ts +12 -0
  78. package/dist/configurator/server/start.d.ts.map +1 -0
  79. package/dist/configurator/server/start.js +91 -0
  80. package/dist/configurator/testing.d.ts +11 -0
  81. package/dist/configurator/testing.d.ts.map +1 -0
  82. package/dist/configurator/testing.js +74 -0
  83. package/dist/configurator/ui/bindings/bindings.d.ts +35 -0
  84. package/dist/configurator/ui/bindings/bindings.d.ts.map +1 -0
  85. package/dist/configurator/ui/bindings/bindings.js +5 -0
  86. package/dist/configurator/ui/bindings/parsers.d.ts +7 -0
  87. package/dist/configurator/ui/bindings/parsers.d.ts.map +1 -0
  88. package/dist/configurator/ui/bindings/parsers.js +85 -0
  89. package/dist/configurator/ui/form/users.d.ts +11 -0
  90. package/dist/configurator/ui/form/users.d.ts.map +1 -0
  91. package/dist/configurator/ui/form/users.js +33 -0
  92. package/dist/configurator/ui/plan/dependencyHosts.d.ts +2 -0
  93. package/dist/configurator/ui/plan/dependencyHosts.d.ts.map +1 -0
  94. package/dist/configurator/ui/plan/dependencyHosts.js +36 -0
  95. package/dist/configurator/ui/plan/templateValues.d.ts +11 -0
  96. package/dist/configurator/ui/plan/templateValues.d.ts.map +1 -0
  97. package/dist/configurator/ui/plan/templateValues.js +70 -0
  98. package/dist/configurator/workflows.d.ts +54 -0
  99. package/dist/configurator/workflows.d.ts.map +1 -0
  100. package/dist/configurator/workflows.js +161 -0
  101. package/dist/configurator-assets/forms/bindings.yml +265 -0
  102. package/dist/configurator-assets/templates/README.md +18 -0
  103. package/dist/configurator-assets/templates/charts-values/dependencies/values.override.yaml +4 -0
  104. package/dist/configurator-assets/templates/charts-values/dependencies/values.yaml +96 -0
  105. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  106. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.yaml +83 -0
  107. package/dist/configurator-assets/templates/charts-values/opentelemetry/values.yaml +102 -0
  108. package/dist/configurator-assets/templates/charts-values/traefik/values.override.yaml +4 -0
  109. package/dist/configurator-assets/templates/charts-values/traefik/values.yaml +130 -0
  110. package/dist/configurator-assets/templates/inventory/inventory.template.yml +98 -0
  111. package/dist/configurator-assets/ui/apple-touch-icon.png +0 -0
  112. package/dist/configurator-assets/ui/assets/index-CaqYFJUk.css +6 -0
  113. package/dist/configurator-assets/ui/assets/index-DU1Y6E0b.js +169 -0
  114. package/dist/configurator-assets/ui/assets/opencrvs-logo-sIjz08HT.svg +1 -0
  115. package/dist/configurator-assets/ui/assets/poppins-400-BwTUGeWf.woff2 +0 -0
  116. package/dist/configurator-assets/ui/assets/poppins-500-CWICHMj6.woff2 +0 -0
  117. package/dist/configurator-assets/ui/assets/poppins-600-DJVo7c07.woff2 +0 -0
  118. package/dist/configurator-assets/ui/assets/poppins-700-g9MkRaG0.woff2 +0 -0
  119. package/dist/configurator-assets/ui/favicon-32x32.png +0 -0
  120. package/dist/configurator-assets/ui/index.html +25 -0
  121. package/dist/environment/custom-types.d.ts +1 -0
  122. package/dist/environment/custom-types.d.ts.map +1 -1
  123. package/dist/environment/derived-variables.d.ts +18 -4
  124. package/dist/environment/derived-variables.d.ts.map +1 -1
  125. package/dist/environment/derived-variables.js +20 -4
  126. package/dist/environment/questions.d.ts +42 -9
  127. package/dist/environment/questions.d.ts.map +1 -1
  128. package/dist/environment/questions.js +71 -48
  129. package/dist/environment/registry.d.ts +15 -0
  130. package/dist/environment/registry.d.ts.map +1 -0
  131. package/dist/environment/registry.js +112 -0
  132. package/dist/environment/setup-environment.d.ts.map +1 -1
  133. package/dist/environment/setup-environment.js +145 -25
  134. package/dist/environment/templates.d.ts.map +1 -1
  135. package/dist/events/index.js +826 -210
  136. package/dist/migrations/add-notify-config.d.ts +40 -0
  137. package/dist/migrations/add-notify-config.d.ts.map +1 -0
  138. package/dist/migrations/add-notify-config.js +249 -0
  139. package/dist/migrations/index.d.ts +9 -0
  140. package/dist/migrations/index.d.ts.map +1 -0
  141. package/dist/migrations/index.js +1306 -0
  142. package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
  143. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
  144. package/dist/migrations/move-declaration-to-declare-action.js +260 -0
  145. package/dist/migrations/{add-translations.d.ts → persistent/add-translations.d.ts} +1 -1
  146. package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
  147. package/dist/migrations/{add-translations.js → persistent/add-translations.js} +2 -2
  148. package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
  149. package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
  150. package/dist/migrations/persistent/check-upgrade-path.js +105 -0
  151. package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
  152. package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
  153. package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
  154. package/dist/migrations/{v2.2/read-declaration-through-helper.d.ts → read-declaration-through-helper.d.ts} +1 -1
  155. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
  156. package/dist/migrations/{v2.2/read-declaration-through-helper.js → read-declaration-through-helper.js} +4 -62
  157. package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
  158. package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
  159. package/dist/migrations/replace-incomplete-flag.js +126 -0
  160. package/dist/migrations/resolve-versioned-event-config.d.ts +56 -0
  161. package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
  162. package/dist/migrations/resolve-versioned-event-config.js +353 -0
  163. package/dist/migrations/utils.d.ts +61 -0
  164. package/dist/migrations/utils.d.ts.map +1 -0
  165. package/dist/migrations/utils.js +218 -0
  166. package/dist/notification/index.js +722 -82
  167. package/dist/roles/index.d.ts +2 -0
  168. package/dist/roles/index.d.ts.map +1 -0
  169. package/dist/roles/index.js +730 -0
  170. package/dist/scopes/index.d.ts +54 -94
  171. package/dist/scopes/index.js +15 -12
  172. package/dist/templates/charts-values/dependencies/values.yaml +5 -2
  173. package/dist/templates/charts-values/opencrvs-services/values.yaml +5 -7
  174. package/dist/templates/charts-values/traefik/values.yaml +2 -0
  175. package/dist/verify/endpoints.d.ts +11 -0
  176. package/dist/verify/endpoints.d.ts.map +1 -1
  177. package/dist/verify/endpoints.js +21 -27
  178. package/opencrvs-toolkit-2.2.0-rc.e6591c5.tgz +0 -0
  179. package/package.json +17 -4
  180. package/tsconfig.build.json +11 -1
  181. package/tsconfig.build.tsbuildinfo +1 -1
  182. package/tsconfig.json +15 -6
  183. package/dist/migrations/add-translations.d.ts.map +0 -1
  184. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
  185. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
  186. package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
  187. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
  188. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
  189. package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
  190. package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
  191. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
  192. package/dist/migrations/v2.1/enable-telemetry.js +0 -455
  193. package/dist/migrations/v2.1/index.d.ts +0 -6
  194. package/dist/migrations/v2.1/index.d.ts.map +0 -1
  195. package/dist/migrations/v2.1/index.js +0 -50
  196. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -17
  197. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
  198. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
  199. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
  200. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
  201. package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
  202. package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
  203. package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
  204. package/dist/migrations/v2.1/remove-sentry.js +0 -354
  205. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
  206. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
  207. package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
  208. package/dist/migrations/v2.1/template-files.d.ts +0 -8
  209. package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
  210. package/dist/migrations/v2.1/template-files.js +0 -49
  211. package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -11
  212. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
  213. package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
  214. package/dist/migrations/v2.2/index.d.ts +0 -6
  215. package/dist/migrations/v2.2/index.d.ts.map +0 -1
  216. package/dist/migrations/v2.2/index.js +0 -456
  217. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +0 -1
  218. package/dist/templates/countryconfig-template/.tiltignore +0 -1
  219. package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
  220. package/dist/templates/countryconfig-template/Tiltfile +0 -112
  221. package/dist/templates/countryconfig-template/assets/README.md +0 -1
  222. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
  223. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
  224. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
  225. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
  226. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
  227. package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
  228. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
  229. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
  230. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
  231. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
  232. package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
  233. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
  234. package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
  235. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
  236. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
  237. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
  238. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
  239. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
  240. package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
  241. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
  242. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
  243. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
  244. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
  245. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
  246. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
  247. package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
  248. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
  249. package/opencrvs-toolkit-2.2.0-rc.ac299dc.tgz +0 -0
@@ -40,14 +40,17 @@ __export(notification_exports, {
40
40
  module.exports = __toCommonJS(notification_exports);
41
41
  var z48 = __toESM(require("zod/v4"));
42
42
 
43
+ // ../commons/src/events/index.ts
44
+ var import_compile = require("zod/compile");
45
+
43
46
  // ../commons/src/events/AuditLog.ts
44
47
  var z9 = __toESM(require("zod/v4"));
45
48
 
46
- // ../commons/src/authentication.ts
49
+ // ../commons/src/users/authentication.ts
47
50
  var import_jwt_decode = __toESM(require("jwt-decode"));
48
51
  var z8 = __toESM(require("zod/v4"));
49
52
 
50
- // ../commons/src/scopes.ts
53
+ // ../commons/src/users/scopes.ts
51
54
  var z7 = __toESM(require("zod/v4"));
52
55
  var qs = __toESM(require("qs"));
53
56
 
@@ -133,7 +136,9 @@ var ActionTypes = z2.enum([
133
136
  "CUSTOM"
134
137
  ]);
135
138
  var ClientSpecificAction = {
136
- REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
139
+ REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST",
140
+ /** Opens the user's declare or notify draft of the event in its own flow */
141
+ CONTINUE_DRAFT: "CONTINUE_DRAFT"
137
142
  };
138
143
  var declarationActionValues = [
139
144
  ActionTypes.enum.DECLARE,
@@ -186,7 +191,7 @@ var ActionStatus = {
186
191
  };
187
192
 
188
193
  // ../commons/src/events/Flag.ts
189
- var z5 = __toESM(require("zod/v4"));
194
+ var z5 = __toESM(require("zod"));
190
195
 
191
196
  // ../commons/src/events/TranslationConfig.ts
192
197
  var z3 = __toESM(require("zod/v4"));
@@ -255,7 +260,6 @@ var FieldConditional = z4.discriminatedUnion("type", [
255
260
 
256
261
  // ../commons/src/events/Flag.ts
257
262
  var InherentFlags = {
258
- INCOMPLETE: "incomplete",
259
263
  REJECTED: "rejected",
260
264
  CORRECTION_REQUESTED: "correction-requested",
261
265
  POTENTIAL_DUPLICATE: "potential-duplicate",
@@ -283,7 +287,7 @@ var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).inclu
283
287
  message: `Custom flag cannot be one of the inherent flags: ${Object.values(
284
288
  InherentFlags
285
289
  ).join(", ")}`
286
- }).refine((val) => !ActionFlag.safeParse(val).success, {
290
+ }).refine((val) => !ActionFlag.validate(val), {
287
291
  message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
288
292
  }).describe("Custom flag identifier defined by the country config.");
289
293
  var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
@@ -326,7 +330,7 @@ var EventStatus = z6.enum([
326
330
  "ARCHIVED"
327
331
  ]);
328
332
 
329
- // ../commons/src/scopes.ts
333
+ // ../commons/src/users/scopes.ts
330
334
  var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
331
335
  "Filters based on user jurisdiction relative to their office location in hierarchy."
332
336
  );
@@ -599,7 +603,7 @@ var DEFAULT_SCOPE_OPTIONS = {
599
603
  registeredIn: JurisdictionFilter.enum.all
600
604
  };
601
605
 
602
- // ../commons/src/authentication.ts
606
+ // ../commons/src/users/authentication.ts
603
607
  var TokenUserType = z8.enum(["user", "system"]);
604
608
  var TokenWithBearer = z8.string().regex(/^Bearer\s/);
605
609
 
@@ -997,7 +1001,7 @@ var z14 = __toESM(require("zod/v4"));
997
1001
  // ../commons/src/documents.ts
998
1002
  var z11 = __toESM(require("zod/v4"));
999
1003
  var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
1000
- "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
1004
+ "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://s3.opencrvs.com/bucket-name/document-id.jpg"
1001
1005
  );
1002
1006
  var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
1003
1007
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
@@ -1007,7 +1011,7 @@ var DocumentPath = z11.string().brand("DocumentPath").describe(
1007
1011
  );
1008
1012
 
1009
1013
  // ../commons/src/events/CompositeFieldValue.ts
1010
- var z12 = __toESM(require("zod/v4"));
1014
+ var z12 = __toESM(require("zod"));
1011
1015
  var AddressType = {
1012
1016
  DOMESTIC: "DOMESTIC",
1013
1017
  INTERNATIONAL: "INTERNATIONAL"
@@ -1104,6 +1108,26 @@ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
1104
1108
  // ../commons/src/events/PlainDate.ts
1105
1109
  var import_zod = require("zod");
1106
1110
  var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
1111
+ var dateFormats = /* @__PURE__ */ new Map();
1112
+ function getDateFormat(timeZone) {
1113
+ let format2 = dateFormats.get(timeZone);
1114
+ if (!format2) {
1115
+ format2 = new Intl.DateTimeFormat("en-US", {
1116
+ timeZone,
1117
+ year: "numeric",
1118
+ month: "2-digit",
1119
+ day: "2-digit"
1120
+ });
1121
+ dateFormats.set(timeZone, format2);
1122
+ }
1123
+ return format2;
1124
+ }
1125
+ function toPlainDateInTimeZone(date, timeZone) {
1126
+ const parts = Object.fromEntries(
1127
+ getDateFormat(timeZone).formatToParts(date).map(({ type, value }) => [type, value])
1128
+ );
1129
+ return `${parts.year}-${parts.month}-${parts.day}`;
1130
+ }
1107
1131
 
1108
1132
  // ../commons/src/events/FieldValue.ts
1109
1133
  var TextValue = z14.string();
@@ -1212,7 +1236,7 @@ function safeUnion(schemas) {
1212
1236
  );
1213
1237
  return z14.any().superRefine((val, ctx) => {
1214
1238
  for (const schema of sortedSchemas) {
1215
- if (schema.safeParse(val).success) {
1239
+ if (schema.validate(val)) {
1216
1240
  return;
1217
1241
  }
1218
1242
  }
@@ -1540,6 +1564,9 @@ var LegalStatuses = z17.object({
1540
1564
  var EventMetadata = z17.object({
1541
1565
  id: UUID,
1542
1566
  type: z17.string().describe("The type of event, such as birth, death, or marriage."),
1567
+ configVersionId: z17.string().describe(
1568
+ "Id of the event configuration version the record was created under. Records created before versioning have 'initial'."
1569
+ ),
1543
1570
  status: EventStatus,
1544
1571
  legalStatuses: LegalStatuses.describe(
1545
1572
  "Metadata related to the legal registration of the event, such as who registered it and when."
@@ -2908,6 +2935,12 @@ var ReadActionConfig = ActionConfigBase.extend(
2908
2935
  var NotifyConfig = ActionConfigBase.extend(
2909
2936
  z25.object({
2910
2937
  type: z25.literal(ActionType.NOTIFY),
2938
+ notificationForm: DeclarationFormConfig.describe(
2939
+ "Notification form configuration. Its fields must be a subset of the declaration form fields, with matching types. The values submitted on the notification form pre-fill the declaration."
2940
+ ),
2941
+ review: DeclarationReviewConfig.describe(
2942
+ "Review page configuration for the notify action. Values of its fields are stored as the NOTIFY action annotation."
2943
+ ),
2911
2944
  form: actionConfirmationForm
2912
2945
  }).shape
2913
2946
  );
@@ -3089,11 +3122,11 @@ var ActionConfig = z25.discriminatedUnion("type", [
3089
3122
  }),
3090
3123
  NotifyConfig.meta({
3091
3124
  id: "NotifyActionConfig",
3092
- description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3125
+ description: "Configuration for the notify action: the notification form and its review page. An event without a NOTIFY action cannot be notified."
3093
3126
  }),
3094
3127
  DeclareConfig.meta({
3095
3128
  id: "DeclareActionConfig",
3096
- description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3129
+ description: "Configuration for the declare action. Includes the declaration form and review-page fields."
3097
3130
  }),
3098
3131
  DuplicateDetectedConfig.meta({
3099
3132
  id: "DuplicateDetectedActionConfig",
@@ -3357,7 +3390,7 @@ var ReferenceField = BaseField2.extend({
3357
3390
  var Field = BaseField2.extend({
3358
3391
  id: z29.string().describe("Identifier of the summary field."),
3359
3392
  value: TranslationConfig.describe(
3360
- 'Field value template supports variables from configuration (e.g. "{informant.phoneNo} {informant.email}") and EventMetadata (e.g. "{event.legalStatuses.REGISTERED.acceptedAt, date, ::dd MMMM yyyy}").'
3393
+ 'Field value template supports variables from configuration (e.g. "{informant.phoneNo} {informant.email}") and EventMetadata (e.g. "{event.legalStatuses.REGISTERED.acceptedAt, date, ::dd MMMM yyyy}"). "{event.configVersionLabel}" gives the label of the configuration version that the record was created under.'
3361
3394
  ),
3362
3395
  label: TranslationConfig
3363
3396
  }).describe("Custom field defined for the summary view.");
@@ -3443,9 +3476,6 @@ var BaseField3 = z30.object({
3443
3476
  ),
3444
3477
  allowedLocations: JurisdictionReference.optional().describe(
3445
3478
  `Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
3446
- ),
3447
- useFormDefaultValue: z30.boolean().optional().describe(
3448
- `Set to false to open the field empty in advanced search instead of pre-filled with the declaration form's defaultValue.`
3449
3479
  )
3450
3480
  });
3451
3481
  var SearchQueryParams = z30.object({
@@ -3455,7 +3485,10 @@ var SearchQueryParams = z30.object({
3455
3485
  }).catchall(FieldValue);
3456
3486
  var FieldConfigSchema = BaseField3.extend({
3457
3487
  fieldId: z30.string(),
3458
- fieldType: z30.literal("field")
3488
+ fieldType: z30.literal("field"),
3489
+ defaultValue: z30.union([z30.boolean(), z30.string(), z30.number()]).optional().describe(
3490
+ `Value the field opens with in advanced search. Omitted or true uses the declaration form's defaultValue, false opens the field empty, and any other value opens it with that value. Only text, number and date fields take a value; every other field type, and date fields searched as a range, only accept true or false.`
3491
+ )
3459
3492
  });
3460
3493
  var EventFieldIdInput = z30.enum([
3461
3494
  "trackingId",
@@ -3504,32 +3537,20 @@ var AdvancedSearchConfig = z30.object({
3504
3537
  description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
3505
3538
  });
3506
3539
 
3507
- // ../commons/src/events/utils.ts
3508
- var import_lodash4 = require("lodash");
3509
-
3510
- // ../commons/src/conditionals/validate.ts
3511
- var import__ = __toESM(require("ajv/dist/2019"));
3512
- var import_ajv_formats = __toESM(require("ajv-formats"));
3513
- var z34 = __toESM(require("zod/v4"));
3514
- var import_date_fns2 = require("date-fns");
3515
-
3516
- // ../commons/src/events/FieldTypeMapping.ts
3517
- var z32 = __toESM(require("zod/v4"));
3518
-
3519
- // ../commons/src/events/DynamicFieldValue.ts
3520
- var z31 = __toESM(require("zod/v4"));
3521
-
3522
- // ../commons/src/events/state/index.ts
3523
- var import_lodash3 = require("lodash");
3524
-
3525
3540
  // ../commons/src/utils.ts
3526
- var z33 = __toESM(require("zod/v4"));
3541
+ var z31 = __toESM(require("zod/v4"));
3527
3542
  var _ = __toESM(require("lodash"));
3528
- var FullNameV1 = z33.array(
3529
- z33.object({
3530
- use: z33.string(),
3531
- family: z33.string(),
3532
- given: z33.array(z33.string())
3543
+ function getOrThrow(x, message) {
3544
+ if (x === void 0 || x === null) {
3545
+ throw new Error(message);
3546
+ }
3547
+ return x;
3548
+ }
3549
+ var FullNameV1 = z31.array(
3550
+ z31.object({
3551
+ use: z31.string(),
3552
+ family: z31.string(),
3553
+ given: z31.array(z31.string())
3533
3554
  })
3534
3555
  );
3535
3556
  function omitKeyDeep(obj, keyToRemove) {
@@ -3548,6 +3569,162 @@ function omitKeyDeep(obj, keyToRemove) {
3548
3569
  return newObj;
3549
3570
  }
3550
3571
 
3572
+ // ../commons/src/events/utils.ts
3573
+ var import_lodash4 = require("lodash");
3574
+
3575
+ // ../commons/src/conditionals/validate.ts
3576
+ var import__ = __toESM(require("ajv/dist/2019"));
3577
+ var import_ajv_formats = __toESM(require("ajv-formats"));
3578
+ var z34 = __toESM(require("zod/v4"));
3579
+ var import_date_fns2 = require("date-fns");
3580
+
3581
+ // ../commons/src/events/FieldTypeMapping.ts
3582
+ var z33 = __toESM(require("zod/v4"));
3583
+
3584
+ // ../commons/src/events/DynamicFieldValue.ts
3585
+ var z32 = __toESM(require("zod/v4"));
3586
+ function getDynamicNameValue(field3) {
3587
+ const nameConfiguration = field3.configuration?.name;
3588
+ const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
3589
+ const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
3590
+ return z32.object({
3591
+ firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
3592
+ surname: surnameRequired ? NonEmptyTextValue : TextValue,
3593
+ middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
3594
+ });
3595
+ }
3596
+ function getDynamicAddressFieldValue(field3) {
3597
+ const schema = field3.required ? AddressFieldValue : AddressFieldUpdateValue;
3598
+ const configIds = field3.configuration?.streetAddressForm?.map((a) => a.id) ?? [];
3599
+ return schema.refine((arg) => {
3600
+ if (!arg) {
3601
+ return true;
3602
+ }
3603
+ const submittedKeys = Object.keys(arg.streetLevelDetails ?? {});
3604
+ const invalidKeys = submittedKeys.filter((k) => !configIds.includes(k));
3605
+ if (invalidKeys.length) {
3606
+ console.log(
3607
+ "Invalid streetLevelDetails: unknown keys",
3608
+ JSON.stringify(invalidKeys, null, 2)
3609
+ );
3610
+ return false;
3611
+ }
3612
+ return true;
3613
+ });
3614
+ }
3615
+
3616
+ // ../commons/src/events/FieldTypeMapping.ts
3617
+ function mapFieldTypeToZod(field3, actionType) {
3618
+ let schema;
3619
+ switch (field3.type) {
3620
+ case FieldType.FIELD_GROUP: {
3621
+ schema = z33.object(
3622
+ field3.fields.reduce((acc, subfield) => {
3623
+ acc[subfield.id] = mapFieldTypeToZod(subfield, actionType);
3624
+ return acc;
3625
+ }, {})
3626
+ );
3627
+ break;
3628
+ }
3629
+ case FieldType.DATE:
3630
+ schema = PlainDate;
3631
+ break;
3632
+ case FieldType.AGE:
3633
+ schema = AgeValue;
3634
+ break;
3635
+ case FieldType.TIME:
3636
+ schema = TimeValue;
3637
+ break;
3638
+ case FieldType.EMAIL:
3639
+ schema = EmailValue;
3640
+ break;
3641
+ case FieldType.DATE_RANGE:
3642
+ schema = DateRangeFieldValue;
3643
+ break;
3644
+ case FieldType.SELECT_DATE_RANGE:
3645
+ schema = SelectDateRangeValue;
3646
+ break;
3647
+ case FieldType.TEXT:
3648
+ case FieldType.TEXTAREA:
3649
+ case FieldType.DIVIDER:
3650
+ case FieldType.BULLET_LIST:
3651
+ case FieldType.PAGE_HEADER:
3652
+ case FieldType.LOCATION:
3653
+ case FieldType.SELECT:
3654
+ case FieldType.COUNTRY:
3655
+ case FieldType.RADIO_GROUP:
3656
+ case FieldType.PARAGRAPH:
3657
+ case FieldType.HEADING:
3658
+ case FieldType.IMAGE_VIEW:
3659
+ case FieldType.ADMINISTRATIVE_AREA:
3660
+ case FieldType.FACILITY:
3661
+ case FieldType.OFFICE:
3662
+ case FieldType.PHONE:
3663
+ case FieldType.LINK_BUTTON:
3664
+ case FieldType.VERIFICATION_STATUS:
3665
+ case FieldType.ID:
3666
+ case FieldType.LOADER:
3667
+ case FieldType.ALPHA_HIDDEN:
3668
+ case FieldType.USER_ROLE:
3669
+ schema = field3.required ? NonEmptyTextValue : TextValue;
3670
+ break;
3671
+ case FieldType.NUMBER:
3672
+ schema = NumberFieldValue;
3673
+ break;
3674
+ case FieldType.NUMBER_WITH_UNIT:
3675
+ schema = field3.required ? NumberWithUnitFieldValue : NumberWithUnitFieldUpdateValue;
3676
+ break;
3677
+ case FieldType.CHECKBOX:
3678
+ schema = CheckboxFieldValue;
3679
+ break;
3680
+ case FieldType.SIGNATURE:
3681
+ case FieldType.FILE:
3682
+ schema = FileFieldValue;
3683
+ break;
3684
+ case FieldType.FILE_WITH_OPTIONS:
3685
+ schema = field3.required ? FileFieldWithOptionValue.min(1) : FileFieldWithOptionValue;
3686
+ break;
3687
+ case FieldType.ADDRESS:
3688
+ schema = getDynamicAddressFieldValue(field3);
3689
+ break;
3690
+ case FieldType.DATA:
3691
+ schema = DataFieldValue;
3692
+ break;
3693
+ case FieldType.NAME:
3694
+ schema = actionType === ActionType.NOTIFY ? NameFieldUpdateValue : getDynamicNameValue(field3);
3695
+ break;
3696
+ case FieldType.BUTTON:
3697
+ schema = ButtonFieldValue;
3698
+ break;
3699
+ case FieldType.ALPHA_PRINT_BUTTON:
3700
+ schema = TextValue;
3701
+ break;
3702
+ case FieldType.AUTOCOMPLETE:
3703
+ schema = AutocompleteValue;
3704
+ break;
3705
+ case FieldType.HTTP:
3706
+ case FieldType.SEARCH:
3707
+ schema = HttpFieldUpdateValue;
3708
+ break;
3709
+ case FieldType.QUERY_PARAM_READER:
3710
+ schema = QueryParamReaderFieldUpdateValue;
3711
+ break;
3712
+ case FieldType.QR_READER:
3713
+ schema = QrReaderFieldValue;
3714
+ break;
3715
+ case FieldType.ID_READER:
3716
+ schema = IdReaderFieldValue;
3717
+ break;
3718
+ case FieldType._EXPERIMENTAL_CUSTOM:
3719
+ schema = CustomFieldValue;
3720
+ break;
3721
+ }
3722
+ return field3.required ? schema : schema.nullish();
3723
+ }
3724
+
3725
+ // ../commons/src/events/state/index.ts
3726
+ var import_lodash3 = require("lodash");
3727
+
3551
3728
  // ../commons/src/events/state/utils.ts
3552
3729
  var import_lodash = require("lodash");
3553
3730
  var updateActions = new Set(
@@ -3579,15 +3756,6 @@ var INHERENT_FLAG_RULES = [
3579
3756
  setOn: [ActionType.REQUEST_CORRECTION],
3580
3757
  resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
3581
3758
  },
3582
- {
3583
- // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
3584
- // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
3585
- // are deliberately excluded so the flag freezes across an archive/unarchive
3586
- // round trip and comes back exactly as it was.
3587
- flag: InherentFlags.INCOMPLETE,
3588
- setOn: [ActionType.NOTIFY],
3589
- resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
3590
- },
3591
3759
  {
3592
3760
  flag: InherentFlags.REJECTED,
3593
3761
  setOn: [ActionType.REJECT],
@@ -4298,7 +4466,9 @@ function buildClientFunctionContext(input) {
4298
4466
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
4299
4467
  $online: isOnline(),
4300
4468
  $user: input.validatorContext?.user,
4301
- $event: input.validatorContext?.event?.document,
4469
+ $event: input.validatorContext?.event?.document ? getEventWithCompleteAcceptedActions(
4470
+ input.validatorContext.event.document
4471
+ ) : void 0,
4302
4472
  $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
4303
4473
  user: input.systemVariables?.user,
4304
4474
  $window: input.systemVariables?.$window,
@@ -4402,6 +4572,12 @@ function getDeclarationPages(configuration) {
4402
4572
  function getDeclarationFields(configuration) {
4403
4573
  return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
4404
4574
  }
4575
+ function findNotificationForm(configuration) {
4576
+ const notifyAction = configuration.actions.find(
4577
+ (action) => action.type === ActionType.NOTIFY
4578
+ );
4579
+ return notifyAction?.type === ActionType.NOTIFY ? notifyAction.notificationForm : void 0;
4580
+ }
4405
4581
  var getActionAnnotationFields = (actionConfig) => {
4406
4582
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
4407
4583
  return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
@@ -4416,12 +4592,108 @@ var getActionAnnotationFields = (actionConfig) => {
4416
4592
  function getAllAnnotationFields(config) {
4417
4593
  return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
4418
4594
  }
4595
+ function deepMerge(currentDocument, actionDocument) {
4596
+ return (0, import_lodash4.mergeWith)(
4597
+ (0, import_lodash4.cloneDeep)(currentDocument),
4598
+ actionDocument,
4599
+ (previousValue, incomingValue) => {
4600
+ if (incomingValue === void 0) {
4601
+ return previousValue;
4602
+ }
4603
+ if ((0, import_lodash4.isArray)(incomingValue)) {
4604
+ return incomingValue;
4605
+ }
4606
+ if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
4607
+ return void 0;
4608
+ }
4609
+ return incomingValue;
4610
+ }
4611
+ );
4612
+ }
4419
4613
  var findAllFields = (config) => {
4420
4614
  return (0, import_lodash4.flattenDeep)([
4421
4615
  ...getDeclarationFields(config),
4616
+ ...findNotificationForm(config)?.pages.flatMap(({ fields }) => fields) ?? [],
4422
4617
  ...getAllAnnotationFields(config)
4423
4618
  ]);
4424
4619
  };
4620
+ function isAcceptedAction(a) {
4621
+ return a.status === ActionStatus.Accepted;
4622
+ }
4623
+ function getCompleteActionAnnotation(event2, action) {
4624
+ if (action.originalActionId) {
4625
+ const originalAction = event2.actions.find(
4626
+ ({ id }) => id === action.originalActionId
4627
+ );
4628
+ if (originalAction?.status === ActionStatus.Requested) {
4629
+ return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
4630
+ }
4631
+ }
4632
+ return action.annotation ?? {};
4633
+ }
4634
+ function getCompleteActionContent(event2, action) {
4635
+ const currentContent = "content" in action ? action.content : void 0;
4636
+ if (!action.originalActionId) {
4637
+ return currentContent;
4638
+ }
4639
+ const originalAction = event2.actions.find(
4640
+ ({ id }) => id === action.originalActionId
4641
+ );
4642
+ if (originalAction && "content" in originalAction && originalAction.content) {
4643
+ return {
4644
+ ...originalAction.content,
4645
+ ...currentContent ?? {}
4646
+ };
4647
+ }
4648
+ return currentContent;
4649
+ }
4650
+ function getCompleteActionDeclaration(declaration, event2, action) {
4651
+ if (action.originalActionId) {
4652
+ const originalAction = event2.actions.find(
4653
+ ({ id }) => id === action.originalActionId
4654
+ );
4655
+ if (originalAction?.status === ActionStatus.Requested) {
4656
+ return deepMerge(
4657
+ deepMerge(declaration, originalAction.declaration),
4658
+ action.declaration
4659
+ );
4660
+ }
4661
+ }
4662
+ return deepMerge(declaration, action.declaration);
4663
+ }
4664
+ function completeAcceptedAction(event2, action) {
4665
+ return {
4666
+ ...action,
4667
+ declaration: getCompleteActionDeclaration({}, event2, action),
4668
+ annotation: getCompleteActionAnnotation(event2, action)
4669
+ };
4670
+ }
4671
+ function getEventWithCompleteAcceptedActions(event2) {
4672
+ return {
4673
+ ...event2,
4674
+ actions: event2.actions.map((action) => {
4675
+ if (!isAcceptedAction(action) || !action.originalActionId) {
4676
+ return action;
4677
+ }
4678
+ const requestedAction = event2.actions.find(
4679
+ ({ id }) => id === action.originalActionId
4680
+ );
4681
+ if (requestedAction?.status !== ActionStatus.Requested) {
4682
+ return action;
4683
+ }
4684
+ const content = getCompleteActionContent(event2, action);
4685
+ return {
4686
+ ...completeAcceptedAction(event2, action),
4687
+ // Who requested the action, as getActionUpdateMetadata resolves it.
4688
+ createdBy: requestedAction.createdBy,
4689
+ createdByRole: requestedAction.createdByRole,
4690
+ createdByUserType: requestedAction.createdByUserType,
4691
+ createdAtLocation: requestedAction.createdAtLocation,
4692
+ ...content ? { content } : {}
4693
+ };
4694
+ })
4695
+ };
4696
+ }
4425
4697
  var EXCLUDED_ACTIONS = [
4426
4698
  ActionType.REQUEST_CORRECTION,
4427
4699
  ActionType.PRINT_CERTIFICATE,
@@ -4429,6 +4701,20 @@ var EXCLUDED_ACTIONS = [
4429
4701
  ];
4430
4702
 
4431
4703
  // ../commons/src/events/eventConfigValidation.ts
4704
+ var SEARCH_DEFAULT_VALUE_FIELD_TYPES = [
4705
+ FieldType.TEXT,
4706
+ FieldType.TEXTAREA,
4707
+ FieldType.EMAIL,
4708
+ FieldType.PHONE,
4709
+ FieldType.ID,
4710
+ FieldType.SELECT,
4711
+ FieldType.RADIO_GROUP,
4712
+ FieldType.COUNTRY,
4713
+ FieldType.LOCATION,
4714
+ FieldType.ADMINISTRATIVE_AREA,
4715
+ FieldType.NUMBER,
4716
+ FieldType.DATE
4717
+ ];
4432
4718
  function validateAdvancedSearchConfig(event2, ctx) {
4433
4719
  const allFields = findAllFields(event2);
4434
4720
  const fieldIds = allFields.map((field3) => field3.id);
@@ -4460,6 +4746,56 @@ function validateAdvancedSearchConfig(event2, ctx) {
4460
4746
  path: ["advancedSearch"]
4461
4747
  });
4462
4748
  }
4749
+ event2.advancedSearch.forEach((section, sectionIndex) => {
4750
+ section.fields.forEach((searchField, fieldIndex) => {
4751
+ if (searchField.fieldType !== "field" || searchField.defaultValue === void 0) {
4752
+ return;
4753
+ }
4754
+ const path = [
4755
+ "advancedSearch",
4756
+ sectionIndex,
4757
+ "fields",
4758
+ fieldIndex,
4759
+ "defaultValue"
4760
+ ];
4761
+ if (searchField.config.searchFields && searchField.config.searchFields.length > 0) {
4762
+ ctx.addIssue({
4763
+ code: "custom",
4764
+ message: `Advanced search field ${searchField.fieldId} searches across several form fields, so it does not support a defaultValue.`,
4765
+ path
4766
+ });
4767
+ return;
4768
+ }
4769
+ if (typeof searchField.defaultValue === "boolean") {
4770
+ return;
4771
+ }
4772
+ const formField = allFields.find(({ id }) => id === searchField.fieldId);
4773
+ if (!formField) {
4774
+ return;
4775
+ }
4776
+ if (!SEARCH_DEFAULT_VALUE_FIELD_TYPES.some(
4777
+ (type) => type === formField.type
4778
+ )) {
4779
+ ctx.addIssue({
4780
+ code: "custom",
4781
+ message: `Advanced search field ${searchField.fieldId} is a ${formField.type} field, which does not support a defaultValue value, only true or false. Field types that support a defaultValue value: ${SEARCH_DEFAULT_VALUE_FIELD_TYPES.join(", ")}.`,
4782
+ path
4783
+ });
4784
+ } else if (formField.type === FieldType.DATE && searchField.config.type === "range") {
4785
+ ctx.addIssue({
4786
+ code: "custom",
4787
+ message: `Advanced search field ${searchField.fieldId} is searched as a date range, so its defaultValue can only be true or false.`,
4788
+ path
4789
+ });
4790
+ } else if (!mapFieldTypeToZod(formField).safeParse(searchField.defaultValue).success) {
4791
+ ctx.addIssue({
4792
+ code: "custom",
4793
+ message: `Advanced search field ${searchField.fieldId} has defaultValue "${searchField.defaultValue}", which is not a valid ${formField.type} value.`,
4794
+ path
4795
+ });
4796
+ }
4797
+ });
4798
+ });
4463
4799
  }
4464
4800
  function validateDateOfEvent(event2, ctx) {
4465
4801
  if (event2.dateOfEvent && isFieldReference(event2.dateOfEvent)) {
@@ -4583,15 +4919,65 @@ function validateDeclarationGivenExactlyOnce(config, ctx) {
4583
4919
  });
4584
4920
  }
4585
4921
  }
4922
+ function validateNotificationForm(event2, ctx) {
4923
+ const declarationFields = getDeclarationPages(event2).flatMap(
4924
+ (page) => page.fields.map((field3) => ({ field: field3, pageId: page.id }))
4925
+ );
4926
+ event2.actions.forEach((action, actionIndex) => {
4927
+ if (action.type !== ActionType.NOTIFY) {
4928
+ return;
4929
+ }
4930
+ action.notificationForm.pages.forEach((page, pageIndex) => {
4931
+ page.fields.forEach((field3, fieldIndex) => {
4932
+ const path = [
4933
+ "actions",
4934
+ actionIndex,
4935
+ "notificationForm",
4936
+ "pages",
4937
+ pageIndex,
4938
+ "fields",
4939
+ fieldIndex
4940
+ ];
4941
+ const matchingFields = declarationFields.filter(
4942
+ (declarationField) => declarationField.field.id === field3.id
4943
+ );
4944
+ if (matchingFields.length === 0) {
4945
+ ctx.addIssue({
4946
+ code: "custom",
4947
+ message: `Notification form field '${field3.id}' does not exist in the declaration form of event '${event2.id}'. Notification form fields must also be defined in the ${ActionType.DECLARE} action's declaration.`,
4948
+ path
4949
+ });
4950
+ return;
4951
+ }
4952
+ if (!matchingFields.some(
4953
+ (declarationField) => declarationField.field.type === field3.type
4954
+ )) {
4955
+ const [declarationField] = matchingFields;
4956
+ ctx.addIssue({
4957
+ code: "custom",
4958
+ message: `Notification form field '${field3.id}' on page '${page.id}' is of type ${field3.type}, but the declaration form field with the same id in event '${event2.id}' (${ActionType.DECLARE} declaration, page '${declarationField.pageId}') is of type ${declarationField.field.type}.`,
4959
+ path
4960
+ });
4961
+ }
4962
+ });
4963
+ });
4964
+ });
4965
+ }
4586
4966
 
4587
4967
  // ../commons/src/events/EventConfig.ts
4588
4968
  var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
4589
4969
  "Reference to a field defined in the event metadata, using the field id."
4590
4970
  );
4591
- var _EventConfigBase = z35.object({
4971
+ var eventLevelFields = {
4592
4972
  id: z35.string().describe(
4593
4973
  'Machine-readable identifier of the event (e.g. "birth", "death").'
4594
4974
  ),
4975
+ label: TranslationConfig.describe("Human-readable label for the event type."),
4976
+ advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
4977
+ "Configuration of fields available in the advanced search feature."
4978
+ )
4979
+ };
4980
+ var versionFields = {
4595
4981
  dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
4596
4982
  "Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
4597
4983
  ),
@@ -4607,18 +4993,12 @@ var _EventConfigBase = z35.object({
4607
4993
  summary: SummaryConfig.describe(
4608
4994
  "Summary information displayed in the event overview."
4609
4995
  ),
4610
- label: TranslationConfig.describe(
4611
- "Human-readable label for the event type."
4612
- ),
4613
4996
  actions: z35.array(ActionConfig).describe(
4614
4997
  "Configuration of core and custom actions associated with the event."
4615
4998
  ),
4616
4999
  actionOrder: z35.array(z35.string()).optional().describe(
4617
5000
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
4618
5001
  ),
4619
- advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
4620
- "Configuration of fields available in the advanced search feature."
4621
- ),
4622
5002
  flags: z35.array(FlagConfig).optional().default([]).describe(
4623
5003
  "Configuration of custom flags associated with the actions of this event type."
4624
5004
  ),
@@ -4628,20 +5008,155 @@ var _EventConfigBase = z35.object({
4628
5008
  icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
4629
5009
  'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
4630
5010
  )
4631
- });
4632
- var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
5011
+ };
5012
+ var _EventConfigBase = z35.object({ ...eventLevelFields, ...versionFields });
5013
+ function validateEventConfig(event2, ctx) {
4633
5014
  if (!validateExactlyOneDeclareAction(event2, ctx)) {
4634
5015
  return;
4635
5016
  }
5017
+ validateNotificationForm(event2, ctx);
4636
5018
  validateAdvancedSearchConfig(event2, ctx);
4637
5019
  validateDateOfEvent(event2, ctx);
4638
5020
  validatePlaceOfEvent(event2, ctx);
4639
5021
  validateActionFlags(event2, ctx);
4640
5022
  validateActionOrder(event2, ctx);
4641
- }).meta({
5023
+ }
5024
+ var EventConfig2 = _EventConfigBase.superRefine(validateEventConfig).meta({
4642
5025
  id: "EventConfig",
4643
5026
  description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
4644
5027
  });
5028
+ var INITIAL_EVENT_CONFIG_VERSION_ID = "initial";
5029
+ var DEFAULT_EFFECTIVE_FROM = "0001-01-01";
5030
+ var _EventConfigVersion = z35.object({
5031
+ id: z35.string().describe(
5032
+ 'Identifier of the version, unique within the event (e.g. "birth-v2").'
5033
+ ),
5034
+ label: TranslationConfig.describe(
5035
+ 'Name of the version, which the UI shows wherever it names the version. For example, "{event.configVersionLabel}" in the event summary.'
5036
+ ),
5037
+ effectiveFrom: z35.iso.date().default(DEFAULT_EFFECTIVE_FROM).describe(
5038
+ `Date (YYYY-MM-DD) from which this version is effective. A version without one is effective from the beginning of time ('${DEFAULT_EFFECTIVE_FROM}').`
5039
+ ),
5040
+ ...versionFields
5041
+ });
5042
+ var resolvedConfigs = /* @__PURE__ */ new WeakMap();
5043
+ function toEventConfig(config, version) {
5044
+ let resolvedVersions = resolvedConfigs.get(config);
5045
+ if (!resolvedVersions) {
5046
+ resolvedVersions = /* @__PURE__ */ new WeakMap();
5047
+ resolvedConfigs.set(config, resolvedVersions);
5048
+ }
5049
+ const cached = resolvedVersions.get(version);
5050
+ if (cached) {
5051
+ return cached;
5052
+ }
5053
+ const {
5054
+ id: _id,
5055
+ label: _label,
5056
+ effectiveFrom: _effectiveFrom,
5057
+ ...fields
5058
+ } = version;
5059
+ const resolved = {
5060
+ ...fields,
5061
+ id: config.id,
5062
+ label: config.label,
5063
+ advancedSearch: config.advancedSearch
5064
+ };
5065
+ resolvedVersions.set(version, resolved);
5066
+ return resolved;
5067
+ }
5068
+ function byEffectiveFrom(a, b) {
5069
+ return a.effectiveFrom.localeCompare(b.effectiveFrom);
5070
+ }
5071
+ function getVersionsInEffectOn(config, date) {
5072
+ return config.versions.filter(({ effectiveFrom }) => effectiveFrom <= date).sort(byEffectiveFrom);
5073
+ }
5074
+ function findVersionInEffectOn(config, date) {
5075
+ return getVersionsInEffectOn(config, date).at(-1);
5076
+ }
5077
+ function resolveEventConfigOnDate(config, date) {
5078
+ return toEventConfig(
5079
+ config,
5080
+ getOrThrow(
5081
+ findVersionInEffectOn(config, date),
5082
+ `Event '${config.id}' has no version in effect on ${date}`
5083
+ )
5084
+ );
5085
+ }
5086
+ function resolveEventConfigInTimeZone(config, timeZone, now2 = /* @__PURE__ */ new Date()) {
5087
+ return resolveEventConfigOnDate(config, toPlainDateInTimeZone(now2, timeZone));
5088
+ }
5089
+ function resolveEventConfig(config) {
5090
+ return resolveEventConfigInTimeZone(config, "UTC");
5091
+ }
5092
+ function validateVersionList(config, ctx) {
5093
+ const ids = /* @__PURE__ */ new Set();
5094
+ const versionIdByEffectiveFrom = /* @__PURE__ */ new Map();
5095
+ config.versions.forEach((version, index) => {
5096
+ if (ids.has(version.id)) {
5097
+ ctx.addIssue({
5098
+ code: "custom",
5099
+ message: `Event '${config.id}' has more than one version with id '${version.id}'. Each version must have a different id.`,
5100
+ path: ["versions", index, "id"]
5101
+ });
5102
+ }
5103
+ ids.add(version.id);
5104
+ const sameEffectiveFromId = versionIdByEffectiveFrom.get(
5105
+ version.effectiveFrom
5106
+ );
5107
+ if (sameEffectiveFromId !== void 0) {
5108
+ const versionIds = `'${sameEffectiveFromId}', '${version.id}'`;
5109
+ ctx.addIssue({
5110
+ code: "custom",
5111
+ message: version.effectiveFrom !== DEFAULT_EFFECTIVE_FROM ? `Event '${config.id}' has more than one version with \`effectiveFrom\` '${version.effectiveFrom}' (${versionIds}). Each version must have a different \`effectiveFrom\`.` : `Event '${config.id}' has more than one version without \`effectiveFrom\` (${versionIds}). At most one version may omit it.`,
5112
+ path: ["versions", index, "effectiveFrom"]
5113
+ });
5114
+ } else {
5115
+ versionIdByEffectiveFrom.set(version.effectiveFrom, version.id);
5116
+ }
5117
+ });
5118
+ }
5119
+ function validateEachVersion(ctx, events, validate2) {
5120
+ const reported = /* @__PURE__ */ new Set();
5121
+ events.forEach((event2, index) => {
5122
+ const addIssue = (issue) => {
5123
+ if (typeof issue === "string") {
5124
+ ctx.addIssue({
5125
+ code: "custom",
5126
+ message: issue,
5127
+ path: ["versions", index]
5128
+ });
5129
+ return;
5130
+ }
5131
+ const [field3] = issue.path ?? [];
5132
+ const isEventLevel = typeof field3 === "string" && field3 in eventLevelFields;
5133
+ const path = isEventLevel ? issue.path ?? [] : ["versions", index, ...issue.path ?? []];
5134
+ const key = JSON.stringify([path, issue.message]);
5135
+ if (reported.has(key)) {
5136
+ return;
5137
+ }
5138
+ reported.add(key);
5139
+ ctx.addIssue({ ...issue, path });
5140
+ };
5141
+ validate2(event2, { value: event2, addIssue });
5142
+ });
5143
+ }
5144
+ var VersionedEventConfig2 = z35.object({
5145
+ ...eventLevelFields,
5146
+ versions: z35.array(_EventConfigVersion).min(1).describe(
5147
+ `Versions of the event configuration, each effective from its \`effectiveFrom\`. An event configured without versions has a single version, with id '${INITIAL_EVENT_CONFIG_VERSION_ID}' and \`effectiveFrom\` '${DEFAULT_EFFECTIVE_FROM}'.`
5148
+ )
5149
+ }).superRefine((config, ctx) => {
5150
+ validateVersionList(config, ctx);
5151
+ validateEachVersion(
5152
+ ctx,
5153
+ config.versions.map((version) => toEventConfig(config, version)),
5154
+ validateEventConfig
5155
+ );
5156
+ }).meta({
5157
+ id: "VersionedEventConfig",
5158
+ description: "Configuration of an event type registered in OpenCRVS (for example birth or death), with every version of it."
5159
+ });
4645
5160
 
4646
5161
  // ../commons/src/events/EventConfigInput.ts
4647
5162
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -4713,7 +5228,7 @@ function createSearchConfig(baseField) {
4713
5228
 
4714
5229
  // ../commons/src/event-config/event-configuration.ts
4715
5230
  function isNonSearchableEventMetadataTimeFieldId(fieldId) {
4716
- return !EventFieldIdInput.safeParse(fieldId).success;
5231
+ return !EventFieldIdInput.validate(fieldId);
4717
5232
  }
4718
5233
  function createEventFieldConfig(fieldId) {
4719
5234
  const baseField = {
@@ -4740,7 +5255,10 @@ function eventFn(fieldId) {
4740
5255
  }
4741
5256
  var event = Object.assign(eventFn, {
4742
5257
  /**
4743
- * Checks if the event contains a specific action type.
5258
+ * Checks if the event contains a specific accepted action type.
5259
+ * Only Accepted actions are matched: a confirmable action is stored as a
5260
+ * Requested and an Accepted action, and a pending or rejected request must
5261
+ * not count as the action having happened.
4744
5262
  * Can be used directly as a conditional or chained with additional methods.
4745
5263
  * @param action - The action type to check for.
4746
5264
  */
@@ -4758,9 +5276,12 @@ var event = Object.assign(eventFn, {
4758
5276
  properties: {
4759
5277
  type: {
4760
5278
  const: action
5279
+ },
5280
+ status: {
5281
+ const: ActionStatus.Accepted
4761
5282
  }
4762
5283
  },
4763
- required: ["type"]
5284
+ required: ["type", "status"]
4764
5285
  }
4765
5286
  }
4766
5287
  },
@@ -4771,9 +5292,10 @@ var event = Object.assign(eventFn, {
4771
5292
  });
4772
5293
  const buildActionConstraints = (additionalFields) => {
4773
5294
  const actionProperties = {
4774
- type: { const: action }
5295
+ type: { const: action },
5296
+ status: { const: ActionStatus.Accepted }
4775
5297
  };
4776
- const requiredFields = ["type"];
5298
+ const requiredFields = ["type", "status"];
4777
5299
  if (additionalFields) {
4778
5300
  Object.entries(additionalFields).forEach(([key, value]) => {
4779
5301
  actionProperties[key] = { const: value };
@@ -5044,6 +5566,12 @@ var RegisterActionInput = BaseActionInput.extend(
5044
5566
  var NotifyActionInput = BaseActionInput.extend(
5045
5567
  z39.object({
5046
5568
  type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
5569
+ declaration: BaseActionInput.shape.declaration.describe(
5570
+ "Values for fields of the notification form, keyed by field id. Fields outside the notification form are rejected. Only these values become part of the record declaration, so any id that needs to be searchable must be a declaration field."
5571
+ ),
5572
+ annotation: BaseActionInput.shape.annotation.describe(
5573
+ "Values for notify-only fields (NOTIFY review and form fields), keyed by field id. These are stored on the NOTIFY action, not in the record declaration."
5574
+ ),
5047
5575
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5048
5576
  createdAtLocation: UUID.nullish().describe(
5049
5577
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
@@ -5227,17 +5755,19 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
5227
5755
  /*
5228
5756
  * A draft can name a file that no action references. Such a file stays until
5229
5757
  * the record is deleted or the record's next action sweeps its prefix.
5230
- * DECLARE is available only where one of those is still coming: a created
5231
- * record, which can still be deleted, and a record part way through an edit,
5232
- * which is about to be declared or registered.
5758
+ * Drafts are therefore saved only on a created record, which can still be deleted.
5759
+ * The server refuses them on any other record.
5233
5760
  */
5234
- type: z40.literal(ActionTypes.enum.DECLARE),
5761
+ type: z40.enum([ActionTypes.enum.DECLARE, ActionTypes.enum.NOTIFY]),
5235
5762
  status: z40.enum([
5236
5763
  ActionStatus.Requested,
5237
5764
  ActionStatus.Accepted,
5238
5765
  ActionStatus.Rejected
5239
5766
  ])
5240
5767
  });
5768
+ var RemoteDraft = Draft.extend({
5769
+ action: Draft.shape.action.extend({ type: DraftInput.shape.type })
5770
+ });
5241
5771
 
5242
5772
  // ../commons/src/events/EventInput.ts
5243
5773
  var z41 = __toESM(require("zod/v4"));
@@ -5247,6 +5777,9 @@ var EventInput = z41.object({
5247
5777
  type: z41.string(),
5248
5778
  createdAtLocation: UUID.nullish().describe(
5249
5779
  "Location where the event occurred. Required for system users."
5780
+ ),
5781
+ configVersionId: z41.string().optional().describe(
5782
+ "Id of the event configuration version the client created the record under, e.g. while offline. Must be configured and not take effect in the future. Defaults to the version in effect when the server receives the record."
5250
5783
  )
5251
5784
  }).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
5252
5785
 
@@ -5262,6 +5795,9 @@ var EventDocument = z42.object({
5262
5795
  actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
5263
5796
  trackingId: z42.string().describe(
5264
5797
  "System-generated tracking identifier used to look up the event."
5798
+ ),
5799
+ configVersionId: z42.string().describe(
5800
+ "Id of the event configuration version the record was created under. Every action on the record uses that version. Records created before versioning have 'initial'."
5265
5801
  )
5266
5802
  }).meta({ id: "EventDocument" });
5267
5803
  var EventDocumentOnlyLastAction = EventDocument.extend({
@@ -5281,18 +5817,103 @@ function moveDeclarationToDeclareAction({
5281
5817
  }
5282
5818
  return {
5283
5819
  ...config,
5284
- actions: config.actions.map(
5285
- (action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
5286
- )
5820
+ actions: config.actions.map((action) => {
5821
+ if (action.type !== ActionType.DECLARE) {
5822
+ return action;
5823
+ }
5824
+ const declarationOfAction = action.declaration ?? declaration;
5825
+ if (!declarationOfAction) {
5826
+ throw new Error(`Event '${config.id}' does not define \`declaration\`.`);
5827
+ }
5828
+ return { ...action, declaration: declarationOfAction };
5829
+ })
5287
5830
  };
5288
5831
  }
5832
+ var VERSIONED_EVENT_FIELDS = [
5833
+ "id",
5834
+ "label",
5835
+ "advancedSearch",
5836
+ "versions"
5837
+ ];
5838
+ function validateNoVersionFieldsAtTopLevel(config, ctx) {
5839
+ Object.keys(config).filter((key) => !VERSIONED_EVENT_FIELDS.includes(key)).forEach((key) => {
5840
+ ctx.addIssue({
5841
+ code: "custom",
5842
+ message: `Event '${config.id}' defines \`versions\`, so \`${key}\` must be defined on each version, not at the top level.`,
5843
+ path: [key]
5844
+ });
5845
+ });
5846
+ }
5847
+ function toVersionedInput(config) {
5848
+ if ("versions" in config) {
5849
+ return config;
5850
+ }
5851
+ const { id, label, advancedSearch, ...version } = moveDeclarationToDeclareAction(config);
5852
+ return {
5853
+ id,
5854
+ label,
5855
+ advancedSearch,
5856
+ versions: [{ ...version, id: INITIAL_EVENT_CONFIG_VERSION_ID, label }]
5857
+ };
5858
+ }
5859
+ var WESTERNMOST_TIME_ZONE = "Etc/GMT+12";
5860
+ function validateVersionInEffectToday(config, ctx) {
5861
+ const today = toPlainDateInTimeZone(/* @__PURE__ */ new Date(), WESTERNMOST_TIME_ZONE);
5862
+ const isAnyVersionInEffect = config.versions.some(
5863
+ ({ effectiveFrom }) => effectiveFrom <= today
5864
+ );
5865
+ if (!isAnyVersionInEffect) {
5866
+ ctx.addIssue({
5867
+ code: "custom",
5868
+ message: `Event '${config.id}' has no version in effect today (${today}, UTC\u221212, the last time zone to begin the day). At least one version must omit \`effectiveFrom\` or take effect on or before that date.`,
5869
+ path: ["versions"]
5870
+ });
5871
+ }
5872
+ }
5289
5873
  var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
5290
- if (validateExactlyOneDeclareAction(config, ctx)) {
5291
- validateDeclarationGivenExactlyOnce(config, ctx);
5874
+ if ("versions" in config) {
5875
+ validateNoVersionFieldsAtTopLevel(config, ctx);
5876
+ return;
5292
5877
  }
5293
- }).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
5878
+ const eventCtx = { ...ctx, value: config };
5879
+ if (validateExactlyOneDeclareAction(config, eventCtx)) {
5880
+ validateDeclarationGivenExactlyOnce(config, eventCtx);
5881
+ }
5882
+ }).transform(toVersionedInput).pipe(VersionedEventConfig2).superRefine(validateVersionInEffectToday);
5294
5883
  var defineConfig = (config) => EventConfigDefinition.parse(config);
5295
5884
 
5885
+ // ../commons/src/events/toNotificationForm.ts
5886
+ function toOptionalField(field3) {
5887
+ const { validation: _validation, ...rest } = field3;
5888
+ if (rest.type === FieldType.FIELD_GROUP && "fields" in rest) {
5889
+ return {
5890
+ ...rest,
5891
+ required: false,
5892
+ fields: rest.fields.map(toOptionalField)
5893
+ };
5894
+ }
5895
+ return { ...rest, required: false };
5896
+ }
5897
+ function toNotificationForm(declaration) {
5898
+ return {
5899
+ ...declaration,
5900
+ pages: declaration.pages.map((page) => ({
5901
+ ...page,
5902
+ fields: page.fields.map(
5903
+ toOptionalField
5904
+ )
5905
+ }))
5906
+ };
5907
+ }
5908
+ function toNotificationReview(review) {
5909
+ return {
5910
+ ...review,
5911
+ fields: review.fields.map(
5912
+ toOptionalField
5913
+ )
5914
+ };
5915
+ }
5916
+
5296
5917
  // ../commons/src/events/test.utils.ts
5297
5918
  var import_lodash5 = require("lodash");
5298
5919
  var import_date_fns4 = require("date-fns");
@@ -6541,7 +7162,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6541
7162
  });
6542
7163
 
6543
7164
  // ../commons/src/fixtures/tennis-club-membership-event.ts
6544
- var tennisClubMembershipEvent = defineConfig({
7165
+ var versionedTennisClubMembershipEvent = defineConfig({
6545
7166
  id: TENNIS_CLUB_MEMBERSHIP,
6546
7167
  declaration: TENNIS_CLUB_DECLARATION_FORM,
6547
7168
  label: {
@@ -6600,6 +7221,8 @@ var tennisClubMembershipEvent = defineConfig({
6600
7221
  description: "This is shown as the action name anywhere the user can trigger the action from",
6601
7222
  id: "event.tennis-club-membership.action.notify.label"
6602
7223
  },
7224
+ notificationForm: toNotificationForm(TENNIS_CLUB_DECLARATION_FORM),
7225
+ review: toNotificationReview(TENNIS_CLUB_DECLARATION_REVIEW),
6603
7226
  flags: [
6604
7227
  {
6605
7228
  id: "health-worker-notified",
@@ -6896,9 +7519,12 @@ var tennisClubMembershipEvent = defineConfig({
6896
7519
  }
6897
7520
  ]
6898
7521
  });
7522
+ var tennisClubMembershipEvent = resolveEventConfig(
7523
+ versionedTennisClubMembershipEvent
7524
+ );
6899
7525
 
6900
7526
  // ../commons/src/fixtures/football-club-membership-event.ts
6901
- var footballClubMembershipEvent = defineConfig({
7527
+ var versionedFootballClubMembershipEvent = defineConfig({
6902
7528
  id: "FOOTBALL_CLUB_MEMBERSHIP",
6903
7529
  label: {
6904
7530
  defaultMessage: "Football club membership application",
@@ -7221,6 +7847,9 @@ var footballClubMembershipEvent = defineConfig({
7221
7847
  ],
7222
7848
  declaration: TENNIS_CLUB_DECLARATION_FORM
7223
7849
  });
7850
+ var footballClubMembershipEvent = resolveEventConfig(
7851
+ versionedFootballClubMembershipEvent
7852
+ );
7224
7853
 
7225
7854
  // ../commons/src/fixtures/library-membership-event.ts
7226
7855
  var libraryMembershipForm = defineDeclarationForm({
@@ -7264,7 +7893,7 @@ var libraryMembershipForm = defineDeclarationForm({
7264
7893
  }
7265
7894
  ]
7266
7895
  });
7267
- var libraryMembershipEvent = defineConfig({
7896
+ var versionedLibraryMembershipEvent = defineConfig({
7268
7897
  id: "library-membership",
7269
7898
  label: {
7270
7899
  defaultMessage: "Library membership application",
@@ -7297,6 +7926,9 @@ var libraryMembershipEvent = defineConfig({
7297
7926
  ],
7298
7927
  declaration: libraryMembershipForm
7299
7928
  });
7929
+ var libraryMembershipEvent = resolveEventConfig(
7930
+ versionedLibraryMembershipEvent
7931
+ );
7300
7932
 
7301
7933
  // ../commons/src/fixtures/child-onboarding-event.ts
7302
7934
  function generateTranslationConfig(message) {
@@ -7510,7 +8142,7 @@ var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
7510
8142
  label: generateTranslationConfig("Birth decalration form"),
7511
8143
  pages: [child, mother]
7512
8144
  });
7513
- var ChildOnboardingEvent = defineConfig({
8145
+ var versionedChildOnboardingEvent = defineConfig({
7514
8146
  id: CHILD_ONBOARDING_EVENT,
7515
8147
  title: generateTranslationConfig(
7516
8148
  "{child.name.firstname} {child.name.surname}"
@@ -7538,6 +8170,9 @@ var ChildOnboardingEvent = defineConfig({
7538
8170
  ],
7539
8171
  advancedSearch: []
7540
8172
  });
8173
+ var ChildOnboardingEvent = resolveEventConfig(
8174
+ versionedChildOnboardingEvent
8175
+ );
7541
8176
 
7542
8177
  // ../commons/src/fixtures/digital-identity-issuance-event.ts
7543
8178
  var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
@@ -7726,7 +8361,7 @@ var digitalIdentityForm = defineDeclarationForm({
7726
8361
  }
7727
8362
  ]
7728
8363
  });
7729
- var digitalIdentityEvent = defineConfig({
8364
+ var versionedDigitalIdentityEvent = defineConfig({
7730
8365
  id: "digital-identity",
7731
8366
  label: {
7732
8367
  defaultMessage: "Digital identity issuance",
@@ -7768,6 +8403,9 @@ var digitalIdentityEvent = defineConfig({
7768
8403
  ],
7769
8404
  declaration: digitalIdentityForm
7770
8405
  });
8406
+ var digitalIdentityEvent = resolveEventConfig(
8407
+ versionedDigitalIdentityEvent
8408
+ );
7771
8409
 
7772
8410
  // ../commons/src/events/test.utils.ts
7773
8411
  var z45 = __toESM(require("zod/v4"));
@@ -8234,6 +8872,8 @@ var ACTION_SCOPE_MAP = {
8234
8872
  "record.correct"
8235
8873
  ],
8236
8874
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
8875
+ // Not granted by a scope: the client checks the draft's own action instead
8876
+ [ClientSpecificAction.CONTINUE_DRAFT]: [],
8237
8877
  [ActionType.REJECT_CORRECTION]: ["record.correct"],
8238
8878
  [ActionType.APPROVE_CORRECTION]: ["record.correct"],
8239
8879
  [ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],