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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/build.sh +17 -14
  2. package/dist/application-config/index.js +21 -11
  3. package/dist/authentication/index.d.ts +2 -1
  4. package/dist/authentication/index.js +20 -13
  5. package/dist/cli.js +2631 -377
  6. package/dist/commons/api/router.d.ts +263 -250
  7. package/dist/commons/application-config/index.d.ts +3 -3
  8. package/dist/commons/conditionals/conditionals.d.ts +4 -4
  9. package/dist/commons/conditionals/index.d.ts +1 -0
  10. package/dist/commons/conditionals/validate.d.ts +6 -1
  11. package/dist/commons/events/ActionConfig.d.ts +16 -23
  12. package/dist/commons/events/ActionDocument.d.ts +1 -0
  13. package/dist/commons/events/ActionInput.d.ts +4 -4
  14. package/dist/commons/events/ActionStatus.d.ts +2 -2
  15. package/dist/commons/events/ActionType.d.ts +2 -0
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -6
  17. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  18. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -18
  19. package/dist/commons/events/Draft.d.ts +34 -1
  20. package/dist/commons/events/EventConfig.d.ts +448 -1
  21. package/dist/commons/events/EventDocument.d.ts +2 -0
  22. package/dist/commons/events/EventIndex.d.ts +3 -6
  23. package/dist/commons/events/EventInput.d.ts +1 -0
  24. package/dist/commons/events/EventMetadata.d.ts +1 -1
  25. package/dist/commons/events/FieldConfig.d.ts +1 -1
  26. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  27. package/dist/commons/events/Flag.d.ts +1 -7
  28. package/dist/commons/events/PlainDate.d.ts +6 -0
  29. package/dist/commons/events/WorkqueueConfig.d.ts +12 -27
  30. package/dist/commons/events/defineConfig.d.ts +7 -2
  31. package/dist/commons/events/event.d.ts +4 -1
  32. package/dist/commons/events/eventConfigValidation.d.ts +9 -0
  33. package/dist/commons/events/field.d.ts +5 -5
  34. package/dist/commons/events/index.d.ts +3 -0
  35. package/dist/commons/events/locations.d.ts +1 -1
  36. package/dist/commons/events/scopes.d.ts +2 -1
  37. package/dist/commons/events/state/flags.d.ts +1 -1
  38. package/dist/commons/events/state/index.d.ts +1 -0
  39. package/dist/commons/events/test.utils.d.ts +62 -7
  40. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  41. package/dist/commons/events/utils.d.ts +59 -7
  42. package/dist/commons/users/Role.d.ts +23 -0
  43. package/dist/commons/users/User.d.ts +263 -0
  44. package/dist/commons/users/authentication.d.ts +67 -0
  45. package/dist/commons/users/index.d.ts +5 -0
  46. package/dist/commons/users/roleValidations.d.ts +15 -0
  47. package/dist/commons/users/scopes.d.ts +1402 -0
  48. package/dist/commons/users/userReferences.d.ts +176 -0
  49. package/dist/conditionals/index.js +5 -6
  50. package/dist/configurator/index.d.ts +24 -0
  51. package/dist/configurator/index.d.ts.map +1 -0
  52. package/dist/configurator/index.js +161 -0
  53. package/dist/configurator/layout.d.ts +29 -0
  54. package/dist/configurator/layout.d.ts.map +1 -0
  55. package/dist/configurator/layout.js +78 -0
  56. package/dist/configurator/paths.d.ts +13 -0
  57. package/dist/configurator/paths.d.ts.map +1 -0
  58. package/dist/configurator/paths.js +48 -0
  59. package/dist/configurator/server/environments.d.ts +20 -0
  60. package/dist/configurator/server/environments.d.ts.map +1 -0
  61. package/dist/configurator/server/environments.js +143 -0
  62. package/dist/configurator/server/files.d.ts +11 -0
  63. package/dist/configurator/server/files.d.ts.map +1 -0
  64. package/dist/configurator/server/files.js +67 -0
  65. package/dist/configurator/server/github.d.ts +56 -0
  66. package/dist/configurator/server/github.d.ts.map +1 -0
  67. package/dist/configurator/server/github.js +239 -0
  68. package/dist/configurator/server/plugin.d.ts +39 -0
  69. package/dist/configurator/server/plugin.d.ts.map +1 -0
  70. package/dist/configurator/server/plugin.js +298 -0
  71. package/dist/configurator/server/seal.d.ts +2 -0
  72. package/dist/configurator/server/seal.d.ts.map +1 -0
  73. package/dist/configurator/server/seal.js +36 -0
  74. package/dist/configurator/server/sshKeys.d.ts +5 -0
  75. package/dist/configurator/server/sshKeys.d.ts.map +1 -0
  76. package/dist/configurator/server/sshKeys.js +28 -0
  77. package/dist/configurator/server/start.d.ts +12 -0
  78. package/dist/configurator/server/start.d.ts.map +1 -0
  79. package/dist/configurator/server/start.js +91 -0
  80. package/dist/configurator/testing.d.ts +11 -0
  81. package/dist/configurator/testing.d.ts.map +1 -0
  82. package/dist/configurator/testing.js +74 -0
  83. package/dist/configurator/ui/bindings/bindings.d.ts +35 -0
  84. package/dist/configurator/ui/bindings/bindings.d.ts.map +1 -0
  85. package/dist/configurator/ui/bindings/bindings.js +5 -0
  86. package/dist/configurator/ui/bindings/parsers.d.ts +7 -0
  87. package/dist/configurator/ui/bindings/parsers.d.ts.map +1 -0
  88. package/dist/configurator/ui/bindings/parsers.js +85 -0
  89. package/dist/configurator/ui/form/users.d.ts +11 -0
  90. package/dist/configurator/ui/form/users.d.ts.map +1 -0
  91. package/dist/configurator/ui/form/users.js +33 -0
  92. package/dist/configurator/ui/plan/dependencyHosts.d.ts +2 -0
  93. package/dist/configurator/ui/plan/dependencyHosts.d.ts.map +1 -0
  94. package/dist/configurator/ui/plan/dependencyHosts.js +36 -0
  95. package/dist/configurator/ui/plan/templateValues.d.ts +11 -0
  96. package/dist/configurator/ui/plan/templateValues.d.ts.map +1 -0
  97. package/dist/configurator/ui/plan/templateValues.js +70 -0
  98. package/dist/configurator/workflows.d.ts +54 -0
  99. package/dist/configurator/workflows.d.ts.map +1 -0
  100. package/dist/configurator/workflows.js +161 -0
  101. package/dist/configurator-assets/forms/bindings.yml +265 -0
  102. package/dist/configurator-assets/templates/README.md +18 -0
  103. package/dist/configurator-assets/templates/charts-values/dependencies/values.override.yaml +4 -0
  104. package/dist/configurator-assets/templates/charts-values/dependencies/values.yaml +96 -0
  105. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  106. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.yaml +83 -0
  107. package/dist/configurator-assets/templates/charts-values/opentelemetry/values.yaml +102 -0
  108. package/dist/configurator-assets/templates/charts-values/traefik/values.override.yaml +4 -0
  109. package/dist/configurator-assets/templates/charts-values/traefik/values.yaml +130 -0
  110. package/dist/configurator-assets/templates/inventory/inventory.template.yml +98 -0
  111. package/dist/configurator-assets/ui/apple-touch-icon.png +0 -0
  112. package/dist/configurator-assets/ui/assets/index-CaqYFJUk.css +6 -0
  113. package/dist/configurator-assets/ui/assets/index-DU1Y6E0b.js +169 -0
  114. package/dist/configurator-assets/ui/assets/opencrvs-logo-sIjz08HT.svg +1 -0
  115. package/dist/configurator-assets/ui/assets/poppins-400-BwTUGeWf.woff2 +0 -0
  116. package/dist/configurator-assets/ui/assets/poppins-500-CWICHMj6.woff2 +0 -0
  117. package/dist/configurator-assets/ui/assets/poppins-600-DJVo7c07.woff2 +0 -0
  118. package/dist/configurator-assets/ui/assets/poppins-700-g9MkRaG0.woff2 +0 -0
  119. package/dist/configurator-assets/ui/favicon-32x32.png +0 -0
  120. package/dist/configurator-assets/ui/index.html +25 -0
  121. package/dist/environment/custom-types.d.ts +1 -0
  122. package/dist/environment/custom-types.d.ts.map +1 -1
  123. package/dist/environment/derived-variables.d.ts +18 -4
  124. package/dist/environment/derived-variables.d.ts.map +1 -1
  125. package/dist/environment/derived-variables.js +20 -4
  126. package/dist/environment/questions.d.ts +42 -9
  127. package/dist/environment/questions.d.ts.map +1 -1
  128. package/dist/environment/questions.js +71 -48
  129. package/dist/environment/registry.d.ts +15 -0
  130. package/dist/environment/registry.d.ts.map +1 -0
  131. package/dist/environment/registry.js +112 -0
  132. package/dist/environment/setup-environment.d.ts.map +1 -1
  133. package/dist/environment/setup-environment.js +145 -25
  134. package/dist/environment/templates.d.ts.map +1 -1
  135. package/dist/events/index.js +826 -210
  136. package/dist/migrations/add-notify-config.d.ts +40 -0
  137. package/dist/migrations/add-notify-config.d.ts.map +1 -0
  138. package/dist/migrations/add-notify-config.js +249 -0
  139. package/dist/migrations/index.d.ts +9 -0
  140. package/dist/migrations/index.d.ts.map +1 -0
  141. package/dist/migrations/index.js +1306 -0
  142. package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
  143. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
  144. package/dist/migrations/move-declaration-to-declare-action.js +260 -0
  145. package/dist/migrations/{add-translations.d.ts → persistent/add-translations.d.ts} +1 -1
  146. package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
  147. package/dist/migrations/{add-translations.js → persistent/add-translations.js} +2 -2
  148. package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
  149. package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
  150. package/dist/migrations/persistent/check-upgrade-path.js +105 -0
  151. package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
  152. package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
  153. package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
  154. package/dist/migrations/{v2.2/read-declaration-through-helper.d.ts → read-declaration-through-helper.d.ts} +1 -1
  155. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
  156. package/dist/migrations/{v2.2/read-declaration-through-helper.js → read-declaration-through-helper.js} +4 -62
  157. package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
  158. package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
  159. package/dist/migrations/replace-incomplete-flag.js +126 -0
  160. package/dist/migrations/resolve-versioned-event-config.d.ts +56 -0
  161. package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
  162. package/dist/migrations/resolve-versioned-event-config.js +353 -0
  163. package/dist/migrations/utils.d.ts +61 -0
  164. package/dist/migrations/utils.d.ts.map +1 -0
  165. package/dist/migrations/utils.js +218 -0
  166. package/dist/notification/index.js +722 -82
  167. package/dist/roles/index.d.ts +2 -0
  168. package/dist/roles/index.d.ts.map +1 -0
  169. package/dist/roles/index.js +730 -0
  170. package/dist/scopes/index.d.ts +54 -94
  171. package/dist/scopes/index.js +15 -12
  172. package/dist/templates/charts-values/dependencies/values.yaml +5 -2
  173. package/dist/templates/charts-values/opencrvs-services/values.yaml +5 -7
  174. package/dist/templates/charts-values/traefik/values.yaml +2 -0
  175. package/dist/verify/endpoints.d.ts +11 -0
  176. package/dist/verify/endpoints.d.ts.map +1 -1
  177. package/dist/verify/endpoints.js +21 -27
  178. package/opencrvs-toolkit-2.2.0-rc.e6591c5.tgz +0 -0
  179. package/package.json +17 -4
  180. package/tsconfig.build.json +11 -1
  181. package/tsconfig.build.tsbuildinfo +1 -1
  182. package/tsconfig.json +15 -6
  183. package/dist/migrations/add-translations.d.ts.map +0 -1
  184. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
  185. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
  186. package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
  187. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
  188. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
  189. package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
  190. package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
  191. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
  192. package/dist/migrations/v2.1/enable-telemetry.js +0 -455
  193. package/dist/migrations/v2.1/index.d.ts +0 -6
  194. package/dist/migrations/v2.1/index.d.ts.map +0 -1
  195. package/dist/migrations/v2.1/index.js +0 -50
  196. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -17
  197. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
  198. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
  199. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
  200. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
  201. package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
  202. package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
  203. package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
  204. package/dist/migrations/v2.1/remove-sentry.js +0 -354
  205. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
  206. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
  207. package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
  208. package/dist/migrations/v2.1/template-files.d.ts +0 -8
  209. package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
  210. package/dist/migrations/v2.1/template-files.js +0 -49
  211. package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -11
  212. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
  213. package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
  214. package/dist/migrations/v2.2/index.d.ts +0 -6
  215. package/dist/migrations/v2.2/index.d.ts.map +0 -1
  216. package/dist/migrations/v2.2/index.js +0 -456
  217. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +0 -1
  218. package/dist/templates/countryconfig-template/.tiltignore +0 -1
  219. package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
  220. package/dist/templates/countryconfig-template/Tiltfile +0 -112
  221. package/dist/templates/countryconfig-template/assets/README.md +0 -1
  222. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
  223. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
  224. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
  225. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
  226. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
  227. package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
  228. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
  229. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
  230. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
  231. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
  232. package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
  233. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
  234. package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
  235. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
  236. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
  237. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
  238. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
  239. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
  240. package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
  241. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
  242. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
  243. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
  244. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
  245. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
  246. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
  247. package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
  248. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
  249. package/opencrvs-toolkit-2.2.0-rc.ac299dc.tgz +0 -0
@@ -31,6 +31,9 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
31
31
  }>, z.core.$strip> | z.ZodObject<{
32
32
  age: z.ZodNumber;
33
33
  asOfDateRef: z.ZodString;
34
+ }, z.core.$strip> | z.ZodObject<{
35
+ numericValue: z.ZodOptional<z.ZodNumber>;
36
+ unit: z.ZodOptional<z.ZodString>;
34
37
  }, z.core.$strip> | z.ZodObject<{
35
38
  path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
36
39
  originalFilename: z.ZodString;
@@ -40,9 +43,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
40
43
  }, z.core.$strip> | z.ZodObject<{
41
44
  numericValue: z.ZodNumber;
42
45
  unit: z.ZodString;
43
- }, z.core.$strip> | z.ZodObject<{
44
- numericValue: z.ZodOptional<z.ZodNumber>;
45
- unit: z.ZodOptional<z.ZodString>;
46
46
  }, z.core.$strip> | z.ZodObject<{
47
47
  label: z.ZodString;
48
48
  value: z.ZodString;
@@ -67,6 +67,9 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
67
67
  }>, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
68
68
  age: z.ZodNumber;
69
69
  asOfDateRef: z.ZodString;
70
+ }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
+ numericValue: z.ZodOptional<z.ZodNumber>;
72
+ unit: z.ZodOptional<z.ZodString>;
70
73
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
74
  path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
72
75
  originalFilename: z.ZodString;
@@ -76,9 +79,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
76
79
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
77
80
  numericValue: z.ZodNumber;
78
81
  unit: z.ZodString;
79
- }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
80
- numericValue: z.ZodOptional<z.ZodNumber>;
81
- unit: z.ZodOptional<z.ZodString>;
82
82
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
83
83
  label: z.ZodString;
84
84
  value: z.ZodString;
@@ -243,15 +243,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
243
243
  }, z.core.$strip>>>;
244
244
  data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
245
245
  }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>>> | z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUnknown, "CustomFieldValue", "out">>> | z.ZodString | z.ZodType<{
246
- country: string;
247
- streetLevelDetails?: Record<string, string> | undefined;
248
- addressType: "DOMESTIC";
249
- administrativeArea: string;
250
- } | {
251
- country: string;
252
- streetLevelDetails?: Record<string, string> | undefined;
253
- addressType: "INTERNATIONAL";
254
- } | {
255
246
  country?: string | null | undefined;
256
247
  streetLevelDetails?: Record<string, string | null> | null | undefined;
257
248
  addressType: "DOMESTIC";
@@ -260,7 +251,7 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
260
251
  country?: string | null | undefined;
261
252
  streetLevelDetails?: Record<string, string | null> | null | undefined;
262
253
  addressType: "INTERNATIONAL";
263
- } | null | undefined, unknown, z.core.$ZodTypeInternals<{
254
+ } | {
264
255
  country: string;
265
256
  streetLevelDetails?: Record<string, string> | undefined;
266
257
  addressType: "DOMESTIC";
@@ -269,7 +260,7 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
269
260
  country: string;
270
261
  streetLevelDetails?: Record<string, string> | undefined;
271
262
  addressType: "INTERNATIONAL";
272
- } | {
263
+ } | null | undefined, unknown, z.core.$ZodTypeInternals<{
273
264
  country?: string | null | undefined;
274
265
  streetLevelDetails?: Record<string, string | null> | null | undefined;
275
266
  addressType: "DOMESTIC";
@@ -278,6 +269,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
278
269
  country?: string | null | undefined;
279
270
  streetLevelDetails?: Record<string, string | null> | null | undefined;
280
271
  addressType: "INTERNATIONAL";
272
+ } | {
273
+ country: string;
274
+ streetLevelDetails?: Record<string, string> | undefined;
275
+ addressType: "DOMESTIC";
276
+ administrativeArea: string;
277
+ } | {
278
+ country: string;
279
+ streetLevelDetails?: Record<string, string> | undefined;
280
+ addressType: "INTERNATIONAL";
281
281
  } | null | undefined, unknown>> | z.ZodUnion<[z.ZodObject<{
282
282
  start: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
283
283
  end: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
@@ -1,6 +1,5 @@
1
- import * as z from 'zod/v4';
1
+ import * as z from 'zod';
2
2
  export declare const InherentFlags: {
3
- readonly INCOMPLETE: 'incomplete';
4
3
  readonly REJECTED: 'rejected';
5
4
  readonly CORRECTION_REQUESTED: 'correction-requested';
6
5
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -19,7 +18,6 @@ export type ActionFlag = z.infer<typeof ActionFlag>;
19
18
  export declare const CustomFlag: z.ZodString;
20
19
  export type CustomFlag = z.infer<typeof CustomFlag>;
21
20
  export declare const Flag: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
22
- readonly INCOMPLETE: 'incomplete';
23
21
  readonly REJECTED: 'rejected';
24
22
  readonly CORRECTION_REQUESTED: 'correction-requested';
25
23
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -34,7 +32,6 @@ export declare const Flag: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
34
32
  export type Flag = z.infer<typeof Flag>;
35
33
  export declare const ContainsFlags: z.ZodObject<{
36
34
  anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
37
- readonly INCOMPLETE: 'incomplete';
38
35
  readonly REJECTED: 'rejected';
39
36
  readonly CORRECTION_REQUESTED: 'correction-requested';
40
37
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -47,7 +44,6 @@ export declare const ContainsFlags: z.ZodObject<{
47
44
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
48
45
  }>]>, z.ZodString]>>>;
49
46
  noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
50
- readonly INCOMPLETE: 'incomplete';
51
47
  readonly REJECTED: 'rejected';
52
48
  readonly CORRECTION_REQUESTED: 'correction-requested';
53
49
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -60,7 +56,6 @@ export declare const ContainsFlags: z.ZodObject<{
60
56
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
61
57
  }>]>, z.ZodString]>>>;
62
58
  allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
63
- readonly INCOMPLETE: 'incomplete';
64
59
  readonly REJECTED: 'rejected';
65
60
  readonly CORRECTION_REQUESTED: 'correction-requested';
66
61
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -88,7 +83,6 @@ export type FlagConfig = z.infer<typeof FlagConfig>;
88
83
  */
89
84
  export declare const ActionFlagConfig: z.ZodObject<{
90
85
  id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
91
- readonly INCOMPLETE: 'incomplete';
92
86
  readonly REJECTED: 'rejected';
93
87
  readonly CORRECTION_REQUESTED: 'correction-requested';
94
88
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -9,6 +9,7 @@ import { z } from 'zod';
9
9
  */
10
10
  export declare const PlainDate: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
11
11
  export type PlainDate = z.infer<typeof PlainDate>;
12
+ export declare const isPlainDate: (date: unknown) => date is PlainDate;
12
13
  /**
13
14
  * Extracts the plain calendar date from an ISO 8601 datetime (or passes an
14
15
  * already-plain YYYY-MM-DD through) as a {@link PlainDate}. This is the single
@@ -17,6 +18,11 @@ export type PlainDate = z.infer<typeof PlainDate>;
17
18
  * YYYY-MM-DD input, as produced by the event metadata and date fields.
18
19
  */
19
20
  export declare function toPlainDate(dateTime: string): PlainDate;
21
+ /**
22
+ * The calendar date of `date` in the IANA `timeZone` (e.g. 'Asia/Dhaka'), as a
23
+ * {@link PlainDate}. Unlike {@link toPlainDate}, which reads the UTC date.
24
+ */
25
+ export declare function toPlainDateInTimeZone(date: Date, timeZone: string): PlainDate;
20
26
  /**
21
27
  * Converts a {@link PlainDate} (YYYY-MM-DD) to a local `Date` at midnight.
22
28
  *
@@ -341,21 +341,18 @@ export declare const WorkqueueConfig: z.ZodObject<{
341
341
  }, z.core.$strip>>>;
342
342
  flags: z.ZodOptional<z.ZodOptional<z.ZodObject<{
343
343
  anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
344
- readonly INCOMPLETE: 'incomplete';
345
344
  readonly REJECTED: 'rejected';
346
345
  readonly CORRECTION_REQUESTED: 'correction-requested';
347
346
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
348
347
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
349
348
  }>]>, z.ZodString]>>>;
350
349
  noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
351
- readonly INCOMPLETE: 'incomplete';
352
350
  readonly REJECTED: 'rejected';
353
351
  readonly CORRECTION_REQUESTED: 'correction-requested';
354
352
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
355
353
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
356
354
  }>]>, z.ZodString]>>>;
357
355
  allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
358
- readonly INCOMPLETE: 'incomplete';
359
356
  readonly REJECTED: 'rejected';
360
357
  readonly CORRECTION_REQUESTED: 'correction-requested';
361
358
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -690,21 +687,18 @@ export declare const WorkqueueConfig: z.ZodObject<{
690
687
  }, z.core.$strip>>>;
691
688
  flags: z.ZodOptional<z.ZodOptional<z.ZodObject<{
692
689
  anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
693
- readonly INCOMPLETE: 'incomplete';
694
690
  readonly REJECTED: 'rejected';
695
691
  readonly CORRECTION_REQUESTED: 'correction-requested';
696
692
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
697
693
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
698
694
  }>]>, z.ZodString]>>>;
699
695
  noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
700
- readonly INCOMPLETE: 'incomplete';
701
696
  readonly REJECTED: 'rejected';
702
697
  readonly CORRECTION_REQUESTED: 'correction-requested';
703
698
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
704
699
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
705
700
  }>]>, z.ZodString]>>>;
706
701
  allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
707
- readonly INCOMPLETE: 'incomplete';
708
702
  readonly REJECTED: 'rejected';
709
703
  readonly CORRECTION_REQUESTED: 'correction-requested';
710
704
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -1470,21 +1464,18 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
1470
1464
  }, z.core.$strip>>>;
1471
1465
  flags: z.ZodOptional<z.ZodOptional<z.ZodObject<{
1472
1466
  anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
1473
- readonly INCOMPLETE: 'incomplete';
1474
1467
  readonly REJECTED: 'rejected';
1475
1468
  readonly CORRECTION_REQUESTED: 'correction-requested';
1476
1469
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
1477
1470
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
1478
1471
  }>]>, z.ZodString]>>>;
1479
1472
  noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
1480
- readonly INCOMPLETE: 'incomplete';
1481
1473
  readonly REJECTED: 'rejected';
1482
1474
  readonly CORRECTION_REQUESTED: 'correction-requested';
1483
1475
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
1484
1476
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
1485
1477
  }>]>, z.ZodString]>>>;
1486
1478
  allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
1487
- readonly INCOMPLETE: 'incomplete';
1488
1479
  readonly REJECTED: 'rejected';
1489
1480
  readonly CORRECTION_REQUESTED: 'correction-requested';
1490
1481
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -1818,21 +1809,18 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
1818
1809
  }, z.core.$strip>>>;
1819
1810
  flags: z.ZodOptional<z.ZodOptional<z.ZodObject<{
1820
1811
  anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
1821
- readonly INCOMPLETE: 'incomplete';
1822
1812
  readonly REJECTED: 'rejected';
1823
1813
  readonly CORRECTION_REQUESTED: 'correction-requested';
1824
1814
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
1825
1815
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
1826
1816
  }>]>, z.ZodString]>>>;
1827
1817
  noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
1828
- readonly INCOMPLETE: 'incomplete';
1829
1818
  readonly REJECTED: 'rejected';
1830
1819
  readonly CORRECTION_REQUESTED: 'correction-requested';
1831
1820
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
1832
1821
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
1833
1822
  }>]>, z.ZodString]>>>;
1834
1823
  allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
1835
- readonly INCOMPLETE: 'incomplete';
1836
1824
  readonly REJECTED: 'rejected';
1837
1825
  readonly CORRECTION_REQUESTED: 'correction-requested';
1838
1826
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -2167,21 +2155,18 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
2167
2155
  }, z.core.$strip>>>;
2168
2156
  flags: z.ZodOptional<z.ZodOptional<z.ZodObject<{
2169
2157
  anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
2170
- readonly INCOMPLETE: 'incomplete';
2171
2158
  readonly REJECTED: 'rejected';
2172
2159
  readonly CORRECTION_REQUESTED: 'correction-requested';
2173
2160
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
2174
2161
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
2175
2162
  }>]>, z.ZodString]>>>;
2176
2163
  noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
2177
- readonly INCOMPLETE: 'incomplete';
2178
2164
  readonly REJECTED: 'rejected';
2179
2165
  readonly CORRECTION_REQUESTED: 'correction-requested';
2180
2166
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
2181
2167
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
2182
2168
  }>]>, z.ZodString]>>>;
2183
2169
  allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
2184
- readonly INCOMPLETE: 'incomplete';
2185
2170
  readonly REJECTED: 'rejected';
2186
2171
  readonly CORRECTION_REQUESTED: 'correction-requested';
2187
2172
  readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
@@ -2207,14 +2192,14 @@ export declare function defineWorkqueue(workqueueInput: WorkqueueConfigInput): {
2207
2192
  clauses: {
2208
2193
  eventType?: string | undefined;
2209
2194
  status?: {
2210
- type: "exact";
2211
- term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2212
- } | {
2213
2195
  type: "anyOf";
2214
2196
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2215
2197
  } | {
2216
2198
  type: "noneOf";
2217
2199
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2200
+ } | {
2201
+ type: "exact";
2202
+ term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2218
2203
  } | undefined;
2219
2204
  createdAt?: {
2220
2205
  type: "range";
@@ -2356,14 +2341,14 @@ export declare function defineWorkqueue(workqueueInput: WorkqueueConfigInput): {
2356
2341
  clauses: {
2357
2342
  eventType?: string | undefined;
2358
2343
  status?: {
2359
- type: "exact";
2360
- term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2361
- } | {
2362
2344
  type: "anyOf";
2363
2345
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2364
2346
  } | {
2365
2347
  type: "noneOf";
2366
2348
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2349
+ } | {
2350
+ type: "exact";
2351
+ term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2367
2352
  } | undefined;
2368
2353
  createdAt?: {
2369
2354
  type: "range";
@@ -2538,14 +2523,14 @@ export declare function defineWorkqueues(workqueues: WorkqueueConfigInputWithV19
2538
2523
  clauses: {
2539
2524
  eventType?: string | undefined;
2540
2525
  status?: {
2541
- type: "exact";
2542
- term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2543
- } | {
2544
2526
  type: "anyOf";
2545
2527
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2546
2528
  } | {
2547
2529
  type: "noneOf";
2548
2530
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2531
+ } | {
2532
+ type: "exact";
2533
+ term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2549
2534
  } | undefined;
2550
2535
  createdAt?: {
2551
2536
  type: "range";
@@ -2687,14 +2672,14 @@ export declare function defineWorkqueues(workqueues: WorkqueueConfigInputWithV19
2687
2672
  clauses: {
2688
2673
  eventType?: string | undefined;
2689
2674
  status?: {
2690
- type: "exact";
2691
- term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2692
- } | {
2693
2675
  type: "anyOf";
2694
2676
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2695
2677
  } | {
2696
2678
  type: "noneOf";
2697
2679
  terms: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED")[];
2680
+ } | {
2681
+ type: "exact";
2682
+ term: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
2698
2683
  } | undefined;
2699
2684
  createdAt?: {
2700
2685
  type: "range";
@@ -1,3 +1,8 @@
1
- import { EventConfig, EventConfigInput } from './EventConfig';
2
- export declare const defineConfig: (config: EventConfigInput) => EventConfig;
1
+ import { EventConfigInput, VersionedEventConfig, VersionedEventConfigInput } from './EventConfig';
2
+ /**
3
+ * Validates an event configuration. Accepts an event with `versions`, or, as before
4
+ * versioning, an event without them, which is taken as a single version with id
5
+ * `initial`, effective from the beginning of time.
6
+ */
7
+ export declare const defineConfig: (config: EventConfigInput | VersionedEventConfigInput) => VersionedEventConfig;
3
8
  //# sourceMappingURL=defineConfig.d.ts.map
@@ -17,7 +17,10 @@ declare function eventFn(fieldId: NonSearchableEventMetadataTimeFieldIdInput): {
17
17
  };
18
18
  declare const event: typeof eventFn & {
19
19
  /**
20
- * Checks if the event contains a specific action type.
20
+ * Checks if the event contains a specific accepted action type.
21
+ * Only Accepted actions are matched: a confirmable action is stored as a
22
+ * Requested and an Accepted action, and a pending or rejected request must
23
+ * not count as the action having happened.
21
24
  * Can be used directly as a conditional or chained with additional methods.
22
25
  * @param action - The action type to check for.
23
26
  */
@@ -21,4 +21,13 @@ export declare function validateExactlyOneDeclareAction<T extends {
21
21
  * compatibility) or on the DECLARE action.
22
22
  */
23
23
  export declare function validateDeclarationGivenExactlyOnce(config: EventConfigInput, ctx: z.RefinementCtx<EventConfigInput>): void;
24
+ /**
25
+ * Validation which ensures that a NOTIFY notificationForm:
26
+ * - only includes fields with ids that are also in the declaration form
27
+ * - the field types match the ones on the declaration form
28
+ *
29
+ * This is because the notification form is used as pre-filled values during declaration.
30
+ * For now we have made the design decision to not allow fields that are not present in the declaration form.
31
+ */
32
+ export declare function validateNotificationForm(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
24
33
  //# sourceMappingURL=eventConfigValidation.d.ts.map
@@ -37,7 +37,7 @@ export declare function field(fieldId: string, options?: {
37
37
  validations?: ValidationConfig[];
38
38
  searchCriteriaLabelPrefix?: TranslationConfig;
39
39
  allowedLocations?: JurisdictionReference;
40
- useFormDefaultValue?: boolean;
40
+ defaultValue?: boolean | string | number;
41
41
  }): {
42
42
  $$field: string;
43
43
  $$subfield: string[];
@@ -388,7 +388,7 @@ export declare function field(fieldId: string, options?: {
388
388
  validations?: ValidationConfig[];
389
389
  searchCriteriaLabelPrefix?: TranslationConfig;
390
390
  allowedLocations?: JurisdictionReference;
391
- useFormDefaultValue?: boolean;
391
+ defaultValue?: boolean | string | number;
392
392
  fieldId: string;
393
393
  fieldType: 'field';
394
394
  } & {
@@ -402,7 +402,7 @@ export declare function field(fieldId: string, options?: {
402
402
  validations?: ValidationConfig[];
403
403
  searchCriteriaLabelPrefix?: TranslationConfig;
404
404
  allowedLocations?: JurisdictionReference;
405
- useFormDefaultValue?: boolean;
405
+ defaultValue?: boolean | string | number;
406
406
  fieldId: string;
407
407
  fieldType: 'field';
408
408
  } & {
@@ -416,7 +416,7 @@ export declare function field(fieldId: string, options?: {
416
416
  validations?: ValidationConfig[];
417
417
  searchCriteriaLabelPrefix?: TranslationConfig;
418
418
  allowedLocations?: JurisdictionReference;
419
- useFormDefaultValue?: boolean;
419
+ defaultValue?: boolean | string | number;
420
420
  fieldId: string;
421
421
  fieldType: 'field';
422
422
  } & {
@@ -430,7 +430,7 @@ export declare function field(fieldId: string, options?: {
430
430
  validations?: ValidationConfig[];
431
431
  searchCriteriaLabelPrefix?: TranslationConfig;
432
432
  allowedLocations?: JurisdictionReference;
433
- useFormDefaultValue?: boolean;
433
+ defaultValue?: boolean | string | number;
434
434
  fieldId: string;
435
435
  fieldType: 'field';
436
436
  } & {
@@ -1,3 +1,4 @@
1
+ import 'zod/compile';
1
2
  export * from './AuditLog';
2
3
  export * from './Constants';
3
4
  export * from './ActionConfig';
@@ -25,6 +26,7 @@ export * from './state';
25
26
  export * from './state/flags';
26
27
  export * from './utils';
27
28
  export * from './defineConfig';
29
+ export * from './toNotificationForm';
28
30
  export * from './DeduplicationConfig';
29
31
  export * from './transactions';
30
32
  export * from './FieldType';
@@ -46,6 +48,7 @@ export * from './Flag';
46
48
  export * from './event';
47
49
  export * from './locations';
48
50
  export * from './locationPayloads';
51
+ export * from './PlainDate';
49
52
  export { UUID } from '../uuid';
50
53
  export { DocumentPath } from '../documents';
51
54
  //# sourceMappingURL=index.d.ts.map
@@ -3,7 +3,7 @@ import * as z from 'zod/v4';
3
3
  import { PlainDate } from './PlainDate';
4
4
  import { EventIndex } from './EventIndex';
5
5
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
6
- import { RecordScopeV2, UserScopeV2 } from '../scopes';
6
+ import { RecordScopeV2, UserScopeV2 } from '../users/scopes';
7
7
  import { SystemContext, UserContext } from '../users/User';
8
8
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
9
9
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -1,5 +1,5 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../scopes';
2
+ import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../users/scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
@@ -15,6 +15,7 @@ export declare const ACTION_SCOPE_MAP: {
15
15
  PRINT_CERTIFICATE: "record.print-certified-copies"[];
16
16
  REQUEST_CORRECTION: ("record.correct" | "record.request-correction")[];
17
17
  REVIEW_CORRECTION_REQUEST: "record.correct"[];
18
+ CONTINUE_DRAFT: never[];
18
19
  REJECT_CORRECTION: "record.correct"[];
19
20
  APPROVE_CORRECTION: "record.correct"[];
20
21
  REVOKE_REGISTRATION: "record.revoke-registration"[];
@@ -27,7 +27,7 @@ export declare function resolveEventCustomFlags(event: EventDocument, eventConfi
27
27
  *
28
28
  * Flags are determined by combining:
29
29
  * - Action status flags (format 'ActionType:ActionStatus')
30
- * - Inherent flags (e.g. incomplete, rejected, correction requested, potential duplicate, edit in progress)
30
+ * - Inherent flags (e.g. rejected, correction requested, potential duplicate, edit in progress)
31
31
  * - Event type-specific custom flags defined in the event configuration
32
32
  *
33
33
  * @param event - The EventDocument containing the action history and payload
@@ -63,6 +63,7 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
63
63
  export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
64
64
  id: string & import("zod").$brand<"UUID">;
65
65
  type: string;
66
+ configVersionId: string;
66
67
  status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
67
68
  legalStatuses: {
68
69
  NOTIFIED?: {
@@ -1,10 +1,10 @@
1
1
  import { UUID } from '../uuid';
2
- import { ActionDocument, ActionUpdate } from './ActionDocument';
2
+ import { Action, ActionBase, ActionDocument, ActionStatus, ActionUpdate } from './ActionDocument';
3
3
  import { ValidatorContext } from '../conditionals/validate';
4
4
  import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput, RevokeRegistrationActionInput, ReinstateRegistrationActionInput } from './ActionInput';
5
5
  import { ActionType } from './ActionType';
6
- import { Draft } from './Draft';
7
- import { EventConfig, EventConfigInput } from './EventConfig';
6
+ import { Draft, DraftInput, RemoteDraft } from './Draft';
7
+ import { EventConfig, EventConfigInput, VersionedEventConfig } from './EventConfig';
8
8
  import { EventDocument } from './EventDocument';
9
9
  import { EventIndex } from './EventIndex';
10
10
  import { EventInput } from './EventInput';
@@ -98,7 +98,8 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
98
98
  eventId: string;
99
99
  };
100
100
  /**
101
- * Notify allows sending incomplete data. Think it as 'partial declare' for now.
101
+ * NOTIFY submits the values of the notification form, and the record can stay incomplete.
102
+ * When `declaration` is not given, string values are left out of the generated declaration to make it incomplete.
102
103
  */
103
104
  notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
104
105
  type: "NOTIFY";
@@ -278,6 +279,13 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
278
279
  };
279
280
  };
280
281
  };
282
+ /**
283
+ * Generates a single action document with exactly the given status (Accepted by default).
284
+ *
285
+ * For realistic data use `generateActionDocuments`, which also creates the Requested
286
+ * action the events service stores for a confirmable action. Use this one for edge
287
+ * cases, such as pending or rejected requests, or actions without an original request.
288
+ */
281
289
  export declare function generateActionDocument<T extends ActionType>({ configuration, action, rng, defaults, declarationOverrides }: {
282
290
  configuration: EventConfig;
283
291
  action: T;
@@ -287,6 +295,45 @@ export declare function generateActionDocument<T extends ActionType>({ configura
287
295
  }>>;
288
296
  declarationOverrides?: ActionUpdate;
289
297
  }): ActionDocument;
298
+ type GenerateActionDocumentsArgs<T extends ActionType> = Parameters<typeof generateActionDocument<T>>[0];
299
+ type ActionConfirmation<S extends ActionStatus> = {
300
+ status: S;
301
+ defaults?: Partial<ActionBase>;
302
+ };
303
+ /**
304
+ * Generates the action documents the events service stores for a single action.
305
+ *
306
+ * Mirrors the events service: a confirmable action is first stored as Requested,
307
+ * carrying the declaration and annotation, and then confirmed by a separate
308
+ * Accepted (or Rejected) action that points back to it through originalActionId.
309
+ * Other actions are stored once, as Accepted.
310
+ *
311
+ * `confirmation.status` picks the outcome of a confirmable action:
312
+ * - Accepted (default): [Requested, Accepted]
313
+ * - Rejected: [Requested, Rejected]
314
+ * - Requested: [Requested], i.e. still waiting for confirmation
315
+ *
316
+ * By default the request is confirmed synchronously, so both actions share the
317
+ * `transactionId`. `confirmation.defaults` apply to the confirming action only,
318
+ * e.g. a system user and a `transactionId` of its own for an asynchronous confirmation.
319
+ *
320
+ * The confirming action keeps the generated (or given) `id`, since references such
321
+ * as `requestId` of APPROVE_CORRECTION point to the accepted action.
322
+ *
323
+ * Use `generateActionDocument` instead to build a single action with an explicit status.
324
+ *
325
+ * Only a rejection yields an AsyncRejectActionDocument, so the result is typed
326
+ * as `ActionDocument[]` when `confirmation.status` is known not to be Rejected.
327
+ */
328
+ export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
329
+ confirmation: ActionConfirmation<typeof ActionStatus.Rejected>;
330
+ }): Action[];
331
+ export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
332
+ confirmation?: Partial<ActionConfirmation<typeof ActionStatus.Accepted | typeof ActionStatus.Requested>>;
333
+ }): ActionDocument[];
334
+ export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
335
+ confirmation?: Partial<ActionConfirmation<ActionStatus>>;
336
+ }): Action[];
290
337
  export declare function generateRandomDatetime(rng: () => number, start: Date, end: Date): string;
291
338
  export declare function getRandomDate(rng: () => number, start: string, end: string): string;
292
339
  export declare function generateEventDocument({ configuration, actions, rng, defaults }: {
@@ -310,11 +357,11 @@ export declare function generateEventDocument({ configuration, actions, rng, def
310
357
  }): EventDocument;
311
358
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
312
359
  eventId: UUID;
313
- actionType: ActionType;
360
+ actionType: DraftInput['type'];
314
361
  rng?: () => number;
315
362
  declaration?: ActionUpdate;
316
363
  annotation?: ActionUpdate;
317
- }): Draft;
364
+ }): RemoteDraft;
318
365
  /**
319
366
  * Useful for testing when we need deterministic outcome.
320
367
  * @param seed - Seed value for the pseudo-random number generator
@@ -352,7 +399,9 @@ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfE
352
399
  actions?: EventConfigInput['actions'];
353
400
  }) => EventConfig;
354
401
  /**
355
- * @returns a copy of the configuration with the DECLARE action's declaration replaced.
402
+ * The notification form is replaced too, since it may refer to fields of the replaced declaration.
403
+ *
404
+ * @returns a copy of the configuration with the DECLARE action's declaration replaced, and the NOTIFY action's notification form made from it.
356
405
  */
357
406
  export declare function withDeclaration(configuration: EventConfig, declaration: DeclarationFormConfig): EventConfig;
358
407
  /**
@@ -371,4 +420,10 @@ export declare function generateTestValidatorContext(userRole?: TestUserRole, ev
371
420
  event: EventDocument;
372
421
  eventConfig: EventConfig;
373
422
  }): ValidatorContext;
423
+ /**
424
+ * Serves `config` as country config does: as the only version of its event.
425
+ * For mocking `/config/events` and `event.config.get` with a configuration built in a test.
426
+ */
427
+ export declare function toVersionedEventConfig({ id, label, advancedSearch, ...version }: EventConfig): VersionedEventConfig;
428
+ export {};
374
429
  //# sourceMappingURL=test.utils.d.ts.map
@@ -0,0 +1,17 @@
1
+ import * as z from 'zod/v4';
2
+ import { DeclarationFormConfig, DeclarationFormConfigInput } from './FormConfig';
3
+ import { DeclarationReviewConfig } from './ActionConfig';
4
+ type DeclarationReviewConfigInput = z.input<typeof DeclarationReviewConfig>;
5
+ type DeclarationReviewConfigOutput = z.infer<typeof DeclarationReviewConfig>;
6
+ /**
7
+ * NOTIFY submits incomplete records, and its notification form is validated like any form.
8
+ *
9
+ * @returns a copy of the declaration form with every field optional and without validations, to use as the NOTIFY `notificationForm`.
10
+ */
11
+ export declare function toNotificationForm<F extends DeclarationFormConfig | DeclarationFormConfigInput>(declaration: F): F;
12
+ /**
13
+ * @returns a copy of the DECLARE review with every field optional and without validations, to use as the NOTIFY `review`.
14
+ */
15
+ export declare function toNotificationReview<R extends DeclarationReviewConfigOutput | DeclarationReviewConfigInput>(review: R): R;
16
+ export {};
17
+ //# sourceMappingURL=toNotificationForm.d.ts.map