@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
@@ -38,23 +38,17 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z46 = __toESM(require("zod/v4"));
42
-
43
- // ../commons/src/url.ts
44
- function joinUrl(base, path) {
45
- const baseWithSlash = base.endsWith("/") ? base : base + "/";
46
- return new URL(path, baseWithSlash);
47
- }
41
+ var z47 = __toESM(require("zod/v4"));
48
42
 
49
43
  // ../commons/src/events/AuditLog.ts
50
- var z5 = __toESM(require("zod/v4"));
44
+ var z9 = __toESM(require("zod/v4"));
51
45
 
52
46
  // ../commons/src/authentication.ts
53
47
  var import_jwt_decode = __toESM(require("jwt-decode"));
54
- var z3 = __toESM(require("zod/v4"));
48
+ var z8 = __toESM(require("zod/v4"));
55
49
 
56
50
  // ../commons/src/scopes.ts
57
- var z2 = __toESM(require("zod/v4"));
51
+ var z7 = __toESM(require("zod/v4"));
58
52
  var qs = __toESM(require("qs"));
59
53
 
60
54
  // ../commons/src/uuid.ts
@@ -65,12 +59,270 @@ function getUUID() {
65
59
  return (0, import_uuid.v4)();
66
60
  }
67
61
 
62
+ // ../commons/src/events/ActionType.ts
63
+ var z2 = __toESM(require("zod/v4"));
64
+ var ActionType = {
65
+ // Pre-declaration actions
66
+ DELETE: "DELETE",
67
+ CREATE: "CREATE",
68
+ NOTIFY: "NOTIFY",
69
+ // Declaration actions
70
+ DECLARE: "DECLARE",
71
+ REGISTER: "REGISTER",
72
+ EDIT: "EDIT",
73
+ // Declaration system actions. Non-configurable.
74
+ DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
75
+ REJECT: "REJECT",
76
+ // REJECT_DECLARATION
77
+ MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
78
+ MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
79
+ ARCHIVE: "ARCHIVE",
80
+ UNARCHIVE: "UNARCHIVE",
81
+ // Record actions
82
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
83
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
84
+ REJECT_CORRECTION: "REJECT_CORRECTION",
85
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
86
+ // General actions
87
+ READ: "READ",
88
+ ASSIGN: "ASSIGN",
89
+ UNASSIGN: "UNASSIGN",
90
+ // Custom action
91
+ CUSTOM: "CUSTOM"
92
+ };
93
+ var ConfirmableActions = [
94
+ ActionType.NOTIFY,
95
+ ActionType.DECLARE,
96
+ ActionType.EDIT,
97
+ ActionType.REGISTER,
98
+ ActionType.REJECT,
99
+ ActionType.ARCHIVE,
100
+ ActionType.UNARCHIVE,
101
+ ActionType.PRINT_CERTIFICATE,
102
+ ActionType.REQUEST_CORRECTION,
103
+ ActionType.APPROVE_CORRECTION,
104
+ ActionType.REJECT_CORRECTION,
105
+ ActionType.CUSTOM
106
+ ];
107
+ var ActionTypes = z2.enum([
108
+ "DELETE",
109
+ "CREATE",
110
+ "NOTIFY",
111
+ "DECLARE",
112
+ "EDIT",
113
+ "REGISTER",
114
+ "DUPLICATE_DETECTED",
115
+ "REJECT",
116
+ "MARK_AS_DUPLICATE",
117
+ "MARK_AS_NOT_DUPLICATE",
118
+ "ARCHIVE",
119
+ "UNARCHIVE",
120
+ "PRINT_CERTIFICATE",
121
+ "REQUEST_CORRECTION",
122
+ "REJECT_CORRECTION",
123
+ "APPROVE_CORRECTION",
124
+ "READ",
125
+ "ASSIGN",
126
+ "UNASSIGN",
127
+ "CUSTOM"
128
+ ]);
129
+ var ClientSpecificAction = {
130
+ REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
131
+ };
132
+ var declarationActionValues = [
133
+ ActionTypes.enum.DECLARE,
134
+ ActionTypes.enum.EDIT,
135
+ ActionTypes.enum.REGISTER,
136
+ ActionTypes.enum.NOTIFY,
137
+ ActionTypes.enum.DUPLICATE_DETECTED
138
+ ];
139
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
140
+ var declarationUpdateActionValues = [
141
+ ...declarationActionValues,
142
+ ActionTypes.enum.REQUEST_CORRECTION
143
+ ];
144
+ var DeclarationUpdateActions = ActionTypes.extract(
145
+ declarationUpdateActionValues
146
+ );
147
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
148
+ var writeActions = ActionTypes.exclude([
149
+ ActionType.CREATE,
150
+ ActionType.READ,
151
+ ActionType.ASSIGN,
152
+ ActionType.UNASSIGN
153
+ ]);
154
+ var WorkqueueActionType = ActionTypes.extract([
155
+ ActionType.READ,
156
+ ActionType.DELETE,
157
+ ActionType.DECLARE,
158
+ ActionType.REGISTER,
159
+ ActionType.EDIT,
160
+ ActionType.REJECT,
161
+ ActionType.MARK_AS_DUPLICATE,
162
+ ActionType.ARCHIVE,
163
+ ActionType.UNARCHIVE,
164
+ ActionType.PRINT_CERTIFICATE,
165
+ ActionType.REQUEST_CORRECTION
166
+ ]);
167
+ var META_ACTIONS = [
168
+ ActionType.ASSIGN,
169
+ ActionType.UNASSIGN,
170
+ ActionType.READ
171
+ ];
172
+
173
+ // ../commons/src/events/ActionStatus.ts
174
+ var ActionStatus = {
175
+ Requested: "Requested",
176
+ Accepted: "Accepted",
177
+ Rejected: "Rejected"
178
+ };
179
+
180
+ // ../commons/src/events/Flag.ts
181
+ var z5 = __toESM(require("zod/v4"));
182
+
183
+ // ../commons/src/events/TranslationConfig.ts
184
+ var z3 = __toESM(require("zod/v4"));
185
+ var TranslationConfig = z3.object({
186
+ id: z3.string().describe(
187
+ "The identifier of the translation referred in translation CSV files"
188
+ ),
189
+ defaultMessage: z3.string().describe("Default translation message"),
190
+ description: z3.string().describe(
191
+ "Describe the translation for a translator to be able to identify it."
192
+ )
193
+ }).meta({
194
+ description: "Translation configuration",
195
+ id: "TranslationConfig"
196
+ });
197
+
198
+ // ../commons/src/events/Conditional.ts
199
+ var z4 = __toESM(require("zod/v4"));
200
+ var Conditional = z4.any().describe("JSONSchema").meta({
201
+ description: "JSON schema conditional configuration",
202
+ id: "Conditional"
203
+ });
204
+ var ConditionalType = {
205
+ SHOW: "SHOW",
206
+ ENABLE: "ENABLE",
207
+ DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
208
+ };
209
+ var ShowConditional = z4.object({
210
+ type: z4.literal(ConditionalType.SHOW),
211
+ conditional: Conditional
212
+ }).describe(
213
+ "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
214
+ );
215
+ var EnableConditional = z4.object({
216
+ type: z4.literal(ConditionalType.ENABLE),
217
+ conditional: Conditional
218
+ }).describe(
219
+ "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
220
+ );
221
+ var ActionConditional = z4.discriminatedUnion("type", [
222
+ // Action can be shown / hidden
223
+ ShowConditional,
224
+ // Action can be shown to the user in the list but as disabled
225
+ EnableConditional
226
+ ]).meta({
227
+ id: "ActionConditional",
228
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
229
+ });
230
+ var DisplayOnReviewConditional = z4.object({
231
+ type: z4.literal(ConditionalType.DISPLAY_ON_REVIEW),
232
+ conditional: Conditional
233
+ }).describe(
234
+ "If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
235
+ );
236
+ var FieldConditional = z4.discriminatedUnion("type", [
237
+ // Field input can be shown / hidden
238
+ ShowConditional,
239
+ // Field input can be shown to the user but as disabled
240
+ EnableConditional,
241
+ // Field output can be shown / hidden on the review page
242
+ DisplayOnReviewConditional
243
+ ]).meta({
244
+ id: "FieldConditional",
245
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
246
+ });
247
+
248
+ // ../commons/src/events/Flag.ts
249
+ var InherentFlags = {
250
+ INCOMPLETE: "incomplete",
251
+ REJECTED: "rejected",
252
+ CORRECTION_REQUESTED: "correction-requested",
253
+ POTENTIAL_DUPLICATE: "potential-duplicate",
254
+ /**
255
+ * This flag is set by the Edit-action and removed after the declaration or registration.
256
+ * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
257
+ *
258
+ * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
259
+ */
260
+ EDIT_IN_PROGRESS: "edit-in-progress"
261
+ };
262
+ var actionFlagPattern;
263
+ function getActionFlagPattern() {
264
+ actionFlagPattern ??= new RegExp(
265
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
266
+ ActionStatus
267
+ ).join("|").toLowerCase()})$`
268
+ );
269
+ return actionFlagPattern;
270
+ }
271
+ var ActionFlag = z5.string().refine((value) => getActionFlagPattern().test(value), {
272
+ message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
273
+ });
274
+ var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).includes(val), {
275
+ message: `Custom flag cannot be one of the inherent flags: ${Object.values(
276
+ InherentFlags
277
+ ).join(", ")}`
278
+ }).refine((val) => !ActionFlag.safeParse(val).success, {
279
+ message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
280
+ }).describe("Custom flag identifier defined by the country config.");
281
+ var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
282
+ var ContainsFlags = z5.object({
283
+ anyOf: z5.array(Flag).optional(),
284
+ noneOf: z5.array(Flag).optional(),
285
+ allOf: z5.array(Flag).optional()
286
+ }).meta({
287
+ id: "ContainsFlags"
288
+ });
289
+ var FlagConfig = z5.object({
290
+ id: CustomFlag,
291
+ requiresAction: z5.boolean().describe(
292
+ "Indicates if this flag expects an action to be performed to be cleared."
293
+ ),
294
+ label: TranslationConfig.describe("Human readable label of the flag.")
295
+ }).meta({
296
+ id: "FlagConfig",
297
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
298
+ });
299
+ var ActionFlagConfig = z5.object({
300
+ id: Flag,
301
+ operation: z5.enum(["add", "remove"]).describe("Operation to perform on the flag."),
302
+ conditional: Conditional.optional().describe(
303
+ "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
304
+ )
305
+ }).meta({
306
+ id: "ActionFlagConfig",
307
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
308
+ });
309
+
310
+ // ../commons/src/events/EventStatus.ts
311
+ var z6 = __toESM(require("zod/v4"));
312
+ var EventStatus = z6.enum([
313
+ "CREATED",
314
+ "NOTIFIED",
315
+ "DECLARED",
316
+ "REGISTERED",
317
+ "ARCHIVED"
318
+ ]);
319
+
68
320
  // ../commons/src/scopes.ts
69
- var JurisdictionFilter = z2.enum(["administrativeArea", "location", "all"]).describe(
321
+ var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
70
322
  "Filters based on user jurisdiction relative to their office location in hierarchy."
71
323
  );
72
- var UserFilter = z2.enum(["user"]).describe("Filters based on the user. Limits to self.");
73
- var RecordScopeTypeV2 = z2.enum([
324
+ var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
325
+ var RecordScopeTypeV2 = z7.enum([
74
326
  "record.search",
75
327
  "record.create",
76
328
  "record.read",
@@ -86,14 +338,21 @@ var RecordScopeTypeV2 = z2.enum([
86
338
  "record.request-correction",
87
339
  "record.correct",
88
340
  "record.unassign-others",
89
- "record.custom-action"
341
+ "record.custom-action",
342
+ "record.action.accept",
343
+ "record.action.reject"
90
344
  ]);
91
- var PlainScopeType = z2.enum([
345
+ var PlainScopeType = z7.enum([
92
346
  // Misc. system scopes
93
347
  "bypassratelimit",
94
348
  "record.reindex",
95
349
  "user.data-seeding",
96
350
  "integration.create",
351
+ // Reading an integration's audit log. Deliberately separate from
352
+ // 'integration.create' so read-only oversight can be granted on its own, and
353
+ // deliberately option-less: system clients have no office and no
354
+ // administrative area, so jurisdiction options would have nothing to bind to.
355
+ "integration.audit.read",
97
356
  "record.import",
98
357
  "config.update-all",
99
358
  "location.edit",
@@ -103,77 +362,87 @@ var PlainScopeType = z2.enum([
103
362
  // Performance dashboard
104
363
  "performance.read",
105
364
  "performance.read-dashboards",
106
- "performance.vital-statistics-export",
107
- // Scopes used exclusively by countryconfig integration token
108
- "record.confirm-registration",
109
- "record.reject-registration"
365
+ "performance.vital-statistics-export"
110
366
  ]);
111
- var scopeByEvent = z2.preprocess(
367
+ var scopeByEvent = z7.preprocess(
112
368
  (val) => val === void 0 ? void 0 : [val].flat(),
113
- z2.array(z2.string()).optional()
369
+ z7.array(z7.string()).optional()
114
370
  ).describe("Event type, e.g. birth, death");
115
- var userRole = z2.preprocess(
371
+ var scopeByStatus = z7.preprocess(
372
+ (val) => val === void 0 ? void 0 : [val].flat(),
373
+ z7.array(EventStatus).optional()
374
+ ).describe(
375
+ "Restricts the scope to records currently in one of these statuses."
376
+ );
377
+ var userRole = z7.preprocess(
116
378
  (val) => val === void 0 ? void 0 : [val].flat(),
117
- z2.array(z2.string()).optional()
379
+ z7.array(z7.string()).optional()
118
380
  ).describe("User role, e.g. admin, field agent");
119
- var scopeOptionsPlaceEvent = z2.object({
381
+ var scopeOptionsPlaceEvent = z7.object({
120
382
  event: scopeByEvent,
121
- placeOfEvent: JurisdictionFilter.optional()
383
+ placeOfEvent: JurisdictionFilter.optional(),
384
+ createdBy: UserFilter.optional(),
385
+ createdIn: JurisdictionFilter.optional()
122
386
  }).describe("Options applicable to all record scopes.");
123
387
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
124
388
  notifiedIn: JurisdictionFilter.optional(),
125
389
  notifiedBy: UserFilter.optional(),
126
390
  declaredIn: JurisdictionFilter.optional(),
127
- declaredBy: UserFilter.optional()
391
+ declaredBy: UserFilter.optional(),
392
+ status: scopeByStatus
128
393
  }).describe("Options applicable to actions that may take place after DECLARE");
129
394
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
130
395
  registeredIn: JurisdictionFilter.optional(),
131
- registeredBy: UserFilter.optional()
396
+ registeredBy: UserFilter.optional(),
397
+ flags: ContainsFlags.optional()
132
398
  }).describe(
133
399
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
134
400
  );
135
401
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
136
- customActionTypes: z2.preprocess(
402
+ customActionTypes: z7.preprocess(
137
403
  (val) => val === void 0 ? void 0 : [val].flat(),
138
- z2.array(z2.string()).optional()
404
+ z7.array(z7.string()).optional()
139
405
  ).describe("Allowed custom action types")
140
406
  });
141
- var AccessLevelOptions = z2.object({
407
+ var AccessLevelOptions = z7.object({
142
408
  accessLevel: JurisdictionFilter.optional()
143
409
  });
144
410
  var AllUserScopeOptions = AccessLevelOptions.extend({
145
411
  role: userRole.optional()
146
412
  });
147
- var WorkqueueOrDashboardOptions = z2.object({
148
- ids: z2.preprocess(
413
+ var WorkqueueOrDashboardOptions = z7.object({
414
+ ids: z7.preprocess(
149
415
  (val) => val === void 0 ? void 0 : [val].flat(),
150
- z2.array(z2.string())
416
+ z7.array(z7.string())
151
417
  ).describe("Must contain a list of workqueue or dashboard ids.")
152
418
  });
153
- var AllScopeOptions = z2.object({
419
+ var AllScopeOptions = z7.object({
154
420
  ...AllRecordScopeOptions.shape,
155
421
  ...AccessLevelOptions.shape,
156
422
  ...AllUserScopeOptions.shape,
157
423
  ...WorkqueueOrDashboardOptions.shape
158
424
  });
159
425
  var ScopeOptionKey = AllScopeOptions.keyof();
160
- var ResolvedScopeOptionsPlaceEvent = z2.object({
426
+ var ResolvedScopeOptionsPlaceEvent = z7.object({
161
427
  event: scopeByEvent,
162
- placeOfEvent: UUID.nullish()
428
+ placeOfEvent: UUID.nullish(),
429
+ createdBy: z7.string().optional(),
430
+ createdIn: UUID.nullish()
163
431
  }).describe(
164
432
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
165
433
  );
166
434
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
167
435
  notifiedIn: UUID.nullish(),
168
- notifiedBy: z2.string().optional(),
436
+ notifiedBy: z7.string().optional(),
169
437
  declaredIn: UUID.nullish(),
170
- declaredBy: z2.string().optional()
438
+ declaredBy: z7.string().optional()
171
439
  }).describe(
172
440
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
173
441
  );
174
442
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
175
443
  registeredIn: UUID.nullish(),
176
- registeredBy: z2.string().optional()
444
+ registeredBy: z7.string().optional(),
445
+ flags: ContainsFlags.optional()
177
446
  }).describe(
178
447
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
179
448
  );
@@ -187,7 +456,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
187
456
  "record.reject",
188
457
  "record.archive",
189
458
  "record.unarchive",
190
- "record.review-duplicates",
191
459
  "record.register"
192
460
  ]);
193
461
  var ScopesWithFullOptions = RecordScopeTypeV2.extract([
@@ -195,41 +463,53 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
195
463
  "record.read",
196
464
  "record.request-correction",
197
465
  "record.correct",
198
- "record.unassign-others"
466
+ "record.unassign-others",
467
+ "record.review-duplicates"
199
468
  ]);
200
469
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
201
- templates: z2.preprocess(
470
+ templates: z7.preprocess(
202
471
  (val) => val === void 0 ? void 0 : [val].flat(),
203
- z2.array(z2.string()).optional()
472
+ z7.array(z7.string()).optional()
204
473
  ).describe(
205
474
  "Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
206
475
  )
207
476
  });
208
- var RecordScopeV2 = z2.discriminatedUnion("type", [
209
- z2.object({
477
+ var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
478
+ "record.action.accept",
479
+ "record.action.reject"
480
+ ]);
481
+ var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
482
+ "Options for confirming (accepting or rejecting) an action."
483
+ );
484
+ var RecordScopeV2 = z7.discriminatedUnion("type", [
485
+ z7.object({
210
486
  type: ScopesWithPlaceEventOptions,
211
487
  options: scopeOptionsPlaceEvent.optional()
212
488
  }),
213
- z2.object({
489
+ z7.object({
214
490
  type: ScopesWithDeclaredOptions,
215
491
  options: scopeOptionsDeclaredOrNotified.optional()
216
492
  }),
217
- z2.object({
493
+ z7.object({
218
494
  type: ScopesWithFullOptions,
219
495
  options: AllRecordScopeOptions.optional()
220
496
  }),
221
- z2.object({
222
- type: z2.literal("record.custom-action"),
497
+ z7.object({
498
+ type: z7.literal("record.custom-action"),
223
499
  options: CustomActionScopeOptions.optional()
224
500
  }),
225
- z2.object({
226
- type: z2.literal("record.print-certified-copies"),
501
+ z7.object({
502
+ type: z7.literal("record.print-certified-copies"),
227
503
  options: ScopeOptionsPrintCertifiedCopies.optional()
504
+ }),
505
+ z7.object({
506
+ type: ActionConfirmationScopeType,
507
+ options: ActionConfirmationScopeOptions.optional()
228
508
  })
229
509
  ]).describe(
230
510
  "Scopes used to check user's permission to perform actions on a record."
231
511
  );
232
- var SystemScopeType = z2.enum([
512
+ var SystemScopeType = z7.enum([
233
513
  "organisation.read-locations",
234
514
  "user.read",
235
515
  "user.create",
@@ -243,61 +523,61 @@ var UserScopeType = SystemScopeType.extract([
243
523
  "user.search"
244
524
  ]);
245
525
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
246
- var UserScopeV2 = z2.discriminatedUnion("type", [
247
- z2.object({
526
+ var UserScopeV2 = z7.discriminatedUnion("type", [
527
+ z7.object({
248
528
  type: ScopesWithRoleOption,
249
529
  options: AllUserScopeOptions.optional()
250
530
  }),
251
- z2.object({
531
+ z7.object({
252
532
  type: UserScopeType.extract(["user.read", "user.search"]),
253
533
  options: AccessLevelOptions.optional()
254
534
  })
255
535
  ]);
256
- var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
257
- z2.object({
536
+ var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
537
+ z7.object({
258
538
  type: ScopesWithPlaceEventOptions,
259
539
  options: ResolvedScopeOptionsPlaceEvent.optional()
260
540
  }),
261
- z2.object({
541
+ z7.object({
262
542
  type: ScopesWithDeclaredOptions,
263
543
  options: ResolvedScopeOptionsDeclared.optional()
264
544
  }),
265
- z2.object({
545
+ z7.object({
266
546
  type: ScopesWithFullOptions,
267
547
  options: ResolvedScopeOptionsFull.optional()
268
548
  }),
269
- z2.object({
270
- type: z2.literal("record.print-certified-copies"),
549
+ z7.object({
550
+ type: z7.literal("record.print-certified-copies"),
271
551
  options: ResolvedScopeOptionsFull.extend({
272
- templates: z2.array(z2.string()).optional()
552
+ templates: z7.array(z7.string()).optional()
273
553
  }).optional()
274
554
  })
275
555
  ]).describe("Resolved scope with location/user IDs instead of filters.");
276
- var Scope = z2.discriminatedUnion("type", [
277
- z2.object({ type: PlainScopeType }),
556
+ var Scope = z7.discriminatedUnion("type", [
557
+ z7.object({ type: PlainScopeType }),
278
558
  ...RecordScopeV2.options,
279
559
  ...UserScopeV2.options,
280
- z2.object({
281
- type: z2.literal("organisation.read-locations"),
560
+ z7.object({
561
+ type: z7.literal("organisation.read-locations"),
282
562
  options: AccessLevelOptions.optional()
283
563
  }),
284
- z2.object({
285
- type: z2.literal("workqueue"),
564
+ z7.object({
565
+ type: z7.literal("workqueue"),
286
566
  options: WorkqueueOrDashboardOptions
287
567
  }),
288
- z2.object({
289
- type: z2.literal("dashboard.view"),
568
+ z7.object({
569
+ type: z7.literal("dashboard.view"),
290
570
  options: WorkqueueOrDashboardOptions
291
571
  })
292
572
  ]);
293
- var ScopeType = z2.enum([
573
+ var ScopeType = z7.enum([
294
574
  ...SystemScopeType.options,
295
575
  ...RecordScopeTypeV2.options,
296
576
  ...PlainScopeType.options,
297
577
  "workqueue",
298
578
  "dashboard.view"
299
579
  ]);
300
- var EncodedScope = z2.string().brand("EncodedScope");
580
+ var EncodedScope = z7.string().brand("EncodedScope");
301
581
  var DEFAULT_SCOPE_OPTIONS = {
302
582
  placeOfEvent: JurisdictionFilter.enum.all,
303
583
  accessLevel: JurisdictionFilter.enum.all,
@@ -307,162 +587,51 @@ var DEFAULT_SCOPE_OPTIONS = {
307
587
  };
308
588
 
309
589
  // ../commons/src/authentication.ts
310
- var TokenUserType = z3.enum(["user", "system"]);
311
- var TokenWithBearer = z3.string().regex(/^Bearer\s/);
312
-
313
- // ../commons/src/events/ActionType.ts
314
- var z4 = __toESM(require("zod/v4"));
315
- var ActionType = {
316
- // Pre-declaration actions
317
- DELETE: "DELETE",
318
- CREATE: "CREATE",
319
- NOTIFY: "NOTIFY",
320
- // Declaration actions
321
- DECLARE: "DECLARE",
322
- REGISTER: "REGISTER",
323
- EDIT: "EDIT",
324
- // Declaration system actions. Non-configurable.
325
- DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
326
- REJECT: "REJECT",
327
- // REJECT_DECLARATION
328
- MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
329
- MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
330
- ARCHIVE: "ARCHIVE",
331
- UNARCHIVE: "UNARCHIVE",
332
- // Record actions
333
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
334
- REQUEST_CORRECTION: "REQUEST_CORRECTION",
335
- REJECT_CORRECTION: "REJECT_CORRECTION",
336
- APPROVE_CORRECTION: "APPROVE_CORRECTION",
337
- // General actions
338
- READ: "READ",
339
- ASSIGN: "ASSIGN",
340
- UNASSIGN: "UNASSIGN",
341
- // Custom action
342
- CUSTOM: "CUSTOM"
343
- };
344
- var ConfirmableActions = [
345
- ActionType.NOTIFY,
346
- ActionType.DECLARE,
347
- ActionType.EDIT,
348
- ActionType.REGISTER,
349
- ActionType.REJECT,
350
- ActionType.ARCHIVE,
351
- ActionType.UNARCHIVE,
352
- ActionType.PRINT_CERTIFICATE,
353
- ActionType.REQUEST_CORRECTION,
354
- ActionType.APPROVE_CORRECTION,
355
- ActionType.REJECT_CORRECTION,
356
- ActionType.CUSTOM
357
- ];
358
- var ActionTypes = z4.enum([
359
- "DELETE",
360
- "CREATE",
361
- "NOTIFY",
362
- "DECLARE",
363
- "EDIT",
364
- "REGISTER",
365
- "DUPLICATE_DETECTED",
366
- "REJECT",
367
- "MARK_AS_DUPLICATE",
368
- "MARK_AS_NOT_DUPLICATE",
369
- "ARCHIVE",
370
- "UNARCHIVE",
371
- "PRINT_CERTIFICATE",
372
- "REQUEST_CORRECTION",
373
- "REJECT_CORRECTION",
374
- "APPROVE_CORRECTION",
375
- "READ",
376
- "ASSIGN",
377
- "UNASSIGN",
378
- "CUSTOM"
379
- ]);
380
- var ClientSpecificAction = {
381
- REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
382
- };
383
- var declarationActionValues = [
384
- ActionTypes.enum.DECLARE,
385
- ActionTypes.enum.EDIT,
386
- ActionTypes.enum.REGISTER,
387
- ActionTypes.enum.NOTIFY,
388
- ActionTypes.enum.DUPLICATE_DETECTED
389
- ];
390
- var DeclarationActions = ActionTypes.extract(declarationActionValues);
391
- var declarationUpdateActionValues = [
392
- ...declarationActionValues,
393
- ActionTypes.enum.REQUEST_CORRECTION
394
- ];
395
- var DeclarationUpdateActions = ActionTypes.extract(
396
- declarationUpdateActionValues
397
- );
398
- var annotationActions = ActionTypes.exclude(declarationActionValues);
399
- var writeActions = ActionTypes.exclude([
400
- ActionType.CREATE,
401
- ActionType.READ,
402
- ActionType.ASSIGN,
403
- ActionType.UNASSIGN
404
- ]);
405
- var WorkqueueActionType = ActionTypes.extract([
406
- ActionType.READ,
407
- ActionType.DELETE,
408
- ActionType.DECLARE,
409
- ActionType.REGISTER,
410
- ActionType.EDIT,
411
- ActionType.REJECT,
412
- ActionType.MARK_AS_DUPLICATE,
413
- ActionType.ARCHIVE,
414
- ActionType.UNARCHIVE,
415
- ActionType.PRINT_CERTIFICATE,
416
- ActionType.REQUEST_CORRECTION
417
- ]);
418
- var META_ACTIONS = [
419
- ActionType.ASSIGN,
420
- ActionType.UNASSIGN,
421
- ActionType.READ
422
- ];
590
+ var TokenUserType = z8.enum(["user", "system"]);
591
+ var TokenWithBearer = z8.string().regex(/^Bearer\s/);
423
592
 
424
593
  // ../commons/src/events/AuditLog.ts
425
- var AuditLogEntryBase = z5.object({
426
- id: z5.string(),
427
- clientId: z5.string(),
594
+ var AuditLogEntryBase = z9.object({
595
+ id: z9.string(),
596
+ clientId: z9.string(),
428
597
  clientType: TokenUserType,
429
- createdAt: z5.string()
598
+ createdAt: z9.string()
430
599
  });
431
600
  var EventCreateEntrySchema = AuditLogEntryBase.extend({
432
- operation: z5.literal("event.create"),
433
- requestData: z5.object({
434
- transactionId: z5.string(),
435
- type: z5.string(),
436
- createdAtLocation: z5.string().nullable()
601
+ operation: z9.literal("event.create"),
602
+ requestData: z9.object({
603
+ transactionId: z9.string(),
604
+ type: z9.string(),
605
+ createdAtLocation: z9.string().nullable()
437
606
  }),
438
- responseSummary: z5.object({
439
- eventId: z5.string(),
440
- trackingId: z5.string()
607
+ responseSummary: z9.object({
608
+ eventId: z9.string(),
609
+ trackingId: z9.string()
441
610
  })
442
611
  });
443
612
  var EventGetEntrySchema = AuditLogEntryBase.extend({
444
- operation: z5.literal("event.get"),
445
- requestData: z5.object({ eventId: z5.string() }),
446
- responseSummary: z5.object({
447
- eventType: z5.string(),
448
- trackingId: z5.string()
613
+ operation: z9.literal("event.get"),
614
+ requestData: z9.object({ eventId: z9.string() }),
615
+ responseSummary: z9.object({
616
+ eventType: z9.string(),
617
+ trackingId: z9.string()
449
618
  })
450
619
  });
451
620
  var EventSearchEntrySchema = AuditLogEntryBase.extend({
452
- operation: z5.literal("event.search"),
453
- clientType: z5.literal("system"),
454
- requestData: z5.object({
455
- query: z5.record(z5.string(), z5.unknown()).nullable(),
456
- limit: z5.number().nullable(),
457
- offset: z5.number().nullable()
621
+ operation: z9.literal("event.search"),
622
+ clientType: z9.literal("system"),
623
+ requestData: z9.object({
624
+ query: z9.record(z9.string(), z9.unknown()).nullable(),
625
+ limit: z9.number().nullable(),
626
+ offset: z9.number().nullable()
458
627
  }),
459
- responseSummary: z5.object({
460
- total: z5.number(),
461
- eventIds: z5.array(z5.string())
628
+ responseSummary: z9.object({
629
+ total: z9.number(),
630
+ eventIds: z9.array(z9.string())
462
631
  })
463
632
  });
464
633
  var EventActionEntrySchema = AuditLogEntryBase.extend({
465
- operation: z5.enum([
634
+ operation: z9.enum([
466
635
  "event.actions.notify.request",
467
636
  "event.actions.declare.request",
468
637
  "event.actions.register.request",
@@ -482,159 +651,160 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
482
651
  "event.actions.mark_as_duplicate.request",
483
652
  "event.actions.mark_as_not_duplicate.request"
484
653
  ]),
485
- requestData: z5.object({
486
- eventId: z5.string(),
487
- actionType: z5.string(),
488
- eventType: z5.string(),
489
- trackingId: z5.string(),
490
- transactionId: z5.string()
654
+ requestData: z9.object({
655
+ eventId: z9.string(),
656
+ actionType: z9.string(),
657
+ eventType: z9.string(),
658
+ trackingId: z9.string(),
659
+ transactionId: z9.string()
491
660
  })
492
661
  });
493
662
  var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
494
- operation: z5.literal("event.actions.custom.request"),
495
- requestData: z5.object({
496
- eventId: z5.string(),
497
- actionType: z5.literal(ActionType.CUSTOM),
498
- customAction: z5.string(),
499
- eventType: z5.string(),
500
- trackingId: z5.string(),
501
- transactionId: z5.string()
663
+ operation: z9.literal("event.actions.custom.request"),
664
+ requestData: z9.object({
665
+ eventId: z9.string(),
666
+ actionType: z9.literal(ActionType.CUSTOM),
667
+ customAction: z9.string(),
668
+ eventType: z9.string(),
669
+ trackingId: z9.string(),
670
+ transactionId: z9.string()
502
671
  })
503
672
  });
504
673
  var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
505
- operation: z5.literal("integrations.create"),
506
- requestData: z5.object({ name: z5.string(), scopes: z5.array(z5.string()) }),
507
- responseSummary: z5.object({ clientId: z5.string() })
674
+ operation: z9.literal("integrations.create"),
675
+ requestData: z9.object({ name: z9.string(), scopes: z9.array(z9.string()) }),
676
+ responseSummary: z9.object({ clientId: z9.string() })
508
677
  });
509
678
  var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
510
- operation: z5.literal("integrations.refreshToken"),
511
- requestData: z5.object({ clientId: z5.string() }),
512
- responseSummary: z5.object({ clientId: z5.string() })
679
+ operation: z9.literal("integrations.refreshToken"),
680
+ requestData: z9.object({ clientId: z9.string() }),
681
+ responseSummary: z9.object({ clientId: z9.string() })
513
682
  });
514
683
  var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
515
- operation: z5.literal("integrations.deactivate"),
516
- requestData: z5.object({ id: z5.string() }),
517
- responseSummary: z5.object({ id: z5.string(), status: z5.string() })
684
+ operation: z9.literal("integrations.deactivate"),
685
+ requestData: z9.object({ id: z9.string() }),
686
+ responseSummary: z9.object({ id: z9.string(), status: z9.string() })
518
687
  });
519
688
  var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
520
- operation: z5.literal("integrations.activate"),
521
- requestData: z5.object({ id: z5.string() }),
522
- responseSummary: z5.object({ id: z5.string(), status: z5.string() })
689
+ operation: z9.literal("integrations.activate"),
690
+ requestData: z9.object({ id: z9.string() }),
691
+ responseSummary: z9.object({ id: z9.string(), status: z9.string() })
523
692
  });
524
693
  var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
525
- operation: z5.literal("integrations.delete"),
526
- requestData: z5.object({ id: z5.string() }),
527
- responseSummary: z5.object({ id: z5.string(), name: z5.string() })
694
+ operation: z9.literal("integrations.delete"),
695
+ requestData: z9.object({ id: z9.string() }),
696
+ responseSummary: z9.object({ id: z9.string(), name: z9.string() })
528
697
  });
529
698
  var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
530
- operation: z5.literal("integrations.refreshSecret"),
531
- requestData: z5.object({ id: z5.string() }),
532
- responseSummary: z5.object({ clientId: z5.string() })
699
+ operation: z9.literal("integrations.refreshSecret"),
700
+ requestData: z9.object({ id: z9.string() }),
701
+ responseSummary: z9.object({ clientId: z9.string() })
533
702
  });
534
703
  var createdVersionFields = {
535
- id: z5.string(),
536
- versionId: z5.string(),
537
- name: z5.string(),
538
- externalId: z5.string().nullish(),
539
- effectiveFrom: z5.string(),
540
- status: z5.string()
704
+ id: z9.string(),
705
+ versionId: z9.string(),
706
+ name: z9.string(),
707
+ externalId: z9.string().nullish(),
708
+ effectiveFrom: z9.string(),
709
+ status: z9.string()
541
710
  };
542
711
  var LocationCreateEntrySchema = AuditLogEntryBase.extend({
543
- operation: z5.literal("locations.create"),
544
- requestData: z5.object({
712
+ operation: z9.literal("locations.create"),
713
+ requestData: z9.object({
545
714
  ...createdVersionFields,
546
- administrativeAreaId: z5.string().nullish(),
547
- locationType: z5.string().nullish()
715
+ administrativeAreaId: z9.string().nullish(),
716
+ locationType: z9.string().nullish()
548
717
  })
549
718
  });
550
719
  var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
551
- operation: z5.literal("administrativeAreas.create"),
552
- requestData: z5.object({
720
+ operation: z9.literal("administrativeAreas.create"),
721
+ requestData: z9.object({
553
722
  ...createdVersionFields,
554
- parentId: z5.string().nullish()
723
+ parentId: z9.string().nullish()
555
724
  })
556
725
  });
557
- var ChangedStringField = z5.object({ from: z5.string(), to: z5.string() });
558
- var ChangedNullableStringField = z5.object({
559
- from: z5.string().nullable(),
560
- to: z5.string().nullable()
561
- });
562
- var updatedVersionRequestData = z5.object({
563
- id: z5.string(),
564
- versionId: z5.string(),
565
- name: z5.string(),
566
- externalId: z5.string().nullish(),
567
- status: z5.string(),
568
- effectiveFrom: z5.string(),
569
- lastVersionId: z5.string()
570
- });
571
- var updatedVersionResponseSummary = z5.object({
572
- previousVersionId: z5.string(),
573
- versionId: z5.string(),
574
- changed: z5.object({
726
+ var ChangedStringField = z9.object({ from: z9.string(), to: z9.string() });
727
+ var ChangedNullableStringField = z9.object({
728
+ from: z9.string().nullable(),
729
+ to: z9.string().nullable()
730
+ });
731
+ var updatedVersionRequestData = z9.object({
732
+ id: z9.string(),
733
+ versionId: z9.string(),
734
+ name: z9.string(),
735
+ externalId: z9.string().nullish(),
736
+ status: z9.string(),
737
+ effectiveFrom: z9.string(),
738
+ lastVersionId: z9.string()
739
+ });
740
+ var updatedVersionResponseSummary = z9.object({
741
+ previousVersionId: z9.string(),
742
+ versionId: z9.string(),
743
+ changed: z9.object({
575
744
  name: ChangedStringField.optional(),
576
745
  externalId: ChangedNullableStringField.optional(),
577
746
  status: ChangedStringField.optional()
578
747
  })
579
748
  });
580
749
  var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
581
- operation: z5.literal("locations.update"),
750
+ operation: z9.literal("locations.update"),
582
751
  requestData: updatedVersionRequestData,
583
752
  responseSummary: updatedVersionResponseSummary
584
753
  });
585
754
  var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
586
- operation: z5.literal("administrativeAreas.update"),
755
+ operation: z9.literal("administrativeAreas.update"),
587
756
  requestData: updatedVersionRequestData,
588
757
  responseSummary: updatedVersionResponseSummary
589
758
  });
590
- var withdrawVersionRequestData = z5.object({
591
- id: z5.string(),
592
- versionId: z5.string()
759
+ var withdrawVersionRequestData = z9.object({
760
+ id: z9.string(),
761
+ versionId: z9.string()
593
762
  });
594
- var withdrawVersionResponseSummary = z5.object({
595
- effectiveFrom: z5.string(),
596
- name: z5.string(),
597
- externalId: z5.string().nullish(),
598
- status: z5.string()
763
+ var withdrawVersionResponseSummary = z9.object({
764
+ effectiveFrom: z9.string(),
765
+ name: z9.string(),
766
+ externalId: z9.string().nullish(),
767
+ status: z9.string()
599
768
  });
600
769
  var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
601
- operation: z5.literal("locations.withdrawVersion"),
770
+ operation: z9.literal("locations.withdrawVersion"),
602
771
  requestData: withdrawVersionRequestData,
603
772
  responseSummary: withdrawVersionResponseSummary
604
773
  });
605
774
  var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
606
- operation: z5.literal("administrativeAreas.withdrawVersion"),
775
+ operation: z9.literal("administrativeAreas.withdrawVersion"),
607
776
  requestData: withdrawVersionRequestData,
608
777
  responseSummary: withdrawVersionResponseSummary
609
778
  });
610
779
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
611
- operation: z5.literal("attachments.upload"),
612
- requestData: z5.object({
613
- transactionId: z5.string(),
614
- path: z5.string().nullable()
780
+ operation: z9.literal("attachments.upload"),
781
+ requestData: z9.object({
782
+ transactionId: z9.string(),
783
+ eventId: z9.string().optional(),
784
+ path: z9.string().nullable()
615
785
  }),
616
- responseSummary: z5.object({ fileUrl: z5.string() })
786
+ responseSummary: z9.object({ fileUrl: z9.string() })
617
787
  });
618
- var subjectOnly = z5.object({ subjectId: z5.string() });
619
- var subjectWithReason = z5.object({
620
- subjectId: z5.string(),
621
- reason: z5.string(),
622
- comment: z5.string().optional()
788
+ var subjectOnly = z9.object({ subjectId: z9.string() });
789
+ var subjectWithReason = z9.object({
790
+ subjectId: z9.string(),
791
+ reason: z9.string(),
792
+ comment: z9.string().optional()
623
793
  });
624
794
  var UserCreateEntrySchema = AuditLogEntryBase.extend({
625
- operation: z5.literal("user.create_user"),
626
- requestData: z5.object({
627
- subjectId: z5.string(),
628
- role: z5.string(),
629
- primaryOfficeId: z5.string()
795
+ operation: z9.literal("user.create_user"),
796
+ requestData: z9.object({
797
+ subjectId: z9.string(),
798
+ role: z9.string(),
799
+ primaryOfficeId: z9.string()
630
800
  })
631
801
  });
632
802
  var UserReasonEntrySchema = AuditLogEntryBase.extend({
633
- operation: z5.enum(["user.deactivate", "user.reactivate"]),
803
+ operation: z9.enum(["user.deactivate", "user.reactivate"]),
634
804
  requestData: subjectWithReason
635
805
  });
636
806
  var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
637
- operation: z5.enum([
807
+ operation: z9.enum([
638
808
  "user.edit_user",
639
809
  "user.logged_in",
640
810
  "user.logged_out",
@@ -648,14 +818,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
648
818
  requestData: subjectOnly
649
819
  });
650
820
  var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
651
- operation: z5.literal("user.email_address_changed"),
821
+ operation: z9.literal("user.email_address_changed"),
652
822
  requestData: subjectOnly,
653
- responseSummary: z5.object({ email: z5.string() })
823
+ responseSummary: z9.object({ email: z9.string() })
654
824
  });
655
825
  var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
656
- operation: z5.literal("user.phone_number_changed"),
826
+ operation: z9.literal("user.phone_number_changed"),
657
827
  requestData: subjectOnly,
658
- responseSummary: z5.object({ phoneNumber: z5.string() })
828
+ responseSummary: z9.object({ phoneNumber: z9.string() })
659
829
  });
660
830
  var userBaseOmit = {
661
831
  id: true,
@@ -663,14 +833,14 @@ var userBaseOmit = {
663
833
  clientType: true,
664
834
  createdAt: true
665
835
  };
666
- var UserAuditRecordInput = z5.discriminatedUnion("operation", [
836
+ var UserAuditRecordInput = z9.discriminatedUnion("operation", [
667
837
  UserCreateEntrySchema.omit(userBaseOmit),
668
838
  UserReasonEntrySchema.omit(userBaseOmit),
669
839
  UserSubjectOnlyEntrySchema.omit(userBaseOmit),
670
840
  UserEmailChangedEntrySchema.omit(userBaseOmit),
671
841
  UserPhoneChangedEntrySchema.omit(userBaseOmit)
672
842
  ]);
673
- var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
843
+ var AuditLogEntrySchema = z9.discriminatedUnion("operation", [
674
844
  EventCreateEntrySchema,
675
845
  EventGetEntrySchema,
676
846
  EventSearchEntrySchema,
@@ -701,78 +871,13 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
701
871
  var CHILD_ONBOARDING_EVENT = "child-onboarding";
702
872
 
703
873
  // ../commons/src/events/ActionConfig.ts
704
- var z24 = __toESM(require("zod/v4"));
705
-
706
- // ../commons/src/events/TranslationConfig.ts
707
- var z6 = __toESM(require("zod/v4"));
708
- var TranslationConfig = z6.object({
709
- id: z6.string().describe(
710
- "The identifier of the translation referred in translation CSV files"
711
- ),
712
- defaultMessage: z6.string().describe("Default translation message"),
713
- description: z6.string().describe(
714
- "Describe the translation for a translator to be able to identify it."
715
- )
716
- }).meta({
717
- description: "Translation configuration",
718
- id: "TranslationConfig"
719
- });
874
+ var z25 = __toESM(require("zod/v4"));
720
875
 
721
876
  // ../commons/src/events/FieldConfig.ts
722
877
  var import_v43 = __toESM(require("zod/v4"));
723
878
 
724
- // ../commons/src/events/Conditional.ts
725
- var z7 = __toESM(require("zod/v4"));
726
- var Conditional = z7.any().describe("JSONSchema").meta({
727
- description: "JSON schema conditional configuration",
728
- id: "Conditional"
729
- });
730
- var ConditionalType = {
731
- SHOW: "SHOW",
732
- ENABLE: "ENABLE",
733
- DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
734
- };
735
- var ShowConditional = z7.object({
736
- type: z7.literal(ConditionalType.SHOW),
737
- conditional: Conditional
738
- }).describe(
739
- "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
740
- );
741
- var EnableConditional = z7.object({
742
- type: z7.literal(ConditionalType.ENABLE),
743
- conditional: Conditional
744
- }).describe(
745
- "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
746
- );
747
- var ActionConditional = z7.discriminatedUnion("type", [
748
- // Action can be shown / hidden
749
- ShowConditional,
750
- // Action can be shown to the user in the list but as disabled
751
- EnableConditional
752
- ]).meta({
753
- id: "ActionConditional",
754
- description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
755
- });
756
- var DisplayOnReviewConditional = z7.object({
757
- type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
758
- conditional: Conditional
759
- }).describe(
760
- "If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
761
- );
762
- var FieldConditional = z7.discriminatedUnion("type", [
763
- // Field input can be shown / hidden
764
- ShowConditional,
765
- // Field input can be shown to the user but as disabled
766
- EnableConditional,
767
- // Field output can be shown / hidden on the review page
768
- DisplayOnReviewConditional
769
- ]).meta({
770
- id: "FieldConditional",
771
- description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
772
- });
773
-
774
879
  // ../commons/src/events/FieldType.ts
775
- var z8 = __toESM(require("zod/v4"));
880
+ var z10 = __toESM(require("zod/v4"));
776
881
  var FieldType = {
777
882
  NAME: "NAME",
778
883
  PHONE: "PHONE",
@@ -836,7 +941,7 @@ var FieldType = {
836
941
  */
837
942
  _EXPERIMENTAL_CUSTOM: "CUSTOM"
838
943
  };
839
- var FileFieldType = z8.enum([
944
+ var FileFieldType = z10.enum([
840
945
  FieldType.FILE,
841
946
  FieldType.FILE_WITH_OPTIONS,
842
947
  FieldType.SIGNATURE
@@ -872,160 +977,161 @@ var HiddenFieldTypes = [
872
977
  ];
873
978
 
874
979
  // ../commons/src/events/FieldValue.ts
875
- var z12 = __toESM(require("zod/v4"));
980
+ var z14 = __toESM(require("zod/v4"));
876
981
 
877
982
  // ../commons/src/documents.ts
878
- var z9 = __toESM(require("zod/v4"));
879
- var FullDocumentUrl = z9.string().brand("FullDocumentUrl").describe(
983
+ var z11 = __toESM(require("zod/v4"));
984
+ var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
880
985
  "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"
881
986
  );
882
- var FullDocumentPath = z9.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
987
+ var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
883
988
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
884
989
  );
885
- var DocumentPath = z9.string().brand("DocumentPath").describe(
990
+ var DocumentPath = z11.string().brand("DocumentPath").describe(
886
991
  "A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
887
992
  );
888
993
 
889
994
  // ../commons/src/events/CompositeFieldValue.ts
890
- var z10 = __toESM(require("zod/v4"));
995
+ var z12 = __toESM(require("zod/v4"));
891
996
  var AddressType = {
892
997
  DOMESTIC: "DOMESTIC",
893
998
  INTERNATIONAL: "INTERNATIONAL"
894
999
  };
895
- var FileFieldValue = z10.object({
1000
+ var FileFieldValue = z12.object({
896
1001
  path: DocumentPath,
897
- originalFilename: z10.string(),
898
- type: z10.string()
899
- });
900
- var NameFieldValue = z10.object({
901
- firstname: z10.string(),
902
- surname: z10.string(),
903
- middlename: z10.string().optional()
904
- });
905
- var NameFieldUpdateValue = z10.object({
906
- firstname: z10.string().nullish(),
907
- surname: z10.string().nullish(),
908
- middlename: z10.string().nullish()
909
- }).or(z10.null()).or(z10.undefined());
910
- var StreetLevelDetailsValue = z10.record(z10.string(), z10.string()).optional();
911
- var StreetLevelDetailsUpdateValue = z10.record(z10.string(), z10.string().nullable()).nullish();
912
- var BaseAddressFieldValue = z10.object({
913
- country: z10.string(),
1002
+ originalFilename: z12.string(),
1003
+ type: z12.string()
1004
+ });
1005
+ var NameFieldValue = z12.object({
1006
+ firstname: z12.string(),
1007
+ surname: z12.string(),
1008
+ middlename: z12.string().optional()
1009
+ });
1010
+ var NameFieldUpdateValue = z12.object({
1011
+ firstname: z12.string().nullish(),
1012
+ surname: z12.string().nullish(),
1013
+ middlename: z12.string().nullish()
1014
+ }).or(z12.null()).or(z12.undefined());
1015
+ var StreetLevelDetailsValue = z12.record(z12.string(), z12.string()).optional();
1016
+ var StreetLevelDetailsUpdateValue = z12.record(z12.string(), z12.string().nullable()).nullish();
1017
+ var BaseAddressFieldValue = z12.object({
1018
+ country: z12.string(),
914
1019
  streetLevelDetails: StreetLevelDetailsValue
915
1020
  });
916
- var BaseAddressFieldUpdateValue = z10.object({
917
- country: z10.string().nullish(),
1021
+ var BaseAddressFieldUpdateValue = z12.object({
1022
+ country: z12.string().nullish(),
918
1023
  streetLevelDetails: StreetLevelDetailsUpdateValue
919
1024
  });
920
1025
  var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
921
- addressType: z10.literal(AddressType.DOMESTIC),
922
- administrativeArea: z10.string().uuid()
1026
+ addressType: z12.literal(AddressType.DOMESTIC),
1027
+ administrativeArea: z12.string().uuid()
923
1028
  });
924
1029
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
925
- addressType: z10.literal(AddressType.INTERNATIONAL)
1030
+ addressType: z12.literal(AddressType.INTERNATIONAL)
926
1031
  });
927
- var AddressFieldValue = z10.discriminatedUnion("addressType", [
1032
+ var AddressFieldValue = z12.discriminatedUnion("addressType", [
928
1033
  DomesticAddressFieldValue,
929
1034
  InternationalAddressFieldValue
930
1035
  ]);
931
1036
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
932
- addressType: z10.literal(AddressType.DOMESTIC),
933
- administrativeArea: z10.string().uuid().nullish()
1037
+ addressType: z12.literal(AddressType.DOMESTIC),
1038
+ administrativeArea: z12.string().uuid().nullish()
934
1039
  /* Leaf level admin structure */
935
1040
  });
936
1041
  var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
937
1042
  {
938
- addressType: z10.literal(AddressType.INTERNATIONAL)
1043
+ addressType: z12.literal(AddressType.INTERNATIONAL)
939
1044
  }
940
1045
  );
941
- var AddressFieldUpdateValue = z10.discriminatedUnion("addressType", [
1046
+ var AddressFieldUpdateValue = z12.discriminatedUnion("addressType", [
942
1047
  DomesticAddressUpdateFieldValue,
943
1048
  InternationalAddressUpdateFieldValue
944
1049
  ]).nullish();
945
- var FileFieldValueWithOption = z10.object({
1050
+ var FileFieldValueWithOption = z12.object({
946
1051
  path: DocumentPath,
947
- originalFilename: z10.string(),
948
- type: z10.string(),
949
- option: z10.string()
950
- });
951
- var FileFieldWithOptionValue = z10.array(FileFieldValueWithOption);
952
- var HttpFieldValue = z10.object({
953
- loading: z10.boolean(),
954
- error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
955
- data: z10.any()
956
- });
957
- var HttpFieldUpdateValue = z10.object({
958
- loading: z10.boolean().nullish(),
959
- error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
960
- data: z10.any().nullish()
961
- }).or(z10.null()).or(z10.undefined());
962
- var QueryParamReaderFieldValue = z10.object({
963
- data: z10.record(z10.string(), z10.string()),
964
- updatedAt: z10.iso.datetime()
1052
+ originalFilename: z12.string(),
1053
+ type: z12.string(),
1054
+ option: z12.string()
1055
+ });
1056
+ var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
1057
+ var HttpFieldValue = z12.object({
1058
+ loading: z12.boolean(),
1059
+ error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
1060
+ data: z12.any()
1061
+ });
1062
+ var HttpFieldUpdateValue = z12.object({
1063
+ loading: z12.boolean().nullish(),
1064
+ error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
1065
+ data: z12.any().nullish()
1066
+ }).or(z12.null()).or(z12.undefined());
1067
+ var QueryParamReaderFieldValue = z12.object({
1068
+ data: z12.record(z12.string(), z12.string()),
1069
+ updatedAt: z12.iso.datetime()
965
1070
  }).nullish();
966
- var QueryParamReaderFieldUpdateValue = z10.object({
967
- data: z10.record(z10.string(), z10.string())
1071
+ var QueryParamReaderFieldUpdateValue = z12.object({
1072
+ data: z12.record(z12.string(), z12.string())
968
1073
  });
969
- var ReadDataValue = z10.object({
970
- data: z10.any()
1074
+ var ReadDataValue = z12.object({
1075
+ data: z12.any()
971
1076
  });
972
1077
  var QrReaderFieldValue = ReadDataValue;
973
1078
  var IdReaderFieldValue = ReadDataValue;
974
- var NumberWithUnitFieldValue = z10.object({
975
- numericValue: z10.number(),
976
- unit: z10.string()
1079
+ var NumberWithUnitFieldValue = z12.object({
1080
+ numericValue: z12.number(),
1081
+ unit: z12.string()
977
1082
  });
978
- var NumberWithUnitFieldUpdateValue = z10.object({
979
- numericValue: z10.number().optional(),
980
- unit: z10.string().optional()
1083
+ var NumberWithUnitFieldUpdateValue = z12.object({
1084
+ numericValue: z12.number().optional(),
1085
+ unit: z12.string().optional()
981
1086
  });
982
- var CustomFieldValue = z10.unknown().brand("CustomFieldValue");
1087
+ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
983
1088
 
984
1089
  // ../commons/src/events/PlainDate.ts
985
1090
  var import_zod = require("zod");
986
1091
  var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
987
1092
 
988
1093
  // ../commons/src/events/FieldValue.ts
989
- var TextValue = z12.string();
990
- var HiddenFieldValue = z12.string();
991
- var NonEmptyTextValue = z12.string().trim().min(1);
992
- var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
993
- var AgeValue = z12.object({
994
- age: z12.number(),
995
- asOfDateRef: z12.string()
1094
+ var TextValue = z14.string();
1095
+ var HiddenFieldValue = z14.string();
1096
+ var NonEmptyTextValue = z14.string().trim().min(1);
1097
+ var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
1098
+ var AGE_MAX_VALUE = 999;
1099
+ var AgeValue = z14.object({
1100
+ age: z14.number().int().min(0).max(AGE_MAX_VALUE),
1101
+ asOfDateRef: z14.string()
996
1102
  });
997
1103
  var AgeUpdateValue = AgeValue.optional().nullable();
998
- var AutocompleteValue = z12.object({
999
- label: z12.string(),
1000
- value: z12.string()
1104
+ var AutocompleteValue = z14.object({
1105
+ label: z14.string(),
1106
+ value: z14.string()
1001
1107
  });
1002
1108
  var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
1003
- var TimeValue = z12.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
1004
- var DatetimeValue = z12.iso.datetime();
1005
- var SelectDateRangeValue = z12.enum([
1109
+ var TimeValue = z14.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
1110
+ var DatetimeValue = z14.iso.datetime();
1111
+ var SelectDateRangeValue = z14.enum([
1006
1112
  "last7Days",
1007
1113
  "last30Days",
1008
1114
  "last90Days",
1009
1115
  "last365Days"
1010
1116
  ]);
1011
- var DateRangeFieldValue = z12.object({
1117
+ var DateRangeFieldValue = z14.object({
1012
1118
  start: PlainDate,
1013
1119
  end: PlainDate
1014
1120
  }).or(PlainDate).describe(
1015
1121
  "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
1016
1122
  );
1017
- var EmailValue = z12.email();
1018
- var CheckboxFieldValue = z12.boolean();
1019
- var NumberFieldValue = z12.number();
1123
+ var EmailValue = z14.email();
1124
+ var CheckboxFieldValue = z14.boolean();
1125
+ var NumberFieldValue = z14.number();
1020
1126
  var SignatureFieldValue = FileFieldValue;
1021
- var ButtonFieldValue = z12.number();
1022
- var VerificationStatusValue = z12.enum([
1127
+ var ButtonFieldValue = z14.number();
1128
+ var VerificationStatusValue = z14.enum([
1023
1129
  "verified",
1024
1130
  "authenticated",
1025
1131
  "failed",
1026
1132
  "pending"
1027
1133
  ]);
1028
- var LeafFieldValues = z12.union([
1134
+ var LeafFieldValues = z14.union([
1029
1135
  AddressFieldValue,
1030
1136
  TextValue,
1031
1137
  PlainDate,
@@ -1051,11 +1157,11 @@ var LeafFieldValues = z12.union([
1051
1157
  AutocompleteValue,
1052
1158
  AutocompleteUpdateValue
1053
1159
  ]);
1054
- var FieldGroupValue = z12.record(z12.string(), LeafFieldValues);
1055
- var DataFieldValue = z12.object({
1056
- data: z12.record(z12.string(), LeafFieldValues)
1160
+ var FieldGroupValue = z14.record(z14.string(), LeafFieldValues);
1161
+ var DataFieldValue = z14.object({
1162
+ data: z14.record(z14.string(), LeafFieldValues)
1057
1163
  }).nullish();
1058
- var FieldValue = z12.union([
1164
+ var FieldValue = z14.union([
1059
1165
  LeafFieldValues,
1060
1166
  DataFieldValue,
1061
1167
  FieldGroupValue
@@ -1089,7 +1195,7 @@ function safeUnion(schemas) {
1089
1195
  const sortedSchemas = [...schemas].sort(
1090
1196
  (a, b) => schemaPriority(a) - schemaPriority(b)
1091
1197
  );
1092
- return z12.any().superRefine((val, ctx) => {
1198
+ return z14.any().superRefine((val, ctx) => {
1093
1199
  for (const schema of sortedSchemas) {
1094
1200
  if (schema.safeParse(val).success) {
1095
1201
  return;
@@ -1128,9 +1234,9 @@ var FieldUpdateValue = safeUnion([
1128
1234
  ]);
1129
1235
 
1130
1236
  // ../commons/src/events/serializers/user/serializer.ts
1131
- var z13 = __toESM(require("zod/v4"));
1132
- var SerializedUserField = z13.object({
1133
- $userField: z13.enum([
1237
+ var z15 = __toESM(require("zod/v4"));
1238
+ var SerializedUserField = z15.object({
1239
+ $userField: z15.enum([
1134
1240
  "id",
1135
1241
  "name",
1136
1242
  "role",
@@ -1144,7 +1250,7 @@ var SerializedUserField = z13.object({
1144
1250
  "primaryOfficeId",
1145
1251
  "administrativeAreaId"
1146
1252
  ]),
1147
- $location: z13.string().optional()
1253
+ $location: z15.string().optional()
1148
1254
  });
1149
1255
  function userSerializer(userField) {
1150
1256
  return {
@@ -1167,30 +1273,25 @@ function userSerializer(userField) {
1167
1273
  var import_v4 = require("zod/v4");
1168
1274
 
1169
1275
  // ../commons/src/events/EventMetadata.ts
1170
- var z16 = __toESM(require("zod/v4"));
1276
+ var z17 = __toESM(require("zod/v4"));
1171
1277
 
1172
1278
  // ../commons/src/events/ActionDocument.ts
1173
- var z14 = __toESM(require("zod/v4"));
1174
- var ActionUpdate = z14.record(z14.string(), FieldUpdateValue).describe(
1279
+ var z16 = __toESM(require("zod/v4"));
1280
+ var ActionUpdate = z16.record(z16.string(), FieldUpdateValue).describe(
1175
1281
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
1176
1282
  );
1177
- var EventState = z14.record(z14.string(), FieldValue).describe(
1283
+ var EventState = z16.record(z16.string(), FieldValue).describe(
1178
1284
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
1179
1285
  );
1180
- var ActionStatus = {
1181
- Requested: "Requested",
1182
- Accepted: "Accepted",
1183
- Rejected: "Rejected"
1184
- };
1185
- var ActionBase = z14.object({
1286
+ var ActionBase = z16.object({
1186
1287
  id: UUID.describe("Unique identifier of the action."),
1187
- transactionId: z14.string().describe("Unique identifier of the transaction."),
1288
+ transactionId: z16.string().describe("Unique identifier of the transaction."),
1188
1289
  createdByUserType: TokenUserType.describe(
1189
1290
  "Indicates whether the action was created by a human-user or by a system-user."
1190
1291
  ),
1191
- createdAt: z14.string().datetime().describe("Timestamp indicating when the action was created."),
1192
- createdBy: z14.string().describe("Identifier of the user who created the action."),
1193
- createdByRole: z14.string().optional().describe("Role of the user who created the action."),
1292
+ createdAt: z16.string().datetime().describe("Timestamp indicating when the action was created."),
1293
+ createdBy: z16.string().describe("Identifier of the user who created the action."),
1294
+ createdByRole: z16.string().optional().describe("Role of the user who created the action."),
1194
1295
  createdBySignature: DocumentPath.nullish().describe(
1195
1296
  "Reference to the signature of the user who created the action."
1196
1297
  ),
@@ -1202,7 +1303,7 @@ var ActionBase = z14.object({
1202
1303
  "Declaration data defined by the ActionConfig. Supports partial updates."
1203
1304
  ),
1204
1305
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
1205
- status: z14.enum([
1306
+ status: z16.enum([
1206
1307
  ActionStatus.Requested,
1207
1308
  ActionStatus.Accepted,
1208
1309
  ActionStatus.Rejected
@@ -1214,139 +1315,143 @@ var ActionBase = z14.object({
1214
1315
  )
1215
1316
  });
1216
1317
  var AssignedAction = ActionBase.extend(
1217
- z14.object({
1218
- type: z14.literal(ActionType.ASSIGN),
1219
- assignedTo: z14.string().describe("Identifier of the user to whom the action is assigned.")
1318
+ z16.object({
1319
+ type: z16.literal(ActionType.ASSIGN),
1320
+ assignedTo: z16.string().describe("Identifier of the user to whom the action is assigned.")
1220
1321
  // TODO move into 'content' property
1221
1322
  }).shape
1222
1323
  );
1223
1324
  var UnassignedAction = ActionBase.extend(
1224
- z14.object({
1225
- type: z14.literal(ActionType.UNASSIGN)
1325
+ z16.object({
1326
+ type: z16.literal(ActionType.UNASSIGN)
1226
1327
  }).shape
1227
1328
  );
1228
1329
  var RegisterAction = ActionBase.extend(
1229
- z14.object({
1230
- type: z14.literal(ActionType.REGISTER),
1231
- registrationNumber: z14.string().optional().describe(
1330
+ z16.object({
1331
+ type: z16.literal(ActionType.REGISTER),
1332
+ registrationNumber: z16.string().optional().describe(
1232
1333
  "Registration number of the event. Always present for accepted registrations."
1233
1334
  )
1234
1335
  // TODO move into 'content' property
1235
1336
  }).shape
1236
1337
  );
1237
1338
  var DeclareAction = ActionBase.extend(
1238
- z14.object({
1239
- type: z14.literal(ActionType.DECLARE)
1339
+ z16.object({
1340
+ type: z16.literal(ActionType.DECLARE)
1240
1341
  }).shape
1241
1342
  );
1242
- var ReasonContent = z14.object({
1243
- reason: z14.string().min(1, { error: "Message cannot be empty" }).describe(
1343
+ var ReasonContent = z16.object({
1344
+ reason: z16.string().min(1, { error: "Message cannot be empty" }).describe(
1244
1345
  "Message describing the reason for rejecting or archiving the event."
1245
1346
  )
1246
1347
  });
1247
1348
  var RejectAction = ActionBase.extend(
1248
- z14.object({
1249
- type: z14.literal(ActionType.REJECT),
1349
+ z16.object({
1350
+ type: z16.literal(ActionType.REJECT),
1250
1351
  content: ReasonContent
1251
1352
  }).shape
1252
1353
  );
1253
- var PotentialDuplicate = z14.object({
1354
+ var PotentialDuplicate = z16.object({
1254
1355
  id: UUID,
1255
- trackingId: z14.string()
1356
+ trackingId: z16.string()
1256
1357
  });
1257
1358
  var DuplicateDetectedAction = ActionBase.extend(
1258
- z14.object({
1259
- type: z14.literal(ActionType.DUPLICATE_DETECTED),
1260
- content: z14.object({
1261
- duplicates: z14.array(PotentialDuplicate)
1359
+ z16.object({
1360
+ type: z16.literal(ActionType.DUPLICATE_DETECTED),
1361
+ content: z16.object({
1362
+ duplicates: z16.array(PotentialDuplicate)
1262
1363
  })
1263
1364
  }).shape
1264
1365
  );
1265
1366
  var MarkNotDuplicateAction = ActionBase.extend(
1266
- z14.object({
1267
- type: z14.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1367
+ z16.object({
1368
+ type: z16.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1268
1369
  }).shape
1269
1370
  );
1270
1371
  var MarkAsDuplicateAction = ActionBase.extend(
1271
- z14.object({
1272
- type: z14.literal(ActionType.MARK_AS_DUPLICATE),
1273
- content: z14.object({
1372
+ z16.object({
1373
+ type: z16.literal(ActionType.MARK_AS_DUPLICATE),
1374
+ content: z16.object({
1274
1375
  duplicateOf: UUID
1275
1376
  }).optional()
1276
1377
  }).shape
1277
1378
  );
1278
1379
  var ArchiveAction = ActionBase.extend(
1279
- z14.object({
1280
- type: z14.literal(ActionType.ARCHIVE),
1281
- content: ReasonContent
1380
+ z16.object({
1381
+ type: z16.literal(ActionType.ARCHIVE),
1382
+ /**
1383
+ * Archiving does not collect a reason on its own. Only the
1384
+ * "mark as duplicate" flow archives with a reason attached.
1385
+ */
1386
+ content: ReasonContent.optional()
1282
1387
  }).shape
1283
1388
  );
1284
1389
  var UnarchiveAction = ActionBase.extend(
1285
- z14.object({
1286
- type: z14.literal(ActionType.UNARCHIVE)
1390
+ z16.object({
1391
+ type: z16.literal(ActionType.UNARCHIVE)
1287
1392
  }).shape
1288
1393
  );
1289
1394
  var CreatedAction = ActionBase.extend(
1290
- z14.object({
1291
- type: z14.literal(ActionType.CREATE)
1395
+ z16.object({
1396
+ type: z16.literal(ActionType.CREATE)
1292
1397
  }).shape
1293
1398
  );
1294
1399
  var NotifiedAction = ActionBase.extend(
1295
- z14.object({
1296
- type: z14.literal(ActionType.NOTIFY)
1400
+ z16.object({
1401
+ type: z16.literal(ActionType.NOTIFY)
1297
1402
  }).shape
1298
1403
  );
1299
1404
  var EditAction = ActionBase.extend(
1300
- z14.object({
1301
- type: z14.literal(ActionType.EDIT),
1405
+ z16.object({
1406
+ type: z16.literal(ActionType.EDIT),
1302
1407
  /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1303
- content: z14.object({
1304
- comment: z14.string().describe("Comment for the edit action.").optional()
1408
+ content: z16.object({
1409
+ comment: z16.string().describe("Comment for the edit action.").optional()
1305
1410
  }).optional()
1306
1411
  }).shape
1307
1412
  );
1308
- var PrintContent = z14.object({
1309
- templateId: z14.string().optional()
1413
+ var PrintContent = z16.object({
1414
+ templateId: z16.string().optional()
1310
1415
  });
1311
1416
  var PrintCertificateAction = ActionBase.extend(
1312
- z14.object({
1313
- type: z14.literal(ActionType.PRINT_CERTIFICATE),
1417
+ z16.object({
1418
+ type: z16.literal(ActionType.PRINT_CERTIFICATE),
1314
1419
  content: PrintContent.optional().nullable()
1315
1420
  }).shape
1316
1421
  );
1317
1422
  var RequestedCorrectionAction = ActionBase.extend(
1318
- z14.object({
1319
- type: z14.literal(ActionType.REQUEST_CORRECTION)
1423
+ z16.object({
1424
+ type: z16.literal(ActionType.REQUEST_CORRECTION)
1320
1425
  }).shape
1321
1426
  );
1322
1427
  var ApprovedCorrectionAction = ActionBase.extend(
1323
- z14.object({
1324
- type: z14.literal(ActionType.APPROVE_CORRECTION),
1325
- requestId: z14.string(),
1428
+ z16.object({
1429
+ type: z16.literal(ActionType.APPROVE_CORRECTION),
1430
+ requestId: UUID,
1326
1431
  // TODO move into 'content' property
1327
- content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1432
+ content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
1328
1433
  }).shape
1329
1434
  );
1330
1435
  var RejectedCorrectionAction = ActionBase.extend(
1331
- z14.object({
1332
- type: z14.literal(ActionType.REJECT_CORRECTION),
1333
- requestId: z14.string(),
1436
+ z16.object({
1437
+ type: z16.literal(ActionType.REJECT_CORRECTION),
1438
+ requestId: UUID,
1334
1439
  // TODO move into 'content' property
1335
1440
  content: ReasonContent
1336
1441
  }).shape
1337
1442
  );
1338
1443
  var ReadAction = ActionBase.extend(
1339
- z14.object({
1340
- type: z14.literal(ActionType.READ)
1444
+ z16.object({
1445
+ type: z16.literal(ActionType.READ)
1341
1446
  }).shape
1342
1447
  );
1343
1448
  var CustomAction = ActionBase.merge(
1344
- z14.object({
1345
- type: z14.literal(ActionType.CUSTOM),
1346
- customActionType: z14.string()
1449
+ z16.object({
1450
+ type: z16.literal(ActionType.CUSTOM),
1451
+ customActionType: z16.string()
1347
1452
  })
1348
1453
  );
1349
- var ActionDocument = z14.discriminatedUnion("type", [
1454
+ var ActionDocument = z16.discriminatedUnion("type", [
1350
1455
  CreatedAction.meta({ id: "CreatedAction" }),
1351
1456
  RejectAction.meta({ id: "RejectAction" }),
1352
1457
  DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
@@ -1373,109 +1478,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
1373
1478
  declaration: true,
1374
1479
  annotation: true
1375
1480
  }).extend(
1376
- z14.object({
1377
- type: z14.enum(ConfirmableActions),
1378
- status: z14.literal(ActionStatus.Rejected)
1481
+ z16.object({
1482
+ type: z16.enum(ConfirmableActions),
1483
+ status: z16.literal(ActionStatus.Rejected)
1379
1484
  }).shape
1380
1485
  );
1381
- var Action = z14.union([ActionDocument, AsyncRejectActionDocument]);
1382
-
1383
- // ../commons/src/events/Flag.ts
1384
- var z15 = __toESM(require("zod/v4"));
1385
- var InherentFlags = {
1386
- INCOMPLETE: "incomplete",
1387
- REJECTED: "rejected",
1388
- CORRECTION_REQUESTED: "correction-requested",
1389
- POTENTIAL_DUPLICATE: "potential-duplicate",
1390
- /**
1391
- * This flag is set by the Edit-action and removed after the declaration or registration.
1392
- * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
1393
- *
1394
- * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
1395
- */
1396
- EDIT_IN_PROGRESS: "edit-in-progress"
1397
- };
1398
- var ActionFlag = z15.string().regex(
1399
- new RegExp(
1400
- `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1401
- ActionStatus
1402
- ).join("|").toLowerCase()})$`
1403
- ),
1404
- "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1405
- );
1406
- var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1407
- message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1408
- InherentFlags
1409
- ).join(", ")}`
1410
- }).refine((val) => !ActionFlag.safeParse(val).success, {
1411
- message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1412
- }).describe("Custom flag identifier defined by the country config.");
1413
- var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
1414
- var FlagConfig = z15.object({
1415
- id: CustomFlag,
1416
- requiresAction: z15.boolean().describe(
1417
- "Indicates if this flag expects an action to be performed to be cleared."
1418
- ),
1419
- label: TranslationConfig.describe("Human readable label of the flag.")
1420
- }).meta({
1421
- id: "FlagConfig",
1422
- description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1423
- });
1424
- var ActionFlagConfig = z15.object({
1425
- id: Flag,
1426
- operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1427
- conditional: Conditional.optional().describe(
1428
- "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1429
- )
1430
- }).meta({
1431
- id: "ActionFlagConfig",
1432
- description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1433
- });
1486
+ var Action = z16.union([ActionDocument, AsyncRejectActionDocument]);
1434
1487
 
1435
1488
  // ../commons/src/events/EventMetadata.ts
1436
- var EventStatus = z16.enum([
1437
- "CREATED",
1438
- "NOTIFIED",
1439
- "DECLARED",
1440
- "REGISTERED",
1441
- "ARCHIVED"
1442
- ]);
1443
- var ZodDate = z16.iso.date();
1444
- var ZodDateTime = z16.string().datetime();
1445
- var ActionCreationMetadata = z16.object({
1446
- createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
1447
- createdBy: z16.string().describe("ID of the user who created the action request."),
1489
+ var ZodDate = z17.iso.date();
1490
+ var ZodDateTime = z17.string().datetime();
1491
+ var ActionCreationMetadata = z17.object({
1492
+ createdAt: z17.iso.datetime().describe("The timestamp when the action request was created."),
1493
+ createdBy: z17.string().describe("ID of the user who created the action request."),
1448
1494
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1449
1495
  createdAtLocation: UUID.nullish().describe(
1450
1496
  "Location of the user who created the action request."
1451
1497
  ),
1452
- createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1453
- acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1454
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1498
+ createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1499
+ acceptedAt: z17.iso.datetime().describe("Timestamp when the action request was accepted."),
1500
+ createdByRole: z17.string().optional().describe("Role of the user at the time of action request creation.")
1455
1501
  });
1456
1502
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1457
- registrationNumber: z16.string().describe(
1503
+ registrationNumber: z17.string().describe(
1458
1504
  "Registration number of the event. Always present for accepted registrations."
1459
1505
  )
1460
1506
  });
1461
- var LegalStatuses = z16.object({
1507
+ var LegalStatuses = z17.object({
1462
1508
  [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1463
1509
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1464
1510
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1465
1511
  });
1466
- var EventMetadata = z16.object({
1512
+ var EventMetadata = z17.object({
1467
1513
  id: UUID,
1468
- type: z16.string().describe("The type of event, such as birth, death, or marriage."),
1514
+ type: z17.string().describe("The type of event, such as birth, death, or marriage."),
1469
1515
  status: EventStatus,
1470
1516
  legalStatuses: LegalStatuses.describe(
1471
1517
  "Metadata related to the legal registration of the event, such as who registered it and when."
1472
1518
  ),
1473
- createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
1519
+ createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
1474
1520
  dateOfEvent: ZodDate.nullish(),
1475
1521
  placeOfEvent: UUID.nullish(),
1476
- createdBy: z16.string().describe("ID of the user who created the event."),
1477
- createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1478
- updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
1522
+ createdBy: z17.string().describe("ID of the user who created the event."),
1523
+ createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1524
+ updatedByUserRole: z17.string().nullish().describe("Role of the user who last changed the status."),
1479
1525
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1480
1526
  createdAtLocation: UUID.nullish().describe(
1481
1527
  "Location of the user who created the event."
@@ -1483,18 +1529,18 @@ var EventMetadata = z16.object({
1483
1529
  updatedAtLocation: UUID.nullish().describe(
1484
1530
  "Location of the user who last changed the status."
1485
1531
  ),
1486
- updatedAt: z16.iso.datetime().describe(
1532
+ updatedAt: z17.iso.datetime().describe(
1487
1533
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1488
1534
  ),
1489
- assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
1490
- updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
1491
- trackingId: z16.string().describe(
1535
+ assignedTo: z17.string().nullish().describe("ID of the user currently assigned to the event."),
1536
+ updatedBy: z17.string().nullish().describe("ID of the user who last changed the status."),
1537
+ trackingId: z17.string().describe(
1492
1538
  "System-generated tracking ID used by informants or registrars to look up the event."
1493
1539
  ),
1494
- potentialDuplicates: z16.array(PotentialDuplicate).describe(
1540
+ potentialDuplicates: z17.array(PotentialDuplicate).describe(
1495
1541
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1496
1542
  ),
1497
- flags: z16.array(Flag)
1543
+ flags: z17.array(Flag)
1498
1544
  });
1499
1545
  var EventMetadataKeysArray = [
1500
1546
  "id",
@@ -1515,8 +1561,8 @@ var EventMetadataKeysArray = [
1515
1561
  "legalStatuses",
1516
1562
  "flags"
1517
1563
  ];
1518
- var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1519
- var EventMetadataDateFieldIdInput = z16.enum([
1564
+ var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
1565
+ var EventMetadataDateFieldIdInput = z17.enum([
1520
1566
  "createdAt",
1521
1567
  "updatedAt",
1522
1568
  "legalStatuses.NOTIFIED.createdAt",
@@ -1526,7 +1572,7 @@ var EventMetadataDateFieldIdInput = z16.enum([
1526
1572
  "legalStatuses.REGISTERED.createdAt",
1527
1573
  "legalStatuses.REGISTERED.acceptedAt"
1528
1574
  ]);
1529
- var EventMetadataDateFieldId = z16.enum([
1575
+ var EventMetadataDateFieldId = z17.enum([
1530
1576
  "event.createdAt",
1531
1577
  "event.updatedAt",
1532
1578
  "event.legalStatuses.NOTIFIED.createdAt",
@@ -1588,13 +1634,6 @@ var Range = import_v4.z.object({
1588
1634
  }).meta({
1589
1635
  id: "Range"
1590
1636
  });
1591
- var ContainsFlags = import_v4.z.object({
1592
- anyOf: import_v4.z.array(Flag).optional(),
1593
- noneOf: import_v4.z.array(Flag).optional(),
1594
- allOf: import_v4.z.array(Flag).optional()
1595
- }).meta({
1596
- id: "ContainsFlags"
1597
- });
1598
1637
  var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
1599
1638
  id: "Within"
1600
1639
  });
@@ -1821,8 +1860,8 @@ var BaseField = import_v43.default.object({
1821
1860
  conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
1822
1861
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1823
1862
  ),
1824
- secured: import_v43.default.boolean().default(false).optional().describe(
1825
- "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1863
+ secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
1864
+ "Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
1826
1865
  ),
1827
1866
  placeholder: TranslationConfig.optional(),
1828
1867
  validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
@@ -2220,7 +2259,13 @@ var AdministrativeAreaField = BaseField.extend({
2220
2259
  configuration: import_v43.default.object({
2221
2260
  partOf: FieldReference.optional().describe("Parent location"),
2222
2261
  type: AdministrativeAreas,
2223
- allowedLocations: AllowedLocations
2262
+ allowedLocations: AllowedLocations,
2263
+ activeOnly: import_v43.default.boolean().optional().describe(
2264
+ "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
2265
+ ),
2266
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2267
+ "Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
2268
+ )
2224
2269
  }).describe("Administrative area options")
2225
2270
  }).meta({
2226
2271
  description: "Administrative area input field",
@@ -2231,7 +2276,13 @@ var LocationInput = BaseField.extend({
2231
2276
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2232
2277
  configuration: import_v43.default.object({
2233
2278
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2234
- allowedLocations: AllowedLocations
2279
+ allowedLocations: AllowedLocations,
2280
+ activeOnly: import_v43.default.boolean().optional().describe(
2281
+ "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
2282
+ ),
2283
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2284
+ "Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
2285
+ )
2235
2286
  }).optional()
2236
2287
  }).meta({
2237
2288
  description: "A field for selecting a location",
@@ -2257,12 +2308,20 @@ var FileUploadWithOptions = BaseField.extend({
2257
2308
  var Facility = BaseField.extend({
2258
2309
  type: import_v43.default.literal(FieldType.FACILITY),
2259
2310
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2260
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2311
+ configuration: import_v43.default.object({
2312
+ allowedLocations: AllowedLocations,
2313
+ activeOnly: import_v43.default.boolean().optional(),
2314
+ anchorToDateOfEvent: import_v43.default.boolean().optional()
2315
+ }).optional()
2261
2316
  }).describe("Input field for a facility");
2262
2317
  var Office = BaseField.extend({
2263
2318
  type: import_v43.default.literal(FieldType.OFFICE),
2264
2319
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2265
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2320
+ configuration: import_v43.default.object({
2321
+ allowedLocations: AllowedLocations,
2322
+ activeOnly: import_v43.default.boolean().optional(),
2323
+ anchorToDateOfEvent: import_v43.default.boolean().optional()
2324
+ }).optional()
2266
2325
  }).describe("Input field for an office");
2267
2326
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
2268
2327
  administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
@@ -2295,7 +2354,13 @@ var Address = BaseField.extend({
2295
2354
  parent: FieldReference.optional()
2296
2355
  })
2297
2356
  ).optional(),
2298
- allowedLocations: AllowedLocations
2357
+ allowedLocations: AllowedLocations,
2358
+ activeOnly: import_v43.default.boolean().optional().describe(
2359
+ "Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
2360
+ ),
2361
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2362
+ "Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that. Propagated to the embedded admin-area selectors."
2363
+ )
2299
2364
  }).optional(),
2300
2365
  defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2301
2366
  }).meta({
@@ -2350,10 +2415,19 @@ var ButtonField = BaseField.extend({
2350
2415
  description: "A generic button that can be used to trigger an action",
2351
2416
  id: "ButtonField"
2352
2417
  });
2418
+ var FieldGroupConfiguration = import_v43.default.object({
2419
+ separator: import_v43.default.string().optional().describe(
2420
+ 'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
2421
+ ),
2422
+ hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
2423
+ "Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
2424
+ )
2425
+ });
2353
2426
  var FieldGroup = BaseField.extend({
2354
2427
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2355
2428
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2356
- fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2429
+ fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
2430
+ configuration: FieldGroupConfiguration.optional()
2357
2431
  }).meta({
2358
2432
  description: "A group of fields that are displayed together",
2359
2433
  id: "FieldGroup"
@@ -2596,18 +2670,21 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
2596
2670
  ]);
2597
2671
 
2598
2672
  // ../commons/src/events/FormConfig.ts
2599
- var z22 = __toESM(require("zod/v4"));
2673
+ var z23 = __toESM(require("zod/v4"));
2600
2674
 
2601
2675
  // ../commons/src/events/PageConfig.ts
2602
- var z21 = __toESM(require("zod/v4"));
2603
- var PageTypes = z21.enum(["FORM", "VERIFICATION"]);
2604
- var PageConfigBase = z21.object({
2605
- id: z21.string().describe("Unique identifier for the page"),
2676
+ var z22 = __toESM(require("zod/v4"));
2677
+ var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
2678
+ var PageConfigBase = z22.object({
2679
+ id: z22.string().describe("Unique identifier for the page"),
2606
2680
  title: TranslationConfig.describe("Header title of the page"),
2607
- requireCompletionToContinue: z21.boolean().default(false).describe(
2681
+ requireCompletionToContinue: z22.boolean().default(false).describe(
2608
2682
  "If true, all required fields must be filled before continuing to the next page"
2609
2683
  ),
2610
- fields: z21.array(FieldConfig).describe("Fields to be rendered on the page"),
2684
+ showClearButton: z22.boolean().optional().describe(
2685
+ 'If true, a "Clear" button is shown at the top of the page allowing the user to reset all fields on the page to their default state'
2686
+ ),
2687
+ fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
2611
2688
  conditional: Conditional.optional().describe(
2612
2689
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
2613
2690
  )
@@ -2616,13 +2693,13 @@ var PageConfigBase = z21.object({
2616
2693
  id: "FormPageConfig"
2617
2694
  });
2618
2695
  var FormPageConfig = PageConfigBase.extend({
2619
- type: z21.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2696
+ type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2620
2697
  });
2621
- var VerificationActionConfig = z21.object({
2622
- verify: z21.object({ label: TranslationConfig }),
2623
- cancel: z21.object({
2698
+ var VerificationActionConfig = z22.object({
2699
+ verify: z22.object({ label: TranslationConfig }),
2700
+ cancel: z22.object({
2624
2701
  label: TranslationConfig,
2625
- confirmation: z21.object({
2702
+ confirmation: z22.object({
2626
2703
  title: TranslationConfig,
2627
2704
  body: TranslationConfig
2628
2705
  })
@@ -2632,34 +2709,34 @@ var VerificationActionConfig = z21.object({
2632
2709
  id: "VerificationActionConfig"
2633
2710
  });
2634
2711
  var VerificationPageConfig = FormPageConfig.extend({
2635
- type: z21.literal(PageTypes.enum.VERIFICATION),
2712
+ type: z22.literal(PageTypes.enum.VERIFICATION),
2636
2713
  actions: VerificationActionConfig
2637
2714
  });
2638
- var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2715
+ var PageConfig = z22.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2639
2716
  id: "PageConfig",
2640
2717
  description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
2641
2718
  });
2642
2719
 
2643
2720
  // ../commons/src/events/FormConfig.ts
2644
- var DeclarationFormConfig = z22.object({
2721
+ var DeclarationFormConfig = z23.object({
2645
2722
  label: TranslationConfig.describe("Human readable description of the form"),
2646
- pages: z22.array(FormPageConfig)
2723
+ pages: z23.array(FormPageConfig)
2647
2724
  }).meta({
2648
2725
  id: "DeclarationFormConfig",
2649
2726
  description: "Configuration of the declaration form."
2650
2727
  });
2651
- var ActionFormConfig = z22.object({
2728
+ var ActionFormConfig = z23.object({
2652
2729
  label: TranslationConfig.describe("Human readable description of the form"),
2653
- pages: z22.array(PageConfig)
2730
+ pages: z23.array(PageConfig)
2654
2731
  }).describe(
2655
2732
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
2656
2733
  );
2657
- var FormConfig = z22.union([DeclarationFormConfig, ActionFormConfig]);
2734
+ var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
2658
2735
 
2659
2736
  // ../commons/src/events/DeduplicationConfig.ts
2660
- var z23 = __toESM(require("zod/v4"));
2661
- var FieldReference2 = z23.string();
2662
- var Matcher = z23.object({
2737
+ var z24 = __toESM(require("zod/v4"));
2738
+ var FieldReference2 = z24.string();
2739
+ var Matcher = z24.object({
2663
2740
  /**
2664
2741
  * Reference to the field used in matching.
2665
2742
  *
@@ -2667,23 +2744,23 @@ var Matcher = z23.object({
2667
2744
  * be used as the origin date to calculate the distance from.
2668
2745
  */
2669
2746
  fieldId: FieldReference2,
2670
- options: z23.object({
2671
- boost: z23.number().optional(),
2747
+ options: z24.object({
2748
+ boost: z24.number().optional(),
2672
2749
  matchAgainst: FieldReference2.optional()
2673
2750
  }).optional().default({
2674
2751
  boost: 1
2675
2752
  })
2676
2753
  });
2677
2754
  var FuzzyMatcher = Matcher.extend({
2678
- type: z23.literal("fuzzy"),
2679
- options: z23.object({
2755
+ type: z24.literal("fuzzy"),
2756
+ options: z24.object({
2680
2757
  /**
2681
2758
  * Names of length 3 or less characters = 0 edits allowed
2682
2759
  * Names of length 4 - 6 characters = 1 edit allowed
2683
2760
  * Names of length >7 characters = 2 edits allowed
2684
2761
  */
2685
- fuzziness: z23.union([z23.string(), z23.number()]).optional().default("AUTO:4,7"),
2686
- boost: z23.number().optional().default(1),
2762
+ fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
2763
+ boost: z24.number().optional().default(1),
2687
2764
  matchAgainst: FieldReference2.optional()
2688
2765
  }).optional().default({
2689
2766
  fuzziness: "AUTO:4,7",
@@ -2691,48 +2768,48 @@ var FuzzyMatcher = Matcher.extend({
2691
2768
  })
2692
2769
  });
2693
2770
  var StrictMatcher = Matcher.extend({
2694
- type: z23.literal("strict"),
2695
- options: z23.object({
2696
- boost: z23.number().optional().default(1),
2771
+ type: z24.literal("strict"),
2772
+ options: z24.object({
2773
+ boost: z24.number().optional().default(1),
2697
2774
  /**
2698
2775
  * The constant value to be present in the field for both records
2699
2776
  */
2700
- value: z23.string().optional(),
2777
+ value: z24.string().optional(),
2701
2778
  matchAgainst: FieldReference2.optional()
2702
2779
  }).optional().default({
2703
2780
  boost: 1
2704
2781
  })
2705
2782
  });
2706
2783
  var DateRangeMatcher = Matcher.extend({
2707
- type: z23.literal("dateRange"),
2708
- options: z23.object({
2784
+ type: z24.literal("dateRange"),
2785
+ options: z24.object({
2709
2786
  /**
2710
2787
  * The distance pivot in days. Distance from the origin (the value of
2711
2788
  * fieldId) at which relevance scores receive half of the boost value
2712
2789
  */
2713
- pivot: z23.number().optional(),
2714
- days: z23.number(),
2715
- boost: z23.number().optional().default(1),
2790
+ pivot: z24.number().optional(),
2791
+ days: z24.number(),
2792
+ boost: z24.number().optional().default(1),
2716
2793
  matchAgainst: FieldReference2.optional()
2717
2794
  })
2718
2795
  });
2719
- var Not = z23.object({
2720
- type: z23.literal("not"),
2796
+ var Not = z24.object({
2797
+ type: z24.literal("not"),
2721
2798
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2722
- clause: z23.lazy(() => Clause)
2799
+ clause: z24.lazy(() => Clause)
2723
2800
  });
2724
- var And = z23.object({
2725
- type: z23.literal("and"),
2801
+ var And = z24.object({
2802
+ type: z24.literal("and"),
2726
2803
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2727
- clauses: z23.lazy(() => Clause.array())
2804
+ clauses: z24.lazy(() => Clause.array())
2728
2805
  });
2729
- var Or = z23.object({
2730
- type: z23.literal("or"),
2806
+ var Or = z24.object({
2807
+ type: z24.literal("or"),
2731
2808
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2732
- clauses: z23.lazy(() => Clause.array())
2809
+ clauses: z24.lazy(() => Clause.array())
2733
2810
  });
2734
- var Clause = z23.lazy(
2735
- () => z23.discriminatedUnion("type", [
2811
+ var Clause = z24.lazy(
2812
+ () => z24.discriminatedUnion("type", [
2736
2813
  Not,
2737
2814
  And,
2738
2815
  Or,
@@ -2743,8 +2820,8 @@ var Clause = z23.lazy(
2743
2820
  ).meta({
2744
2821
  id: "Clause"
2745
2822
  });
2746
- var DeduplicationConfig = z23.object({
2747
- id: z23.string(),
2823
+ var DeduplicationConfig = z24.object({
2824
+ id: z24.string(),
2748
2825
  label: TranslationConfig,
2749
2826
  query: Clause
2750
2827
  }).meta({
@@ -2753,15 +2830,15 @@ var DeduplicationConfig = z23.object({
2753
2830
  });
2754
2831
 
2755
2832
  // ../commons/src/events/ActionConfig.ts
2756
- var DeclarationReviewConfig = z24.object({
2833
+ var DeclarationReviewConfig = z25.object({
2757
2834
  title: TranslationConfig.describe("Title of the review page"),
2758
- fields: z24.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2835
+ fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2759
2836
  }).describe(
2760
2837
  "Configuration of the declaration review page for collecting event-related metadata."
2761
2838
  );
2762
- var ActionConfigBase = z24.object({
2839
+ var ActionConfigBase = z25.object({
2763
2840
  label: TranslationConfig.describe("Human readable description of the action"),
2764
- flags: z24.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2841
+ flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2765
2842
  supportingCopy: TranslationConfig.optional().describe(
2766
2843
  "Text displayed on the confirmation dialog"
2767
2844
  ),
@@ -2772,84 +2849,87 @@ var ActionConfigBase = z24.object({
2772
2849
  * "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
2773
2850
  * for EventConfig.d.ts.
2774
2851
  */
2775
- icon: z24.string().describe("Icon representing the action").optional(),
2776
- conditionals: z24.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2852
+ icon: z25.string().describe("Icon representing the action").optional(),
2853
+ conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2777
2854
  });
2778
2855
  var DeclarationActionBase = ActionConfigBase.extend({
2779
2856
  deduplication: DeduplicationConfig.optional()
2780
2857
  });
2781
- var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2858
+ var actionConfirmationForm = z25.array(FieldConfig).optional().describe(
2782
2859
  "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2783
2860
  );
2784
2861
  var ReadActionConfig = ActionConfigBase.extend(
2785
- z24.object({
2786
- type: z24.literal(ActionType.READ),
2862
+ z25.object({
2863
+ type: z25.literal(ActionType.READ),
2787
2864
  review: DeclarationReviewConfig.describe(
2788
2865
  "Configuration of the review page for read-only view."
2789
2866
  ),
2790
- conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2867
+ conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals."),
2868
+ flags: z25.never().optional().describe(
2869
+ "READ is a meta action excluded from flag resolution, so flags configured here would never apply."
2870
+ )
2791
2871
  }).shape
2792
2872
  );
2793
2873
  var NotifyConfig = ActionConfigBase.extend(
2794
- z24.object({
2795
- type: z24.literal(ActionType.NOTIFY),
2874
+ z25.object({
2875
+ type: z25.literal(ActionType.NOTIFY),
2796
2876
  form: actionConfirmationForm
2797
2877
  }).shape
2798
2878
  );
2799
2879
  var DuplicateDetectedConfig = ActionConfigBase.extend(
2800
- z24.object({
2801
- type: z24.literal(ActionType.DUPLICATE_DETECTED),
2802
- label: z24.never().optional().describe(
2880
+ z25.object({
2881
+ type: z25.literal(ActionType.DUPLICATE_DETECTED),
2882
+ label: z25.never().optional().describe(
2803
2883
  "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2804
2884
  ),
2805
- supportingCopy: z24.never().optional(),
2806
- icon: z24.never().optional().describe(
2885
+ supportingCopy: z25.never().optional(),
2886
+ icon: z25.never().optional().describe(
2807
2887
  "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2808
2888
  ),
2809
- conditionals: z24.never().optional().describe(
2889
+ conditionals: z25.never().optional().describe(
2810
2890
  "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2811
2891
  )
2812
2892
  }).shape
2813
2893
  );
2814
2894
  var MarkAsDuplicateConfig = ActionConfigBase.extend(
2815
- z24.object({
2816
- type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2895
+ z25.object({
2896
+ type: z25.literal(ActionType.MARK_AS_DUPLICATE)
2817
2897
  }).shape
2818
2898
  );
2819
2899
  var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2820
- z24.object({
2821
- type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2900
+ z25.object({
2901
+ type: z25.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2822
2902
  }).shape
2823
2903
  );
2824
2904
  var AssignConfig = ActionConfigBase.extend(
2825
- z24.object({
2826
- type: z24.literal(ActionType.ASSIGN),
2827
- flags: z24.never().optional().describe(
2905
+ z25.object({
2906
+ type: z25.literal(ActionType.ASSIGN),
2907
+ flags: z25.never().optional().describe(
2828
2908
  "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2829
2909
  )
2830
2910
  }).shape
2831
2911
  );
2832
2912
  var UnassignConfig = ActionConfigBase.extend(
2833
- z24.object({
2834
- type: z24.literal(ActionType.UNASSIGN),
2835
- flags: z24.never().optional().describe(
2913
+ z25.object({
2914
+ type: z25.literal(ActionType.UNASSIGN),
2915
+ flags: z25.never().optional().describe(
2836
2916
  "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2837
2917
  )
2838
2918
  }).shape
2839
2919
  );
2840
2920
  var DeleteConfig = ActionConfigBase.extend(
2841
- z24.object({
2842
- type: z24.literal(ActionType.DELETE)
2921
+ z25.object({
2922
+ type: z25.literal(ActionType.DELETE)
2843
2923
  }).shape
2844
2924
  );
2845
2925
  var DeclareConfig = DeclarationActionBase.extend(
2846
- z24.object({
2847
- type: z24.literal(ActionType.DECLARE),
2926
+ z25.object({
2927
+ type: z25.literal(ActionType.DECLARE),
2848
2928
  review: DeclarationReviewConfig.describe(
2849
2929
  "Configuration of the review page fields."
2850
2930
  ),
2851
2931
  form: actionConfirmationForm,
2852
- dialogCopy: z24.object({
2932
+ dialogCopy: z25.object({
2853
2933
  notify: TranslationConfig.describe(
2854
2934
  "Confirmation text for the notify action"
2855
2935
  ),
@@ -2863,20 +2943,20 @@ var DeclareConfig = DeclarationActionBase.extend(
2863
2943
  }).shape
2864
2944
  );
2865
2945
  var ArchiveConfig = ActionConfigBase.extend(
2866
- z24.object({
2867
- type: z24.literal(ActionType.ARCHIVE),
2946
+ z25.object({
2947
+ type: z25.literal(ActionType.ARCHIVE),
2868
2948
  form: actionConfirmationForm
2869
2949
  }).shape
2870
2950
  );
2871
2951
  var UnarchiveConfig = ActionConfigBase.extend(
2872
- z24.object({
2873
- type: z24.literal(ActionType.UNARCHIVE)
2952
+ z25.object({
2953
+ type: z25.literal(ActionType.UNARCHIVE)
2874
2954
  }).shape
2875
2955
  );
2876
2956
  var EditActionConfig = ActionConfigBase.extend(
2877
- z24.object({
2878
- type: z24.literal(ActionType.EDIT),
2879
- dialogCopy: z24.object({
2957
+ z25.object({
2958
+ type: z25.literal(ActionType.EDIT),
2959
+ dialogCopy: z25.object({
2880
2960
  notify: TranslationConfig.describe(
2881
2961
  "Confirmation text for the notify with edits action"
2882
2962
  ),
@@ -2890,45 +2970,45 @@ var EditActionConfig = ActionConfigBase.extend(
2890
2970
  }).shape
2891
2971
  );
2892
2972
  var RejectConfig = ActionConfigBase.extend(
2893
- z24.object({
2894
- type: z24.literal(ActionType.REJECT),
2973
+ z25.object({
2974
+ type: z25.literal(ActionType.REJECT),
2895
2975
  form: actionConfirmationForm
2896
2976
  }).shape
2897
2977
  );
2898
2978
  var RegisterConfig = DeclarationActionBase.extend(
2899
- z24.object({
2900
- type: z24.literal(ActionType.REGISTER),
2979
+ z25.object({
2980
+ type: z25.literal(ActionType.REGISTER),
2901
2981
  form: actionConfirmationForm
2902
2982
  }).shape
2903
2983
  );
2904
2984
  var PrintCertificateActionConfig = ActionConfigBase.extend(
2905
- z24.object({
2906
- type: z24.literal(ActionType.PRINT_CERTIFICATE),
2985
+ z25.object({
2986
+ type: z25.literal(ActionType.PRINT_CERTIFICATE),
2907
2987
  printForm: ActionFormConfig
2908
2988
  }).shape
2909
2989
  );
2910
2990
  var RequestCorrectionConfig = ActionConfigBase.extend(
2911
- z24.object({
2912
- type: z24.literal(ActionType.REQUEST_CORRECTION),
2991
+ z25.object({
2992
+ type: z25.literal(ActionType.REQUEST_CORRECTION),
2913
2993
  correctionForm: ActionFormConfig
2914
2994
  }).shape
2915
2995
  );
2916
2996
  var ApproveCorrectionConfig = ActionConfigBase.extend(
2917
- z24.object({
2918
- type: z24.literal(ActionType.APPROVE_CORRECTION)
2997
+ z25.object({
2998
+ type: z25.literal(ActionType.APPROVE_CORRECTION)
2919
2999
  }).shape
2920
3000
  );
2921
3001
  var RejectCorrectionConfig = ActionConfigBase.extend(
2922
- z24.object({
2923
- type: z24.literal(ActionType.REJECT_CORRECTION)
3002
+ z25.object({
3003
+ type: z25.literal(ActionType.REJECT_CORRECTION)
2924
3004
  }).shape
2925
3005
  );
2926
3006
  var CustomActionConfig = ActionConfigBase.extend(
2927
- z24.object({
2928
- type: z24.literal(ActionType.CUSTOM),
2929
- customActionType: z24.string().describe("Type identifier of the custom action."),
3007
+ z25.object({
3008
+ type: z25.literal(ActionType.CUSTOM),
3009
+ customActionType: z25.string().describe("Type identifier of the custom action."),
2930
3010
  /** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
2931
- form: z24.array(FieldConfig).describe(
3011
+ form: z25.array(FieldConfig).describe(
2932
3012
  "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
2933
3013
  ),
2934
3014
  auditHistoryLabel: TranslationConfig.describe(
@@ -2936,7 +3016,7 @@ var CustomActionConfig = ActionConfigBase.extend(
2936
3016
  )
2937
3017
  }).shape
2938
3018
  );
2939
- var ActionConfig = z24.discriminatedUnion("type", [
3019
+ var ActionConfig = z25.discriminatedUnion("type", [
2940
3020
  /*
2941
3021
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2942
3022
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
@@ -3023,89 +3103,225 @@ var ActionConfig = z24.discriminatedUnion("type", [
3023
3103
  var actionConfigTypes = new Set(
3024
3104
  ActionConfig.options.map((opt) => opt.shape.type.value)
3025
3105
  );
3026
- var DeclarationActionConfig = z24.discriminatedUnion("type", [
3106
+ var DeclarationActionConfig = z25.discriminatedUnion("type", [
3027
3107
  DeclareConfig,
3028
3108
  RegisterConfig
3029
3109
  ]);
3030
3110
 
3031
3111
  // ../commons/src/events/offline/CertificateConfig.ts
3032
- var z25 = __toESM(require("zod/v4"));
3033
- var FontFamily = z25.object({
3034
- normal: z25.string(),
3035
- bold: z25.string(),
3036
- italics: z25.string(),
3037
- bolditalics: z25.string()
3038
- });
3039
- var CertificateConfig = z25.object({
3040
- id: z25.string(),
3041
- event: z25.string(),
3042
- isV2Template: z25.boolean().optional(),
3112
+ var z26 = __toESM(require("zod/v4"));
3113
+ var FontFamily = z26.object({
3114
+ normal: z26.string(),
3115
+ bold: z26.string(),
3116
+ italics: z26.string(),
3117
+ bolditalics: z26.string()
3118
+ });
3119
+ var CertificateConfig = z26.object({
3120
+ id: z26.string(),
3121
+ event: z26.string(),
3122
+ isV2Template: z26.boolean().optional(),
3043
3123
  label: TranslationConfig,
3044
- isDefault: z25.boolean(),
3045
- fee: z25.object({
3046
- onTime: z25.number(),
3047
- late: z25.number(),
3048
- delayed: z25.number()
3124
+ isDefault: z26.boolean(),
3125
+ fee: z26.object({
3126
+ onTime: z26.number(),
3127
+ late: z26.number(),
3128
+ delayed: z26.number()
3049
3129
  }),
3050
- svgUrl: z25.string(),
3051
- fonts: z25.record(z25.string(), FontFamily).optional(),
3052
- conditionals: z25.array(ShowConditional).optional()
3130
+ svgUrl: z26.string(),
3131
+ fonts: z26.record(z26.string(), FontFamily).optional(),
3132
+ conditionals: z26.array(ShowConditional).optional()
3053
3133
  });
3054
3134
  var CertificateTemplateConfig = CertificateConfig.extend({
3055
- hash: z25.string().optional(),
3056
- svg: z25.string()
3135
+ hash: z26.string().optional(),
3136
+ svg: z26.string()
3057
3137
  });
3058
3138
 
3059
3139
  // ../commons/src/events/offline/LanguageConfig.ts
3060
- var z26 = __toESM(require("zod/v4"));
3061
- var LanguageConfig = z26.object({
3062
- lang: z26.string(),
3140
+ var z27 = __toESM(require("zod/v4"));
3141
+ var LanguageConfig = z27.object({
3142
+ lang: z27.string(),
3063
3143
  /**
3064
3144
  * client.csv contents
3065
3145
  */
3066
- messages: z26.record(z26.string(), z26.string())
3146
+ messages: z27.record(z27.string(), z27.string())
3067
3147
  });
3068
3148
 
3069
3149
  // ../commons/src/events/EventConfig.ts
3070
- var z33 = __toESM(require("zod/v4"));
3150
+ var z35 = __toESM(require("zod/v4"));
3071
3151
 
3072
3152
  // ../commons/src/events/SummaryConfig.ts
3073
- var z27 = __toESM(require("zod/v4"));
3074
- var BaseField2 = z27.object({
3075
- emptyValueMessage: TranslationConfig.optional().describe(
3076
- "Default message displayed when the field value is empty."
3077
- ),
3078
- conditionals: z27.array(ShowConditional).default([]).optional()
3079
- });
3153
+ var z29 = __toESM(require("zod/v4"));
3154
+
3155
+ // ../commons/src/icons.ts
3156
+ var z28 = __toESM(require("zod/v4"));
3157
+ var AvailableIcons = z28.enum([
3158
+ "Archived",
3159
+ "Assigned",
3160
+ "Briefcase",
3161
+ "Certified",
3162
+ "Close",
3163
+ "Collapse",
3164
+ "Draft",
3165
+ "DuplicateYellow",
3166
+ "Expand",
3167
+ "ExternalValidate",
3168
+ "FilledCheck",
3169
+ "InReview",
3170
+ "Offline",
3171
+ "Registered",
3172
+ "RequiresUpdates",
3173
+ "Sent",
3174
+ "Validated",
3175
+ "WaitingApproval",
3176
+ "ChartActivity",
3177
+ "Activity",
3178
+ "Archive",
3179
+ "ArchiveTray",
3180
+ "ArrowLeft",
3181
+ "ArrowRight",
3182
+ "Buildings",
3183
+ "Circle",
3184
+ "CaretDown",
3185
+ "CaretLeft",
3186
+ "CaretRight",
3187
+ "ChartBar",
3188
+ "ChartLine",
3189
+ "ChatCircle",
3190
+ "CheckSquare",
3191
+ "Compass",
3192
+ "Check",
3193
+ "Copy",
3194
+ "Database",
3195
+ "DotsThreeVertical",
3196
+ "ArrowCounterClockwise",
3197
+ "MagnifyingGlassMinus",
3198
+ "MagnifyingGlassPlus",
3199
+ "Export",
3200
+ "Eye",
3201
+ "EyeSlash",
3202
+ "Envelope",
3203
+ "File",
3204
+ "FileLock",
3205
+ "FileSearch",
3206
+ "FileMinus",
3207
+ "FilePlus",
3208
+ "FileText",
3209
+ "FileX",
3210
+ "Handshake",
3211
+ "Gear",
3212
+ "GitBranch",
3213
+ "IdentificationCard",
3214
+ "List",
3215
+ "ListBullets",
3216
+ "Lock",
3217
+ "MagnifyingGlass",
3218
+ "MapPin",
3219
+ "Medal",
3220
+ "NotePencil",
3221
+ "Paperclip",
3222
+ "PaperPlaneTilt",
3223
+ "Pen",
3224
+ "PenNib",
3225
+ "Pencil",
3226
+ "PencilSimpleLine",
3227
+ "Phone",
3228
+ "Plus",
3229
+ "Printer",
3230
+ "SignOut",
3231
+ "Stamp",
3232
+ "Star",
3233
+ "Target",
3234
+ "TextT",
3235
+ "Trash",
3236
+ "UploadSimple",
3237
+ "User",
3238
+ "UserPlus",
3239
+ "Users",
3240
+ "WarningCircle",
3241
+ "X",
3242
+ "ChatText",
3243
+ "CircleWavyCheck",
3244
+ "CircleWavyQuestion",
3245
+ "ArchiveBox",
3246
+ "ArrowCircleDown",
3247
+ "FileArrowUp",
3248
+ "FileDotted",
3249
+ "Files",
3250
+ "PencilLine",
3251
+ "PencilCircle",
3252
+ "UserCircle",
3253
+ "Clock",
3254
+ "QrCode",
3255
+ "Webcam",
3256
+ "Sun",
3257
+ "DeviceTabletCamera",
3258
+ "Globe",
3259
+ "Fingerprint",
3260
+ "PushPin",
3261
+ "Timer"
3262
+ ]);
3263
+
3264
+ // ../commons/src/events/SummaryConfig.ts
3265
+ var InfoBox = z29.object({
3266
+ type: z29.enum(["info", "positive", "warning", "negative"]).describe(
3267
+ "Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
3268
+ ),
3269
+ background: z29.enum(["tinted", "white"]).default("tinted").optional().describe(
3270
+ "tinted reads as a recessed empty state; white reads as a standalone card."
3271
+ ),
3272
+ icon: AvailableIcons.optional().describe(
3273
+ "Icon displayed inside the icon block. Defaults to FileSearch."
3274
+ ),
3275
+ heading: TranslationConfig.describe(
3276
+ "Primary message. Short, sentence-case."
3277
+ ),
3278
+ description: TranslationConfig.optional().describe(
3279
+ "Secondary copy displayed below the heading, typically a suggested next step."
3280
+ ),
3281
+ conditionals: z29.array(ShowConditional).default([]).optional().describe(
3282
+ "Conditions under which the info box is shown. When omitted, it is always shown."
3283
+ )
3284
+ }).describe(
3285
+ "A compact icon-block + heading + description block displayed above the summary fields in the event overview."
3286
+ );
3287
+ var BaseField2 = z29.object({
3288
+ emptyValueMessage: TranslationConfig.optional().describe(
3289
+ "Default message displayed when the field value is empty."
3290
+ ),
3291
+ conditionals: z29.array(ShowConditional).default([]).optional()
3292
+ });
3080
3293
  var ReferenceField = BaseField2.extend({
3081
- fieldId: z27.string(),
3294
+ fieldId: z29.string(),
3082
3295
  label: TranslationConfig.optional().describe(
3083
3296
  "Overrides the default label from the referenced field when provided."
3084
3297
  )
3085
3298
  }).describe("Field referencing existing event data by field ID.");
3086
3299
  var Field = BaseField2.extend({
3087
- id: z27.string().describe("Identifier of the summary field."),
3300
+ id: z29.string().describe("Identifier of the summary field."),
3088
3301
  value: TranslationConfig.describe(
3089
- 'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
3302
+ '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}").'
3090
3303
  ),
3091
3304
  label: TranslationConfig
3092
3305
  }).describe("Custom field defined for the summary view.");
3093
- var SummaryConfig = z27.object({
3094
- fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3306
+ var SummaryConfig = z29.object({
3307
+ banners: z29.array(InfoBox).default([]).optional().describe(
3308
+ "Info boxes displayed above the summary fields in the event overview."
3309
+ ),
3310
+ fields: z29.array(z29.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3095
3311
  }).meta({
3096
3312
  id: "SummaryConfig",
3097
3313
  description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
3098
3314
  });
3099
3315
 
3100
3316
  // ../commons/src/events/AdvancedSearchConfig.ts
3101
- var z28 = __toESM(require("zod/v4"));
3102
- var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
3103
- var BaseField3 = z28.object({
3104
- config: z28.object({
3317
+ var z30 = __toESM(require("zod/v4"));
3318
+ var MatchType = z30.enum(["fuzzy", "exact", "range", "within"]);
3319
+ var BaseField3 = z30.object({
3320
+ config: z30.object({
3105
3321
  type: MatchType.describe(
3106
3322
  "Determines the search type of field. How to match value."
3107
3323
  ),
3108
- searchFields: z28.array(z28.string()).optional().describe(
3324
+ searchFields: z30.array(z30.string()).optional().describe(
3109
3325
  `
3110
3326
  Defines multiple form fields that should be searched when this field has a value.
3111
3327
  All specified fields will be combined using OR logic.
@@ -3115,7 +3331,7 @@ var BaseField3 = z28.object({
3115
3331
  `
3116
3332
  )
3117
3333
  }),
3118
- type: z28.nativeEnum(FieldType).optional().describe(
3334
+ type: z30.nativeEnum(FieldType).optional().describe(
3119
3335
  `
3120
3336
  Explicitly specify the field type for searchFields.
3121
3337
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -3129,7 +3345,7 @@ var BaseField3 = z28.object({
3129
3345
  This is required when searchFields is defined.
3130
3346
  `
3131
3347
  ),
3132
- options: z28.array(SelectOption).optional(),
3348
+ options: z30.array(SelectOption).optional(),
3133
3349
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
3134
3350
  `
3135
3351
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -3150,7 +3366,7 @@ var BaseField3 = z28.object({
3150
3366
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
3151
3367
  `
3152
3368
  ),
3153
- conditionals: z28.array(FieldConditional).optional().describe(
3369
+ conditionals: z30.array(FieldConditional).optional().describe(
3154
3370
  `
3155
3371
  In advanced search, we sometimes need to override the default field visibility conditionals.
3156
3372
 
@@ -3164,23 +3380,23 @@ var BaseField3 = z28.object({
3164
3380
  are always rendered in the advanced search form.
3165
3381
  `
3166
3382
  ),
3167
- validations: z28.array(ValidationConfig).optional().describe(
3383
+ validations: z30.array(ValidationConfig).optional().describe(
3168
3384
  `Option for overriding the field validations specifically for advanced search form.`
3169
3385
  ),
3170
3386
  allowedLocations: JurisdictionReference.optional().describe(
3171
3387
  `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.`
3172
3388
  )
3173
3389
  });
3174
- var SearchQueryParams = z28.object({
3175
- eventType: z28.string().optional().describe(
3390
+ var SearchQueryParams = z30.object({
3391
+ eventType: z30.string().optional().describe(
3176
3392
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
3177
3393
  )
3178
3394
  }).catchall(FieldValue);
3179
3395
  var FieldConfigSchema = BaseField3.extend({
3180
- fieldId: z28.string(),
3181
- fieldType: z28.literal("field")
3396
+ fieldId: z30.string(),
3397
+ fieldType: z30.literal("field")
3182
3398
  });
3183
- var EventFieldIdInput = z28.enum([
3399
+ var EventFieldIdInput = z30.enum([
3184
3400
  "trackingId",
3185
3401
  "status",
3186
3402
  "legalStatuses.REGISTERED.acceptedAt",
@@ -3189,7 +3405,7 @@ var EventFieldIdInput = z28.enum([
3189
3405
  "updatedAt"
3190
3406
  ]);
3191
3407
  var METADATA_FIELD_PREFIX = "event.";
3192
- var EventFieldId = z28.enum([
3408
+ var EventFieldId = z30.enum([
3193
3409
  `${METADATA_FIELD_PREFIX}trackingId`,
3194
3410
  `${METADATA_FIELD_PREFIX}status`,
3195
3411
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -3199,195 +3415,60 @@ var EventFieldId = z28.enum([
3199
3415
  ]);
3200
3416
  var EventFieldConfigSchema = BaseField3.extend({
3201
3417
  fieldId: EventFieldId,
3202
- fieldType: z28.literal("event")
3418
+ fieldType: z30.literal("event")
3203
3419
  });
3204
- var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3420
+ var AdvancedSearchField = z30.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3205
3421
  if (data.config.searchFields && data.config.searchFields.length > 0) {
3206
3422
  if (!data.label) {
3207
3423
  ctx.addIssue({
3208
- code: z28.ZodIssueCode.custom,
3424
+ code: z30.ZodIssueCode.custom,
3209
3425
  message: "label is required when config.searchFields is defined.",
3210
3426
  path: ["label"]
3211
3427
  });
3212
3428
  }
3213
3429
  if (!data.type) {
3214
3430
  ctx.addIssue({
3215
- code: z28.ZodIssueCode.custom,
3431
+ code: z30.ZodIssueCode.custom,
3216
3432
  message: "type is required when config.searchFields is defined.",
3217
- path: ["type"]
3218
- });
3219
- }
3220
- }
3221
- });
3222
- var AdvancedSearchConfig = z28.object({
3223
- title: TranslationConfig.describe("Advanced search tab title"),
3224
- fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3225
- }).meta({
3226
- id: "AdvancedSearchConfig",
3227
- 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()`)."
3228
- });
3229
-
3230
- // ../commons/src/events/utils.ts
3231
- var import_lodash = require("lodash");
3232
-
3233
- // ../commons/src/conditionals/validate.ts
3234
- var import__ = __toESM(require("ajv/dist/2019"));
3235
- var import_ajv_formats = __toESM(require("ajv-formats"));
3236
- var z31 = __toESM(require("zod/v4"));
3237
- var import_date_fns = require("date-fns");
3238
-
3239
- // ../commons/src/events/FieldTypeMapping.ts
3240
- var z30 = __toESM(require("zod/v4"));
3241
-
3242
- // ../commons/src/events/DynamicFieldValue.ts
3243
- var z29 = __toESM(require("zod/v4"));
3244
-
3245
- // ../commons/src/conditionals/validate.ts
3246
- var ajv = new import__.default({
3247
- $data: true,
3248
- allowUnionTypes: true,
3249
- strict: false
3250
- // Allow minContains and other newer features
3251
- });
3252
- var DataContext = z31.object({
3253
- rootData: z31.object({
3254
- $leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
3255
- })
3256
- });
3257
- function resolveDataPath(rootData, dataPath, instancePath) {
3258
- const pathParts = dataPath.split("/");
3259
- const levels = parseInt(pathParts[0], 10);
3260
- const referencePath = pathParts.slice(1);
3261
- const instanceParts = instancePath.split("/").filter(Boolean);
3262
- const traversedParts = instanceParts.slice(0, -levels);
3263
- let current = rootData;
3264
- for (const part of traversedParts) {
3265
- if (current === null || current === void 0) {
3266
- return void 0;
3267
- }
3268
- current = current[part];
3269
- }
3270
- for (const part of referencePath) {
3271
- if (current === null || current === void 0) {
3272
- return void 0;
3273
- }
3274
- current = current[part];
3275
- }
3276
- return current;
3277
- }
3278
- function todayISO() {
3279
- return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3280
- }
3281
- var compiledFunctionCache = /* @__PURE__ */ new Map();
3282
- function compileClientFunction(code) {
3283
- let fn = compiledFunctionCache.get(code);
3284
- if (!fn) {
3285
- fn = new Function(`return (${code})`)();
3286
- compiledFunctionCache.set(code, fn);
3287
- }
3288
- return fn;
3289
- }
3290
- (0, import_ajv_formats.default)(ajv);
3291
- function buildClientFunctionContext(input) {
3292
- return {
3293
- $form: input.form,
3294
- $now: todayISO(),
3295
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
3296
- $online: isOnline(),
3297
- $user: input.validatorContext?.user,
3298
- $event: input.validatorContext?.event,
3299
- $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3300
- user: input.systemVariables?.user,
3301
- $window: input.systemVariables?.$window,
3302
- locations: input.locations,
3303
- adminLevelIds: input.adminLevelIds
3304
- };
3305
- }
3306
- function runClientFunction(code, data, context) {
3307
- return compileClientFunction(code)(data, context);
3308
- }
3309
- ajv.addKeyword({
3310
- keyword: "daysFromDate",
3311
- type: "string",
3312
- schemaType: "object",
3313
- $data: true,
3314
- errors: true,
3315
- validate(schema, data, _2, dataContext) {
3316
- if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
3317
- throw new Error("Validation context must contain $now");
3318
- }
3319
- const { days, clause } = schema;
3320
- if (typeof data !== "string") {
3321
- return false;
3322
- }
3323
- const date = new Date(data);
3324
- if (isNaN(date.getTime())) {
3325
- return false;
3326
- }
3327
- let referenceDate = schema.referenceDate;
3328
- if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
3329
- referenceDate = resolveDataPath(
3330
- dataContext.rootData,
3331
- referenceDate.$data,
3332
- dataContext.instancePath
3333
- );
3334
- }
3335
- if (!referenceDate) {
3336
- referenceDate = dataContext.rootData.$now;
3337
- }
3338
- const baseDate = new Date(referenceDate);
3339
- if (isNaN(baseDate.getTime())) {
3340
- return false;
3341
- }
3342
- const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
3343
- return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
3344
- }
3345
- });
3346
- ajv.addKeyword({
3347
- keyword: "isLeafLevelLocation",
3348
- type: "string",
3349
- schemaType: "boolean",
3350
- $data: true,
3351
- errors: true,
3352
- // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
3353
- validate(_schema, data, _2, dataContext) {
3354
- const locationIdInput = data;
3355
- const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
3356
- return locations.some((location) => location.id === locationIdInput);
3357
- }
3358
- });
3359
- ajv.addKeyword({
3360
- keyword: "customClientValidator",
3361
- schemaType: "object",
3362
- errors: true,
3363
- // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3364
- // `validate()` callers build root data via `buildClientFunctionContext`,
3365
- // so the cast holds.
3366
- validate(schema, data, _2, dataContext) {
3367
- return Boolean(
3368
- runClientFunction(
3369
- schema.code,
3370
- data,
3371
- dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3372
- )
3373
- );
3433
+ path: ["type"]
3434
+ });
3435
+ }
3374
3436
  }
3375
3437
  });
3376
- function isOnline() {
3377
- if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3378
- return navigator.onLine;
3379
- }
3380
- return true;
3381
- }
3438
+ var AdvancedSearchConfig = z30.object({
3439
+ title: TranslationConfig.describe("Advanced search tab title"),
3440
+ fields: z30.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3441
+ }).meta({
3442
+ id: "AdvancedSearchConfig",
3443
+ 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()`)."
3444
+ });
3382
3445
 
3383
- // ../commons/src/utils.ts
3446
+ // ../commons/src/events/utils.ts
3447
+ var import_lodash4 = require("lodash");
3448
+
3449
+ // ../commons/src/conditionals/validate.ts
3450
+ var import__ = __toESM(require("ajv/dist/2019"));
3451
+ var import_ajv_formats = __toESM(require("ajv-formats"));
3452
+ var z34 = __toESM(require("zod/v4"));
3453
+ var import_date_fns2 = require("date-fns");
3454
+
3455
+ // ../commons/src/events/FieldTypeMapping.ts
3384
3456
  var z32 = __toESM(require("zod/v4"));
3457
+
3458
+ // ../commons/src/events/DynamicFieldValue.ts
3459
+ var z31 = __toESM(require("zod/v4"));
3460
+
3461
+ // ../commons/src/events/state/index.ts
3462
+ var import_lodash3 = require("lodash");
3463
+
3464
+ // ../commons/src/utils.ts
3465
+ var z33 = __toESM(require("zod/v4"));
3385
3466
  var _ = __toESM(require("lodash"));
3386
- var FullNameV1 = z32.array(
3387
- z32.object({
3388
- use: z32.string(),
3389
- family: z32.string(),
3390
- given: z32.array(z32.string())
3467
+ var FullNameV1 = z33.array(
3468
+ z33.object({
3469
+ use: z33.string(),
3470
+ family: z33.string(),
3471
+ given: z33.array(z33.string())
3391
3472
  })
3392
3473
  );
3393
3474
  function omitKeyDeep(obj, keyToRemove) {
@@ -3406,35 +3487,64 @@ function omitKeyDeep(obj, keyToRemove) {
3406
3487
  return newObj;
3407
3488
  }
3408
3489
 
3409
- // ../commons/src/events/utils.ts
3410
- var import_date_fns2 = require("date-fns");
3411
- function getDeclarationFields(configuration) {
3412
- return configuration.declaration.pages.flatMap(({ fields }) => fields);
3413
- }
3414
- var getActionAnnotationFields = (actionConfig) => {
3415
- if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
3416
- return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
3417
- }
3418
- if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3419
- return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3490
+ // ../commons/src/events/state/utils.ts
3491
+ var import_lodash = require("lodash");
3492
+ var updateActions = new Set(
3493
+ ActionTypes.extract([
3494
+ ActionType.CREATE,
3495
+ ActionType.NOTIFY,
3496
+ ActionType.EDIT,
3497
+ ActionType.DECLARE,
3498
+ ActionType.REGISTER,
3499
+ ActionType.REJECT,
3500
+ ActionType.ARCHIVE,
3501
+ ActionType.UNARCHIVE,
3502
+ ActionType.PRINT_CERTIFICATE,
3503
+ ActionType.REQUEST_CORRECTION,
3504
+ ActionType.APPROVE_CORRECTION,
3505
+ ActionType.REJECT_CORRECTION,
3506
+ ActionType.CUSTOM
3507
+ ]).options
3508
+ );
3509
+
3510
+ // ../commons/src/events/state/flags.ts
3511
+ var import_lodash2 = require("lodash");
3512
+ var import_date_fns = require("date-fns");
3513
+ var INHERENT_FLAG_RULES = [
3514
+ {
3515
+ flag: InherentFlags.CORRECTION_REQUESTED,
3516
+ setOn: [ActionType.REQUEST_CORRECTION],
3517
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
3518
+ },
3519
+ {
3520
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
3521
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
3522
+ // are deliberately excluded so the flag freezes across an archive/unarchive
3523
+ // round trip and comes back exactly as it was.
3524
+ flag: InherentFlags.INCOMPLETE,
3525
+ setOn: [ActionType.NOTIFY],
3526
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
3527
+ },
3528
+ {
3529
+ flag: InherentFlags.REJECTED,
3530
+ setOn: [ActionType.REJECT],
3531
+ resetOn: [
3532
+ ActionType.NOTIFY,
3533
+ ActionType.DECLARE,
3534
+ ActionType.EDIT,
3535
+ ActionType.REGISTER
3536
+ ]
3537
+ },
3538
+ {
3539
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
3540
+ setOn: [ActionType.DUPLICATE_DETECTED],
3541
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
3542
+ },
3543
+ {
3544
+ flag: InherentFlags.EDIT_IN_PROGRESS,
3545
+ setOn: [ActionType.EDIT],
3546
+ resetOnAnyOtherAction: true
3420
3547
  }
3421
- const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3422
- const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3423
- return [...reviewFields, ...formFields];
3424
- };
3425
- function getAllAnnotationFields(config) {
3426
- return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
3427
- }
3428
- var findAllFields = (config) => {
3429
- return (0, import_lodash.flattenDeep)([
3430
- ...getDeclarationFields(config),
3431
- ...getAllAnnotationFields(config)
3432
- ]);
3433
- };
3434
- var EXCLUDED_ACTIONS = [
3435
- ActionType.REQUEST_CORRECTION,
3436
- ActionType.PRINT_CERTIFICATE,
3437
- ActionType.REJECT_CORRECTION
3438
3548
  ];
3439
3549
 
3440
3550
  // ../commons/src/conditionals/conditionals.ts
@@ -3643,6 +3753,33 @@ function defineComparison(field3, value, keyword) {
3643
3753
  required: [field3.$$field]
3644
3754
  });
3645
3755
  }
3756
+ function flag(flagvalue) {
3757
+ return defineConditional({
3758
+ type: "object",
3759
+ properties: {
3760
+ $flags: {
3761
+ type: "array",
3762
+ contains: {
3763
+ type: "string",
3764
+ const: flagvalue
3765
+ }
3766
+ }
3767
+ },
3768
+ required: ["$flags"]
3769
+ });
3770
+ }
3771
+ function status(statusValue) {
3772
+ return defineConditional({
3773
+ type: "object",
3774
+ properties: {
3775
+ $status: {
3776
+ type: "string",
3777
+ const: statusValue
3778
+ }
3779
+ },
3780
+ required: ["$status"]
3781
+ });
3782
+ }
3646
3783
  function createFieldConditionals(fieldId) {
3647
3784
  const getDayRange = (field3, days, clause, referenceDate) => ({
3648
3785
  type: "object",
@@ -4044,6 +4181,176 @@ function createFieldConditionals(fieldId) {
4044
4181
  };
4045
4182
  }
4046
4183
 
4184
+ // ../commons/src/conditionals/validate.ts
4185
+ var ajv = new import__.default({
4186
+ $data: true,
4187
+ allowUnionTypes: true,
4188
+ strict: false
4189
+ // Allow minContains and other newer features
4190
+ });
4191
+ var DataContext = z34.object({
4192
+ rootData: z34.object({
4193
+ $leafAdminStructureLocationIds: z34.array(z34.object({ id: UUID }))
4194
+ })
4195
+ });
4196
+ function resolveDataPath(rootData, dataPath, instancePath) {
4197
+ const pathParts = dataPath.split("/");
4198
+ const levels = parseInt(pathParts[0], 10);
4199
+ const referencePath = pathParts.slice(1);
4200
+ const instanceParts = instancePath.split("/").filter(Boolean);
4201
+ const traversedParts = instanceParts.slice(0, -levels);
4202
+ let current = rootData;
4203
+ for (const part of traversedParts) {
4204
+ if (current === null || current === void 0) {
4205
+ return void 0;
4206
+ }
4207
+ current = current[part];
4208
+ }
4209
+ for (const part of referencePath) {
4210
+ if (current === null || current === void 0) {
4211
+ return void 0;
4212
+ }
4213
+ current = current[part];
4214
+ }
4215
+ return current;
4216
+ }
4217
+ function todayISO() {
4218
+ return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
4219
+ }
4220
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
4221
+ function compileClientFunction(code) {
4222
+ let fn = compiledFunctionCache.get(code);
4223
+ if (!fn) {
4224
+ fn = new Function(`return (${code})`)();
4225
+ compiledFunctionCache.set(code, fn);
4226
+ }
4227
+ return fn;
4228
+ }
4229
+ (0, import_ajv_formats.default)(ajv);
4230
+ function buildClientFunctionContext(input) {
4231
+ return {
4232
+ $form: input.form,
4233
+ $flags: input.validatorContext?.event?.state.flags ?? [],
4234
+ $now: todayISO(),
4235
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
4236
+ $online: isOnline(),
4237
+ $user: input.validatorContext?.user,
4238
+ $event: input.validatorContext?.event?.document,
4239
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
4240
+ user: input.systemVariables?.user,
4241
+ $window: input.systemVariables?.$window,
4242
+ locations: input.locations,
4243
+ adminLevelIds: input.adminLevelIds
4244
+ };
4245
+ }
4246
+ function runClientFunction(code, data, context) {
4247
+ return compileClientFunction(code)(data, context);
4248
+ }
4249
+ ajv.addKeyword({
4250
+ keyword: "daysFromDate",
4251
+ type: "string",
4252
+ schemaType: "object",
4253
+ $data: true,
4254
+ errors: true,
4255
+ validate(schema, data, _2, dataContext) {
4256
+ if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
4257
+ throw new Error("Validation context must contain $now");
4258
+ }
4259
+ const { days, clause } = schema;
4260
+ if (typeof data !== "string") {
4261
+ return false;
4262
+ }
4263
+ const date = new Date(data);
4264
+ if (isNaN(date.getTime())) {
4265
+ return false;
4266
+ }
4267
+ let referenceDate = schema.referenceDate;
4268
+ if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
4269
+ referenceDate = resolveDataPath(
4270
+ dataContext.rootData,
4271
+ referenceDate.$data,
4272
+ dataContext.instancePath
4273
+ );
4274
+ }
4275
+ if (!referenceDate) {
4276
+ referenceDate = dataContext.rootData.$now;
4277
+ }
4278
+ const baseDate = new Date(referenceDate);
4279
+ if (isNaN(baseDate.getTime())) {
4280
+ return false;
4281
+ }
4282
+ const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
4283
+ return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
4284
+ }
4285
+ });
4286
+ ajv.addKeyword({
4287
+ keyword: "isLeafLevelLocation",
4288
+ type: "string",
4289
+ schemaType: "boolean",
4290
+ $data: true,
4291
+ errors: true,
4292
+ // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
4293
+ validate(_schema, data, _2, dataContext) {
4294
+ const locationIdInput = data;
4295
+ const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
4296
+ return locations.some((location) => location.id === locationIdInput);
4297
+ }
4298
+ });
4299
+ ajv.addKeyword({
4300
+ keyword: "customClientValidator",
4301
+ schemaType: "object",
4302
+ errors: true,
4303
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
4304
+ // `validate()` callers build root data via `buildClientFunctionContext`,
4305
+ // so the cast holds.
4306
+ validate(schema, data, _2, dataContext) {
4307
+ return Boolean(
4308
+ runClientFunction(
4309
+ schema.code,
4310
+ data,
4311
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
4312
+ )
4313
+ );
4314
+ }
4315
+ });
4316
+ function isOnline() {
4317
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
4318
+ return navigator.onLine;
4319
+ }
4320
+ return true;
4321
+ }
4322
+
4323
+ // ../commons/src/events/utils.ts
4324
+ var import_date_fns3 = require("date-fns");
4325
+ function getDeclarationFields(configuration) {
4326
+ return configuration.declaration.pages.flatMap(({ fields }) => fields);
4327
+ }
4328
+ var getActionAnnotationFields = (actionConfig) => {
4329
+ if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
4330
+ return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
4331
+ }
4332
+ if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
4333
+ return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
4334
+ }
4335
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
4336
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
4337
+ return [...reviewFields, ...formFields];
4338
+ };
4339
+ function getAllAnnotationFields(config) {
4340
+ return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
4341
+ }
4342
+ var findAllFields = (config) => {
4343
+ return (0, import_lodash4.flattenDeep)([
4344
+ ...getDeclarationFields(config),
4345
+ ...getAllAnnotationFields(config)
4346
+ ]);
4347
+ };
4348
+ var EXCLUDED_ACTIONS = [
4349
+ ActionType.REQUEST_CORRECTION,
4350
+ ActionType.PRINT_CERTIFICATE,
4351
+ ActionType.REJECT_CORRECTION
4352
+ ];
4353
+
4047
4354
  // ../commons/src/events/eventConfigValidation.ts
4048
4355
  function validateAdvancedSearchConfig(event2, ctx) {
4049
4356
  const allFields = findAllFields(event2);
@@ -4126,9 +4433,9 @@ function validatePlaceOfEvent(event2, ctx) {
4126
4433
  }
4127
4434
  function validateActionFlags(event2, ctx) {
4128
4435
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
4129
- const configuredFlagIds = event2.flags.map((flag) => flag.id);
4436
+ const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
4130
4437
  const actionFlagIds = event2.actions.flatMap(
4131
- (action) => (action.flags ?? []).map((flag) => flag.id)
4438
+ (action) => (action.flags ?? []).map((flag2) => flag2.id)
4132
4439
  );
4133
4440
  for (const actionFlagId of actionFlagIds) {
4134
4441
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4164,11 +4471,11 @@ function validateActionOrder(event2, ctx) {
4164
4471
  }
4165
4472
 
4166
4473
  // ../commons/src/events/EventConfig.ts
4167
- var EventFieldReference = z33.object({ $$event: EventMetadataDateFieldIdInput }).describe(
4474
+ var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
4168
4475
  "Reference to a field defined in the event metadata, using the field id."
4169
4476
  );
4170
- var _EventConfigBase = z33.object({
4171
- id: z33.string().describe(
4477
+ var _EventConfigBase = z35.object({
4478
+ id: z35.string().describe(
4172
4479
  'Machine-readable identifier of the event (e.g. "birth", "death").'
4173
4480
  ),
4174
4481
  dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
@@ -4187,23 +4494,26 @@ var _EventConfigBase = z33.object({
4187
4494
  "Summary information displayed in the event overview."
4188
4495
  ),
4189
4496
  label: TranslationConfig.describe("Human-readable label for the event type."),
4190
- actions: z33.array(ActionConfig).describe(
4497
+ actions: z35.array(ActionConfig).describe(
4191
4498
  "Configuration of core and custom actions associated with the event."
4192
4499
  ),
4193
- actionOrder: z33.array(z33.string()).optional().describe(
4500
+ actionOrder: z35.array(z35.string()).optional().describe(
4194
4501
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
4195
4502
  ),
4196
4503
  declaration: DeclarationFormConfig.describe(
4197
4504
  "Configuration of the form used to gather event data."
4198
4505
  ),
4199
- advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
4506
+ advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
4200
4507
  "Configuration of fields available in the advanced search feature."
4201
4508
  ),
4202
- flags: z33.array(FlagConfig).optional().default([]).describe(
4509
+ flags: z35.array(FlagConfig).optional().default([]).describe(
4203
4510
  "Configuration of custom flags associated with the actions of this event type."
4204
4511
  ),
4205
- analytics: z33.boolean().optional().default(true).describe(
4512
+ analytics: z35.boolean().optional().default(true).describe(
4206
4513
  "Indicates whether the records of this event type are included in analytics"
4514
+ ),
4515
+ icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
4516
+ '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.'
4207
4517
  )
4208
4518
  });
4209
4519
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
@@ -4223,7 +4533,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
4223
4533
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
4224
4534
 
4225
4535
  // ../commons/src/events/WorkqueueConfig.ts
4226
- var z37 = __toESM(require("zod/v4"));
4536
+ var z38 = __toESM(require("zod/v4"));
4227
4537
 
4228
4538
  // ../commons/src/searchConfigs.ts
4229
4539
  function createSearchConfig(baseField) {
@@ -4420,21 +4730,31 @@ var event = Object.assign(eventFn, {
4420
4730
  return {
4421
4731
  $event: field3
4422
4732
  };
4423
- }
4733
+ },
4734
+ /**
4735
+ * Checks if the event currently has the given status.
4736
+ * @param eventStatus - The status to check for.
4737
+ */
4738
+ hasStatus: (eventStatus) => status(eventStatus),
4739
+ /**
4740
+ * Checks if the event currently carries the given flag.
4741
+ * @param flagValue - The flag to check for.
4742
+ */
4743
+ hasFlag: (flagValue) => flag(flagValue)
4424
4744
  });
4425
4745
 
4426
4746
  // ../commons/src/events/WorkqueueColumnConfig.ts
4427
- var z34 = __toESM(require("zod/v4"));
4747
+ var z36 = __toESM(require("zod/v4"));
4428
4748
  var WorkqueueColumnKeysArray = [
4429
4749
  ...EventMetadataKeysArray,
4430
4750
  "title",
4431
4751
  "outbox"
4432
4752
  ];
4433
- var WorkqueueColumnKeys = z34.enum(WorkqueueColumnKeysArray);
4434
- var WorkqueueColumnValue = z34.object({
4753
+ var WorkqueueColumnKeys = z36.enum(WorkqueueColumnKeysArray);
4754
+ var WorkqueueColumnValue = z36.object({
4435
4755
  $event: WorkqueueColumnKeys
4436
4756
  });
4437
- var WorkqueueColumn = z34.object({
4757
+ var WorkqueueColumn = z36.object({
4438
4758
  label: TranslationConfig,
4439
4759
  value: WorkqueueColumnValue
4440
4760
  }).meta({
@@ -4448,164 +4768,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
4448
4768
  }
4449
4769
 
4450
4770
  // ../commons/src/events/CountryConfigQueryInput.ts
4451
- var z35 = __toESM(require("zod/v4"));
4452
- var SerializableExact = z35.object({
4453
- type: z35.literal("exact"),
4454
- term: z35.union([z35.string(), SerializedUserField])
4455
- });
4456
- var SerializableWithin = z35.object({
4457
- type: z35.literal("within"),
4458
- location: z35.union([z35.string(), SerializedUserField])
4459
- });
4460
- var SerializedQueryExpression = z35.object({
4461
- eventType: z35.string(),
4462
- status: z35.optional(z35.union([AnyOfStatus, ExactStatus])),
4463
- createdAt: z35.optional(DateCondition),
4464
- updatedAt: z35.optional(DateCondition),
4465
- "legalStatuses.DECLARED.createdAtLocation": z35.optional(SerializableWithin),
4466
- "legalStatuses.DECLARED.createdByRole": z35.optional(AnyOf),
4467
- "legalStatuses.REGISTERED.createdAt": z35.optional(DateCondition),
4468
- "legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
4469
- "legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
4470
- "legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
4471
- createdAtLocation: z35.optional(
4472
- z35.union([SerializableWithin, SerializableExact])
4771
+ var z37 = __toESM(require("zod/v4"));
4772
+ var SerializableExact = z37.object({
4773
+ type: z37.literal("exact"),
4774
+ term: z37.union([z37.string(), SerializedUserField])
4775
+ });
4776
+ var SerializableWithin = z37.object({
4777
+ type: z37.literal("within"),
4778
+ location: z37.union([z37.string(), SerializedUserField])
4779
+ });
4780
+ var SerializedQueryExpression = z37.object({
4781
+ eventType: z37.string(),
4782
+ status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
4783
+ createdAt: z37.optional(DateCondition),
4784
+ updatedAt: z37.optional(DateCondition),
4785
+ "legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
4786
+ "legalStatuses.DECLARED.createdByRole": z37.optional(AnyOf),
4787
+ "legalStatuses.REGISTERED.createdAt": z37.optional(DateCondition),
4788
+ "legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
4789
+ "legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
4790
+ "legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
4791
+ createdAtLocation: z37.optional(
4792
+ z37.union([SerializableWithin, SerializableExact])
4473
4793
  ),
4474
- updatedAtLocation: z35.optional(
4475
- z35.union([SerializableWithin, SerializableExact])
4794
+ updatedAtLocation: z37.optional(
4795
+ z37.union([SerializableWithin, SerializableExact])
4476
4796
  ),
4477
- updatedByUserRole: z35.optional(SerializableExact),
4478
- assignedTo: z35.optional(SerializableExact),
4479
- createdBy: z35.optional(SerializableExact),
4797
+ updatedByUserRole: z37.optional(SerializableExact),
4798
+ assignedTo: z37.optional(SerializableExact),
4799
+ createdBy: z37.optional(SerializableExact),
4480
4800
  createdByUserType: ExactUserType,
4481
- updatedBy: z35.optional(SerializableExact),
4482
- trackingId: z35.optional(Exact),
4483
- flags: z35.optional(ContainsFlags),
4801
+ updatedBy: z37.optional(SerializableExact),
4802
+ trackingId: z37.optional(Exact),
4803
+ flags: z37.optional(ContainsFlags),
4484
4804
  data: QueryInput
4485
4805
  }).partial();
4486
- var Or2 = z35.object({
4487
- type: z35.literal("or"),
4488
- clauses: z35.array(SerializedQueryExpression)
4806
+ var Or2 = z37.object({
4807
+ type: z37.literal("or"),
4808
+ clauses: z37.array(SerializedQueryExpression)
4489
4809
  });
4490
- var And2 = z35.object({
4491
- type: z35.literal("and"),
4492
- clauses: z35.array(SerializedQueryExpression)
4810
+ var And2 = z37.object({
4811
+ type: z37.literal("and"),
4812
+ clauses: z37.array(SerializedQueryExpression)
4493
4813
  });
4494
- var CountryConfigQueryType = z35.discriminatedUnion("type", [And2, Or2]);
4495
- var CountryConfigQueryInputType = z35.union([
4814
+ var CountryConfigQueryType = z37.discriminatedUnion("type", [And2, Or2]);
4815
+ var CountryConfigQueryInputType = z37.union([
4496
4816
  SerializedQueryExpression,
4497
4817
  And2,
4498
4818
  Or2
4499
4819
  ]);
4500
4820
 
4501
- // ../commons/src/icons.ts
4502
- var z36 = __toESM(require("zod/v4"));
4503
- var AvailableIcons = z36.enum([
4504
- "Archived",
4505
- "Assigned",
4506
- "Briefcase",
4507
- "Certified",
4508
- "Close",
4509
- "Collapse",
4510
- "Draft",
4511
- "DuplicateYellow",
4512
- "Expand",
4513
- "ExternalValidate",
4514
- "FilledCheck",
4515
- "InReview",
4516
- "Offline",
4517
- "Registered",
4518
- "RequiresUpdates",
4519
- "Sent",
4520
- "Validated",
4521
- "WaitingApproval",
4522
- "ChartActivity",
4523
- "Activity",
4524
- "Archive",
4525
- "ArchiveTray",
4526
- "ArrowLeft",
4527
- "ArrowRight",
4528
- "Buildings",
4529
- "Circle",
4530
- "CaretDown",
4531
- "CaretLeft",
4532
- "CaretRight",
4533
- "ChartBar",
4534
- "ChartLine",
4535
- "ChatCircle",
4536
- "CheckSquare",
4537
- "Compass",
4538
- "Check",
4539
- "Copy",
4540
- "Database",
4541
- "DotsThreeVertical",
4542
- "ArrowCounterClockwise",
4543
- "MagnifyingGlassMinus",
4544
- "MagnifyingGlassPlus",
4545
- "Export",
4546
- "Eye",
4547
- "EyeSlash",
4548
- "Envelope",
4549
- "File",
4550
- "FileSearch",
4551
- "FileMinus",
4552
- "FilePlus",
4553
- "FileText",
4554
- "FileX",
4555
- "Handshake",
4556
- "Gear",
4557
- "GitBranch",
4558
- "IdentificationCard",
4559
- "List",
4560
- "ListBullets",
4561
- "Lock",
4562
- "MagnifyingGlass",
4563
- "MapPin",
4564
- "Medal",
4565
- "NotePencil",
4566
- "Paperclip",
4567
- "PaperPlaneTilt",
4568
- "Pen",
4569
- "PenNib",
4570
- "Pencil",
4571
- "PencilSimpleLine",
4572
- "Phone",
4573
- "Plus",
4574
- "Printer",
4575
- "SignOut",
4576
- "Stamp",
4577
- "Star",
4578
- "Target",
4579
- "TextT",
4580
- "Trash",
4581
- "UploadSimple",
4582
- "User",
4583
- "UserPlus",
4584
- "Users",
4585
- "WarningCircle",
4586
- "X",
4587
- "ChatText",
4588
- "CircleWavyCheck",
4589
- "CircleWavyQuestion",
4590
- "ArchiveBox",
4591
- "ArrowCircleDown",
4592
- "FileArrowUp",
4593
- "FileDotted",
4594
- "Files",
4595
- "PencilLine",
4596
- "PencilCircle",
4597
- "UserCircle",
4598
- "Clock",
4599
- "QrCode",
4600
- "Webcam",
4601
- "Sun",
4602
- "DeviceTabletCamera",
4603
- "Globe",
4604
- "Fingerprint",
4605
- "PushPin",
4606
- "Timer"
4607
- ]);
4608
-
4609
4821
  // ../commons/src/events/WorkqueueConfig.ts
4610
4822
  var mandatoryColumns = defineWorkqueuesColumns([
4611
4823
  {
@@ -4625,16 +4837,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
4625
4837
  value: event.field("updatedAt")
4626
4838
  }
4627
4839
  ]);
4628
- var WorkqueueConfig = z37.object({
4629
- slug: z37.string().describe("Determines the url of the workqueue."),
4840
+ var WorkqueueConfig = z38.object({
4841
+ slug: z38.string().describe("Determines the url of the workqueue."),
4630
4842
  name: TranslationConfig.describe(
4631
4843
  "Title of the workflow (both in navigation and on the page)"
4632
4844
  ),
4633
4845
  query: CountryConfigQueryType,
4634
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4846
+ action: z38.object({ type: WorkqueueActionType }).optional().describe(
4635
4847
  "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
4636
4848
  ),
4637
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4849
+ columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
4638
4850
  icon: AvailableIcons,
4639
4851
  emptyMessage: TranslationConfig.optional()
4640
4852
  }).describe("Configuration for workqueue.");
@@ -4648,10 +4860,10 @@ var WorkqueueConfigInput = WorkqueueConfig.extend({
4648
4860
  id: "WorkqueueConfig",
4649
4861
  description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
4650
4862
  });
4651
- var WorkqueueCountInput = z37.array(
4652
- z37.object({ slug: z37.string(), query: QueryType })
4863
+ var WorkqueueCountInput = z38.array(
4864
+ z38.object({ slug: z38.string(), query: QueryType })
4653
4865
  );
4654
- var WorkqueueCountOutput = z37.record(z37.string(), z37.number());
4866
+ var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
4655
4867
 
4656
4868
  // ../commons/src/events/workqueueDefaultColumns.ts
4657
4869
  var defaultWorkqueueColumns = [
@@ -4674,21 +4886,21 @@ var defaultWorkqueueColumns = [
4674
4886
  ];
4675
4887
 
4676
4888
  // ../commons/src/events/Draft.ts
4677
- var z39 = __toESM(require("zod/v4"));
4889
+ var z40 = __toESM(require("zod/v4"));
4678
4890
 
4679
4891
  // ../commons/src/events/ActionInput.ts
4680
- var z38 = __toESM(require("zod/v4"));
4681
- var BaseActionInput = z38.object({
4892
+ var z39 = __toESM(require("zod/v4"));
4893
+ var BaseActionInput = z39.object({
4682
4894
  eventId: UUID,
4683
- transactionId: z38.string(),
4895
+ transactionId: z39.string(),
4684
4896
  declaration: ActionUpdate.default({}),
4685
4897
  annotation: ActionUpdate.optional(),
4686
4898
  originalActionId: UUID.optional(),
4687
4899
  // should not be part of base action.
4688
- keepAssignment: z38.boolean().optional(),
4689
- keepAssignmentIfAccepted: z38.boolean().optional(),
4690
- keepAssignmentIfRejected: z38.boolean().optional(),
4691
- waitFor: z38.boolean().default(true).describe(
4900
+ keepAssignment: z39.boolean().optional(),
4901
+ keepAssignmentIfAccepted: z39.boolean().optional(),
4902
+ keepAssignmentIfRejected: z39.boolean().optional(),
4903
+ waitFor: z39.boolean().default(true).describe(
4692
4904
  "Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
4693
4905
  ),
4694
4906
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
@@ -4698,8 +4910,8 @@ var BaseActionInput = z38.object({
4698
4910
  )
4699
4911
  });
4700
4912
  var CreateActionInput = BaseActionInput.extend(
4701
- z38.object({
4702
- type: z38.literal(ActionType.CREATE).default(ActionType.CREATE),
4913
+ z39.object({
4914
+ type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
4703
4915
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4704
4916
  createdAtLocation: UUID.nullish().describe(
4705
4917
  "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."
@@ -4707,14 +4919,14 @@ var CreateActionInput = BaseActionInput.extend(
4707
4919
  }).shape
4708
4920
  );
4709
4921
  var RegisterActionInput = BaseActionInput.extend(
4710
- z38.strictObject({
4711
- type: z38.literal(ActionType.REGISTER).default(ActionType.REGISTER),
4712
- registrationNumber: z38.string().optional()
4922
+ z39.strictObject({
4923
+ type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
4924
+ registrationNumber: z39.string().optional()
4713
4925
  }).shape
4714
4926
  );
4715
4927
  var NotifyActionInput = BaseActionInput.extend(
4716
- z38.object({
4717
- type: z38.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
4928
+ z39.object({
4929
+ type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
4718
4930
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4719
4931
  createdAtLocation: UUID.nullish().describe(
4720
4932
  "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."
@@ -4730,103 +4942,107 @@ var NotifyActionInput = BaseActionInput.extend(
4730
4942
  }
4731
4943
  });
4732
4944
  var DeclareActionInput = BaseActionInput.extend(
4733
- z38.object({
4734
- type: z38.literal(ActionType.DECLARE).default(ActionType.DECLARE)
4945
+ z39.object({
4946
+ type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
4735
4947
  }).shape
4736
4948
  );
4737
4949
  var EditActionInput = BaseActionInput.extend(
4738
- z38.object({
4739
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4950
+ z39.object({
4951
+ type: z39.literal(ActionType.EDIT).default(ActionType.EDIT)
4740
4952
  }).shape
4741
4953
  );
4742
4954
  var PrintCertificateActionInput = BaseActionInput.extend(
4743
- z38.object({
4744
- type: z38.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
4955
+ z39.object({
4956
+ type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
4745
4957
  content: PrintContent.optional()
4746
4958
  }).shape
4747
4959
  );
4748
4960
  var RejectDeclarationActionInput = BaseActionInput.extend(
4749
- z38.object({
4750
- type: z38.literal(ActionType.REJECT).default(ActionType.REJECT),
4961
+ z39.object({
4962
+ type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
4751
4963
  content: ReasonContent
4752
4964
  }).shape
4753
4965
  );
4754
4966
  var DuplicateDetectedActionInput = BaseActionInput.extend(
4755
- z38.object({
4756
- type: z38.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
4757
- content: z38.object({
4758
- duplicates: z38.array(PotentialDuplicate)
4967
+ z39.object({
4968
+ type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
4969
+ content: z39.object({
4970
+ duplicates: z39.array(PotentialDuplicate)
4759
4971
  })
4760
4972
  }).shape
4761
4973
  );
4762
4974
  var MarkAsDuplicateActionInput = BaseActionInput.extend(
4763
- z38.object({
4764
- type: z38.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
4765
- content: z38.object({
4975
+ z39.object({
4976
+ type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
4977
+ content: z39.object({
4766
4978
  duplicateOf: UUID
4767
4979
  }).optional()
4768
4980
  }).shape
4769
4981
  );
4770
4982
  var MarkNotDuplicateActionInput = BaseActionInput.extend(
4771
- z38.object({
4772
- type: z38.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
4983
+ z39.object({
4984
+ type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
4773
4985
  }).shape
4774
4986
  );
4775
4987
  var ArchiveActionInput = BaseActionInput.extend(
4776
- z38.object({
4777
- type: z38.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
4778
- content: ReasonContent
4988
+ z39.object({
4989
+ type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
4990
+ /**
4991
+ * Archiving does not collect a reason on its own. Only the
4992
+ * "mark as duplicate" flow archives with a reason attached.
4993
+ */
4994
+ content: ReasonContent.optional()
4779
4995
  }).shape
4780
4996
  );
4781
4997
  var UnarchiveActionInput = BaseActionInput.extend(
4782
- z38.object({
4783
- type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4998
+ z39.object({
4999
+ type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4784
5000
  }).shape
4785
5001
  );
4786
5002
  var AssignActionInput = BaseActionInput.extend(
4787
- z38.object({
4788
- type: z38.literal(ActionType.ASSIGN),
4789
- assignedTo: z38.string()
5003
+ z39.object({
5004
+ type: z39.literal(ActionType.ASSIGN),
5005
+ assignedTo: z39.string()
4790
5006
  }).shape
4791
5007
  );
4792
5008
  var UnassignActionInput = BaseActionInput.extend(
4793
- z38.object({
4794
- type: z38.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
4795
- assignedTo: z38.literal(null).default(null)
5009
+ z39.object({
5010
+ type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
5011
+ assignedTo: z39.literal(null).default(null)
4796
5012
  }).shape
4797
5013
  );
4798
5014
  var RequestCorrectionActionInput = BaseActionInput.extend(
4799
- z38.object({
4800
- type: z38.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
5015
+ z39.object({
5016
+ type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
4801
5017
  }).shape
4802
5018
  );
4803
5019
  var RejectCorrectionActionInput = BaseActionInput.extend(
4804
- z38.object({
4805
- requestId: z38.string(),
4806
- type: z38.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
5020
+ z39.object({
5021
+ requestId: z39.string(),
5022
+ type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
4807
5023
  content: ReasonContent
4808
5024
  }).shape
4809
5025
  );
4810
5026
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4811
- z38.object({
4812
- requestId: z38.string(),
4813
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4814
- content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
5027
+ z39.object({
5028
+ requestId: z39.string(),
5029
+ type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
5030
+ content: z39.object({ immediateCorrection: z39.boolean().optional() }).optional()
4815
5031
  }).shape
4816
5032
  );
4817
5033
  var ReadActionInput = BaseActionInput.extend(
4818
- z38.object({
4819
- type: z38.literal(ActionType.READ).default(ActionType.READ)
5034
+ z39.object({
5035
+ type: z39.literal(ActionType.READ).default(ActionType.READ)
4820
5036
  }).shape
4821
5037
  );
4822
- var DeleteActionInput = z38.object({ eventId: UUID });
5038
+ var DeleteActionInput = z39.object({ eventId: UUID });
4823
5039
  var CustomActionInput = BaseActionInput.extend(
4824
- z38.object({
4825
- type: z38.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
4826
- customActionType: z38.string().describe("Name of the custom action.")
5040
+ z39.object({
5041
+ type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
5042
+ customActionType: z39.string().describe("Name of the custom action.")
4827
5043
  }).shape
4828
5044
  );
4829
- var ActionInput = z38.discriminatedUnion("type", [
5045
+ var ActionInput = z39.discriminatedUnion("type", [
4830
5046
  CreateActionInput.meta({ id: "CreateActionInput" }),
4831
5047
  RegisterActionInput.meta({ id: "RegisterActionInput" }),
4832
5048
  NotifyActionInput.meta({ id: "NotifyActionInput" }),
@@ -4863,11 +5079,11 @@ var ActionInput = z38.discriminatedUnion("type", [
4863
5079
  });
4864
5080
 
4865
5081
  // ../commons/src/events/Draft.ts
4866
- var Draft = z39.object({
5082
+ var Draft = z40.object({
4867
5083
  id: UUID,
4868
5084
  eventId: UUID,
4869
- transactionId: z39.string(),
4870
- createdAt: z39.string().datetime(),
5085
+ transactionId: z40.string(),
5086
+ createdAt: z40.string().datetime(),
4871
5087
  action: ActionBase.extend({
4872
5088
  type: ActionTypes.exclude([ActionTypes.enum.DELETE])
4873
5089
  }).omit({ id: true, createdAtLocation: true })
@@ -4875,8 +5091,15 @@ var Draft = z39.object({
4875
5091
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4876
5092
  );
4877
5093
  var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4878
- type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4879
- status: z39.enum([
5094
+ /*
5095
+ * A draft can name a file that no action references. Such a file stays until
5096
+ * the record is deleted or the record's next action sweeps its prefix.
5097
+ * DECLARE is available only where one of those is still coming: a created
5098
+ * record, which can still be deleted, and a record part way through an edit,
5099
+ * which is about to be declared or registered.
5100
+ */
5101
+ type: z40.literal(ActionTypes.enum.DECLARE),
5102
+ status: z40.enum([
4880
5103
  ActionStatus.Requested,
4881
5104
  ActionStatus.Accepted,
4882
5105
  ActionStatus.Rejected
@@ -4884,125 +5107,37 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4884
5107
  });
4885
5108
 
4886
5109
  // ../commons/src/events/EventInput.ts
4887
- var z40 = __toESM(require("zod/v4"));
4888
- var import_uuid10 = require("uuid");
4889
- var EventInput = z40.object({
4890
- transactionId: z40.string(),
4891
- type: z40.string(),
5110
+ var z41 = __toESM(require("zod/v4"));
5111
+ var import_uuid11 = require("uuid");
5112
+ var EventInput = z41.object({
5113
+ transactionId: z41.string(),
5114
+ type: z41.string(),
4892
5115
  createdAtLocation: UUID.nullish().describe(
4893
5116
  "Location where the event occurred. Required for system users."
4894
5117
  )
4895
- }).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
5118
+ }).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
4896
5119
 
4897
5120
  // ../commons/src/events/EventDocument.ts
4898
- var z41 = __toESM(require("zod/v4"));
4899
- var EventDocument = z41.object({
5121
+ var z42 = __toESM(require("zod/v4"));
5122
+ var EventDocument = z42.object({
4900
5123
  id: UUID.describe("Unique identifier of the event."),
4901
- type: z41.string().describe("Type of the event (e.g. birth, death, marriage)."),
4902
- createdAt: z41.string().datetime().describe("Timestamp indicating when the event was created."),
4903
- updatedAt: z41.string().datetime().describe(
5124
+ type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
5125
+ createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
5126
+ updatedAt: z42.string().datetime().describe(
4904
5127
  "Timestamp of the last update, excluding changes from actions."
4905
5128
  ),
4906
- actions: z41.array(Action).describe("Ordered list of actions associated with the event."),
4907
- trackingId: z41.string().describe(
5129
+ actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
5130
+ trackingId: z42.string().describe(
4908
5131
  "System-generated tracking identifier used to look up the event."
4909
5132
  )
4910
5133
  }).meta({ id: "EventDocument" });
4911
-
4912
- // ../commons/src/events/state/index.ts
4913
- var import_lodash4 = require("lodash");
4914
-
4915
- // ../commons/src/events/state/utils.ts
4916
- var import_lodash2 = require("lodash");
4917
- var updateActions = ActionTypes.extract([
4918
- ActionType.CREATE,
4919
- ActionType.NOTIFY,
4920
- ActionType.EDIT,
4921
- ActionType.DECLARE,
4922
- ActionType.REGISTER,
4923
- ActionType.REJECT,
4924
- ActionType.ARCHIVE,
4925
- ActionType.UNARCHIVE,
4926
- ActionType.PRINT_CERTIFICATE,
4927
- ActionType.REQUEST_CORRECTION,
4928
- ActionType.APPROVE_CORRECTION,
4929
- ActionType.REJECT_CORRECTION,
4930
- ActionType.CUSTOM
4931
- ]);
4932
-
4933
- // ../commons/src/events/state/flags.ts
4934
- var import_lodash3 = require("lodash");
4935
- var import_date_fns3 = require("date-fns");
4936
- var INHERENT_FLAG_RULES = [
4937
- {
4938
- flag: InherentFlags.CORRECTION_REQUESTED,
4939
- setOn: [ActionType.REQUEST_CORRECTION],
4940
- resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4941
- },
4942
- {
4943
- // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4944
- // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4945
- // are deliberately excluded so the flag freezes across an archive/unarchive
4946
- // round trip and comes back exactly as it was.
4947
- flag: InherentFlags.INCOMPLETE,
4948
- setOn: [ActionType.NOTIFY],
4949
- resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4950
- },
4951
- {
4952
- flag: InherentFlags.REJECTED,
4953
- setOn: [ActionType.REJECT],
4954
- resetOn: [
4955
- ActionType.NOTIFY,
4956
- ActionType.DECLARE,
4957
- ActionType.EDIT,
4958
- ActionType.REGISTER
4959
- ]
4960
- },
4961
- {
4962
- flag: InherentFlags.POTENTIAL_DUPLICATE,
4963
- setOn: [ActionType.DUPLICATE_DETECTED],
4964
- resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4965
- },
4966
- {
4967
- flag: InherentFlags.EDIT_IN_PROGRESS,
4968
- setOn: [ActionType.EDIT],
4969
- resetOnAnyOtherAction: true
4970
- }
4971
- ];
5134
+ var EventDocumentOnlyLastAction = EventDocument.extend({
5135
+ actions: z42.array(Action).max(1).describe("Only the last action associated with the event.")
5136
+ }).brand("EventDocumentOnlyLastAction");
4972
5137
 
4973
5138
  // ../commons/src/events/defineConfig.ts
4974
- var IGNORED_EVENT_TYPES = [
4975
- "FOOTBALL_CLUB_MEMBERSHIP",
4976
- "tennis-club-membership",
4977
- "library-membership",
4978
- "child-onboarding",
4979
- "digital-identity",
4980
- "event-with-optional-address"
4981
- ];
4982
- function warnOnConfigurationIssues(config) {
4983
- const eventId = config.id;
4984
- if (IGNORED_EVENT_TYPES.includes(eventId)) {
4985
- return;
4986
- }
4987
- const validateDeclarationAction = config.actions.find(
4988
- (action) => action.type === ActionType.CUSTOM && action.customActionType === "VALIDATE_DECLARATION"
4989
- );
4990
- if (!validateDeclarationAction) {
4991
- console.warn(
4992
- `
4993
- ************** WARNING **************
4994
- A custom action with customActionType 'VALIDATE_DECLARATION' is not defined for event '${eventId}'!
4995
- For v2.0, we expect this to be defined for all events.
4996
-
4997
- The deprecated v1.9 'ActionType.VALIDATE' actions are migrated to customActionType 'VALIDATE_DECLARATION' in v2.0.
4998
- ************** WARNING **************
4999
- `
5000
- );
5001
- }
5002
- }
5003
5139
  var defineConfig = (config) => {
5004
5140
  const input = EventConfig.parse(config);
5005
- warnOnConfigurationIssues(input);
5006
5141
  return input;
5007
5142
  };
5008
5143
 
@@ -5693,6 +5828,21 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5693
5828
  description: "Title of the review page"
5694
5829
  },
5695
5830
  fields: [
5831
+ {
5832
+ id: "annotation.hidden",
5833
+ type: FieldType.TEXT,
5834
+ label: {
5835
+ id: "annotation.hidden.label",
5836
+ defaultMessage: "Show not be visible",
5837
+ description: "Catch for rendering"
5838
+ },
5839
+ conditionals: [
5840
+ {
5841
+ type: ConditionalType.SHOW,
5842
+ conditional: never2()
5843
+ }
5844
+ ]
5845
+ },
5696
5846
  {
5697
5847
  id: "review.comment",
5698
5848
  type: FieldType.TEXTAREA,
@@ -5749,7 +5899,23 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5749
5899
  defaultMessage: "Who is applying for the membership?",
5750
5900
  description: "This is the title of the section"
5751
5901
  },
5902
+ showClearButton: true,
5752
5903
  fields: [
5904
+ {
5905
+ id: "declaration.hidden",
5906
+ type: FieldType.TEXT,
5907
+ label: {
5908
+ id: "declaration.hidden.label",
5909
+ defaultMessage: "Show not be visible",
5910
+ description: "Catch for rendering"
5911
+ },
5912
+ conditionals: [
5913
+ {
5914
+ type: ConditionalType.SHOW,
5915
+ conditional: never2()
5916
+ }
5917
+ ]
5918
+ },
5753
5919
  {
5754
5920
  id: "applicant.name",
5755
5921
  type: FieldType.NAME,
@@ -7419,21 +7585,7 @@ var digitalIdentityEvent = defineConfig({
7419
7585
  });
7420
7586
 
7421
7587
  // ../commons/src/events/test.utils.ts
7422
- var z42 = __toESM(require("zod/v4"));
7423
- var TestUserRole = z42.enum([
7424
- "FIELD_AGENT",
7425
- "LOCAL_REGISTRAR",
7426
- "LOCAL_SYSTEM_ADMIN",
7427
- "NATIONAL_REGISTRAR",
7428
- "REGISTRATION_AGENT",
7429
- "NATIONAL_SYSTEM_ADMIN",
7430
- "SOCIAL_WORKER",
7431
- "COMMUNITY_LEADER",
7432
- "PROVINCIAL_REGISTRAR"
7433
- ]);
7434
-
7435
- // ../commons/src/events/scopes.ts
7436
- var import_lodash6 = require("lodash");
7588
+ var z44 = __toESM(require("zod/v4"));
7437
7589
 
7438
7590
  // ../commons/src/events/locations.ts
7439
7591
  var z43 = __toESM(require("zod/v4"));
@@ -7467,116 +7619,65 @@ var Location = z43.object({
7467
7619
  status: LocationStatus,
7468
7620
  versions: z43.array(LocationVersion)
7469
7621
  });
7622
+ var ClientAdministrativeArea = AdministrativeArea.omit({
7623
+ name: true,
7624
+ status: true,
7625
+ externalId: true
7626
+ });
7627
+ var ClientLocation = Location.omit({
7628
+ name: true,
7629
+ status: true,
7630
+ externalId: true
7631
+ });
7632
+ function toClientLocation(location) {
7633
+ return {
7634
+ id: location.id,
7635
+ administrativeAreaId: location.administrativeAreaId,
7636
+ locationType: location.locationType,
7637
+ versions: location.versions
7638
+ };
7639
+ }
7640
+ function toClientAdministrativeArea(area) {
7641
+ return {
7642
+ id: area.id,
7643
+ parentId: area.parentId,
7644
+ versions: area.versions
7645
+ };
7646
+ }
7647
+ function validateAscendingDates(versions, ctx) {
7648
+ const ascending = versions.every(
7649
+ (version, index) => index === 0 || versions[index - 1].effectiveFrom < version.effectiveFrom
7650
+ );
7651
+ if (!ascending) {
7652
+ ctx.addIssue("versions must be strictly ascending by effectiveFrom");
7653
+ }
7654
+ }
7655
+ function validateUniqueIds(versions, ctx) {
7656
+ const versionIds = new Set(versions.map((version) => version.versionId));
7657
+ if (versionIds.size !== versions.length) {
7658
+ ctx.addIssue("versions must not repeat a versionId");
7659
+ }
7660
+ }
7661
+ var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7662
+ validateAscendingDates(versions, ctx);
7663
+ validateUniqueIds(versions, ctx);
7664
+ });
7470
7665
  var SetLocationPayload = z43.object({
7471
7666
  id: UUID,
7472
7667
  name: z43.string(),
7473
7668
  externalId: z43.string().nullish(),
7474
7669
  administrativeAreaId: UUID.nullable(),
7475
- locationType: z43.string().nullable()
7670
+ locationType: z43.string().nullable(),
7671
+ versions: SeededLocationVersions.optional()
7476
7672
  });
7477
7673
  var SetAdministrativeAreaPayload = z43.object({
7478
7674
  id: UUID,
7479
7675
  name: z43.string(),
7480
7676
  externalId: z43.string().nullish(),
7481
- parentId: UUID.nullable()
7677
+ parentId: UUID.nullable(),
7678
+ versions: SeededLocationVersions.optional()
7482
7679
  });
7483
7680
 
7484
- // ../commons/src/events/scopes.ts
7485
- var ACTION_SCOPE_MAP = {
7486
- [ActionType.READ]: ["record.read"],
7487
- [ActionType.CREATE]: ["record.create"],
7488
- [ActionType.NOTIFY]: ["record.notify"],
7489
- [ActionType.DECLARE]: ["record.declare", "record.register"],
7490
- [ActionType.EDIT]: ["record.edit"],
7491
- [ActionType.DELETE]: ["record.declare", "record.notify"],
7492
- [ActionType.REGISTER]: ["record.register"],
7493
- [ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
7494
- [ActionType.REQUEST_CORRECTION]: [
7495
- "record.request-correction",
7496
- "record.correct"
7497
- ],
7498
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
7499
- [ActionType.REJECT_CORRECTION]: ["record.correct"],
7500
- [ActionType.APPROVE_CORRECTION]: ["record.correct"],
7501
- [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7502
- [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7503
- [ActionType.ARCHIVE]: ["record.archive"],
7504
- [ActionType.UNARCHIVE]: ["record.unarchive"],
7505
- [ActionType.REJECT]: ["record.reject"],
7506
- [ActionType.ASSIGN]: null,
7507
- [ActionType.UNASSIGN]: null,
7508
- [ActionType.DUPLICATE_DETECTED]: [],
7509
- [ActionType.CUSTOM]: []
7510
- };
7511
-
7512
- // ../commons/src/events/state/availableActions.ts
7513
- var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7514
- [EventStatus.enum.CREATED]: [
7515
- ActionType.READ,
7516
- ActionType.DECLARE,
7517
- ActionType.NOTIFY,
7518
- ActionType.DELETE,
7519
- ActionType.CUSTOM
7520
- ],
7521
- [EventStatus.enum.NOTIFIED]: [
7522
- ActionType.READ,
7523
- ActionType.EDIT,
7524
- ActionType.MARK_AS_DUPLICATE,
7525
- ActionType.ARCHIVE,
7526
- ActionType.REJECT,
7527
- ActionType.CUSTOM
7528
- ],
7529
- [EventStatus.enum.DECLARED]: [
7530
- ActionType.READ,
7531
- ActionType.REGISTER,
7532
- ActionType.MARK_AS_DUPLICATE,
7533
- ActionType.ARCHIVE,
7534
- ActionType.REJECT,
7535
- ActionType.CUSTOM,
7536
- ActionType.EDIT
7537
- ],
7538
- [EventStatus.enum.REGISTERED]: [
7539
- ActionType.READ,
7540
- ActionType.PRINT_CERTIFICATE,
7541
- ActionType.REQUEST_CORRECTION,
7542
- ActionType.APPROVE_CORRECTION,
7543
- ActionType.REJECT_CORRECTION,
7544
- ActionType.CUSTOM,
7545
- ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7546
- ],
7547
- [EventStatus.enum.ARCHIVED]: [
7548
- ActionType.READ,
7549
- ActionType.CUSTOM,
7550
- ActionType.UNARCHIVE
7551
- ]
7552
- };
7553
- var ACTION_FILTERS = {
7554
- [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
7555
- [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
7556
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
7557
- [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
7558
- [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
7559
- [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7560
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7561
- [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7562
- [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
7563
- [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7564
- [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7565
- [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7566
- [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7567
- [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7568
- };
7569
- var REJECTED_ACTIONS = [
7570
- ActionType.READ,
7571
- ActionType.NOTIFY,
7572
- ActionType.CUSTOM,
7573
- ActionType.EDIT,
7574
- ActionType.ARCHIVE
7575
- ];
7576
-
7577
- // ../commons/src/events/FileUtils.ts
7578
- var import_lodash7 = require("lodash");
7579
-
7580
7681
  // ../commons/src/events/mocks.test.utils.ts
7581
7682
  function withVersionFields(entity) {
7582
7683
  return {
@@ -7909,138 +8010,355 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7909
8010
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7910
8011
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7911
8012
  );
8013
+ var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
8014
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
8015
+ );
8016
+ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
8017
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
8018
+ a.id,
8019
+ toClientAdministrativeArea(a)
8020
+ ])
8021
+ );
8022
+
8023
+ // ../commons/src/events/test.utils.ts
8024
+ var TestUserRole = z44.enum([
8025
+ "FIELD_AGENT",
8026
+ "LOCAL_REGISTRAR",
8027
+ "LOCAL_SYSTEM_ADMIN",
8028
+ "NATIONAL_REGISTRAR",
8029
+ "REGISTRATION_AGENT",
8030
+ "NATIONAL_SYSTEM_ADMIN",
8031
+ "SOCIAL_WORKER",
8032
+ "COMMUNITY_LEADER",
8033
+ "PROVINCIAL_REGISTRAR"
8034
+ ]);
8035
+
8036
+ // ../commons/src/events/scopes.ts
8037
+ var import_lodash6 = require("lodash");
8038
+ var ACTION_SCOPE_MAP = {
8039
+ [ActionType.READ]: ["record.read"],
8040
+ [ActionType.CREATE]: ["record.create"],
8041
+ [ActionType.NOTIFY]: ["record.notify"],
8042
+ [ActionType.DECLARE]: ["record.declare", "record.register"],
8043
+ [ActionType.EDIT]: ["record.edit"],
8044
+ [ActionType.DELETE]: ["record.declare", "record.notify"],
8045
+ [ActionType.REGISTER]: ["record.register"],
8046
+ [ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
8047
+ [ActionType.REQUEST_CORRECTION]: [
8048
+ "record.request-correction",
8049
+ "record.correct"
8050
+ ],
8051
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
8052
+ [ActionType.REJECT_CORRECTION]: ["record.correct"],
8053
+ [ActionType.APPROVE_CORRECTION]: ["record.correct"],
8054
+ [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
8055
+ [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
8056
+ [ActionType.ARCHIVE]: ["record.archive"],
8057
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
8058
+ [ActionType.REJECT]: ["record.reject"],
8059
+ [ActionType.ASSIGN]: null,
8060
+ [ActionType.UNASSIGN]: null,
8061
+ [ActionType.DUPLICATE_DETECTED]: [],
8062
+ [ActionType.CUSTOM]: []
8063
+ };
8064
+ var RECORD_WRITE_SCOPES = (0, import_lodash6.uniq)(
8065
+ Object.entries(ACTION_SCOPE_MAP).filter(([action]) => action !== ActionType.READ).flatMap(([, scopes]) => scopes ?? [])
8066
+ );
8067
+
8068
+ // ../commons/src/events/state/availableActions.ts
8069
+ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8070
+ [EventStatus.enum.CREATED]: [
8071
+ ActionType.READ,
8072
+ ActionType.DECLARE,
8073
+ ActionType.NOTIFY,
8074
+ ActionType.DELETE
8075
+ ],
8076
+ [EventStatus.enum.NOTIFIED]: [
8077
+ ActionType.READ,
8078
+ ActionType.EDIT,
8079
+ ActionType.MARK_AS_DUPLICATE,
8080
+ ActionType.ARCHIVE,
8081
+ ActionType.REJECT,
8082
+ ActionType.CUSTOM
8083
+ ],
8084
+ [EventStatus.enum.DECLARED]: [
8085
+ ActionType.READ,
8086
+ ActionType.REGISTER,
8087
+ ActionType.MARK_AS_DUPLICATE,
8088
+ ActionType.ARCHIVE,
8089
+ ActionType.REJECT,
8090
+ ActionType.CUSTOM,
8091
+ ActionType.EDIT
8092
+ ],
8093
+ [EventStatus.enum.REGISTERED]: [
8094
+ ActionType.READ,
8095
+ ActionType.PRINT_CERTIFICATE,
8096
+ ActionType.REQUEST_CORRECTION,
8097
+ ActionType.APPROVE_CORRECTION,
8098
+ ActionType.REJECT_CORRECTION,
8099
+ ActionType.CUSTOM,
8100
+ ClientSpecificAction.REVIEW_CORRECTION_REQUEST
8101
+ ],
8102
+ [EventStatus.enum.ARCHIVED]: [
8103
+ ActionType.READ,
8104
+ ActionType.CUSTOM,
8105
+ ActionType.UNARCHIVE
8106
+ ]
8107
+ };
8108
+ var ACTION_FILTERS = {
8109
+ [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8110
+ [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8111
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8112
+ [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8113
+ [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8114
+ [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8115
+ [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8116
+ [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8117
+ [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8118
+ [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8119
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8120
+ [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8121
+ [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8122
+ [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
8123
+ };
8124
+ var REJECTED_ACTIONS = [
8125
+ ActionType.READ,
8126
+ ActionType.NOTIFY,
8127
+ ActionType.CUSTOM,
8128
+ ActionType.EDIT,
8129
+ ActionType.ARCHIVE
8130
+ ];
8131
+
8132
+ // ../commons/src/events/FileUtils.ts
8133
+ var import_lodash7 = require("lodash");
7912
8134
 
7913
8135
  // ../commons/src/events/locationPayloads.ts
7914
- var z44 = __toESM(require("zod/v4"));
7915
- var CreateLocationPayload = z44.object({
8136
+ var z45 = __toESM(require("zod/v4"));
8137
+ var CreateLocationPayload = z45.object({
7916
8138
  id: UUID.optional(),
7917
8139
  versionId: UUID.optional(),
7918
- name: z44.string(),
7919
- externalId: z44.string().nullish(),
8140
+ name: z45.string(),
8141
+ externalId: z45.string().nullish(),
7920
8142
  administrativeAreaId: UUID.nullable(),
7921
- locationType: z44.string().nullable(),
7922
- effectiveFrom: z44.iso.date().optional(),
8143
+ locationType: z45.string().nullable(),
8144
+ effectiveFrom: z45.iso.date().optional(),
7923
8145
  status: LocationStatus.default("active")
7924
8146
  });
7925
- var UpdateLocationPayload = z44.strictObject({
8147
+ var UpdateLocationPayload = z45.strictObject({
7926
8148
  id: UUID,
7927
8149
  versionId: UUID.optional(),
7928
- name: z44.string(),
7929
- externalId: z44.string().nullish(),
8150
+ name: z45.string(),
8151
+ externalId: z45.string().nullish(),
7930
8152
  status: LocationStatus,
7931
- effectiveFrom: z44.iso.date().optional(),
8153
+ effectiveFrom: z45.iso.date().optional(),
7932
8154
  lastVersionId: UUID
7933
8155
  });
7934
- var WithdrawLocationVersionPayload = z44.object({
8156
+ var WithdrawLocationVersionPayload = z45.object({
7935
8157
  id: UUID,
7936
8158
  versionId: UUID
7937
8159
  });
7938
- var CreateAdministrativeAreaPayload = z44.object({
8160
+ var CreateAdministrativeAreaPayload = z45.object({
7939
8161
  id: UUID.optional(),
7940
8162
  versionId: UUID.optional(),
7941
- name: z44.string(),
7942
- externalId: z44.string().nullish(),
8163
+ name: z45.string(),
8164
+ externalId: z45.string().nullish(),
7943
8165
  parentId: UUID.nullable(),
7944
- effectiveFrom: z44.iso.date().optional(),
8166
+ effectiveFrom: z45.iso.date().optional(),
7945
8167
  status: LocationStatus.default("active")
7946
8168
  });
7947
- var UpdateAdministrativeAreaPayload = z44.strictObject({
8169
+ var UpdateAdministrativeAreaPayload = z45.strictObject({
7948
8170
  id: UUID,
7949
8171
  versionId: UUID.optional(),
7950
- name: z44.string(),
7951
- externalId: z44.string().nullish(),
8172
+ name: z45.string(),
8173
+ externalId: z45.string().nullish(),
7952
8174
  status: LocationStatus,
7953
- effectiveFrom: z44.iso.date().optional(),
8175
+ effectiveFrom: z45.iso.date().optional(),
7954
8176
  lastVersionId: UUID
7955
8177
  });
7956
- var WithdrawAdministrativeAreaVersionPayload = z44.object({
8178
+ var WithdrawAdministrativeAreaVersionPayload = z45.object({
7957
8179
  id: UUID,
7958
8180
  versionId: UUID
7959
8181
  });
7960
8182
 
7961
8183
  // ../commons/src/notification/UserNotifications.ts
7962
- var z45 = __toESM(require("zod/v4"));
8184
+ var z46 = __toESM(require("zod/v4"));
7963
8185
  var TriggerEvent = {
7964
8186
  USER_CREATED: "user-created",
7965
8187
  USER_UPDATED: "user-updated",
7966
8188
  USERNAME_REMINDER: "username-reminder",
7967
8189
  RESET_PASSWORD: "reset-password",
7968
8190
  RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
8191
+ PASSWORD_RESET_LINK: "password-reset-link",
8192
+ USERNAME_REMINDER_LINK: "username-reminder-link",
7969
8193
  RESEND_INVITE: "resend-invite",
7970
8194
  TWO_FA: "2fa",
7971
8195
  ALL_USER_NOTIFICATION: "all-user-notification",
7972
8196
  CHANGE_PHONE_NUMBER: "change-phone-number",
7973
8197
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7974
8198
  };
7975
- var Recipient = z45.object({
8199
+ var Recipient = z46.object({
7976
8200
  name: NameFieldValue.optional(),
7977
- mobile: z45.string().optional(),
7978
- email: z45.string().optional(),
7979
- bcc: z45.array(z45.string()).optional()
8201
+ mobile: z46.string().optional(),
8202
+ email: z46.string().optional(),
8203
+ bcc: z46.array(z46.string()).optional()
7980
8204
  });
7981
- var BasePayload = z45.object({
8205
+ var BasePayload = z46.object({
7982
8206
  recipient: Recipient
7983
8207
  });
7984
8208
  var TriggerPayload = {
7985
8209
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7986
- username: z45.string(),
7987
- temporaryPassword: z45.string()
8210
+ username: z46.string(),
8211
+ temporaryPassword: z46.string()
7988
8212
  }),
7989
8213
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7990
- oldUsername: z45.string(),
7991
- newUsername: z45.string()
8214
+ oldUsername: z46.string(),
8215
+ newUsername: z46.string()
7992
8216
  }),
7993
8217
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7994
- username: z45.string()
8218
+ username: z46.string()
7995
8219
  }),
7996
8220
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7997
- code: z45.string()
8221
+ code: z46.string()
7998
8222
  }),
7999
8223
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
8000
- temporaryPassword: z45.string(),
8001
- admin: z45.object({
8002
- id: z45.string(),
8224
+ temporaryPassword: z46.string(),
8225
+ admin: z46.object({
8226
+ id: z46.string(),
8003
8227
  name: NameFieldValue,
8004
- role: z45.string()
8228
+ role: z46.string()
8005
8229
  })
8006
8230
  }),
8231
+ [TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
8232
+ token: z46.string()
8233
+ }),
8234
+ [TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
8235
+ token: z46.string()
8236
+ }),
8007
8237
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
8008
- username: z45.string(),
8009
- temporaryPassword: z45.string()
8238
+ username: z46.string(),
8239
+ temporaryPassword: z46.string()
8010
8240
  }),
8011
8241
  [TriggerEvent.TWO_FA]: BasePayload.extend({
8012
- code: z45.string()
8242
+ code: z46.string()
8013
8243
  }),
8014
8244
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
8015
- subject: z45.string(),
8016
- body: z45.string()
8245
+ subject: z46.string(),
8246
+ body: z46.string()
8017
8247
  }),
8018
8248
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
8019
- code: z45.string()
8249
+ code: z46.string()
8020
8250
  }),
8021
8251
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
8022
- code: z45.string()
8252
+ code: z46.string()
8023
8253
  })
8024
8254
  };
8255
+ function parseUserEventTrigger(event2, body) {
8256
+ const schema = TriggerPayload[event2];
8257
+ return schema.parse(body);
8258
+ }
8259
+
8260
+ // ../commons/src/url.ts
8261
+ function joinUrl(base, path) {
8262
+ const baseWithSlash = base.endsWith("/") ? base : base + "/";
8263
+ return new URL(path, baseWithSlash);
8264
+ }
8265
+
8266
+ // ../commons/src/logger.ts
8267
+ var import_pino = __toESM(require("pino"));
8268
+ function normalizeLogArgs(args) {
8269
+ const [first, ...rest] = args;
8270
+ if (typeof first !== "string" || rest.length === 0) {
8271
+ return args;
8272
+ }
8273
+ const mergingObject = {};
8274
+ const primitives = [];
8275
+ for (const arg of rest) {
8276
+ if (arg instanceof Error) {
8277
+ mergingObject.err = import_pino.default.stdSerializers.err(arg);
8278
+ } else if (arg !== null && typeof arg === "object") {
8279
+ Object.assign(mergingObject, arg);
8280
+ } else {
8281
+ primitives.push(arg);
8282
+ }
8283
+ }
8284
+ const message = primitives.length ? `${first} ${primitives.join(" ")}` : first;
8285
+ return Object.keys(mergingObject).length ? [mergingObject, message] : [message];
8286
+ }
8287
+ function filterHealthCheckLogs(args, method) {
8288
+ const logger2 = this;
8289
+ for (const arg of args) {
8290
+ if (typeof arg === "string" && arg.includes("get /ping 200")) {
8291
+ if (logger2.debug) {
8292
+ return logger2.debug(...args);
8293
+ }
8294
+ }
8295
+ }
8296
+ return method.apply(this, normalizeLogArgs(args));
8297
+ }
8298
+ function buildLoggerOptions() {
8299
+ return {
8300
+ serializers: { err: import_pino.default.stdSerializers.err },
8301
+ hooks: { logMethod: filterHealthCheckLogs }
8302
+ };
8303
+ }
8304
+ var logger = process.env.NODE_ENV === "production" ? (0, import_pino.default)({
8305
+ level: "info",
8306
+ redact: [
8307
+ "req.headers.authorization",
8308
+ "req.remoteAddress",
8309
+ "req.headers['x-real-ip']"
8310
+ ],
8311
+ ...buildLoggerOptions()
8312
+ }) : (0, import_pino.default)({
8313
+ level: "debug",
8314
+ transport: {
8315
+ target: "pino-pretty",
8316
+ options: {
8317
+ colorize: true,
8318
+ ignore: "pid,hostname"
8319
+ }
8320
+ },
8321
+ ...buildLoggerOptions()
8322
+ });
8323
+ var level = process.env.NODE_ENV === "test" ? "silent" : process.env.LOG_LEVEL;
8324
+ if (level) {
8325
+ logger.level = level;
8326
+ }
8327
+
8328
+ // ../commons/src/notification/dispatch.ts
8025
8329
  async function triggerUserEventNotification({
8026
8330
  event: event2,
8027
8331
  payload,
8028
8332
  countryConfigUrl,
8029
8333
  authHeader
8030
8334
  }) {
8031
- return await fetch(joinUrl(countryConfigUrl, `triggers/user/${event2}`), {
8032
- method: "POST",
8033
- body: JSON.stringify(payload),
8034
- headers: {
8035
- "Content-Type": "application/json",
8036
- ...authHeader
8335
+ const response = await fetch(
8336
+ joinUrl(countryConfigUrl, `trigger/user/${event2}`),
8337
+ {
8338
+ method: "POST",
8339
+ body: JSON.stringify(payload),
8340
+ headers: {
8341
+ "Content-Type": "application/json",
8342
+ ...authHeader
8343
+ }
8037
8344
  }
8038
- });
8039
- }
8040
- function parseUserEventTrigger(event2, body) {
8041
- const schema = TriggerPayload[event2];
8042
- return schema.parse(body);
8345
+ );
8346
+ if (!response.ok) {
8347
+ logger.error(
8348
+ `triggerUserEventNotification: dispatch failed for event "${event2}" with status ${response.status}`
8349
+ );
8350
+ }
8351
+ return response;
8043
8352
  }
8044
8353
 
8045
8354
  // src/notification/index.ts
8046
- z46.globalRegistry.clear();
8355
+ z47.globalRegistry.clear();
8356
+ // Annotate the CommonJS export names for ESM import in node:
8357
+ 0 && (module.exports = {
8358
+ BasePayload,
8359
+ Recipient,
8360
+ TriggerEvent,
8361
+ TriggerPayload,
8362
+ parseUserEventTrigger,
8363
+ triggerUserEventNotification
8364
+ });