@opencrvs/toolkit 2.1.0-rc.ffe0b7f → 2.2.0-rc.ab91cce

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 (246) hide show
  1. package/README.md +2 -12
  2. package/build.sh +23 -5
  3. package/create-countryconfig/index.js +441 -59
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +5 -2
  6. package/dist/application-config/index.js +362 -284
  7. package/dist/authentication/index.d.ts +66 -0
  8. package/dist/authentication/index.d.ts.map +1 -0
  9. package/dist/authentication/index.js +765 -0
  10. package/dist/cli.js +2041 -1311
  11. package/dist/commons/api/router.d.ts +940 -363
  12. package/dist/commons/application-config/index.d.ts +0 -2
  13. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  14. package/dist/commons/conditionals/validate.d.ts +34 -8
  15. package/dist/commons/events/ActionConfig.d.ts +77 -7
  16. package/dist/commons/events/ActionDocument.d.ts +35 -15
  17. package/dist/commons/events/ActionInput.d.ts +4 -4
  18. package/dist/commons/events/ActionStatus.d.ts +14 -0
  19. package/dist/commons/events/AdvancedSearchConfig.d.ts +48 -12
  20. package/dist/commons/events/AuditLog.d.ts +148 -0
  21. package/dist/commons/events/Draft.d.ts +1 -21
  22. package/dist/commons/events/EventConfig.d.ts +29 -6
  23. package/dist/commons/events/EventDocument.d.ts +472 -4
  24. package/dist/commons/events/EventIndex.d.ts +3 -26
  25. package/dist/commons/events/EventMetadata.d.ts +1 -11
  26. package/dist/commons/events/EventStatus.d.ts +19 -0
  27. package/dist/commons/events/FieldConfig.d.ts +109 -63
  28. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  29. package/dist/commons/events/FieldValue.d.ts +3 -2
  30. package/dist/commons/events/Flag.d.ts +42 -0
  31. package/dist/commons/events/FormConfig.d.ts +6 -0
  32. package/dist/commons/events/PageConfig.d.ts +4 -0
  33. package/dist/commons/events/PlainDate.d.ts +8 -0
  34. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  35. package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
  36. package/dist/commons/events/event.d.ts +12 -0
  37. package/dist/commons/events/eventConfigValidation.d.ts +17 -1
  38. package/dist/commons/events/index.d.ts +1 -0
  39. package/dist/commons/events/locationPayloads.d.ts +95 -0
  40. package/dist/commons/events/locations.d.ts +169 -26
  41. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  42. package/dist/commons/events/scopes.d.ts +21 -1
  43. package/dist/commons/events/test.utils.d.ts +83 -25
  44. package/dist/commons/events/utils.d.ts +52 -17
  45. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  46. package/dist/commons/notification/dispatch.d.ts +10 -0
  47. package/dist/commons/notification/index.d.ts +1 -0
  48. package/dist/conditionals/index.js +349 -65
  49. package/dist/csv.d.ts +25 -0
  50. package/dist/csv.d.ts.map +1 -0
  51. package/dist/csv.js +120 -0
  52. package/dist/environment/derived-variables.d.ts +18 -0
  53. package/dist/environment/derived-variables.d.ts.map +1 -1
  54. package/dist/environment/derived-variables.js +22 -1
  55. package/dist/environment/index.d.ts.map +1 -1
  56. package/dist/environment/index.js +2 -1
  57. package/dist/environment/logger.d.ts +15 -3
  58. package/dist/environment/logger.d.ts.map +1 -1
  59. package/dist/environment/manage-users.js +1 -1
  60. package/dist/environment/questions.d.ts.map +1 -1
  61. package/dist/environment/questions.js +20 -14
  62. package/dist/environment/setup-environment.d.ts +1 -1
  63. package/dist/environment/setup-environment.d.ts.map +1 -1
  64. package/dist/environment/setup-environment.js +610 -560
  65. package/dist/environment/swarm-to-k8s.js +3 -4
  66. package/dist/environment/templates.d.ts +0 -1
  67. package/dist/environment/templates.d.ts.map +1 -1
  68. package/dist/environment/templates.js +3 -8
  69. package/dist/environment/update-workflows.d.ts.map +1 -1
  70. package/dist/environment/update-workflows.js +4 -0
  71. package/dist/environment/utils.d.ts +0 -12
  72. package/dist/environment/utils.d.ts.map +1 -1
  73. package/dist/environment/utils.js +1 -28
  74. package/dist/events/index.js +6115 -5378
  75. package/dist/migrations/add-translations.d.ts +15 -0
  76. package/dist/migrations/add-translations.d.ts.map +1 -0
  77. package/dist/migrations/add-translations.js +151 -0
  78. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  79. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  80. package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
  81. package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/enable-telemetry.d.ts} +1 -1
  82. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  83. package/dist/migrations/v2.1/enable-telemetry.js +455 -0
  84. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  85. package/dist/migrations/v2.1/index.js +47 -215
  86. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +17 -0
  87. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  88. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
  89. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  90. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  91. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  92. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  93. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  94. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  95. package/dist/migrations/{v2.0/create-events-index.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  96. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  97. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  98. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  99. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  100. package/dist/migrations/v2.1/template-files.js +49 -0
  101. package/dist/migrations/v2.1/upgrade-tilt.d.ts +11 -0
  102. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  103. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  104. package/dist/migrations/v2.2/index.d.ts +6 -0
  105. package/dist/migrations/v2.2/index.d.ts.map +1 -0
  106. package/dist/migrations/v2.2/index.js +456 -0
  107. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
  108. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
  109. package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
  110. package/dist/notification/index.js +2012 -1455
  111. package/dist/scopes/index.d.ts +614 -36
  112. package/dist/scopes/index.js +351 -65
  113. package/dist/telemetry/index.d.ts +45 -0
  114. package/dist/telemetry/index.d.ts.map +1 -0
  115. package/dist/telemetry/index.js +43 -0
  116. package/dist/templates/charts-values/dependencies/values.yaml +8 -0
  117. package/dist/templates/charts-values/opencrvs-services/values.yaml +10 -3
  118. package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
  119. package/dist/templates/charts-values/traefik/values.yaml +25 -12
  120. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  121. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  122. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  123. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  124. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  125. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  126. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  127. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  128. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  129. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  130. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  131. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  132. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  133. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  134. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  135. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  136. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  137. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  138. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  139. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  140. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  141. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  142. package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
  143. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  144. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  145. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  146. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  147. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  148. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  149. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  150. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  151. package/dist/templates/inventory/inventory.template.yml +1 -3
  152. package/dist/translations/template.d.ts +11 -0
  153. package/dist/translations/template.d.ts.map +1 -0
  154. package/dist/translations/template.js +100 -0
  155. package/dist/verify/endpoints.d.ts +2 -0
  156. package/dist/verify/endpoints.d.ts.map +1 -0
  157. package/dist/verify/endpoints.js +510 -0
  158. package/opencrvs-toolkit-2.2.0-rc.ab91cce.tgz +0 -0
  159. package/package.json +13 -7
  160. package/tsconfig.build.json +11 -0
  161. package/tsconfig.build.tsbuildinfo +1 -0
  162. package/tsconfig.json +3 -0
  163. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  164. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  165. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  166. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  167. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  168. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  169. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  170. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  171. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  172. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  173. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  174. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  175. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  176. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  177. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  178. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  179. package/dist/migrations/v2.0/create-events-index.js +0 -325
  180. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  181. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  182. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  183. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  184. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  185. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  186. package/dist/migrations/v2.0/index.d.ts +0 -13
  187. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  188. package/dist/migrations/v2.0/index.js +0 -103
  189. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  190. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  191. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  192. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  193. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  194. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  195. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  196. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  197. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  198. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  199. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  200. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  201. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  202. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  203. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  204. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  205. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  206. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  207. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  208. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  209. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  210. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  211. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  212. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  213. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  214. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  215. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  216. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  217. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  218. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  219. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  220. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  221. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  222. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  223. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  224. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  225. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  226. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  227. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  228. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  229. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  230. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  231. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  232. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  233. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  234. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  235. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  236. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  237. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  238. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  239. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  240. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  241. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  242. package/dist/migrations/v2.0/update-package-json.js +0 -105
  243. package/dist/templates/inventory/production.example.yml +0 -77
  244. package/dist/templates/inventory/qa.example.yml +0 -48
  245. package/opencrvs-toolkit-2.1.0-rc.ffe0b7f.tgz +0 -0
  246. package/tsconfig.tsbuildinfo +0 -1
@@ -1,15 +1,17 @@
1
1
  import { UUID } from '../uuid';
2
2
  import { ActionDocument, ActionUpdate } from './ActionDocument';
3
+ import { ValidatorContext } from '../conditionals/validate';
3
4
  import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput } from './ActionInput';
4
5
  import { ActionType } from './ActionType';
5
6
  import { Draft } from './Draft';
6
- import { EventConfig } from './EventConfig';
7
+ import { EventConfig, EventConfigInput } from './EventConfig';
7
8
  import { EventDocument } from './EventDocument';
8
9
  import { EventIndex } from './EventIndex';
9
10
  import { EventInput } from './EventInput';
10
11
  import { TranslationConfig } from './TranslationConfig';
11
12
  import { FieldConfig } from './FieldConfig';
12
- import { SetLocationPayload, SetAdministrativeAreaPayload } from './locations';
13
+ import { DeclarationFormConfig } from './FormConfig';
14
+ import { LocationVersion, SetLocationPayload, SetAdministrativeAreaPayload, ClientAdministrativeArea } from './locations';
13
15
  import { WorkqueueConfig } from './WorkqueueConfig';
14
16
  import * as z from 'zod/v4';
15
17
  import { DocumentPath } from '../documents';
@@ -43,6 +45,13 @@ export declare function generateUuid(rng?: () => number): UUID;
43
45
  export declare function generateTrackingId(rng: () => number): string;
44
46
  export declare function generateRegistrationNumber(rng: () => number): string;
45
47
  export declare function generateRandomSignature(rng: () => number): DocumentPath;
48
+ /**
49
+ * Builds one element of a location / administrative area `versions` history.
50
+ * Every field is defaulted so a call names only what its assertion is about —
51
+ * an `effectiveFrom`, a `name`, or an explicit `versionId` when the test needs
52
+ * to control version identity.
53
+ */
54
+ export declare function locationVersion(overrides?: Partial<LocationVersion>, rng?: () => number): LocationVersion;
46
55
  export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng: () => number,
47
56
  /**
48
57
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
@@ -77,8 +86,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
77
86
  omitFields?: string[];
78
87
  }, input?: Partial<Draft>) => Draft;
79
88
  actions: {
80
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
89
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
81
90
  keepAssignment?: boolean | undefined;
91
+ keepAssignmentIfAccepted?: boolean | undefined;
92
+ keepAssignmentIfRejected?: boolean | undefined;
93
+ waitFor?: boolean | undefined;
82
94
  type: "DECLARE";
83
95
  transactionId: string;
84
96
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
@@ -88,56 +100,70 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
88
100
  /**
89
101
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
90
102
  */
91
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
103
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
92
104
  type: "NOTIFY";
93
105
  transactionId: string;
94
106
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
95
107
  eventId: string;
96
108
  keepAssignment: boolean | undefined;
109
+ keepAssignmentIfAccepted: boolean | undefined;
110
+ keepAssignmentIfRejected: boolean | undefined;
111
+ waitFor: boolean | undefined;
97
112
  };
98
- edit: (eventId: string, input?: Partial<Pick<EditActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
113
+ edit: (eventId: string, input?: Partial<Pick<EditActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
99
114
  keepAssignment?: boolean | undefined;
115
+ keepAssignmentIfAccepted?: boolean | undefined;
116
+ keepAssignmentIfRejected?: boolean | undefined;
117
+ waitFor?: boolean | undefined;
100
118
  type: "EDIT";
101
119
  transactionId: string;
102
120
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
103
121
  annotation: {};
104
122
  eventId: string;
105
123
  };
106
- assign: (eventId: string, input?: Partial<Pick<AssignActionInput, 'transactionId' | 'assignedTo'>>) => {
124
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, 'transactionId' | 'assignedTo' | 'waitFor'>>) => {
107
125
  type: "ASSIGN";
108
126
  transactionId: string;
109
127
  declaration: {};
110
128
  assignedTo: string;
111
129
  eventId: string;
130
+ waitFor: boolean | undefined;
112
131
  };
113
- unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, 'transactionId'>>) => {
132
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, 'transactionId' | 'waitFor'>>) => {
114
133
  type: "UNASSIGN";
115
134
  transactionId: string;
116
135
  declaration: {};
117
136
  assignedTo: null;
118
137
  eventId: string;
138
+ waitFor: boolean | undefined;
119
139
  };
120
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
140
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
121
141
  keepAssignment?: boolean | undefined;
142
+ keepAssignmentIfAccepted?: boolean | undefined;
143
+ keepAssignmentIfRejected?: boolean | undefined;
144
+ waitFor?: boolean | undefined;
122
145
  type: "ARCHIVE";
123
146
  transactionId: string;
124
147
  declaration: {};
125
148
  annotation: {};
126
149
  eventId: string;
127
- content: {
128
- reason: string;
129
- };
130
150
  };
131
- unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
151
+ unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
132
152
  keepAssignment?: boolean | undefined;
153
+ keepAssignmentIfAccepted?: boolean | undefined;
154
+ keepAssignmentIfRejected?: boolean | undefined;
155
+ waitFor?: boolean | undefined;
133
156
  type: "UNARCHIVE";
134
157
  transactionId: string;
135
158
  declaration: {};
136
159
  annotation: {};
137
160
  eventId: string;
138
161
  };
139
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
162
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
140
163
  keepAssignment?: boolean | undefined;
164
+ keepAssignmentIfAccepted?: boolean | undefined;
165
+ keepAssignmentIfRejected?: boolean | undefined;
166
+ waitFor?: boolean | undefined;
141
167
  type: "REJECT";
142
168
  transactionId: string;
143
169
  declaration: {};
@@ -147,8 +173,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
147
173
  reason: string;
148
174
  };
149
175
  };
150
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'registrationNumber'>>) => {
176
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'registrationNumber' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
151
177
  keepAssignment?: boolean | undefined;
178
+ keepAssignmentIfAccepted?: boolean | undefined;
179
+ keepAssignmentIfRejected?: boolean | undefined;
180
+ waitFor?: boolean | undefined;
152
181
  registrationNumber?: string | undefined;
153
182
  type: "REGISTER";
154
183
  transactionId: string;
@@ -156,8 +185,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
156
185
  annotation: {};
157
186
  eventId: string;
158
187
  };
159
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
188
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
160
189
  keepAssignment?: boolean | undefined;
190
+ keepAssignmentIfAccepted?: boolean | undefined;
191
+ keepAssignmentIfRejected?: boolean | undefined;
192
+ waitFor?: boolean | undefined;
161
193
  type: "PRINT_CERTIFICATE";
162
194
  transactionId: string;
163
195
  declaration: {};
@@ -165,15 +197,18 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
165
197
  eventId: string;
166
198
  };
167
199
  correction: {
168
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
200
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
169
201
  type: "REQUEST_CORRECTION";
170
202
  transactionId: string;
171
203
  declaration: import("lodash").Omit<Record<string, import("./FieldValue").FieldUpdateValue>, "applicant.email" | "applicant.image">;
172
204
  annotation: {};
173
205
  eventId: string;
174
206
  keepAssignment: boolean | undefined;
207
+ keepAssignmentIfAccepted: boolean | undefined;
208
+ keepAssignmentIfRejected: boolean | undefined;
209
+ waitFor: boolean | undefined;
175
210
  };
176
- approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
211
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
177
212
  type: "APPROVE_CORRECTION";
178
213
  transactionId: string;
179
214
  declaration: {};
@@ -181,18 +216,24 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
181
216
  eventId: string;
182
217
  requestId: string;
183
218
  keepAssignment: boolean | undefined;
219
+ keepAssignmentIfAccepted: boolean | undefined;
220
+ keepAssignmentIfRejected: boolean | undefined;
221
+ waitFor: boolean | undefined;
184
222
  };
185
- reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'content'>>) => {
223
+ reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, 'transactionId' | 'annotation' | 'content' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
186
224
  type: "REJECT_CORRECTION";
187
225
  transactionId: string;
188
226
  declaration: {};
189
227
  annotation: {};
190
228
  eventId: string;
191
229
  requestId: string;
192
- keepAssignment: boolean | undefined;
193
230
  content: {
194
231
  reason: string;
195
232
  };
233
+ keepAssignment: boolean | undefined;
234
+ keepAssignmentIfAccepted: boolean | undefined;
235
+ keepAssignmentIfRejected: boolean | undefined;
236
+ waitFor: boolean | undefined;
196
237
  };
197
238
  };
198
239
  duplicate: {
@@ -271,11 +312,6 @@ export declare function createPrng(seed: number): () => number;
271
312
  */
272
313
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
273
314
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
274
- export declare const BearerTokenByUserType: {
275
- fieldAgent: string;
276
- registrationAgent: string;
277
- localRegistrar: string;
278
- };
279
315
  export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
280
316
  /**
281
317
  * Backend focused event config generator for testing fields in a lightweight way.
@@ -285,10 +321,32 @@ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
285
321
  * @param placeOfEventId - Optional place of event field id.
286
322
  * @param dateOfEventId - Optional date of event field id.
287
323
  */
288
- export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId }: {
324
+ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId, actions }: {
289
325
  id: string;
290
326
  fields: FieldConfig[];
291
327
  placeOfEventId?: string;
292
328
  dateOfEventId?: string;
329
+ /** Extra actions appended to the default READ + DECLARE pair, e.g. a REQUEST_CORRECTION action with its own correctionForm. */
330
+ actions?: EventConfigInput['actions'];
293
331
  }) => EventConfig;
332
+ /**
333
+ * @returns a copy of the configuration with the DECLARE action's declaration replaced.
334
+ */
335
+ export declare function withDeclaration(configuration: EventConfig, declaration: DeclarationFormConfig): EventConfig;
336
+ /**
337
+ * Get the leaf administrative area IDs from a list of administrative areas.
338
+ *
339
+ * A leaf administrative area is defined as an administrative area that does not have any children in the provided list.
340
+ * AdministrativeArea might have a CRVS_OFFICE as children, but is still considered to be a leaf administrative area.
341
+ *
342
+ * @param administrativeAreas - The list of administrative areas to search.
343
+ * @returns The list of leaf administrative area IDs.
344
+ */
345
+ export declare function getLeafAdministrativeAreaIds(administrativeAreas: Map<UUID, ClientAdministrativeArea>): Array<{
346
+ id: UUID;
347
+ }>;
348
+ export declare function generateTestValidatorContext(userRole?: TestUserRole, eventWithConfig?: {
349
+ event: EventDocument;
350
+ eventConfig: EventConfig;
351
+ }): ValidatorContext;
294
352
  //# sourceMappingURL=test.utils.d.ts.map
@@ -10,20 +10,8 @@ import { UUID } from '../uuid';
10
10
  import { ActionConfig, ActionConfigTypes } from './ActionConfig';
11
11
  import { FormConfig } from './FormConfig';
12
12
  import { PlainDate, SelectDateRangeValue } from './FieldValue';
13
+ import { EventIndex } from './EventIndex';
13
14
  export declare function ageToDate(age: number, asOfDate: PlainDate): string & import("zod").$brand<"PlainDate">;
14
- export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
15
- export declare function getDeclarationPages(configuration: EventConfig): {
16
- id: string;
17
- title: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- requireCompletionToContinue: boolean;
23
- fields: FieldConfig[];
24
- conditional?: any;
25
- type: "FORM";
26
- }[];
27
15
  export declare function getDeclaration(configuration: EventConfig): {
28
16
  label: {
29
17
  id: string;
@@ -38,11 +26,26 @@ export declare function getDeclaration(configuration: EventConfig): {
38
26
  description: string;
39
27
  };
40
28
  requireCompletionToContinue: boolean;
29
+ showClearButton?: boolean | undefined;
41
30
  fields: FieldConfig[];
42
31
  conditional?: any;
43
32
  type: "FORM";
44
33
  }[];
45
34
  };
35
+ export declare function getDeclarationPages(configuration: EventConfig): {
36
+ id: string;
37
+ title: {
38
+ id: string;
39
+ defaultMessage: string;
40
+ description: string;
41
+ };
42
+ requireCompletionToContinue: boolean;
43
+ showClearButton?: boolean | undefined;
44
+ fields: FieldConfig[];
45
+ conditional?: any;
46
+ type: "FORM";
47
+ }[];
48
+ export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
46
49
  export declare function isActionConfigType(type: ActionType): type is ActionConfigTypes;
47
50
  export declare function getActionConfig({ eventConfiguration, actionType, customActionType }: {
48
51
  eventConfiguration: EventConfig;
@@ -66,6 +69,7 @@ export declare function getPrintCertificatePages(configuration: EventConfig): ({
66
69
  description: string;
67
70
  };
68
71
  requireCompletionToContinue: boolean;
72
+ showClearButton?: boolean | undefined;
69
73
  fields: FieldConfig[];
70
74
  conditional?: any;
71
75
  type: "FORM";
@@ -77,6 +81,7 @@ export declare function getPrintCertificatePages(configuration: EventConfig): ({
77
81
  description: string;
78
82
  };
79
83
  requireCompletionToContinue: boolean;
84
+ showClearButton?: boolean | undefined;
80
85
  fields: FieldConfig[];
81
86
  conditional?: any;
82
87
  type: "VERIFICATION";
@@ -255,9 +260,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
255
260
  status: "Accepted" | "Rejected" | "Requested";
256
261
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
257
262
  type: "ARCHIVE";
258
- content: {
263
+ content?: {
259
264
  reason: string;
260
- };
265
+ } | undefined;
261
266
  } | {
262
267
  id: string & import("zod").$brand<"UUID">;
263
268
  transactionId: string;
@@ -358,7 +363,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
358
363
  status: "Accepted" | "Rejected" | "Requested";
359
364
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
360
365
  type: "APPROVE_CORRECTION";
361
- requestId: string;
366
+ requestId: string & import("zod").$brand<"UUID">;
362
367
  content?: {
363
368
  immediateCorrection?: boolean | undefined;
364
369
  } | undefined;
@@ -376,7 +381,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
376
381
  status: "Accepted" | "Rejected" | "Requested";
377
382
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
378
383
  type: "REJECT_CORRECTION";
379
- requestId: string;
384
+ requestId: string & import("zod").$brand<"UUID">;
380
385
  content: {
381
386
  reason: string;
382
387
  };
@@ -596,5 +601,35 @@ export declare function getCompleteActionContent(event: EventDocument, action: A
596
601
  export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
597
602
  export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
598
603
  export declare function aggregateActionDeclarations(event: EventDocument): EventState;
604
+ /**
605
+ * Returns the declaration after each of `event.actions`, which must be in chronological order.
606
+ * Index `i` equals `aggregateActionDeclarations` of the first `i + 1` actions, in linear time.
607
+ */
608
+ export declare function getDeclarationAfterEachAction(event: EventDocument): EventState[];
609
+ /**
610
+ * Returns the event's declaration state as it will be once the single pending
611
+ * action is accepted — i.e. the aggregate of all accepted declarations with the
612
+ * pending action's changes applied on top.
613
+ *
614
+ * Country configuration confirmation handlers (and notifications) need the
615
+ * up-to-date declaration at confirmation time, before core has accepted the
616
+ * action. Reaching for `aggregateActionDeclarations` alone is not enough for
617
+ * corrections: when confirming an APPROVE_CORRECTION the changed fields live on
618
+ * the linked REQUEST_CORRECTION, not on the pending action's own (empty)
619
+ * declaration. This helper applies the same correction-aware merge that
620
+ * `aggregateActionDeclarations` uses for already-accepted approvals, so callers
621
+ * do not have to reimplement the `requestId`/`originalActionId` resolution.
622
+ */
623
+ export declare function getDeclarationWithPendingAction(event: EventDocument): EventState;
599
624
  export declare function aggregateActionAnnotations(event: EventDocument): EventState;
625
+ /**
626
+ * 2.1. onwards secured fields have accepted conditionals.
627
+ * Secured fields are not present in EventIndex payload.
628
+ * When we derive @see EventIndex from @see EventDocument, we will have all the fields present.
629
+ *
630
+ * To keep the views consistent, and not to change if event.get gets triggered, we need to clean out the secured fields.
631
+ *
632
+ * @returns EventIndex without values that evaluate to secured: true.
633
+ */
634
+ export declare function dropSecuredDeclarationFields(eventConfig: EventConfig, eventIndex: EventIndex, validatorContext: ValidatorContext): EventIndex;
600
635
  //# sourceMappingURL=utils.d.ts.map
@@ -5,6 +5,8 @@ export declare const TriggerEvent: {
5
5
  readonly USERNAME_REMINDER: 'username-reminder';
6
6
  readonly RESET_PASSWORD: 'reset-password';
7
7
  readonly RESET_PASSWORD_BY_ADMIN: 'reset-password-by-admin';
8
+ readonly PASSWORD_RESET_LINK: 'password-reset-link';
9
+ readonly USERNAME_REMINDER_LINK: 'username-reminder-link';
8
10
  readonly RESEND_INVITE: 'resend-invite';
9
11
  readonly TWO_FA: '2fa';
10
12
  readonly ALL_USER_NOTIFICATION: 'all-user-notification';
@@ -113,6 +115,32 @@ export declare const TriggerPayload: {
113
115
  role: z.ZodString;
114
116
  }, z.core.$strip>;
115
117
  }, z.core.$strip>;
118
+ readonly "password-reset-link": z.ZodObject<{
119
+ recipient: z.ZodObject<{
120
+ name: z.ZodOptional<z.ZodObject<{
121
+ firstname: z.ZodString;
122
+ surname: z.ZodString;
123
+ middlename: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>>;
125
+ mobile: z.ZodOptional<z.ZodString>;
126
+ email: z.ZodOptional<z.ZodString>;
127
+ bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ }, z.core.$strip>;
129
+ token: z.ZodString;
130
+ }, z.core.$strip>;
131
+ readonly "username-reminder-link": z.ZodObject<{
132
+ recipient: z.ZodObject<{
133
+ name: z.ZodOptional<z.ZodObject<{
134
+ firstname: z.ZodString;
135
+ surname: z.ZodString;
136
+ middlename: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ mobile: z.ZodOptional<z.ZodString>;
139
+ email: z.ZodOptional<z.ZodString>;
140
+ bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ }, z.core.$strip>;
142
+ token: z.ZodString;
143
+ }, z.core.$strip>;
116
144
  readonly "resend-invite": z.ZodObject<{
117
145
  recipient: z.ZodObject<{
118
146
  name: z.ZodOptional<z.ZodObject<{
@@ -184,18 +212,5 @@ export declare const TriggerPayload: {
184
212
  export type TriggerPayload = {
185
213
  [K in TriggerEvent]: z.infer<(typeof TriggerPayload)[K]>;
186
214
  };
187
- export declare function triggerUserEventNotification(args: {
188
- event: typeof TriggerEvent.ALL_USER_NOTIFICATION;
189
- payload: TriggerPayload[typeof TriggerEvent.ALL_USER_NOTIFICATION];
190
- countryConfigUrl: string;
191
- }): Promise<Response>;
192
- export declare function triggerUserEventNotification<T extends Exclude<TriggerEvent, typeof TriggerEvent.ALL_USER_NOTIFICATION>>(args: {
193
- event: T;
194
- payload: TriggerPayload[T];
195
- countryConfigUrl: string;
196
- authHeader: {
197
- Authorization: string;
198
- };
199
- }): Promise<Response>;
200
215
  export declare function parseUserEventTrigger<T extends TriggerEvent>(event: T, body: unknown): TriggerPayload[T];
201
216
  //# sourceMappingURL=UserNotifications.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { TriggerEvent, TriggerPayload } from './UserNotifications';
2
+ export declare function triggerUserEventNotification<T extends TriggerEvent>({ event, payload, countryConfigUrl, authHeader }: {
3
+ event: T;
4
+ payload: TriggerPayload[T];
5
+ countryConfigUrl: string;
6
+ authHeader: {
7
+ Authorization: string;
8
+ };
9
+ }): Promise<Response>;
10
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export * from './UserNotifications';
2
+ export * from './dispatch';
2
3
  //# sourceMappingURL=index.d.ts.map