@opencrvs/toolkit 2.1.0-rc.ffe0b7f → 2.2.0-rc.9042a13

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 (250) 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 +391 -286
  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 +778 -0
  10. package/dist/cli.js +2041 -1311
  11. package/dist/commons/api/router.d.ts +2359 -485
  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 +131 -7
  16. package/dist/commons/events/ActionDocument.d.ts +123 -15
  17. package/dist/commons/events/ActionInput.d.ts +56 -4
  18. package/dist/commons/events/ActionStatus.d.ts +14 -0
  19. package/dist/commons/events/ActionType.d.ts +11 -1
  20. package/dist/commons/events/AdvancedSearchConfig.d.ts +60 -12
  21. package/dist/commons/events/AuditLog.d.ts +152 -0
  22. package/dist/commons/events/CountryConfigQueryInput.d.ts +132 -0
  23. package/dist/commons/events/Draft.d.ts +3 -21
  24. package/dist/commons/events/EventConfig.d.ts +29 -6
  25. package/dist/commons/events/EventDocument.d.ts +560 -4
  26. package/dist/commons/events/EventIndex.d.ts +23 -26
  27. package/dist/commons/events/EventMetadata.d.ts +24 -11
  28. package/dist/commons/events/EventStatus.d.ts +20 -0
  29. package/dist/commons/events/FieldConfig.d.ts +119 -63
  30. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  31. package/dist/commons/events/FieldValue.d.ts +3 -2
  32. package/dist/commons/events/Flag.d.ts +42 -0
  33. package/dist/commons/events/FormConfig.d.ts +6 -0
  34. package/dist/commons/events/PageConfig.d.ts +4 -0
  35. package/dist/commons/events/PlainDate.d.ts +8 -0
  36. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  37. package/dist/commons/events/WorkqueueConfig.d.ts +167 -20
  38. package/dist/commons/events/event.d.ts +12 -0
  39. package/dist/commons/events/eventConfigValidation.d.ts +17 -1
  40. package/dist/commons/events/index.d.ts +1 -0
  41. package/dist/commons/events/locationPayloads.d.ts +95 -0
  42. package/dist/commons/events/locations.d.ts +169 -26
  43. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  44. package/dist/commons/events/scopes.d.ts +23 -1
  45. package/dist/commons/events/state/index.d.ts +10 -2
  46. package/dist/commons/events/state/utils.d.ts +11 -1
  47. package/dist/commons/events/test.utils.d.ts +106 -26
  48. package/dist/commons/events/utils.d.ts +81 -18
  49. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  50. package/dist/commons/notification/dispatch.d.ts +10 -0
  51. package/dist/commons/notification/index.d.ts +1 -0
  52. package/dist/conditionals/index.js +362 -65
  53. package/dist/csv.d.ts +25 -0
  54. package/dist/csv.d.ts.map +1 -0
  55. package/dist/csv.js +120 -0
  56. package/dist/environment/derived-variables.d.ts +18 -0
  57. package/dist/environment/derived-variables.d.ts.map +1 -1
  58. package/dist/environment/derived-variables.js +22 -1
  59. package/dist/environment/index.d.ts.map +1 -1
  60. package/dist/environment/index.js +2 -1
  61. package/dist/environment/logger.d.ts +15 -3
  62. package/dist/environment/logger.d.ts.map +1 -1
  63. package/dist/environment/manage-users.js +1 -1
  64. package/dist/environment/questions.d.ts.map +1 -1
  65. package/dist/environment/questions.js +20 -14
  66. package/dist/environment/setup-environment.d.ts +1 -1
  67. package/dist/environment/setup-environment.d.ts.map +1 -1
  68. package/dist/environment/setup-environment.js +610 -560
  69. package/dist/environment/swarm-to-k8s.js +3 -4
  70. package/dist/environment/templates.d.ts +0 -1
  71. package/dist/environment/templates.d.ts.map +1 -1
  72. package/dist/environment/templates.js +3 -8
  73. package/dist/environment/update-workflows.d.ts.map +1 -1
  74. package/dist/environment/update-workflows.js +4 -0
  75. package/dist/environment/utils.d.ts +0 -12
  76. package/dist/environment/utils.d.ts.map +1 -1
  77. package/dist/environment/utils.js +1 -28
  78. package/dist/events/index.js +7909 -7056
  79. package/dist/migrations/add-translations.d.ts +15 -0
  80. package/dist/migrations/add-translations.d.ts.map +1 -0
  81. package/dist/migrations/add-translations.js +151 -0
  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.0/rename-api-paths.d.ts → v2.1/enable-telemetry.d.ts} +1 -1
  86. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  87. package/dist/migrations/v2.1/enable-telemetry.js +455 -0
  88. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  89. package/dist/migrations/v2.1/index.js +47 -215
  90. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +17 -0
  91. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  92. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
  93. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  94. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  95. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  96. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  97. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  98. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  99. package/dist/migrations/{v2.0/create-events-index.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  100. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  101. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  102. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  103. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  104. package/dist/migrations/v2.1/template-files.js +49 -0
  105. package/dist/migrations/v2.1/upgrade-tilt.d.ts +11 -0
  106. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  107. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  108. package/dist/migrations/v2.2/index.d.ts +6 -0
  109. package/dist/migrations/v2.2/index.d.ts.map +1 -0
  110. package/dist/migrations/v2.2/index.js +456 -0
  111. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
  112. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
  113. package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
  114. package/dist/notification/index.js +2090 -1456
  115. package/dist/scopes/index.d.ts +637 -36
  116. package/dist/scopes/index.js +364 -65
  117. package/dist/telemetry/index.d.ts +45 -0
  118. package/dist/telemetry/index.d.ts.map +1 -0
  119. package/dist/telemetry/index.js +43 -0
  120. package/dist/templates/charts-values/dependencies/values.yaml +8 -0
  121. package/dist/templates/charts-values/opencrvs-services/values.yaml +10 -3
  122. package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
  123. package/dist/templates/charts-values/traefik/values.yaml +25 -12
  124. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  125. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  126. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  127. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  128. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  129. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  130. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  131. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  132. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  133. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  134. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  135. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  136. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  137. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  138. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  139. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  140. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  141. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  142. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  143. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  144. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  145. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  146. package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
  147. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  148. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  149. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  150. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  151. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  152. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  153. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  154. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  155. package/dist/templates/inventory/inventory.template.yml +1 -3
  156. package/dist/translations/template.d.ts +11 -0
  157. package/dist/translations/template.d.ts.map +1 -0
  158. package/dist/translations/template.js +100 -0
  159. package/dist/verify/endpoints.d.ts +2 -0
  160. package/dist/verify/endpoints.d.ts.map +1 -0
  161. package/dist/verify/endpoints.js +510 -0
  162. package/opencrvs-toolkit-2.2.0-rc.9042a13.tgz +0 -0
  163. package/package.json +13 -7
  164. package/tsconfig.build.json +11 -0
  165. package/tsconfig.build.tsbuildinfo +1 -0
  166. package/tsconfig.json +3 -0
  167. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  168. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  169. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  170. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  171. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  172. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  173. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  174. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  175. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  176. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  177. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  178. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  179. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  180. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  181. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  182. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  183. package/dist/migrations/v2.0/create-events-index.js +0 -325
  184. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  185. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  186. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  187. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  188. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  189. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  190. package/dist/migrations/v2.0/index.d.ts +0 -13
  191. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  192. package/dist/migrations/v2.0/index.js +0 -103
  193. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  194. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  195. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  196. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  197. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  198. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  199. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  200. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  201. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  202. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  203. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  204. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  205. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  206. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  207. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  208. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  209. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  210. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  211. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  212. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  213. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  214. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  215. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  216. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  217. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  218. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  219. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  220. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  221. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  222. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  223. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  224. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  225. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  226. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  227. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  228. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  229. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  230. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  231. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  232. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  233. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  234. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  235. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  236. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  237. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  238. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  239. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  240. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  241. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  242. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  243. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  244. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  245. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  246. package/dist/migrations/v2.0/update-package-json.js +0 -105
  247. package/dist/templates/inventory/production.example.yml +0 -77
  248. package/dist/templates/inventory/qa.example.yml +0 -48
  249. package/opencrvs-toolkit-2.1.0-rc.ffe0b7f.tgz +0 -0
  250. package/tsconfig.tsbuildinfo +0 -1
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/scopes/index.ts
31
31
  var scopes_exports = {};
32
32
  __export(scopes_exports, {
33
+ ActionConfirmationScopeType: () => ActionConfirmationScopeType,
33
34
  EncodedScope: () => EncodedScope2,
34
35
  JurisdictionFilter: () => JurisdictionFilter,
35
36
  RecordScopeTypeV2: () => RecordScopeTypeV2,
@@ -59,10 +60,10 @@ __export(scopes_exports, {
59
60
  scopeUsesRoleOptions: () => scopeUsesRoleOptions
60
61
  });
61
62
  module.exports = __toCommonJS(scopes_exports);
62
- var z4 = __toESM(require("zod/v4"));
63
+ var z9 = __toESM(require("zod/v4"));
63
64
 
64
65
  // ../commons/src/scopes.ts
65
- var z3 = __toESM(require("zod/v4"));
66
+ var z8 = __toESM(require("zod/v4"));
66
67
  var qs = __toESM(require("qs"));
67
68
 
68
69
  // ../commons/src/uuid.ts
@@ -96,12 +97,276 @@ var getTokenPayload = (token) => {
96
97
  };
97
98
  var TokenWithBearer = z2.string().regex(/^Bearer\s/);
98
99
 
100
+ // ../commons/src/events/ActionType.ts
101
+ var z3 = __toESM(require("zod/v4"));
102
+ var ActionType = {
103
+ // Pre-declaration actions
104
+ DELETE: "DELETE",
105
+ CREATE: "CREATE",
106
+ NOTIFY: "NOTIFY",
107
+ // Declaration actions
108
+ DECLARE: "DECLARE",
109
+ REGISTER: "REGISTER",
110
+ EDIT: "EDIT",
111
+ // Declaration system actions. Non-configurable.
112
+ DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
113
+ REJECT: "REJECT",
114
+ // REJECT_DECLARATION
115
+ MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
116
+ MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
117
+ ARCHIVE: "ARCHIVE",
118
+ UNARCHIVE: "UNARCHIVE",
119
+ // Record actions
120
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
121
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
122
+ REJECT_CORRECTION: "REJECT_CORRECTION",
123
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
124
+ REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
125
+ REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
126
+ // General actions
127
+ READ: "READ",
128
+ ASSIGN: "ASSIGN",
129
+ UNASSIGN: "UNASSIGN",
130
+ // Custom action
131
+ CUSTOM: "CUSTOM"
132
+ };
133
+ var ConfirmableActions = [
134
+ ActionType.NOTIFY,
135
+ ActionType.DECLARE,
136
+ ActionType.EDIT,
137
+ ActionType.REGISTER,
138
+ ActionType.REJECT,
139
+ ActionType.ARCHIVE,
140
+ ActionType.UNARCHIVE,
141
+ ActionType.PRINT_CERTIFICATE,
142
+ ActionType.REQUEST_CORRECTION,
143
+ ActionType.APPROVE_CORRECTION,
144
+ ActionType.REJECT_CORRECTION,
145
+ ActionType.REVOKE_REGISTRATION,
146
+ ActionType.REINSTATE_REGISTRATION,
147
+ ActionType.CUSTOM
148
+ ];
149
+ var ActionTypes = z3.enum([
150
+ "DELETE",
151
+ "CREATE",
152
+ "NOTIFY",
153
+ "DECLARE",
154
+ "EDIT",
155
+ "REGISTER",
156
+ "DUPLICATE_DETECTED",
157
+ "REJECT",
158
+ "MARK_AS_DUPLICATE",
159
+ "MARK_AS_NOT_DUPLICATE",
160
+ "ARCHIVE",
161
+ "UNARCHIVE",
162
+ "PRINT_CERTIFICATE",
163
+ "REQUEST_CORRECTION",
164
+ "REJECT_CORRECTION",
165
+ "APPROVE_CORRECTION",
166
+ "REVOKE_REGISTRATION",
167
+ "REINSTATE_REGISTRATION",
168
+ "READ",
169
+ "ASSIGN",
170
+ "UNASSIGN",
171
+ "CUSTOM"
172
+ ]);
173
+ var declarationActionValues = [
174
+ ActionTypes.enum.DECLARE,
175
+ ActionTypes.enum.EDIT,
176
+ ActionTypes.enum.REGISTER,
177
+ ActionTypes.enum.NOTIFY,
178
+ ActionTypes.enum.DUPLICATE_DETECTED
179
+ ];
180
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
181
+ var declarationUpdateActionValues = [
182
+ ...declarationActionValues,
183
+ ActionTypes.enum.REQUEST_CORRECTION
184
+ ];
185
+ var DeclarationUpdateActions = ActionTypes.extract(
186
+ declarationUpdateActionValues
187
+ );
188
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
189
+ var writeActions = ActionTypes.exclude([
190
+ ActionType.CREATE,
191
+ ActionType.READ,
192
+ ActionType.ASSIGN,
193
+ ActionType.UNASSIGN
194
+ ]);
195
+ var WorkqueueActionType = ActionTypes.extract([
196
+ ActionType.READ,
197
+ ActionType.DELETE,
198
+ ActionType.DECLARE,
199
+ ActionType.REGISTER,
200
+ ActionType.EDIT,
201
+ ActionType.REJECT,
202
+ ActionType.MARK_AS_DUPLICATE,
203
+ ActionType.ARCHIVE,
204
+ ActionType.UNARCHIVE,
205
+ ActionType.PRINT_CERTIFICATE,
206
+ ActionType.REQUEST_CORRECTION,
207
+ ActionType.REVOKE_REGISTRATION,
208
+ ActionType.REINSTATE_REGISTRATION
209
+ ]);
210
+ var META_ACTIONS = [
211
+ ActionType.ASSIGN,
212
+ ActionType.UNASSIGN,
213
+ ActionType.READ
214
+ ];
215
+
216
+ // ../commons/src/events/ActionStatus.ts
217
+ var ActionStatus = {
218
+ Requested: "Requested",
219
+ Accepted: "Accepted",
220
+ Rejected: "Rejected"
221
+ };
222
+
223
+ // ../commons/src/events/Flag.ts
224
+ var z6 = __toESM(require("zod/v4"));
225
+
226
+ // ../commons/src/events/TranslationConfig.ts
227
+ var z4 = __toESM(require("zod/v4"));
228
+ var TranslationConfig = z4.object({
229
+ id: z4.string().describe(
230
+ "The identifier of the translation referred in translation CSV files"
231
+ ),
232
+ defaultMessage: z4.string().describe("Default translation message"),
233
+ description: z4.string().describe(
234
+ "Describe the translation for a translator to be able to identify it."
235
+ )
236
+ }).meta({
237
+ description: "Translation configuration",
238
+ id: "TranslationConfig"
239
+ });
240
+
241
+ // ../commons/src/events/Conditional.ts
242
+ var z5 = __toESM(require("zod/v4"));
243
+ var Conditional = z5.any().describe("JSONSchema").meta({
244
+ description: "JSON schema conditional configuration",
245
+ id: "Conditional"
246
+ });
247
+ var ConditionalType = {
248
+ SHOW: "SHOW",
249
+ ENABLE: "ENABLE",
250
+ DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
251
+ };
252
+ var ShowConditional = z5.object({
253
+ type: z5.literal(ConditionalType.SHOW),
254
+ conditional: Conditional
255
+ }).describe(
256
+ "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
257
+ );
258
+ var EnableConditional = z5.object({
259
+ type: z5.literal(ConditionalType.ENABLE),
260
+ conditional: Conditional
261
+ }).describe(
262
+ "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
263
+ );
264
+ var ActionConditional = z5.discriminatedUnion("type", [
265
+ // Action can be shown / hidden
266
+ ShowConditional,
267
+ // Action can be shown to the user in the list but as disabled
268
+ EnableConditional
269
+ ]).meta({
270
+ id: "ActionConditional",
271
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
272
+ });
273
+ var DisplayOnReviewConditional = z5.object({
274
+ type: z5.literal(ConditionalType.DISPLAY_ON_REVIEW),
275
+ conditional: Conditional
276
+ }).describe(
277
+ "If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
278
+ );
279
+ var FieldConditional = z5.discriminatedUnion("type", [
280
+ // Field input can be shown / hidden
281
+ ShowConditional,
282
+ // Field input can be shown to the user but as disabled
283
+ EnableConditional,
284
+ // Field output can be shown / hidden on the review page
285
+ DisplayOnReviewConditional
286
+ ]).meta({
287
+ id: "FieldConditional",
288
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
289
+ });
290
+
291
+ // ../commons/src/events/Flag.ts
292
+ var InherentFlags = {
293
+ INCOMPLETE: "incomplete",
294
+ REJECTED: "rejected",
295
+ CORRECTION_REQUESTED: "correction-requested",
296
+ POTENTIAL_DUPLICATE: "potential-duplicate",
297
+ /**
298
+ * This flag is set by the Edit-action and removed after the declaration or registration.
299
+ * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
300
+ *
301
+ * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
302
+ */
303
+ EDIT_IN_PROGRESS: "edit-in-progress"
304
+ };
305
+ var actionFlagPattern;
306
+ function getActionFlagPattern() {
307
+ actionFlagPattern ??= new RegExp(
308
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
309
+ ActionStatus
310
+ ).join("|").toLowerCase()})$`
311
+ );
312
+ return actionFlagPattern;
313
+ }
314
+ var ActionFlag = z6.string().refine((value) => getActionFlagPattern().test(value), {
315
+ message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
316
+ });
317
+ var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).includes(val), {
318
+ message: `Custom flag cannot be one of the inherent flags: ${Object.values(
319
+ InherentFlags
320
+ ).join(", ")}`
321
+ }).refine((val) => !ActionFlag.safeParse(val).success, {
322
+ message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
323
+ }).describe("Custom flag identifier defined by the country config.");
324
+ var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
325
+ var ContainsFlags = z6.object({
326
+ anyOf: z6.array(Flag).optional(),
327
+ noneOf: z6.array(Flag).optional(),
328
+ allOf: z6.array(Flag).optional()
329
+ }).meta({
330
+ id: "ContainsFlags"
331
+ });
332
+ var FlagConfig = z6.object({
333
+ id: CustomFlag,
334
+ requiresAction: z6.boolean().describe(
335
+ "Indicates if this flag expects an action to be performed to be cleared."
336
+ ),
337
+ label: TranslationConfig.describe("Human readable label of the flag.")
338
+ }).meta({
339
+ id: "FlagConfig",
340
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
341
+ });
342
+ var ActionFlagConfig = z6.object({
343
+ id: Flag,
344
+ operation: z6.enum(["add", "remove"]).describe("Operation to perform on the flag."),
345
+ conditional: Conditional.optional().describe(
346
+ "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
347
+ )
348
+ }).meta({
349
+ id: "ActionFlagConfig",
350
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
351
+ });
352
+
353
+ // ../commons/src/events/EventStatus.ts
354
+ var z7 = __toESM(require("zod/v4"));
355
+ var EventStatus = z7.enum([
356
+ "CREATED",
357
+ "NOTIFIED",
358
+ "DECLARED",
359
+ "REGISTERED",
360
+ "REVOKED",
361
+ "ARCHIVED"
362
+ ]);
363
+
99
364
  // ../commons/src/scopes.ts
100
- var JurisdictionFilter = z3.enum(["administrativeArea", "location", "all"]).describe(
365
+ var JurisdictionFilter = z8.enum(["administrativeArea", "location", "all"]).describe(
101
366
  "Filters based on user jurisdiction relative to their office location in hierarchy."
102
367
  );
103
- var UserFilter = z3.enum(["user"]).describe("Filters based on the user. Limits to self.");
104
- var RecordScopeTypeV2 = z3.enum([
368
+ var UserFilter = z8.enum(["user"]).describe("Filters based on the user. Limits to self.");
369
+ var RecordScopeTypeV2 = z8.enum([
105
370
  "record.search",
106
371
  "record.create",
107
372
  "record.read",
@@ -116,94 +381,114 @@ var RecordScopeTypeV2 = z3.enum([
116
381
  "record.print-certified-copies",
117
382
  "record.request-correction",
118
383
  "record.correct",
384
+ "record.revoke-registration",
385
+ "record.reinstate-registration",
119
386
  "record.unassign-others",
120
- "record.custom-action"
387
+ "record.custom-action",
388
+ "record.action.accept",
389
+ "record.action.reject"
121
390
  ]);
122
- var PlainScopeType = z3.enum([
391
+ var PlainScopeType = z8.enum([
123
392
  // Misc. system scopes
124
393
  "bypassratelimit",
125
394
  "record.reindex",
126
395
  "user.data-seeding",
127
396
  "integration.create",
397
+ // Reading an integration's audit log. Deliberately separate from
398
+ // 'integration.create' so read-only oversight can be granted on its own, and
399
+ // deliberately option-less: system clients have no office and no
400
+ // administrative area, so jurisdiction options would have nothing to bind to.
401
+ "integration.audit.read",
128
402
  "record.import",
129
403
  "config.update-all",
404
+ "location.edit",
130
405
  "attachment.upload",
131
406
  "profile.electronic-signature",
132
407
  "user.read-only-my-audit",
133
408
  // Performance dashboard
134
409
  "performance.read",
135
410
  "performance.read-dashboards",
136
- "performance.vital-statistics-export",
137
- // Scopes used exclusively by countryconfig integration token
138
- "record.confirm-registration",
139
- "record.reject-registration"
411
+ "performance.vital-statistics-export"
140
412
  ]);
141
- var scopeByEvent = z3.preprocess(
413
+ var scopeByEvent = z8.preprocess(
142
414
  (val) => val === void 0 ? void 0 : [val].flat(),
143
- z3.array(z3.string()).optional()
415
+ z8.array(z8.string()).optional()
144
416
  ).describe("Event type, e.g. birth, death");
145
- var userRole = z3.preprocess(
417
+ var scopeByStatus = z8.preprocess(
418
+ (val) => val === void 0 ? void 0 : [val].flat(),
419
+ z8.array(EventStatus).optional()
420
+ ).describe(
421
+ "Restricts the scope to records currently in one of these statuses."
422
+ );
423
+ var userRole = z8.preprocess(
146
424
  (val) => val === void 0 ? void 0 : [val].flat(),
147
- z3.array(z3.string()).optional()
425
+ z8.array(z8.string()).optional()
148
426
  ).describe("User role, e.g. admin, field agent");
149
- var scopeOptionsPlaceEvent = z3.object({
427
+ var scopeOptionsPlaceEvent = z8.object({
150
428
  event: scopeByEvent,
151
- placeOfEvent: JurisdictionFilter.optional()
429
+ placeOfEvent: JurisdictionFilter.optional(),
430
+ createdBy: UserFilter.optional(),
431
+ createdIn: JurisdictionFilter.optional()
152
432
  }).describe("Options applicable to all record scopes.");
153
433
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
154
434
  notifiedIn: JurisdictionFilter.optional(),
155
435
  notifiedBy: UserFilter.optional(),
156
436
  declaredIn: JurisdictionFilter.optional(),
157
- declaredBy: UserFilter.optional()
437
+ declaredBy: UserFilter.optional(),
438
+ status: scopeByStatus
158
439
  }).describe("Options applicable to actions that may take place after DECLARE");
159
440
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
160
441
  registeredIn: JurisdictionFilter.optional(),
161
- registeredBy: UserFilter.optional()
442
+ registeredBy: UserFilter.optional(),
443
+ flags: ContainsFlags.optional()
162
444
  }).describe(
163
445
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
164
446
  );
165
447
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
166
- customActionTypes: z3.preprocess(
448
+ customActionTypes: z8.preprocess(
167
449
  (val) => val === void 0 ? void 0 : [val].flat(),
168
- z3.array(z3.string()).optional()
450
+ z8.array(z8.string()).optional()
169
451
  ).describe("Allowed custom action types")
170
452
  });
171
- var AccessLevelOptions = z3.object({
453
+ var AccessLevelOptions = z8.object({
172
454
  accessLevel: JurisdictionFilter.optional()
173
455
  });
174
456
  var AllUserScopeOptions = AccessLevelOptions.extend({
175
457
  role: userRole.optional()
176
458
  });
177
- var WorkqueueOrDashboardOptions = z3.object({
178
- ids: z3.preprocess(
459
+ var WorkqueueOrDashboardOptions = z8.object({
460
+ ids: z8.preprocess(
179
461
  (val) => val === void 0 ? void 0 : [val].flat(),
180
- z3.array(z3.string())
462
+ z8.array(z8.string())
181
463
  ).describe("Must contain a list of workqueue or dashboard ids.")
182
464
  });
183
- var AllScopeOptions = z3.object({
465
+ var AllScopeOptions = z8.object({
184
466
  ...AllRecordScopeOptions.shape,
185
467
  ...AccessLevelOptions.shape,
186
468
  ...AllUserScopeOptions.shape,
187
469
  ...WorkqueueOrDashboardOptions.shape
188
470
  });
189
471
  var ScopeOptionKey = AllScopeOptions.keyof();
190
- var ResolvedScopeOptionsPlaceEvent = z3.object({
472
+ var ResolvedScopeOptionsPlaceEvent = z8.object({
191
473
  event: scopeByEvent,
192
- placeOfEvent: UUID.nullish()
474
+ placeOfEvent: UUID.nullish(),
475
+ createdBy: z8.string().optional(),
476
+ createdIn: UUID.nullish()
193
477
  }).describe(
194
478
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
195
479
  );
196
480
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
197
481
  notifiedIn: UUID.nullish(),
198
- notifiedBy: z3.string().optional(),
482
+ notifiedBy: z8.string().optional(),
199
483
  declaredIn: UUID.nullish(),
200
- declaredBy: z3.string().optional()
484
+ declaredBy: z8.string().optional()
201
485
  }).describe(
202
486
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
203
487
  );
204
488
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
205
489
  registeredIn: UUID.nullish(),
206
- registeredBy: z3.string().optional()
490
+ registeredBy: z8.string().optional(),
491
+ flags: ContainsFlags.optional()
207
492
  }).describe(
208
493
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
209
494
  );
@@ -217,7 +502,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
217
502
  "record.reject",
218
503
  "record.archive",
219
504
  "record.unarchive",
220
- "record.review-duplicates",
221
505
  "record.register"
222
506
  ]);
223
507
  var ScopesWithFullOptions = RecordScopeTypeV2.extract([
@@ -225,41 +509,55 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
225
509
  "record.read",
226
510
  "record.request-correction",
227
511
  "record.correct",
228
- "record.unassign-others"
512
+ "record.revoke-registration",
513
+ "record.reinstate-registration",
514
+ "record.unassign-others",
515
+ "record.review-duplicates"
229
516
  ]);
230
517
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
231
- templates: z3.preprocess(
518
+ templates: z8.preprocess(
232
519
  (val) => val === void 0 ? void 0 : [val].flat(),
233
- z3.array(z3.string()).optional()
520
+ z8.array(z8.string()).optional()
234
521
  ).describe(
235
522
  "Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
236
523
  )
237
524
  });
238
- var RecordScopeV2 = z3.discriminatedUnion("type", [
239
- z3.object({
525
+ var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
526
+ "record.action.accept",
527
+ "record.action.reject"
528
+ ]);
529
+ var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
530
+ "Options for confirming (accepting or rejecting) an action."
531
+ );
532
+ var RecordScopeV2 = z8.discriminatedUnion("type", [
533
+ z8.object({
240
534
  type: ScopesWithPlaceEventOptions,
241
535
  options: scopeOptionsPlaceEvent.optional()
242
536
  }),
243
- z3.object({
537
+ z8.object({
244
538
  type: ScopesWithDeclaredOptions,
245
539
  options: scopeOptionsDeclaredOrNotified.optional()
246
540
  }),
247
- z3.object({
541
+ z8.object({
248
542
  type: ScopesWithFullOptions,
249
543
  options: AllRecordScopeOptions.optional()
250
544
  }),
251
- z3.object({
252
- type: z3.literal("record.custom-action"),
545
+ z8.object({
546
+ type: z8.literal("record.custom-action"),
253
547
  options: CustomActionScopeOptions.optional()
254
548
  }),
255
- z3.object({
256
- type: z3.literal("record.print-certified-copies"),
549
+ z8.object({
550
+ type: z8.literal("record.print-certified-copies"),
257
551
  options: ScopeOptionsPrintCertifiedCopies.optional()
552
+ }),
553
+ z8.object({
554
+ type: ActionConfirmationScopeType,
555
+ options: ActionConfirmationScopeOptions.optional()
258
556
  })
259
557
  ]).describe(
260
558
  "Scopes used to check user's permission to perform actions on a record."
261
559
  );
262
- var SystemScopeType = z3.enum([
560
+ var SystemScopeType = z8.enum([
263
561
  "organisation.read-locations",
264
562
  "user.read",
265
563
  "user.create",
@@ -273,12 +571,12 @@ var UserScopeType = SystemScopeType.extract([
273
571
  "user.search"
274
572
  ]);
275
573
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
276
- var UserScopeV2 = z3.discriminatedUnion("type", [
277
- z3.object({
574
+ var UserScopeV2 = z8.discriminatedUnion("type", [
575
+ z8.object({
278
576
  type: ScopesWithRoleOption,
279
577
  options: AllUserScopeOptions.optional()
280
578
  }),
281
- z3.object({
579
+ z8.object({
282
580
  type: UserScopeType.extract(["user.read", "user.search"]),
283
581
  options: AccessLevelOptions.optional()
284
582
  })
@@ -298,44 +596,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
298
596
  function isCustomActionScope(scope) {
299
597
  return scope.type === "record.custom-action";
300
598
  }
301
- var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
302
- z3.object({
599
+ var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
600
+ z8.object({
303
601
  type: ScopesWithPlaceEventOptions,
304
602
  options: ResolvedScopeOptionsPlaceEvent.optional()
305
603
  }),
306
- z3.object({
604
+ z8.object({
307
605
  type: ScopesWithDeclaredOptions,
308
606
  options: ResolvedScopeOptionsDeclared.optional()
309
607
  }),
310
- z3.object({
608
+ z8.object({
311
609
  type: ScopesWithFullOptions,
312
610
  options: ResolvedScopeOptionsFull.optional()
313
611
  }),
314
- z3.object({
315
- type: z3.literal("record.print-certified-copies"),
612
+ z8.object({
613
+ type: z8.literal("record.print-certified-copies"),
316
614
  options: ResolvedScopeOptionsFull.extend({
317
- templates: z3.array(z3.string()).optional()
615
+ templates: z8.array(z8.string()).optional()
318
616
  }).optional()
319
617
  })
320
618
  ]).describe("Resolved scope with location/user IDs instead of filters.");
321
- var Scope2 = z3.discriminatedUnion("type", [
322
- z3.object({ type: PlainScopeType }),
619
+ var Scope2 = z8.discriminatedUnion("type", [
620
+ z8.object({ type: PlainScopeType }),
323
621
  ...RecordScopeV2.options,
324
622
  ...UserScopeV2.options,
325
- z3.object({
326
- type: z3.literal("organisation.read-locations"),
623
+ z8.object({
624
+ type: z8.literal("organisation.read-locations"),
327
625
  options: AccessLevelOptions.optional()
328
626
  }),
329
- z3.object({
330
- type: z3.literal("workqueue"),
627
+ z8.object({
628
+ type: z8.literal("workqueue"),
331
629
  options: WorkqueueOrDashboardOptions
332
630
  }),
333
- z3.object({
334
- type: z3.literal("dashboard.view"),
631
+ z8.object({
632
+ type: z8.literal("dashboard.view"),
335
633
  options: WorkqueueOrDashboardOptions
336
634
  })
337
635
  ]);
338
- var ScopeType2 = z3.enum([
636
+ var ScopeType2 = z8.enum([
339
637
  ...SystemScopeType.options,
340
638
  ...RecordScopeTypeV2.options,
341
639
  ...PlainScopeType.options,
@@ -350,11 +648,12 @@ var unflattenScope = (input) => {
350
648
  const { type, ...options } = input;
351
649
  return { type, options };
352
650
  };
353
- var EncodedScope2 = z3.string().brand("EncodedScope");
651
+ var EncodedScope2 = z8.string().brand("EncodedScope");
354
652
  var encodeScope = (scope) => {
355
653
  const flattened = flattenScope(scope);
356
654
  return qs.stringify(flattened, {
357
655
  arrayFormat: "comma",
656
+ commaRoundTrip: true,
358
657
  allowDots: true,
359
658
  addQueryPrefix: false,
360
659
  encode: false
@@ -436,4 +735,4 @@ function defineRoles(roles) {
436
735
  }
437
736
 
438
737
  // src/scopes/index.ts
439
- z4.globalRegistry.clear();
738
+ z9.globalRegistry.clear();
@@ -0,0 +1,45 @@
1
+ /** A single telemetry metric value. */
2
+ export type TelemetryMetricValue = number | string | boolean;
3
+ /**
4
+ * The telemetry report a country configuration hands to {@link sendTelemetry}.
5
+ * `schema_version` is stamped by `sendTelemetry`, not by the caller.
6
+ */
7
+ export interface TelemetryReport {
8
+ /** Client clock, ISO 8601. Kept stable across retries of the same report. */
9
+ reported_at: string;
10
+ /** ISO-style country code of the instance. */
11
+ country_code: string;
12
+ /** Organisation running the instance. Empty string when unset. */
13
+ organisation: string;
14
+ /** Public domain of the instance, or `null`. */
15
+ domain: string | null;
16
+ instance: {
17
+ application_name: string;
18
+ environment: string;
19
+ app_version?: string;
20
+ };
21
+ /** Flat map of dotted metric keys to primitive values. */
22
+ metrics: Record<string, TelemetryMetricValue>;
23
+ }
24
+ /** Outcome of a {@link sendTelemetry} call. */
25
+ export interface TelemetryResult {
26
+ /**
27
+ * How the send resolved:
28
+ * - `sent` — the status service accepted the report (2xx);
29
+ * - `rejected` — the status service returned a non-2xx response.
30
+ */
31
+ outcome: 'sent' | 'rejected';
32
+ /** HTTP status of the request. */
33
+ status: number;
34
+ /** Response body for a `rejected` outcome. */
35
+ detail?: string;
36
+ }
37
+ /**
38
+ * Sends a telemetry report to the OpenCRVS status service. The endpoint and the
39
+ * schema version are fixed by this version of the toolkit.
40
+ *
41
+ * This always attempts the send; deciding *whether* to report (e.g. only from
42
+ * production instances) is the caller's responsibility. Network errors reject.
43
+ */
44
+ export declare function sendTelemetry(report: TelemetryReport): Promise<TelemetryResult>;
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAuBA,uCAAuC;AACvC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE;QACR,gBAAgB,EAAE,MAAM,CAAA;QACxB,WAAW,EAAE,MAAM,CAAA;QACnB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CAC9C;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,UAAU,CAAA;IAC5B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC,CAa1B"}