@opencrvs/toolkit 2.1.0-rc.28fe5a3 → 2.1.0-rc.3028b2e

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 (247) hide show
  1. package/README.md +3 -12
  2. package/build.sh +22 -4
  3. package/create-countryconfig/index.js +441 -59
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +4 -1
  6. package/dist/application-config/index.js +364 -285
  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 +3778 -1231
  11. package/dist/commons/api/router.d.ts +980 -420
  12. package/dist/commons/application-config/index.d.ts +0 -2
  13. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  14. package/dist/commons/conditionals/validate.d.ts +34 -8
  15. package/dist/commons/events/ActionConfig.d.ts +5 -14
  16. package/dist/commons/events/ActionDocument.d.ts +41 -21
  17. package/dist/commons/events/ActionInput.d.ts +4 -10
  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 +3 -0
  23. package/dist/commons/events/EventDocument.d.ts +474 -6
  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/index.d.ts +1 -0
  38. package/dist/commons/events/locationPayloads.d.ts +95 -0
  39. package/dist/commons/events/locations.d.ts +246 -13
  40. package/dist/commons/events/mocks.test.utils.d.ts +46 -2
  41. package/dist/commons/events/scopes.d.ts +21 -1
  42. package/dist/commons/events/test.utils.d.ts +82 -32
  43. package/dist/commons/events/utils.d.ts +41 -6
  44. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  45. package/dist/commons/notification/dispatch.d.ts +10 -0
  46. package/dist/commons/notification/index.d.ts +1 -0
  47. package/dist/conditionals/index.js +349 -65
  48. package/dist/csv.d.ts +25 -0
  49. package/dist/csv.d.ts.map +1 -0
  50. package/dist/csv.js +120 -0
  51. package/dist/environment/derived-variables.d.ts +12 -0
  52. package/dist/environment/derived-variables.d.ts.map +1 -1
  53. package/dist/environment/derived-variables.js +14 -0
  54. package/dist/environment/index.d.ts +1 -0
  55. package/dist/environment/index.d.ts.map +1 -1
  56. package/dist/environment/index.js +12 -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/paths.d.ts +7 -0
  61. package/dist/environment/paths.d.ts.map +1 -0
  62. package/dist/environment/paths.js +72 -0
  63. package/dist/environment/questions.d.ts.map +1 -1
  64. package/dist/environment/questions.js +20 -14
  65. package/dist/environment/setup-environment.d.ts +1 -1
  66. package/dist/environment/setup-environment.d.ts.map +1 -1
  67. package/dist/environment/setup-environment.js +603 -562
  68. package/dist/environment/swarm-to-k8s.js +3 -4
  69. package/dist/environment/templates.d.ts +0 -1
  70. package/dist/environment/templates.d.ts.map +1 -1
  71. package/dist/environment/templates.js +5 -9
  72. package/dist/environment/update-workflows.d.ts.map +1 -1
  73. package/dist/environment/update-workflows.js +21 -5
  74. package/dist/environment/upgrade.d.ts +2 -0
  75. package/dist/environment/upgrade.d.ts.map +1 -0
  76. package/dist/environment/upgrade.js +82 -0
  77. package/dist/environment/users.js +11 -13
  78. package/dist/environment/utils.d.ts +0 -12
  79. package/dist/environment/utils.d.ts.map +1 -1
  80. package/dist/environment/utils.js +1 -28
  81. package/dist/events/index.js +7842 -7212
  82. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  83. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  84. package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
  85. package/dist/migrations/v2.1/add-translations.d.ts +9 -0
  86. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
  87. package/dist/migrations/v2.1/add-translations.js +149 -0
  88. package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/enable-telemetry.d.ts} +1 -1
  89. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  90. package/dist/migrations/v2.1/enable-telemetry.js +455 -0
  91. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  92. package/dist/migrations/v2.1/index.js +1952 -0
  93. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -0
  94. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  95. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
  96. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  97. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  98. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  99. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  100. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  101. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  102. package/dist/migrations/{v2.0/create-events-index.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  103. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  104. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  105. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  106. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  107. package/dist/migrations/v2.1/template-files.js +49 -0
  108. package/dist/migrations/v2.1/upgrade-tilt.d.ts +8 -0
  109. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  110. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  111. package/dist/notification/index.js +1925 -1485
  112. package/dist/scopes/index.d.ts +614 -36
  113. package/dist/scopes/index.js +351 -65
  114. package/dist/telemetry/index.d.ts +45 -0
  115. package/dist/telemetry/index.d.ts.map +1 -0
  116. package/dist/telemetry/index.js +43 -0
  117. package/dist/templates/charts-values/dependencies/values.yaml +8 -0
  118. package/dist/templates/charts-values/opencrvs-services/values.yaml +10 -3
  119. package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
  120. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  121. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  122. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  123. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  124. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  125. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  126. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  127. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  128. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  129. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  130. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  131. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  132. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  133. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  134. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  135. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  136. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  137. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  138. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  139. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  140. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  141. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  142. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  143. package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
  144. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  145. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  146. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  147. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  148. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  149. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  150. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  151. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  152. package/dist/templates/inventory/inventory.template.yml +1 -3
  153. package/dist/translations/template.d.ts +11 -0
  154. package/dist/translations/template.d.ts.map +1 -0
  155. package/dist/translations/template.js +100 -0
  156. package/dist/verify/endpoints.d.ts +2 -0
  157. package/dist/verify/endpoints.d.ts.map +1 -0
  158. package/dist/verify/endpoints.js +510 -0
  159. package/opencrvs-toolkit-2.1.0-rc.3028b2e.tgz +0 -0
  160. package/package.json +14 -7
  161. package/tsconfig.build.json +11 -0
  162. package/tsconfig.build.tsbuildinfo +1 -0
  163. package/tsconfig.json +3 -0
  164. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  165. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  166. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  167. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  168. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  169. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  170. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  171. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  172. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  173. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  174. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  175. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  176. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  177. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  178. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  179. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  180. package/dist/migrations/v2.0/create-events-index.js +0 -325
  181. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  182. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  183. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  184. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  185. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  186. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  187. package/dist/migrations/v2.0/index.d.ts +0 -13
  188. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  189. package/dist/migrations/v2.0/index.js +0 -103
  190. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  191. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  192. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  193. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  194. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  195. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  196. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  197. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  198. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  199. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  200. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  201. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  202. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  203. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  204. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  205. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  206. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  207. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  208. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  209. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  210. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  211. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  212. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  213. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  214. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  215. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  216. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  217. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  218. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  219. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  220. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  221. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  222. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  223. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  224. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  225. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  226. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  227. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  228. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  229. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  230. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  231. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  232. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  233. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  234. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  235. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  236. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  237. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  238. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  239. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  240. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  241. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  242. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  243. package/dist/migrations/v2.0/update-package-json.js +0 -105
  244. package/dist/templates/inventory/production.example.yml +0 -77
  245. package/dist/templates/inventory/qa.example.yml +0 -48
  246. package/opencrvs-toolkit-2.1.0-rc.28fe5a3.tgz +0 -0
  247. package/tsconfig.tsbuildinfo +0 -1
@@ -1,15 +1,16 @@
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 { Location, AdministrativeArea } from './locations';
13
+ import { LocationVersion, SetLocationPayload, SetAdministrativeAreaPayload, ClientAdministrativeArea } from './locations';
13
14
  import { WorkqueueConfig } from './WorkqueueConfig';
14
15
  import * as z from 'zod/v4';
15
16
  import { DocumentPath } from '../documents';
@@ -43,21 +44,28 @@ export declare function generateUuid(rng?: () => number): UUID;
43
44
  export declare function generateTrackingId(rng: () => number): string;
44
45
  export declare function generateRegistrationNumber(rng: () => number): string;
45
46
  export declare function generateRandomSignature(rng: () => number): DocumentPath;
47
+ /**
48
+ * Builds one element of a location / administrative area `versions` history.
49
+ * Every field is defaulted so a call names only what its assertion is about —
50
+ * an `effectiveFrom`, a `name`, or an explicit `versionId` when the test needs
51
+ * to control version identity.
52
+ */
53
+ export declare function locationVersion(overrides?: Partial<LocationVersion>, rng?: () => number): LocationVersion;
46
54
  export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng: () => number,
47
55
  /**
48
56
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
49
57
  */
50
58
  administrativeHierarchy?: {
51
- administrativeAreas: AdministrativeArea[];
52
- locations: Location[];
59
+ administrativeAreas: SetAdministrativeAreaPayload[];
60
+ locations: SetLocationPayload[];
53
61
  }): ActionUpdate;
54
62
  export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number, overrides?: ActionUpdate,
55
63
  /**
56
64
  * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
57
65
  */
58
66
  administrativeHierarchy?: {
59
- administrativeAreas: AdministrativeArea[];
60
- locations: Location[];
67
+ administrativeAreas: SetAdministrativeAreaPayload[];
68
+ locations: SetLocationPayload[];
61
69
  }): ActionUpdate;
62
70
  export declare function generateActionDuplicateDeclarationInput(...args: Parameters<typeof generateActionDeclarationInput>): ReturnType<typeof generateActionDeclarationInput>;
63
71
  export declare function eventPayloadGenerator(rng: () => number, configuration?: EventConfig): {
@@ -77,8 +85,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
77
85
  omitFields?: string[];
78
86
  }, input?: Partial<Draft>) => Draft;
79
87
  actions: {
80
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
88
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
81
89
  keepAssignment?: boolean | undefined;
90
+ keepAssignmentIfAccepted?: boolean | undefined;
91
+ keepAssignmentIfRejected?: boolean | undefined;
92
+ waitFor?: boolean | undefined;
82
93
  type: "DECLARE";
83
94
  transactionId: string;
84
95
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
@@ -88,59 +99,70 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
88
99
  /**
89
100
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
90
101
  */
91
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
102
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
92
103
  type: "NOTIFY";
93
104
  transactionId: string;
94
105
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
95
106
  eventId: string;
96
107
  keepAssignment: boolean | undefined;
108
+ keepAssignmentIfAccepted: boolean | undefined;
109
+ keepAssignmentIfRejected: boolean | undefined;
110
+ waitFor: boolean | undefined;
97
111
  };
98
- edit: (eventId: string, input?: Partial<Pick<EditActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
112
+ edit: (eventId: string, input?: Partial<Pick<EditActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
99
113
  keepAssignment?: boolean | undefined;
114
+ keepAssignmentIfAccepted?: boolean | undefined;
115
+ keepAssignmentIfRejected?: boolean | undefined;
116
+ waitFor?: boolean | undefined;
100
117
  type: "EDIT";
101
- content: {
102
- comment: string;
103
- };
104
118
  transactionId: string;
105
119
  declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
106
120
  annotation: {};
107
121
  eventId: string;
108
122
  };
109
- assign: (eventId: string, input?: Partial<Pick<AssignActionInput, 'transactionId' | 'assignedTo'>>) => {
123
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, 'transactionId' | 'assignedTo' | 'waitFor'>>) => {
110
124
  type: "ASSIGN";
111
125
  transactionId: string;
112
126
  declaration: {};
113
127
  assignedTo: string;
114
128
  eventId: string;
129
+ waitFor: boolean | undefined;
115
130
  };
116
- unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, 'transactionId'>>) => {
131
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, 'transactionId' | 'waitFor'>>) => {
117
132
  type: "UNASSIGN";
118
133
  transactionId: string;
119
134
  declaration: {};
120
135
  assignedTo: null;
121
136
  eventId: string;
137
+ waitFor: boolean | undefined;
122
138
  };
123
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
139
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
124
140
  keepAssignment?: boolean | undefined;
141
+ keepAssignmentIfAccepted?: boolean | undefined;
142
+ keepAssignmentIfRejected?: boolean | undefined;
143
+ waitFor?: boolean | undefined;
125
144
  type: "ARCHIVE";
126
145
  transactionId: string;
127
146
  declaration: {};
128
147
  annotation: {};
129
148
  eventId: string;
130
- content: {
131
- reason: string;
132
- };
133
149
  };
134
- unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
150
+ unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
135
151
  keepAssignment?: boolean | undefined;
152
+ keepAssignmentIfAccepted?: boolean | undefined;
153
+ keepAssignmentIfRejected?: boolean | undefined;
154
+ waitFor?: boolean | undefined;
136
155
  type: "UNARCHIVE";
137
156
  transactionId: string;
138
157
  declaration: {};
139
158
  annotation: {};
140
159
  eventId: string;
141
160
  };
142
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
161
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
143
162
  keepAssignment?: boolean | undefined;
163
+ keepAssignmentIfAccepted?: boolean | undefined;
164
+ keepAssignmentIfRejected?: boolean | undefined;
165
+ waitFor?: boolean | undefined;
144
166
  type: "REJECT";
145
167
  transactionId: string;
146
168
  declaration: {};
@@ -150,8 +172,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
150
172
  reason: string;
151
173
  };
152
174
  };
153
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'registrationNumber'>>) => {
175
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'registrationNumber' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
154
176
  keepAssignment?: boolean | undefined;
177
+ keepAssignmentIfAccepted?: boolean | undefined;
178
+ keepAssignmentIfRejected?: boolean | undefined;
179
+ waitFor?: boolean | undefined;
155
180
  registrationNumber?: string | undefined;
156
181
  type: "REGISTER";
157
182
  transactionId: string;
@@ -159,8 +184,11 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
159
184
  annotation: {};
160
185
  eventId: string;
161
186
  };
162
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
187
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
163
188
  keepAssignment?: boolean | undefined;
189
+ keepAssignmentIfAccepted?: boolean | undefined;
190
+ keepAssignmentIfRejected?: boolean | undefined;
191
+ waitFor?: boolean | undefined;
164
192
  type: "PRINT_CERTIFICATE";
165
193
  transactionId: string;
166
194
  declaration: {};
@@ -168,15 +196,18 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
168
196
  eventId: string;
169
197
  };
170
198
  correction: {
171
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment'>>) => {
199
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, 'transactionId' | 'declaration' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
172
200
  type: "REQUEST_CORRECTION";
173
201
  transactionId: string;
174
202
  declaration: import("lodash").Omit<Record<string, import("./FieldValue").FieldUpdateValue>, "applicant.email" | "applicant.image">;
175
203
  annotation: {};
176
204
  eventId: string;
177
205
  keepAssignment: boolean | undefined;
206
+ keepAssignmentIfAccepted: boolean | undefined;
207
+ keepAssignmentIfRejected: boolean | undefined;
208
+ waitFor: boolean | undefined;
178
209
  };
179
- approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment'>>) => {
210
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
180
211
  type: "APPROVE_CORRECTION";
181
212
  transactionId: string;
182
213
  declaration: {};
@@ -184,18 +215,24 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
184
215
  eventId: string;
185
216
  requestId: string;
186
217
  keepAssignment: boolean | undefined;
218
+ keepAssignmentIfAccepted: boolean | undefined;
219
+ keepAssignmentIfRejected: boolean | undefined;
220
+ waitFor: boolean | undefined;
187
221
  };
188
- reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'content'>>) => {
222
+ reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, 'transactionId' | 'annotation' | 'content' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
189
223
  type: "REJECT_CORRECTION";
190
224
  transactionId: string;
191
225
  declaration: {};
192
226
  annotation: {};
193
227
  eventId: string;
194
228
  requestId: string;
195
- keepAssignment: boolean | undefined;
196
229
  content: {
197
230
  reason: string;
198
231
  };
232
+ keepAssignment: boolean | undefined;
233
+ keepAssignmentIfAccepted: boolean | undefined;
234
+ keepAssignmentIfRejected: boolean | undefined;
235
+ waitFor: boolean | undefined;
199
236
  };
200
237
  };
201
238
  duplicate: {
@@ -274,11 +311,6 @@ export declare function createPrng(seed: number): () => number;
274
311
  */
275
312
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
276
313
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
277
- export declare const BearerTokenByUserType: {
278
- fieldAgent: string;
279
- registrationAgent: string;
280
- localRegistrar: string;
281
- };
282
314
  export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
283
315
  /**
284
316
  * Backend focused event config generator for testing fields in a lightweight way.
@@ -288,10 +320,28 @@ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
288
320
  * @param placeOfEventId - Optional place of event field id.
289
321
  * @param dateOfEventId - Optional date of event field id.
290
322
  */
291
- export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId }: {
323
+ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId, actions }: {
292
324
  id: string;
293
325
  fields: FieldConfig[];
294
326
  placeOfEventId?: string;
295
327
  dateOfEventId?: string;
328
+ /** Extra actions appended to the default READ + DECLARE pair, e.g. a REQUEST_CORRECTION action with its own correctionForm. */
329
+ actions?: EventConfigInput['actions'];
296
330
  }) => EventConfig;
331
+ /**
332
+ * Get the leaf administrative area IDs from a list of administrative areas.
333
+ *
334
+ * A leaf administrative area is defined as an administrative area that does not have any children in the provided list.
335
+ * AdministrativeArea might have a CRVS_OFFICE as children, but is still considered to be a leaf administrative area.
336
+ *
337
+ * @param administrativeAreas - The list of administrative areas to search.
338
+ * @returns The list of leaf administrative area IDs.
339
+ */
340
+ export declare function getLeafAdministrativeAreaIds(administrativeAreas: Map<UUID, ClientAdministrativeArea>): Array<{
341
+ id: UUID;
342
+ }>;
343
+ export declare function generateTestValidatorContext(userRole?: TestUserRole, eventWithConfig?: {
344
+ event: EventDocument;
345
+ eventConfig: EventConfig;
346
+ }): ValidatorContext;
297
347
  //# sourceMappingURL=test.utils.d.ts.map
@@ -10,6 +10,7 @@ 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
15
  export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
15
16
  export declare function getDeclarationPages(configuration: EventConfig): {
@@ -20,6 +21,7 @@ export declare function getDeclarationPages(configuration: EventConfig): {
20
21
  description: string;
21
22
  };
22
23
  requireCompletionToContinue: boolean;
24
+ showClearButton?: boolean | undefined;
23
25
  fields: FieldConfig[];
24
26
  conditional?: any;
25
27
  type: "FORM";
@@ -38,6 +40,7 @@ export declare function getDeclaration(configuration: EventConfig): {
38
40
  description: string;
39
41
  };
40
42
  requireCompletionToContinue: boolean;
43
+ showClearButton?: boolean | undefined;
41
44
  fields: FieldConfig[];
42
45
  conditional?: any;
43
46
  type: "FORM";
@@ -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
  };
@@ -439,9 +444,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
439
444
  status: "Accepted" | "Rejected" | "Requested";
440
445
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
441
446
  type: "EDIT";
442
- content: {
447
+ content?: {
443
448
  comment?: string | undefined;
444
- };
449
+ } | undefined;
445
450
  } | {
446
451
  id: string & import("zod").$brand<"UUID">;
447
452
  transactionId: string;
@@ -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