@opencrvs/toolkit 2.2.0-rc.ab91cce → 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 (252) hide show
  1. package/build.sh +17 -14
  2. package/dist/application-config/index.js +57 -14
  3. package/dist/authentication/index.d.ts +2 -1
  4. package/dist/authentication/index.js +34 -14
  5. package/dist/cli.js +2631 -377
  6. package/dist/commons/api/router.d.ts +1564 -248
  7. package/dist/commons/application-config/index.d.ts +3 -3
  8. package/dist/commons/conditionals/conditionals.d.ts +7 -7
  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 +68 -21
  12. package/dist/commons/events/ActionDocument.d.ts +89 -0
  13. package/dist/commons/events/ActionInput.d.ts +56 -4
  14. package/dist/commons/events/ActionStatus.d.ts +2 -2
  15. package/dist/commons/events/ActionType.d.ts +13 -1
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +15 -0
  17. package/dist/commons/events/AuditLog.d.ts +4 -0
  18. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  19. package/dist/commons/events/CountryConfigQueryInput.d.ts +192 -18
  20. package/dist/commons/events/Draft.d.ts +36 -1
  21. package/dist/commons/events/EventConfig.d.ts +448 -1
  22. package/dist/commons/events/EventDocument.d.ts +90 -0
  23. package/dist/commons/events/EventIndex.d.ts +44 -6
  24. package/dist/commons/events/EventInput.d.ts +1 -0
  25. package/dist/commons/events/EventMetadata.d.ts +24 -1
  26. package/dist/commons/events/EventStatus.d.ts +1 -0
  27. package/dist/commons/events/FieldConfig.d.ts +11 -1
  28. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  29. package/dist/commons/events/Flag.d.ts +1 -7
  30. package/dist/commons/events/PlainDate.d.ts +6 -0
  31. package/dist/commons/events/WorkqueueConfig.d.ts +224 -33
  32. package/dist/commons/events/defineConfig.d.ts +7 -2
  33. package/dist/commons/events/event.d.ts +4 -1
  34. package/dist/commons/events/eventConfigValidation.d.ts +9 -0
  35. package/dist/commons/events/field.d.ts +5 -0
  36. package/dist/commons/events/index.d.ts +3 -0
  37. package/dist/commons/events/locations.d.ts +1 -1
  38. package/dist/commons/events/scopes.d.ts +4 -1
  39. package/dist/commons/events/state/flags.d.ts +1 -1
  40. package/dist/commons/events/state/index.d.ts +11 -2
  41. package/dist/commons/events/state/utils.d.ts +11 -1
  42. package/dist/commons/events/test.utils.d.ts +85 -8
  43. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  44. package/dist/commons/events/utils.d.ts +88 -8
  45. package/dist/commons/users/Role.d.ts +23 -0
  46. package/dist/commons/users/User.d.ts +263 -0
  47. package/dist/commons/users/authentication.d.ts +67 -0
  48. package/dist/commons/users/index.d.ts +5 -0
  49. package/dist/commons/users/roleValidations.d.ts +15 -0
  50. package/dist/commons/users/scopes.d.ts +1402 -0
  51. package/dist/commons/users/userReferences.d.ts +176 -0
  52. package/dist/conditionals/index.js +19 -7
  53. package/dist/configurator/index.d.ts +24 -0
  54. package/dist/configurator/index.d.ts.map +1 -0
  55. package/dist/configurator/index.js +161 -0
  56. package/dist/configurator/layout.d.ts +29 -0
  57. package/dist/configurator/layout.d.ts.map +1 -0
  58. package/dist/configurator/layout.js +78 -0
  59. package/dist/configurator/paths.d.ts +13 -0
  60. package/dist/configurator/paths.d.ts.map +1 -0
  61. package/dist/configurator/paths.js +48 -0
  62. package/dist/configurator/server/environments.d.ts +20 -0
  63. package/dist/configurator/server/environments.d.ts.map +1 -0
  64. package/dist/configurator/server/environments.js +143 -0
  65. package/dist/configurator/server/files.d.ts +11 -0
  66. package/dist/configurator/server/files.d.ts.map +1 -0
  67. package/dist/configurator/server/files.js +67 -0
  68. package/dist/configurator/server/github.d.ts +56 -0
  69. package/dist/configurator/server/github.d.ts.map +1 -0
  70. package/dist/configurator/server/github.js +239 -0
  71. package/dist/configurator/server/plugin.d.ts +39 -0
  72. package/dist/configurator/server/plugin.d.ts.map +1 -0
  73. package/dist/configurator/server/plugin.js +298 -0
  74. package/dist/configurator/server/seal.d.ts +2 -0
  75. package/dist/configurator/server/seal.d.ts.map +1 -0
  76. package/dist/configurator/server/seal.js +36 -0
  77. package/dist/configurator/server/sshKeys.d.ts +5 -0
  78. package/dist/configurator/server/sshKeys.d.ts.map +1 -0
  79. package/dist/configurator/server/sshKeys.js +28 -0
  80. package/dist/configurator/server/start.d.ts +12 -0
  81. package/dist/configurator/server/start.d.ts.map +1 -0
  82. package/dist/configurator/server/start.js +91 -0
  83. package/dist/configurator/testing.d.ts +11 -0
  84. package/dist/configurator/testing.d.ts.map +1 -0
  85. package/dist/configurator/testing.js +74 -0
  86. package/dist/configurator/ui/bindings/bindings.d.ts +35 -0
  87. package/dist/configurator/ui/bindings/bindings.d.ts.map +1 -0
  88. package/dist/configurator/ui/bindings/bindings.js +5 -0
  89. package/dist/configurator/ui/bindings/parsers.d.ts +7 -0
  90. package/dist/configurator/ui/bindings/parsers.d.ts.map +1 -0
  91. package/dist/configurator/ui/bindings/parsers.js +85 -0
  92. package/dist/configurator/ui/form/users.d.ts +11 -0
  93. package/dist/configurator/ui/form/users.d.ts.map +1 -0
  94. package/dist/configurator/ui/form/users.js +33 -0
  95. package/dist/configurator/ui/plan/dependencyHosts.d.ts +2 -0
  96. package/dist/configurator/ui/plan/dependencyHosts.d.ts.map +1 -0
  97. package/dist/configurator/ui/plan/dependencyHosts.js +36 -0
  98. package/dist/configurator/ui/plan/templateValues.d.ts +11 -0
  99. package/dist/configurator/ui/plan/templateValues.d.ts.map +1 -0
  100. package/dist/configurator/ui/plan/templateValues.js +70 -0
  101. package/dist/configurator/workflows.d.ts +54 -0
  102. package/dist/configurator/workflows.d.ts.map +1 -0
  103. package/dist/configurator/workflows.js +161 -0
  104. package/dist/configurator-assets/forms/bindings.yml +265 -0
  105. package/dist/configurator-assets/templates/README.md +18 -0
  106. package/dist/configurator-assets/templates/charts-values/dependencies/values.override.yaml +4 -0
  107. package/dist/configurator-assets/templates/charts-values/dependencies/values.yaml +96 -0
  108. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  109. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.yaml +83 -0
  110. package/dist/configurator-assets/templates/charts-values/opentelemetry/values.yaml +102 -0
  111. package/dist/configurator-assets/templates/charts-values/traefik/values.override.yaml +4 -0
  112. package/dist/configurator-assets/templates/charts-values/traefik/values.yaml +130 -0
  113. package/dist/configurator-assets/templates/inventory/inventory.template.yml +98 -0
  114. package/dist/configurator-assets/ui/apple-touch-icon.png +0 -0
  115. package/dist/configurator-assets/ui/assets/index-CaqYFJUk.css +6 -0
  116. package/dist/configurator-assets/ui/assets/index-DU1Y6E0b.js +169 -0
  117. package/dist/configurator-assets/ui/assets/opencrvs-logo-sIjz08HT.svg +1 -0
  118. package/dist/configurator-assets/ui/assets/poppins-400-BwTUGeWf.woff2 +0 -0
  119. package/dist/configurator-assets/ui/assets/poppins-500-CWICHMj6.woff2 +0 -0
  120. package/dist/configurator-assets/ui/assets/poppins-600-DJVo7c07.woff2 +0 -0
  121. package/dist/configurator-assets/ui/assets/poppins-700-g9MkRaG0.woff2 +0 -0
  122. package/dist/configurator-assets/ui/favicon-32x32.png +0 -0
  123. package/dist/configurator-assets/ui/index.html +25 -0
  124. package/dist/environment/custom-types.d.ts +1 -0
  125. package/dist/environment/custom-types.d.ts.map +1 -1
  126. package/dist/environment/derived-variables.d.ts +18 -4
  127. package/dist/environment/derived-variables.d.ts.map +1 -1
  128. package/dist/environment/derived-variables.js +20 -4
  129. package/dist/environment/questions.d.ts +42 -9
  130. package/dist/environment/questions.d.ts.map +1 -1
  131. package/dist/environment/questions.js +71 -48
  132. package/dist/environment/registry.d.ts +15 -0
  133. package/dist/environment/registry.d.ts.map +1 -0
  134. package/dist/environment/registry.js +112 -0
  135. package/dist/environment/setup-environment.d.ts.map +1 -1
  136. package/dist/environment/setup-environment.js +145 -25
  137. package/dist/environment/templates.d.ts.map +1 -1
  138. package/dist/events/index.js +957 -215
  139. package/dist/migrations/add-notify-config.d.ts +40 -0
  140. package/dist/migrations/add-notify-config.d.ts.map +1 -0
  141. package/dist/migrations/add-notify-config.js +249 -0
  142. package/dist/migrations/index.d.ts +9 -0
  143. package/dist/migrations/index.d.ts.map +1 -0
  144. package/dist/migrations/index.js +1306 -0
  145. package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
  146. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
  147. package/dist/migrations/move-declaration-to-declare-action.js +260 -0
  148. package/dist/migrations/{add-translations.d.ts → persistent/add-translations.d.ts} +1 -1
  149. package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
  150. package/dist/migrations/{add-translations.js → persistent/add-translations.js} +2 -2
  151. package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
  152. package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
  153. package/dist/migrations/persistent/check-upgrade-path.js +105 -0
  154. package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
  155. package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
  156. package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
  157. package/dist/migrations/{v2.2/read-declaration-through-helper.d.ts → read-declaration-through-helper.d.ts} +1 -1
  158. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
  159. package/dist/migrations/{v2.2/read-declaration-through-helper.js → read-declaration-through-helper.js} +4 -62
  160. package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
  161. package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
  162. package/dist/migrations/replace-incomplete-flag.js +126 -0
  163. package/dist/migrations/resolve-versioned-event-config.d.ts +56 -0
  164. package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
  165. package/dist/migrations/resolve-versioned-event-config.js +353 -0
  166. package/dist/migrations/utils.d.ts +61 -0
  167. package/dist/migrations/utils.d.ts.map +1 -0
  168. package/dist/migrations/utils.js +218 -0
  169. package/dist/notification/index.js +810 -84
  170. package/dist/roles/index.d.ts +2 -0
  171. package/dist/roles/index.d.ts.map +1 -0
  172. package/dist/roles/index.js +730 -0
  173. package/dist/scopes/index.d.ts +83 -100
  174. package/dist/scopes/index.js +29 -13
  175. package/dist/templates/charts-values/dependencies/values.yaml +5 -2
  176. package/dist/templates/charts-values/opencrvs-services/values.yaml +5 -7
  177. package/dist/templates/charts-values/traefik/values.yaml +2 -0
  178. package/dist/verify/endpoints.d.ts +11 -0
  179. package/dist/verify/endpoints.d.ts.map +1 -1
  180. package/dist/verify/endpoints.js +21 -27
  181. package/opencrvs-toolkit-2.2.0-rc.e6591c5.tgz +0 -0
  182. package/package.json +17 -4
  183. package/tsconfig.build.json +11 -1
  184. package/tsconfig.build.tsbuildinfo +1 -1
  185. package/tsconfig.json +15 -6
  186. package/dist/migrations/add-translations.d.ts.map +0 -1
  187. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
  188. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
  189. package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
  190. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
  191. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
  192. package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
  193. package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
  194. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
  195. package/dist/migrations/v2.1/enable-telemetry.js +0 -455
  196. package/dist/migrations/v2.1/index.d.ts +0 -6
  197. package/dist/migrations/v2.1/index.d.ts.map +0 -1
  198. package/dist/migrations/v2.1/index.js +0 -50
  199. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -17
  200. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
  201. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
  202. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
  203. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
  204. package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
  205. package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
  206. package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
  207. package/dist/migrations/v2.1/remove-sentry.js +0 -354
  208. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
  209. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
  210. package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
  211. package/dist/migrations/v2.1/template-files.d.ts +0 -8
  212. package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
  213. package/dist/migrations/v2.1/template-files.js +0 -49
  214. package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -11
  215. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
  216. package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
  217. package/dist/migrations/v2.2/index.d.ts +0 -6
  218. package/dist/migrations/v2.2/index.d.ts.map +0 -1
  219. package/dist/migrations/v2.2/index.js +0 -456
  220. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +0 -1
  221. package/dist/templates/countryconfig-template/.tiltignore +0 -1
  222. package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
  223. package/dist/templates/countryconfig-template/Tiltfile +0 -112
  224. package/dist/templates/countryconfig-template/assets/README.md +0 -1
  225. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
  226. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
  227. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
  228. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
  229. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
  230. package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
  231. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
  232. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
  233. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
  234. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
  235. package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
  236. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
  237. package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
  238. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
  239. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
  240. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
  241. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
  242. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
  243. package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
  244. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
  245. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
  246. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
  247. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
  248. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
  249. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
  250. package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
  251. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
  252. package/opencrvs-toolkit-2.2.0-rc.ab91cce.tgz +0 -0
@@ -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,8 +15,11 @@ 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"[];
21
+ REVOKE_REGISTRATION: "record.revoke-registration"[];
22
+ REINSTATE_REGISTRATION: "record.reinstate-registration"[];
20
23
  MARK_AS_DUPLICATE: "record.review-duplicates"[];
21
24
  MARK_AS_NOT_DUPLICATE: "record.review-duplicates"[];
22
25
  ARCHIVE: "record.archive"[];
@@ -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
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
7
7
  import { EventConfig } from '../EventConfig';
8
8
  import { UUID } from '../../uuid';
9
9
  import { DocumentPath } from '../../documents';
10
- export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
10
+ export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
11
11
  export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
12
12
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
13
13
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
@@ -63,7 +63,8 @@ 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
- status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
66
+ configVersionId: string;
67
+ status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
67
68
  legalStatuses: {
68
69
  NOTIFIED?: {
69
70
  createdAt: string;
@@ -90,6 +91,14 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
90
91
  createdByRole?: string | undefined;
91
92
  registrationNumber: string;
92
93
  } | null | undefined;
94
+ REVOKED?: {
95
+ createdAt: string;
96
+ createdBy: string;
97
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
98
+ createdByUserType?: "system" | "user" | null | undefined;
99
+ acceptedAt: string;
100
+ createdByRole?: string | undefined;
101
+ } | null | undefined;
93
102
  };
94
103
  createdAt: string;
95
104
  dateOfEvent?: string | null | undefined;
@@ -1,4 +1,5 @@
1
1
  import { Action } from '../ActionDocument';
2
+ import { EventStatus } from '../EventMetadata';
2
3
  /**
3
4
  * Returns the creation metadata of the last update action (Requested or Accepted).
4
5
  * Requested actions are included so that async flows (202) correctly reflect the
@@ -29,7 +30,7 @@ export declare function getActionUpdateMetadata(actions: Action[]): Pick<{
29
30
  * @returns the legal statuses of the event. Event is considered legal if it has been accepted.
30
31
  * @see EventIndex for the description of the returned object.
31
32
  */
32
- export declare function getLegalStatuses(actions: Action[]): {
33
+ export declare function getLegalStatuses(actions: Action[], status: EventStatus): {
33
34
  NOTIFIED: {
34
35
  createdAt: string;
35
36
  createdBy: string;
@@ -57,5 +58,14 @@ export declare function getLegalStatuses(actions: Action[]): {
57
58
  createdByRole: string | undefined;
58
59
  registrationNumber: string | null | undefined;
59
60
  } | null;
61
+ REVOKED: {
62
+ createdAt: string;
63
+ createdBy: string;
64
+ createdByUserType: "system" | "user";
65
+ createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
66
+ acceptedAt: string;
67
+ createdByRole: string | undefined;
68
+ registrationNumber: string | null | undefined;
69
+ } | null;
60
70
  };
61
71
  //# sourceMappingURL=utils.d.ts.map
@@ -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
- import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput } from './ActionInput';
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";
@@ -159,6 +160,28 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
159
160
  annotation: {};
160
161
  eventId: string;
161
162
  };
163
+ revokeRegistration: (eventId: string, input?: Partial<Pick<RevokeRegistrationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
164
+ keepAssignment?: boolean | undefined;
165
+ keepAssignmentIfAccepted?: boolean | undefined;
166
+ keepAssignmentIfRejected?: boolean | undefined;
167
+ waitFor?: boolean | undefined;
168
+ type: "REVOKE_REGISTRATION";
169
+ transactionId: string;
170
+ declaration: {};
171
+ annotation: {};
172
+ eventId: string;
173
+ };
174
+ reinstateRegistration: (eventId: string, input?: Partial<Pick<ReinstateRegistrationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
175
+ keepAssignment?: boolean | undefined;
176
+ keepAssignmentIfAccepted?: boolean | undefined;
177
+ keepAssignmentIfRejected?: boolean | undefined;
178
+ waitFor?: boolean | undefined;
179
+ type: "REINSTATE_REGISTRATION";
180
+ transactionId: string;
181
+ declaration: {};
182
+ annotation: {};
183
+ eventId: string;
184
+ };
162
185
  reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
163
186
  keepAssignment?: boolean | undefined;
164
187
  keepAssignmentIfAccepted?: boolean | undefined;
@@ -256,6 +279,13 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
256
279
  };
257
280
  };
258
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
+ */
259
289
  export declare function generateActionDocument<T extends ActionType>({ configuration, action, rng, defaults, declarationOverrides }: {
260
290
  configuration: EventConfig;
261
291
  action: T;
@@ -265,6 +295,45 @@ export declare function generateActionDocument<T extends ActionType>({ configura
265
295
  }>>;
266
296
  declarationOverrides?: ActionUpdate;
267
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[];
268
337
  export declare function generateRandomDatetime(rng: () => number, start: Date, end: Date): string;
269
338
  export declare function getRandomDate(rng: () => number, start: string, end: string): string;
270
339
  export declare function generateEventDocument({ configuration, actions, rng, defaults }: {
@@ -288,11 +357,11 @@ export declare function generateEventDocument({ configuration, actions, rng, def
288
357
  }): EventDocument;
289
358
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
290
359
  eventId: UUID;
291
- actionType: ActionType;
360
+ actionType: DraftInput['type'];
292
361
  rng?: () => number;
293
362
  declaration?: ActionUpdate;
294
363
  annotation?: ActionUpdate;
295
- }): Draft;
364
+ }): RemoteDraft;
296
365
  /**
297
366
  * Useful for testing when we need deterministic outcome.
298
367
  * @param seed - Seed value for the pseudo-random number generator
@@ -330,7 +399,9 @@ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfE
330
399
  actions?: EventConfigInput['actions'];
331
400
  }) => EventConfig;
332
401
  /**
333
- * @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.
334
405
  */
335
406
  export declare function withDeclaration(configuration: EventConfig, declaration: DeclarationFormConfig): EventConfig;
336
407
  /**
@@ -349,4 +420,10 @@ export declare function generateTestValidatorContext(userRole?: TestUserRole, ev
349
420
  event: EventDocument;
350
421
  eventConfig: EventConfig;
351
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 {};
352
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
@@ -1,5 +1,5 @@
1
1
  import { ActionType, DeclarationActionType, DisplayableAction } from './ActionType';
2
- import { EventConfig } from './EventConfig';
2
+ import { EventConfig, VersionedEventConfig } from './EventConfig';
3
3
  import { FieldConfig, FieldReference } from './FieldConfig';
4
4
  import { Action, ActionDocument, ActionUpdate, EventState } from './ActionDocument';
5
5
  import { PageConfig, VerificationPageConfig } from './PageConfig';
@@ -8,7 +8,7 @@ import { Draft } from './Draft';
8
8
  import { EventDocument } from './EventDocument';
9
9
  import { UUID } from '../uuid';
10
10
  import { ActionConfig, ActionConfigTypes } from './ActionConfig';
11
- import { FormConfig } from './FormConfig';
11
+ import { DeclarationFormConfig, FormConfig } from './FormConfig';
12
12
  import { PlainDate, SelectDateRangeValue } from './FieldValue';
13
13
  import { EventIndex } from './EventIndex';
14
14
  export declare function ageToDate(age: number, asOfDate: PlainDate): string & import("zod").$brand<"PlainDate">;
@@ -46,6 +46,47 @@ export declare function getDeclarationPages(configuration: EventConfig): {
46
46
  type: "FORM";
47
47
  }[];
48
48
  export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
49
+ /**
50
+ * @returns the declaration fields of every version of the event, one per id: what any
51
+ * record of the event can hold, whichever version it was created under. Where versions
52
+ * define an id differently, the newest version's field is kept.
53
+ *
54
+ * Used to build the search index mapping: records of every version share one index per
55
+ * event, so its mapping must hold the fields of all of them. Goes away once each version
56
+ * gets its own index (#14335).
57
+ * Known limitation: a field id must keep its type in every version until #14335.
58
+ */
59
+ export declare function getDeclarationFieldsOfAllVersions(config: VersionedEventConfig): FieldConfig[];
60
+ /**
61
+ * @returns the notification form configured on the NOTIFY action.
62
+ * @throws when the event has no NOTIFY action.
63
+ */
64
+ export declare function getNotificationForm(configuration: EventConfig): DeclarationFormConfig;
65
+ export declare function getNotificationFields(configuration: EventConfig): FieldConfig[];
66
+ /**
67
+ * Form a user fills in to submit the given action:
68
+ * the notification form for NOTIFY, the declaration form for DECLARE.
69
+ */
70
+ export declare function getActionForm(configuration: EventConfig, actionType: typeof ActionType.NOTIFY | typeof ActionType.DECLARE): {
71
+ label: {
72
+ id: string;
73
+ defaultMessage: string;
74
+ description: string;
75
+ };
76
+ pages: {
77
+ id: string;
78
+ title: {
79
+ id: string;
80
+ defaultMessage: string;
81
+ description: string;
82
+ };
83
+ requireCompletionToContinue: boolean;
84
+ showClearButton?: boolean | undefined;
85
+ fields: FieldConfig[];
86
+ conditional?: any;
87
+ type: "FORM";
88
+ }[];
89
+ };
49
90
  export declare function isActionConfigType(type: ActionType): type is ActionConfigTypes;
50
91
  export declare function getActionConfig({ eventConfiguration, actionType, customActionType }: {
51
92
  eventConfiguration: EventConfig;
@@ -55,10 +96,6 @@ export declare function getActionConfig({ eventConfiguration, actionType, custom
55
96
  export declare function getCustomActionFields(eventConfiguration: EventConfig, customActionType: string): FieldConfig[];
56
97
  /**
57
98
  * Returns the fields configured for an action's confirmation dialog.
58
- *
59
- * Unlike review fields and supporting copy, NOTIFY does NOT fall back to the
60
- * DECLARE config here: dialog fields always come from the action's own
61
- * configuration entry.
62
99
  */
63
100
  export declare function getActionFormFields(eventConfiguration: EventConfig, actionType: ActionType, customActionType?: string): FieldConfig[];
64
101
  export declare function getPrintCertificatePages(configuration: EventConfig): ({
@@ -277,6 +314,34 @@ export declare function findLastAssignmentAction(actions: Action[]): {
277
314
  status: "Accepted" | "Rejected" | "Requested";
278
315
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
279
316
  type: "UNARCHIVE";
317
+ } | {
318
+ id: string & import("zod").$brand<"UUID">;
319
+ transactionId: string;
320
+ createdByUserType: "system" | "user";
321
+ createdAt: string;
322
+ createdBy: string;
323
+ createdByRole?: string | undefined;
324
+ createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
325
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
326
+ declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
327
+ annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
328
+ status: "Accepted" | "Rejected" | "Requested";
329
+ originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
330
+ type: "REVOKE_REGISTRATION";
331
+ } | {
332
+ id: string & import("zod").$brand<"UUID">;
333
+ transactionId: string;
334
+ createdByUserType: "system" | "user";
335
+ createdAt: string;
336
+ createdBy: string;
337
+ createdByRole?: string | undefined;
338
+ createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
339
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
340
+ declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
341
+ annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
342
+ status: "Accepted" | "Rejected" | "Requested";
343
+ originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
344
+ type: "REINSTATE_REGISTRATION";
280
345
  } | {
281
346
  id: string & import("zod").$brand<"UUID">;
282
347
  transactionId: string;
@@ -472,7 +537,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
472
537
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
473
538
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
474
539
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
475
- type: "APPROVE_CORRECTION" | "ARCHIVE" | "CUSTOM" | "DECLARE" | "EDIT" | "NOTIFY" | "PRINT_CERTIFICATE" | "REGISTER" | "REJECT" | "REJECT_CORRECTION" | "REQUEST_CORRECTION" | "UNARCHIVE";
540
+ type: "APPROVE_CORRECTION" | "ARCHIVE" | "CUSTOM" | "DECLARE" | "EDIT" | "NOTIFY" | "PRINT_CERTIFICATE" | "REGISTER" | "REINSTATE_REGISTRATION" | "REJECT" | "REJECT_CORRECTION" | "REQUEST_CORRECTION" | "REVOKE_REGISTRATION" | "UNARCHIVE";
476
541
  status: "Rejected";
477
542
  } | undefined;
478
543
  /**
@@ -582,7 +647,9 @@ export declare const findAllFields: (config: EventConfig) => FieldConfig[];
582
647
  * @returns the value of the object at the given path.
583
648
  */
584
649
  export declare function getMixedPath<T = unknown>(obj: Record<string, unknown>, path: string, defaultValue?: T | undefined): T | undefined;
585
- export declare function getEventConfigById(eventConfigs: EventConfig[], id: string): EventConfig;
650
+ export declare function getEventConfigById<T extends {
651
+ id: string;
652
+ }>(eventConfigs: T[], id: string): T;
586
653
  export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
587
654
  startDate: string;
588
655
  endDate: string;
@@ -600,6 +667,19 @@ export declare function getCompleteActionAnnotation(event: EventDocument, action
600
667
  export declare function getCompleteActionContent(event: EventDocument, action: ActionDocument): Record<string, unknown> | null | undefined;
601
668
  export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
602
669
  export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
670
+ /**
671
+ * Returns the event with each Accepted action completed with the details of
672
+ * its original Requested action: who requested it, where, and the request's
673
+ * declaration, annotation and content (the Accepted action's own values win).
674
+ *
675
+ * `$event` conditionals match Accepted actions only, but an Accepted action
676
+ * does not carry everything its request did. A synchronous confirmation drops
677
+ * the request's annotation; an asynchronous `accept` is created by the system
678
+ * user and carries only what the country configuration sent. Without this,
679
+ * `event.hasAction(...).withTemplate(...)` / `.withFields(...)` would stop
680
+ * matching fields that matched the Requested action.
681
+ */
682
+ export declare function getEventWithCompleteAcceptedActions(event: EventDocument): EventDocument;
603
683
  export declare function aggregateActionDeclarations(event: EventDocument): EventState;
604
684
  /**
605
685
  * Returns the declaration after each of `event.actions`, which must be in chronological order.
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { VersionedEventConfig } from '../events/EventConfig';
3
+ export declare const Role: z.ZodObject<{
4
+ id: z.ZodString;
5
+ scopes: z.ZodArray<z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">>;
6
+ }, z.core.$strip>;
7
+ export type Role = z.infer<typeof Role>;
8
+ export declare const Roles: z.ZodArray<z.ZodObject<{
9
+ id: z.ZodString;
10
+ scopes: z.ZodArray<z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">>;
11
+ }, z.core.$strip>>;
12
+ export type Roles = z.infer<typeof Roles>;
13
+ /**
14
+ * Helper for defining user roles. Should be used in country config.
15
+ *
16
+ * @param roles Array of roles in object format.
17
+ * @param eventConfigs Array of event configurations, which are needed to run validations for scopes.
18
+ */
19
+ export declare function defineRoles(roles: Roles, eventConfigs: VersionedEventConfig[]): {
20
+ id: string;
21
+ scopes: (string & z.$brand<"EncodedScope">)[];
22
+ }[];
23
+ //# sourceMappingURL=Role.d.ts.map