@opencrvs/toolkit 2.1.0-rc.d1b9774 → 2.1.0-rc.d235243

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 (223) hide show
  1. package/README.md +2 -12
  2. package/build.sh +15 -5
  3. package/create-countryconfig/index.js +164 -4
  4. package/dist/application-config/index.js +36 -25
  5. package/dist/authentication/index.d.ts +8 -9
  6. package/dist/authentication/index.js +23 -8
  7. package/dist/cli.js +1981 -2823
  8. package/dist/commons/api/router.d.ts +252 -290
  9. package/dist/commons/application-config/index.d.ts +0 -2
  10. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  11. package/dist/commons/conditionals/validate.d.ts +19 -4
  12. package/dist/commons/events/ActionConfig.d.ts +5 -14
  13. package/dist/commons/events/ActionDocument.d.ts +30 -4
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +24 -12
  15. package/dist/commons/events/AuditLog.d.ts +1 -0
  16. package/dist/commons/events/Draft.d.ts +1 -21
  17. package/dist/commons/events/EventDocument.d.ts +4 -4
  18. package/dist/commons/events/FieldConfig.d.ts +26 -15
  19. package/dist/commons/events/FieldTypeMapping.d.ts +10 -10
  20. package/dist/commons/events/FieldValue.d.ts +1 -0
  21. package/dist/commons/events/FormConfig.d.ts +6 -0
  22. package/dist/commons/events/PageConfig.d.ts +4 -0
  23. package/dist/commons/events/locations.d.ts +4 -0
  24. package/dist/commons/events/scopes.d.ts +21 -1
  25. package/dist/commons/events/test.utils.d.ts +71 -22
  26. package/dist/commons/events/utils.d.ts +37 -2
  27. package/dist/conditionals/index.js +21 -7
  28. package/dist/environment/derived-variables.d.ts +18 -0
  29. package/dist/environment/derived-variables.d.ts.map +1 -1
  30. package/dist/environment/derived-variables.js +21 -0
  31. package/dist/environment/index.d.ts.map +1 -1
  32. package/dist/environment/index.js +2 -1
  33. package/dist/environment/manage-users.js +1 -1
  34. package/dist/environment/questions.d.ts +16 -0
  35. package/dist/environment/questions.d.ts.map +1 -1
  36. package/dist/environment/questions.js +27 -2
  37. package/dist/environment/setup-environment.d.ts +1 -1
  38. package/dist/environment/setup-environment.d.ts.map +1 -1
  39. package/dist/environment/setup-environment.js +633 -560
  40. package/dist/environment/swarm-to-k8s.js +3 -4
  41. package/dist/environment/templates.d.ts +0 -1
  42. package/dist/environment/templates.d.ts.map +1 -1
  43. package/dist/environment/templates.js +3 -8
  44. package/dist/environment/update-workflows.d.ts.map +1 -1
  45. package/dist/environment/update-workflows.js +6 -1
  46. package/dist/environment/utils.d.ts +0 -12
  47. package/dist/environment/utils.d.ts.map +1 -1
  48. package/dist/environment/utils.js +1 -28
  49. package/dist/events/index.js +2115 -1884
  50. package/dist/migrations/v2.1/add-recovery-link-notifications.js +4 -4
  51. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -1
  52. package/dist/migrations/v2.1/add-translations.js +4 -68
  53. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -1
  54. package/dist/migrations/v2.1/enable-telemetry.js +30 -13
  55. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  56. package/dist/migrations/v2.1/index.js +35 -1261
  57. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -0
  58. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  59. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
  60. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  61. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  62. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  63. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  64. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  65. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  66. package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  67. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  68. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  69. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  70. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  71. package/dist/migrations/v2.1/template-files.js +49 -0
  72. package/dist/migrations/v2.1/upgrade-tilt.d.ts +8 -0
  73. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  74. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  75. package/dist/migrations/v2.2/add-e2e-tests.d.ts +19 -0
  76. package/dist/migrations/v2.2/add-e2e-tests.d.ts.map +1 -0
  77. package/dist/migrations/v2.2/add-e2e-tests.js +143 -0
  78. package/dist/migrations/v2.2/index.d.ts +6 -0
  79. package/dist/migrations/v2.2/index.d.ts.map +1 -0
  80. package/dist/migrations/v2.2/index.js +279 -0
  81. package/dist/migrations/v2.2/template-files.d.ts +8 -0
  82. package/dist/migrations/v2.2/template-files.d.ts.map +1 -0
  83. package/dist/migrations/v2.2/template-files.js +49 -0
  84. package/dist/migrations/v2.2/upgrade-tilt.d.ts +8 -0
  85. package/dist/migrations/v2.2/upgrade-tilt.d.ts.map +1 -0
  86. package/dist/migrations/v2.2/upgrade-tilt.js +139 -0
  87. package/dist/notification/index.js +249 -207
  88. package/dist/scopes/index.d.ts +288 -5
  89. package/dist/scopes/index.js +22 -7
  90. package/dist/telemetry/index.js +4 -0
  91. package/dist/templates/charts-values/dependencies/values.yaml +8 -0
  92. package/dist/templates/charts-values/opencrvs-services/values.yaml +6 -0
  93. package/dist/templates/charts-values/opentelemetry/values.yaml +7 -0
  94. package/dist/templates/charts-values/traefik/values.yaml +2 -3
  95. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  96. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  97. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  98. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  99. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  100. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  101. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  102. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  103. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  104. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  105. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  106. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  107. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  108. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  109. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  110. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  111. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  112. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  113. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  114. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  115. package/dist/templates/countryconfig-template/e2e/README.md +36 -0
  116. package/dist/templates/countryconfig-template/e2e/constants.ts +28 -0
  117. package/dist/templates/countryconfig-template/e2e/login.e2e.ts +59 -0
  118. package/dist/templates/countryconfig-template/package.json +153 -0
  119. package/dist/templates/countryconfig-template/playwright.config.ts +42 -0
  120. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  121. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  122. package/dist/templates/countryconfig-template/tilt/common.tilt +159 -0
  123. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  124. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  125. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  126. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  127. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  128. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  129. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  130. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  131. package/dist/translations/template.d.ts +11 -0
  132. package/dist/translations/template.d.ts.map +1 -0
  133. package/dist/translations/template.js +100 -0
  134. package/dist/verify/endpoints.d.ts.map +1 -1
  135. package/dist/verify/endpoints.js +180 -15
  136. package/opencrvs-toolkit-2.1.0-rc.d235243.tgz +0 -0
  137. package/package.json +2 -1
  138. package/tsconfig.build.tsbuildinfo +1 -1
  139. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  140. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  141. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  142. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  143. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  144. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  145. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  146. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  147. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  148. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  149. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  150. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  151. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  152. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  153. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  154. package/dist/migrations/v2.0/create-events-index.d.ts +0 -3
  155. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  156. package/dist/migrations/v2.0/create-events-index.js +0 -325
  157. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  158. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  159. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  160. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  161. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  162. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  163. package/dist/migrations/v2.0/index.d.ts +0 -13
  164. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  165. package/dist/migrations/v2.0/index.js +0 -103
  166. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  167. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  168. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  169. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  170. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  171. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  172. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  173. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  174. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  175. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  176. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  177. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  178. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  179. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  180. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  181. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  182. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  183. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  184. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  185. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  186. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  187. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  188. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  189. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  190. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  191. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  192. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  193. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  194. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  195. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  196. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  197. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  198. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  199. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  200. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  201. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  202. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  203. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  204. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  205. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  206. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  207. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  208. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  209. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  210. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  211. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  212. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  213. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  214. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  215. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  216. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  217. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  218. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  219. package/dist/migrations/v2.0/update-package-json.js +0 -105
  220. package/dist/translations/check.d.ts +0 -19
  221. package/dist/translations/check.d.ts.map +0 -1
  222. package/dist/translations/check.js +0 -127
  223. package/opencrvs-toolkit-2.1.0-rc.d1b9774.tgz +0 -0
package/README.md CHANGED
@@ -55,19 +55,9 @@ Toolkit "re-exports" TRPC router to allow for easy client interaction.
55
55
 
56
56
  Toolkit "re-exports" common definitions (e.g. events, conditionals) and make them available through npm.
57
57
 
58
- ### Releasing and buiding
58
+ ### Publishing
59
59
 
60
- #### While developing
61
-
62
- 1. Update version number in `package.json`
63
- 2. `yarn build:all`
64
- 3. `npm publish`
65
-
66
- #### Through version control
67
-
68
- 1. Update version number in `package.json`
69
- 2. Create a pull request
70
- 3. Once merged, github action will get triggered.
60
+ Publish via [Publish toolkit to NPM registry](https://github.com/opencrvs/opencrvs-core/actions/workflows/publish-toolkit-to-npm.yml).
71
61
 
72
62
  #### Gotchas, good to know
73
63
 
package/build.sh CHANGED
@@ -20,7 +20,7 @@ npx tsc --build tsconfig.build.json
20
20
  npx esbuild src/events/index.ts --bundle --format=cjs --outdir=./dist/events --allow-overwrite --packages=external
21
21
 
22
22
  # Build telemetry client (self-contained; .d.ts comes from tsc --build above)
23
- npx esbuild src/telemetry/index.ts --bundle --format=cjs --outdir=./dist/telemetry --allow-overwrite --packages=external
23
+ npx esbuild src/telemetry/index.ts --bundle --platform=node --format=cjs --outdir=./dist/telemetry --allow-overwrite --packages=external
24
24
  mkdir -p ./dist/commons/events
25
25
  cp -r ../commons/build/dist/common/events/*.d.ts ./dist/commons/events
26
26
  mkdir -p ./dist/commons/events/state
@@ -49,7 +49,7 @@ npx esbuild src/events/deduplication.ts --bundle --format=cjs --outdir=./dist/ev
49
49
  cp -r ../commons/build/dist/common/events/deduplication.d.ts ./dist/events/deduplication.d.ts
50
50
 
51
51
  # Build common notifications
52
- npx esbuild src/notification/index.ts --bundle --format=cjs --outdir=./dist/notification --allow-overwrite --packages=external
52
+ npx esbuild src/notification/index.ts --bundle --platform=node --format=cjs --outdir=./dist/notification --allow-overwrite --packages=external
53
53
  mkdir -p ./dist/commons/notification
54
54
  cp -r ../commons/build/dist/common/notification/*.d.ts ./dist/commons/notification
55
55
 
@@ -59,8 +59,8 @@ mkdir -p ./dist/commons/application-config
59
59
  cp -r ../commons/build/dist/common/application-config.d.ts ./dist/commons/application-config/index.d.ts
60
60
 
61
61
  # Build migration CLI
62
- npx esbuild src/migrations/v2.1/index.ts --bundle --format=cjs --outdir=./dist/migrations/v2.1 --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
63
- chmod +x ./dist/migrations/v2.1/index.js
62
+ npx esbuild src/migrations/v2.2/index.ts --bundle --platform=node --format=cjs --outdir=./dist/migrations/v2.2 --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
63
+ chmod +x ./dist/migrations/v2.2/index.js
64
64
 
65
65
  if [[ "$OSTYPE" == "darwin"* ]]; then
66
66
  sed -i '' 's|@opencrvs/events/build/types|../commons/api|g' dist/api/index.d.ts
@@ -71,8 +71,18 @@ else
71
71
  fi
72
72
 
73
73
  # Build CLI
74
- npx esbuild src/cli.ts --bundle --format=cjs --outdir=./dist --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
74
+ npx esbuild src/cli.ts --bundle --platform=node --format=cjs --outdir=./dist --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
75
75
  cp -R src/environment/templates dist/templates
76
+ # Template files copied into country configs by the upgrade-tilt,
77
+ # migrate-infrastructure-to-assets and add-e2e-tests codemods. Image builds that use the toolkit as
78
+ # a library (testland, mosip-api) do not copy the template in and do not need them.
79
+ TEMPLATE_DIR=../countryconfig-template
80
+ if [ -d "$TEMPLATE_DIR" ]; then
81
+ mkdir -p dist/templates/countryconfig-template
82
+ cp -R $TEMPLATE_DIR/Tiltfile $TEMPLATE_DIR/.tiltignore $TEMPLATE_DIR/tilt $TEMPLATE_DIR/assets $TEMPLATE_DIR/Dockerfile.assets $TEMPLATE_DIR/e2e $TEMPLATE_DIR/playwright.config.ts $TEMPLATE_DIR/package.json dist/templates/countryconfig-template/
83
+ else
84
+ echo "$TEMPLATE_DIR not found, 'opencrvs upgrade' will not be able to copy the template files"
85
+ fi
76
86
  chmod +x ./dist/cli.js
77
87
 
78
88
  echo "Build completed successfully."
@@ -13,6 +13,7 @@
13
13
 
14
14
  const path = require('path')
15
15
  const fs = require('fs')
16
+ const { execSync } = require('child_process')
16
17
  const readline = require('readline/promises')
17
18
  const degit = require('degit').default
18
19
 
@@ -21,6 +22,14 @@ const CORE_REPOSITORY = 'opencrvs/opencrvs-core'
21
22
  const COUNTRYCONFIG_TEMPLATE_REPOSITORY_SUBPATH =
22
23
  'packages/countryconfig-template'
23
24
 
25
+ const CORE_REPO_URL = 'https://github.com/' + CORE_REPOSITORY + '.git'
26
+ const INFRASTRUCTURE_REPO_URL =
27
+ 'https://github.com/' + INFRASTRUCTURE_REPOSITORY + '.git'
28
+
29
+ const { version } = JSON.parse(
30
+ fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8')
31
+ )
32
+
24
33
  function joinValues(values, separator) {
25
34
  return values
26
35
  .filter((value) => !!value)
@@ -28,19 +37,162 @@ function joinValues(values, separator) {
28
37
  .trim()
29
38
  }
30
39
 
40
+ function tagExists(repoUrl, tag) {
41
+ try {
42
+ execSync(
43
+ 'git ls-remote --exit-code --tags ' + repoUrl + ' refs/tags/' + tag,
44
+ { stdio: 'pipe' }
45
+ )
46
+ return true
47
+ } catch (err) {
48
+ return false
49
+ }
50
+ }
51
+
52
+ function branchExists(repoUrl, branch) {
53
+ try {
54
+ execSync(
55
+ 'git ls-remote --exit-code --heads ' + repoUrl + ' refs/heads/' + branch,
56
+ { stdio: 'pipe' }
57
+ )
58
+ return true
59
+ } catch (err) {
60
+ return false
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Release tags (e.g. "v2.1.0"), highest first. Delegates the version-aware
66
+ * ordering to git itself rather than hand-parsing semver, then filters down
67
+ * to strict "vX.Y.Z" tags - `--sort=-version:refname` alone still leaves in
68
+ * non-release refs (e.g. "vtesting", "v2.0.0-beta") and peeled annotated-tag
69
+ * lines ("refs/tags/v2.0.0^{}").
70
+ */
71
+ function listReleaseTags(repoUrl) {
72
+ const output = execSync(
73
+ 'git ls-remote --tags --sort=-version:refname ' + repoUrl,
74
+ { encoding: 'utf-8' }
75
+ )
76
+
77
+ return output
78
+ .split('\n')
79
+ .map((line) => line.split('\t')[1])
80
+ .filter(Boolean)
81
+ .map((ref) => ref.replace('refs/tags/', ''))
82
+ .filter((tag) => /^v\d+\.\d+\.\d+$/.test(tag))
83
+ }
84
+
85
+ /**
86
+ * The highest release tag present in *both* repositories - used as the
87
+ * fallback when the version-specific tag can't be found in one or both, so
88
+ * scaffolding still lands on a real, matched release rather than develop.
89
+ */
90
+ function getLatestCommonReleaseTag() {
91
+ const infrastructureTags = new Set(listReleaseTags(INFRASTRUCTURE_REPO_URL))
92
+ return (
93
+ listReleaseTags(CORE_REPO_URL).find((tag) => infrastructureTags.has(tag)) ||
94
+ null
95
+ )
96
+ }
97
+
98
+ /**
99
+ * Resolves the ref that both repositories are cloned from. A single ref
100
+ * clones both, so every candidate must exist in *both* - a tag present in
101
+ * only one of them can't be used.
102
+ *
103
+ * The exact "v<version>" tag wins whenever it exists: it pins a commit, so
104
+ * a release, an explicit `@X.Y.Z` pin, or a blessed prerelease (npm `@beta`,
105
+ * published from that tag) reproduces however late it's scaffolded.
106
+ *
107
+ * Otherwise a prerelease falls back to a branch, since a rolling release
108
+ * candidate (npm `@next`) is never tagged: "release/X.Y.Z" of the base
109
+ * version when that release has been cut, otherwise develop. A release
110
+ * falls back to the highest tag common to both repositories - never a
111
+ * mismatched pairing of the two at different releases - or errors.
112
+ */
113
+ function resolveRef() {
114
+ const versionTag = 'v' + version
115
+ if (
116
+ tagExists(CORE_REPO_URL, versionTag) &&
117
+ tagExists(INFRASTRUCTURE_REPO_URL, versionTag)
118
+ ) {
119
+ return versionTag
120
+ }
121
+
122
+ if (version.includes('-')) {
123
+ const releaseBranch = 'release/' + version.split('-')[0]
124
+ if (
125
+ branchExists(CORE_REPO_URL, releaseBranch) &&
126
+ branchExists(INFRASTRUCTURE_REPO_URL, releaseBranch)
127
+ ) {
128
+ return releaseBranch
129
+ }
130
+ return 'develop'
131
+ }
132
+
133
+ const latestCommonTag = getLatestCommonReleaseTag()
134
+ if (latestCommonTag) {
135
+ console.warn(
136
+ '\nWarning: tag "' +
137
+ versionTag +
138
+ '" was not found in both repositories; falling back to the latest ' +
139
+ 'available release, ' +
140
+ latestCommonTag +
141
+ '.'
142
+ )
143
+ return latestCommonTag
144
+ }
145
+
146
+ console.error(
147
+ '\nError: no matching release tag was found in both the core and ' +
148
+ 'infrastructure repositories.'
149
+ )
150
+ process.exit(1)
151
+ }
152
+
31
153
  /**
32
154
  * Clones a repository from GitHub to a target directory.
33
155
  *
34
156
  * @param {*} param0 repository - The repository to clone (e.g., 'opencrvs/opencrvs-core').
35
157
  * @param {*} param0 repositorySubPath - The subpath within the repository to clone (optional). Otherwise the entire repository will be cloned.
36
158
  * @param {*} param0 branch - The branch to clone (optional). Defaults to the default branch if not specified.
159
+ * @param {*} param0 keepHistory - Keep the repository's git history instead of degit's usual history-free copy (optional, defaults to false). The cloned "origin" remote is replaced with "upstream", leaving the directory ready for the user to add their own fork/repo as "origin". Not supported together with repositorySubPath, since a plain git clone can't fetch a single subdirectory.
37
160
  *
38
161
  * @param {*} targetDir - The target directory where the repository will be cloned.
39
162
  */
40
163
  async function cloneRepository(
41
- { repository, repositorySubPath, branch },
164
+ { repository, repositorySubPath, branch, keepHistory = false },
42
165
  targetDir
43
166
  ) {
167
+ if (keepHistory && repositorySubPath) {
168
+ throw new Error(
169
+ 'cloneRepository: keepHistory is not supported together with repositorySubPath.'
170
+ )
171
+ }
172
+
173
+ if (keepHistory) {
174
+ const repoUrl = `https://github.com/${repository}.git`
175
+ console.log(
176
+ `Cloning repository from ${repoUrl}#${branch} to ${targetDir}...`
177
+ )
178
+
179
+ execSync('git clone --branch ' + branch + ' ' + repoUrl + ' ' + targetDir, {
180
+ stdio: 'inherit'
181
+ })
182
+
183
+ console.log(
184
+ `Copied files from ${repoUrl}#${branch} to ${targetDir} succesfully.`
185
+ )
186
+
187
+ console.log(`Replacing 'origin' remote with 'upstream' in ${targetDir}...`)
188
+ execSync('git remote remove origin', { cwd: targetDir, stdio: 'inherit' })
189
+ execSync('git remote add upstream ' + repoUrl, {
190
+ cwd: targetDir,
191
+ stdio: 'inherit'
192
+ })
193
+ return
194
+ }
195
+
44
196
  const repositoryPath = joinValues([repository, repositorySubPath], '/')
45
197
  const fullPath = joinValues([repositoryPath, branch], '#')
46
198
 
@@ -271,6 +423,8 @@ async function main() {
271
423
  ensureTargetDirectoryDoesNotExist(countryconfigDirName)
272
424
  ensureTargetDirectoryDoesNotExist(infrastructureDirName)
273
425
 
426
+ const ref = resolveRef()
427
+
274
428
  // Gather all answers up front so the operator isn't interrupted mid-clone.
275
429
  const organisation = await promptOrganisation()
276
430
  const countryCode = await promptCountryCode()
@@ -280,7 +434,8 @@ async function main() {
280
434
  await cloneRepository(
281
435
  {
282
436
  repository: CORE_REPOSITORY,
283
- repositorySubPath: COUNTRYCONFIG_TEMPLATE_REPOSITORY_SUBPATH
437
+ repositorySubPath: COUNTRYCONFIG_TEMPLATE_REPOSITORY_SUBPATH,
438
+ branch: ref
284
439
  },
285
440
  countryconfigTargetPath
286
441
  )
@@ -293,7 +448,7 @@ async function main() {
293
448
 
294
449
  try {
295
450
  await cloneRepository(
296
- { repository: INFRASTRUCTURE_REPOSITORY },
451
+ { repository: INFRASTRUCTURE_REPOSITORY, branch: ref, keepHistory: true },
297
452
  infrastructureTargetPath
298
453
  )
299
454
  } catch (err) {
@@ -319,7 +474,12 @@ async function main() {
319
474
  console.log(' tilt up\n')
320
475
  console.log('To get started with the infrastructure:\n')
321
476
  console.log(' cd ' + infrastructureDirName)
322
- console.log(' git init\n')
477
+ console.log(' git remote add origin <your-infrastructure-repo-url>')
478
+ console.log(' git push -u origin ' + ref + '\n')
479
+ console.log(
480
+ 'The "upstream" remote points at the official infrastructure repository, ' +
481
+ 'so you can pull future releases with `git fetch upstream`.\n'
482
+ )
323
483
  }
324
484
 
325
485
  main()
@@ -331,8 +331,9 @@ var TextValue = z7.string();
331
331
  var HiddenFieldValue = z7.string();
332
332
  var NonEmptyTextValue = z7.string().trim().min(1);
333
333
  var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
334
+ var AGE_MAX_VALUE = 999;
334
335
  var AgeValue = z7.object({
335
- age: z7.number(),
336
+ age: z7.number().int().min(0).max(AGE_MAX_VALUE),
336
337
  asOfDateRef: z7.string()
337
338
  });
338
339
  var AgeUpdateValue = AgeValue.optional().nullable();
@@ -719,7 +720,9 @@ var RecordScopeTypeV2 = z13.enum([
719
720
  "record.request-correction",
720
721
  "record.correct",
721
722
  "record.unassign-others",
722
- "record.custom-action"
723
+ "record.custom-action",
724
+ "record.action.accept",
725
+ "record.action.reject"
723
726
  ]);
724
727
  var PlainScopeType = z13.enum([
725
728
  // Misc. system scopes
@@ -741,10 +744,7 @@ var PlainScopeType = z13.enum([
741
744
  // Performance dashboard
742
745
  "performance.read",
743
746
  "performance.read-dashboards",
744
- "performance.vital-statistics-export",
745
- // Scopes used exclusively by countryconfig integration token
746
- "record.confirm-registration",
747
- "record.reject-registration"
747
+ "performance.vital-statistics-export"
748
748
  ]);
749
749
  var scopeByEvent = z13.preprocess(
750
750
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -762,7 +762,9 @@ var userRole = z13.preprocess(
762
762
  ).describe("User role, e.g. admin, field agent");
763
763
  var scopeOptionsPlaceEvent = z13.object({
764
764
  event: scopeByEvent,
765
- placeOfEvent: JurisdictionFilter.optional()
765
+ placeOfEvent: JurisdictionFilter.optional(),
766
+ createdBy: UserFilter.optional(),
767
+ createdIn: JurisdictionFilter.optional()
766
768
  }).describe("Options applicable to all record scopes.");
767
769
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
768
770
  notifiedIn: JurisdictionFilter.optional(),
@@ -805,7 +807,9 @@ var AllScopeOptions = z13.object({
805
807
  var ScopeOptionKey = AllScopeOptions.keyof();
806
808
  var ResolvedScopeOptionsPlaceEvent = z13.object({
807
809
  event: scopeByEvent,
808
- placeOfEvent: UUID.nullish()
810
+ placeOfEvent: UUID.nullish(),
811
+ createdBy: z13.string().optional(),
812
+ createdIn: UUID.nullish()
809
813
  }).describe(
810
814
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
811
815
  );
@@ -852,6 +856,13 @@ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
852
856
  "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."
853
857
  )
854
858
  });
859
+ var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
860
+ "record.action.accept",
861
+ "record.action.reject"
862
+ ]);
863
+ var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
864
+ "Options for confirming (accepting or rejecting) an action."
865
+ );
855
866
  var RecordScopeV2 = z13.discriminatedUnion("type", [
856
867
  z13.object({
857
868
  type: ScopesWithPlaceEventOptions,
@@ -872,6 +883,10 @@ var RecordScopeV2 = z13.discriminatedUnion("type", [
872
883
  z13.object({
873
884
  type: z13.literal("record.print-certified-copies"),
874
885
  options: ScopeOptionsPrintCertifiedCopies.optional()
886
+ }),
887
+ z13.object({
888
+ type: ActionConfirmationScopeType,
889
+ options: ActionConfirmationScopeOptions.optional()
875
890
  })
876
891
  ]).describe(
877
892
  "Scopes used to check user's permission to perform actions on a record."
@@ -1108,7 +1123,7 @@ var RequestedCorrectionAction = ActionBase.extend(
1108
1123
  var ApprovedCorrectionAction = ActionBase.extend(
1109
1124
  z15.object({
1110
1125
  type: z15.literal(ActionType.APPROVE_CORRECTION),
1111
- requestId: z15.string(),
1126
+ requestId: UUID,
1112
1127
  // TODO move into 'content' property
1113
1128
  content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
1114
1129
  }).shape
@@ -1116,7 +1131,7 @@ var ApprovedCorrectionAction = ActionBase.extend(
1116
1131
  var RejectedCorrectionAction = ActionBase.extend(
1117
1132
  z15.object({
1118
1133
  type: z15.literal(ActionType.REJECT_CORRECTION),
1119
- requestId: z15.string(),
1134
+ requestId: UUID,
1120
1135
  // TODO move into 'content' property
1121
1136
  content: ReasonContent
1122
1137
  }).shape
@@ -1912,9 +1927,6 @@ var AdministrativeAreaField = BaseField.extend({
1912
1927
  partOf: FieldReference.optional().describe("Parent location"),
1913
1928
  type: AdministrativeAreas,
1914
1929
  allowedLocations: AllowedLocations,
1915
- listHistoricalNames: import_v43.default.boolean().optional().describe(
1916
- "List every historical name a location has had as a separate, selectable option."
1917
- ),
1918
1930
  activeOnly: import_v43.default.boolean().optional().describe(
1919
1931
  "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
1920
1932
  ),
@@ -1932,9 +1944,6 @@ var LocationInput = BaseField.extend({
1932
1944
  configuration: import_v43.default.object({
1933
1945
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1934
1946
  allowedLocations: AllowedLocations,
1935
- listHistoricalNames: import_v43.default.boolean().optional().describe(
1936
- "List every historical name a location has had as a separate, selectable option."
1937
- ),
1938
1947
  activeOnly: import_v43.default.boolean().optional().describe(
1939
1948
  "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
1940
1949
  ),
@@ -1968,7 +1977,6 @@ var Facility = BaseField.extend({
1968
1977
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1969
1978
  configuration: import_v43.default.object({
1970
1979
  allowedLocations: AllowedLocations,
1971
- listHistoricalNames: import_v43.default.boolean().optional(),
1972
1980
  activeOnly: import_v43.default.boolean().optional(),
1973
1981
  anchorToDateOfEvent: import_v43.default.boolean().optional()
1974
1982
  }).optional()
@@ -1978,7 +1986,6 @@ var Office = BaseField.extend({
1978
1986
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1979
1987
  configuration: import_v43.default.object({
1980
1988
  allowedLocations: AllowedLocations,
1981
- listHistoricalNames: import_v43.default.boolean().optional(),
1982
1989
  activeOnly: import_v43.default.boolean().optional(),
1983
1990
  anchorToDateOfEvent: import_v43.default.boolean().optional()
1984
1991
  }).optional()
@@ -2015,9 +2022,6 @@ var Address = BaseField.extend({
2015
2022
  })
2016
2023
  ).optional(),
2017
2024
  allowedLocations: AllowedLocations,
2018
- listHistoricalNames: import_v43.default.boolean().optional().describe(
2019
- "List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
2020
- ),
2021
2025
  activeOnly: import_v43.default.boolean().optional().describe(
2022
2026
  "Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
2023
2027
  ),
@@ -2078,10 +2082,19 @@ var ButtonField = BaseField.extend({
2078
2082
  description: "A generic button that can be used to trigger an action",
2079
2083
  id: "ButtonField"
2080
2084
  });
2085
+ var FieldGroupConfiguration = import_v43.default.object({
2086
+ separator: import_v43.default.string().optional().describe(
2087
+ 'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
2088
+ ),
2089
+ hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
2090
+ "Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
2091
+ )
2092
+ });
2081
2093
  var FieldGroup = BaseField.extend({
2082
2094
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2083
2095
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2084
- fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2096
+ fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
2097
+ configuration: FieldGroupConfiguration.optional()
2085
2098
  }).meta({
2086
2099
  description: "A group of fields that are displayed together",
2087
2100
  id: "FieldGroup"
@@ -2372,8 +2385,7 @@ var LoginConfig = z21.object({
2372
2385
  USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
2373
2386
  INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
2374
2387
  PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
2375
- LOGIN_BACKGROUND: BackgroundConfig,
2376
- SENTRY: z21.string().optional()
2388
+ LOGIN_BACKGROUND: BackgroundConfig
2377
2389
  });
2378
2390
  var defineLoginConfig = (config) => {
2379
2391
  return LoginConfig.parse(config);
@@ -2381,7 +2393,6 @@ var defineLoginConfig = (config) => {
2381
2393
  var ClientConfig = z21.object({
2382
2394
  COUNTRY: z21.string(),
2383
2395
  LANGUAGES: z21.array(z21.string()),
2384
- SENTRY: z21.string().optional(),
2385
2396
  LOGIN_URL: z21.string().optional(),
2386
2397
  REGISTER_BACKGROUND: BackgroundConfig,
2387
2398
  DASHBOARDS: z21.array(
@@ -1,7 +1,6 @@
1
1
  import { Nominal } from './nominal';
2
2
  import * as z from 'zod/v4';
3
3
  import { ScopeType, Scope, EncodedScope } from './scopes';
4
- import { UUID } from './uuid';
5
4
  export * from './scopes';
6
5
  /**
7
6
  * Returns an array of accepted scopes from a JWT token, filtered by the given accepted scope types.
@@ -25,8 +24,6 @@ export interface ITokenPayload {
25
24
  scope: EncodedScope[];
26
25
  role?: string;
27
26
  userType: TokenUserType;
28
- eventId?: UUID;
29
- actionId?: UUID;
30
27
  }
31
28
  /**
32
29
  * Depending on how the API is called, there might or might not be Bearer keyword in the header.
@@ -42,13 +39,15 @@ export declare const getUserId: (token: TokenWithBearer) => string;
42
39
  */
43
40
  export declare const getUserIdFromToken: (token: string) => string | null;
44
41
  /**
45
- * Fixed subject (`sub`) of the service token that core's auth service mints
46
- * at `GET /internal/service-token`. The token carries no scopes and has
47
- * userType 'system'; core uses it for unattended service-to-service calls where
48
- * no user is involved — startup event-config load, background broadcasts and
49
- * telemetry. See packages/auth/src/features/serviceToken/handler.ts.
42
+ * Fixed subject (`sub`) of the service token that core's auth service mints at `GET /internal/service-token`.
43
+ * Core uses it for service-to-service calls where no user is involved.
44
+ *
45
+ * Must be a well-formed UUID so a service verifying the token can resolve it as
46
+ * a `SystemContext` as with `INTEGRATION_CREATOR_USER_ID` / `REINDEX_USER_ID`.
47
+ *
48
+ * See packages/auth/src/features/serviceToken/handler.ts
50
49
  */
51
- export declare const SERVICE_USER_ID = "__SERVICE_USER__";
50
+ export declare const SERVICE_USER_ID = "00000000-0000-4000-8000-000000000002";
52
51
  /**
53
52
  * True when a decoded token payload (e.g. Hapi's `request.auth.credentials`)
54
53
  * belongs to core's service token, identified by its fixed subject. A country
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/authentication/index.ts
31
31
  var authentication_exports = {};
32
32
  __export(authentication_exports, {
33
+ ActionConfirmationScopeType: () => ActionConfirmationScopeType,
33
34
  EncodedScope: () => EncodedScope,
34
35
  JurisdictionFilter: () => JurisdictionFilter,
35
36
  RecordScopeTypeV2: () => RecordScopeTypeV2,
@@ -361,7 +362,9 @@ var RecordScopeTypeV2 = z7.enum([
361
362
  "record.request-correction",
362
363
  "record.correct",
363
364
  "record.unassign-others",
364
- "record.custom-action"
365
+ "record.custom-action",
366
+ "record.action.accept",
367
+ "record.action.reject"
365
368
  ]);
366
369
  var PlainScopeType = z7.enum([
367
370
  // Misc. system scopes
@@ -383,10 +386,7 @@ var PlainScopeType = z7.enum([
383
386
  // Performance dashboard
384
387
  "performance.read",
385
388
  "performance.read-dashboards",
386
- "performance.vital-statistics-export",
387
- // Scopes used exclusively by countryconfig integration token
388
- "record.confirm-registration",
389
- "record.reject-registration"
389
+ "performance.vital-statistics-export"
390
390
  ]);
391
391
  var scopeByEvent = z7.preprocess(
392
392
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -404,7 +404,9 @@ var userRole = z7.preprocess(
404
404
  ).describe("User role, e.g. admin, field agent");
405
405
  var scopeOptionsPlaceEvent = z7.object({
406
406
  event: scopeByEvent,
407
- placeOfEvent: JurisdictionFilter.optional()
407
+ placeOfEvent: JurisdictionFilter.optional(),
408
+ createdBy: UserFilter.optional(),
409
+ createdIn: JurisdictionFilter.optional()
408
410
  }).describe("Options applicable to all record scopes.");
409
411
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
410
412
  notifiedIn: JurisdictionFilter.optional(),
@@ -447,7 +449,9 @@ var AllScopeOptions = z7.object({
447
449
  var ScopeOptionKey = AllScopeOptions.keyof();
448
450
  var ResolvedScopeOptionsPlaceEvent = z7.object({
449
451
  event: scopeByEvent,
450
- placeOfEvent: UUID.nullish()
452
+ placeOfEvent: UUID.nullish(),
453
+ createdBy: z7.string().optional(),
454
+ createdIn: UUID.nullish()
451
455
  }).describe(
452
456
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
453
457
  );
@@ -494,6 +498,13 @@ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
494
498
  "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."
495
499
  )
496
500
  });
501
+ var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
502
+ "record.action.accept",
503
+ "record.action.reject"
504
+ ]);
505
+ var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
506
+ "Options for confirming (accepting or rejecting) an action."
507
+ );
497
508
  var RecordScopeV2 = z7.discriminatedUnion("type", [
498
509
  z7.object({
499
510
  type: ScopesWithPlaceEventOptions,
@@ -514,6 +525,10 @@ var RecordScopeV2 = z7.discriminatedUnion("type", [
514
525
  z7.object({
515
526
  type: z7.literal("record.print-certified-copies"),
516
527
  options: ScopeOptionsPrintCertifiedCopies.optional()
528
+ }),
529
+ z7.object({
530
+ type: ActionConfirmationScopeType,
531
+ options: ActionConfirmationScopeOptions.optional()
517
532
  })
518
533
  ]).describe(
519
534
  "Scopes used to check user's permission to perform actions on a record."
@@ -736,7 +751,7 @@ var getUserIdFromToken = (token) => {
736
751
  return null;
737
752
  }
738
753
  };
739
- var SERVICE_USER_ID = "__SERVICE_USER__";
754
+ var SERVICE_USER_ID = "00000000-0000-4000-8000-000000000002";
740
755
  function isServiceToken(credentials) {
741
756
  return typeof credentials === "object" && credentials !== null && credentials.sub === SERVICE_USER_ID;
742
757
  }