@opencrvs/toolkit 2.0.0-rc.bee2b7b → 2.0.0-rc.bf6bf6b

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 (84) hide show
  1. package/create-countryconfig/index.js +73 -0
  2. package/create-countryconfig/package.json +11 -0
  3. package/dist/application-config/index.js +15 -14
  4. package/dist/cli.js +1774 -368
  5. package/dist/commons/api/router.d.ts +55 -54
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  8. package/dist/commons/events/FieldConfig.d.ts +10 -0
  9. package/dist/commons/events/locations.d.ts +21 -0
  10. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  11. package/dist/commons/events/scopes.d.ts +24 -1
  12. package/dist/conditionals/index.js +11 -10
  13. package/dist/events/index.js +66 -10
  14. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  15. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  16. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  17. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  18. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  19. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  20. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  21. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -14
  22. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  23. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  24. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  25. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  26. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  27. package/dist/migrations/v2.0/create-events-index.js +1 -2
  28. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
  29. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
  31. package/dist/migrations/v2.0/index.d.ts +10 -4
  32. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  33. package/dist/migrations/v2.0/index.js +1742 -365
  34. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  35. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  36. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
  37. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  38. package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
  39. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  40. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  41. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  42. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/migrate-scopes.js +6 -7
  44. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  46. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  47. package/dist/migrations/v2.0/migrate-workqueue-configs.js +143 -63
  48. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  50. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  51. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  52. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  53. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  54. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  55. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  56. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  57. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  58. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  59. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  60. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  61. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  62. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  63. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  64. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  65. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  66. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  67. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  68. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  69. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  70. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  71. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  72. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  73. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  74. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  75. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  76. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  77. package/dist/migrations/v2.0/update-package-json.js +105 -0
  78. package/dist/notification/index.js +11 -10
  79. package/dist/scopes/index.d.ts +8 -1
  80. package/dist/scopes/index.js +11 -10
  81. package/opencrvs-toolkit-2.0.0-rc.bf6bf6b.tgz +0 -0
  82. package/package.json +1 -1
  83. package/tsconfig.tsbuildinfo +1 -1
  84. package/opencrvs-toolkit-2.0.0-rc.bee2b7b.tgz +0 -0
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+
3
+ /*
4
+ * This Source Code Form is subject to the terms of the Mozilla Public
5
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
+ *
8
+ * OpenCRVS is also distributed under the terms of the Civil Registration
9
+ * & Healthcare Disclaimer located at http://opencrvs.org/license.
10
+ *
11
+ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
12
+ */
13
+
14
+ const { execSync } = require('child_process')
15
+ const path = require('path')
16
+ const fs = require('fs')
17
+
18
+ const REPO_URL = 'https://github.com/opencrvs/opencrvs-countryconfig.git'
19
+
20
+ const projectName = process.argv[2]
21
+
22
+ if (!projectName) {
23
+ console.error(
24
+ 'Please specify a project name:\n\n npm create @opencrvs/countryconfig <project-name>\n'
25
+ )
26
+ process.exit(1)
27
+ }
28
+
29
+ const targetDir = path.resolve(process.cwd(), projectName)
30
+
31
+ if (fs.existsSync(targetDir)) {
32
+ console.error(`Error: Directory "${projectName}" already exists.`)
33
+ process.exit(1)
34
+ }
35
+
36
+ console.log(`\nScaffolding OpenCRVS country config in ./${projectName}...\n`)
37
+
38
+ try {
39
+ execSync(`git clone --depth 1 ${REPO_URL} ${projectName}`, {
40
+ stdio: 'inherit'
41
+ })
42
+ } catch (err) {
43
+ console.error('Failed to clone the repository:', err.message)
44
+ process.exit(1)
45
+ }
46
+
47
+ try {
48
+ fs.rmSync(path.join(targetDir, '.git'), { recursive: true, force: true })
49
+ } catch (err) {
50
+ console.error('Failed to remove .git directory:', err.message)
51
+ process.exit(1)
52
+ }
53
+
54
+ const pkgPath = path.join(targetDir, 'package.json')
55
+ if (fs.existsSync(pkgPath)) {
56
+ try {
57
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
58
+ pkg.name = projectName
59
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
60
+ } catch (err) {
61
+ console.error('Failed to update package.json:', err.message)
62
+ process.exit(1)
63
+ }
64
+ } else {
65
+ console.warn(
66
+ `Warning: No package.json found in the cloned repository. Project name was not updated.`
67
+ )
68
+ }
69
+
70
+ console.log(`\nDone! To get started:\n`)
71
+ console.log(` cd ${projectName}`)
72
+ console.log(` git init`)
73
+ console.log(` npm install\n`)
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@opencrvs/create-countryconfig",
3
+ "version": "1.0.0",
4
+ "description": "Scaffold a new OpenCRVS country configuration",
5
+ "bin": {
6
+ "create-countryconfig": "./index.js"
7
+ },
8
+ "files": ["index.js"],
9
+ "keywords": ["opencrvs", "countryconfig", "create"],
10
+ "license": "MPL-2.0"
11
+ }
@@ -683,6 +683,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
683
683
  var AccessLevelOptions = z11.object({
684
684
  accessLevel: JurisdictionFilter.optional()
685
685
  });
686
+ var AllUserScopeOptions = AccessLevelOptions.extend({
687
+ role: userRole.optional()
688
+ });
686
689
  var WorkqueueOrDashboardOptions = z11.object({
687
690
  ids: z11.preprocess(
688
691
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -692,6 +695,7 @@ var WorkqueueOrDashboardOptions = z11.object({
692
695
  var AllScopeOptions = z11.object({
693
696
  ...AllRecordScopeOptions.shape,
694
697
  ...AccessLevelOptions.shape,
698
+ ...AllUserScopeOptions.shape,
695
699
  ...WorkqueueOrDashboardOptions.shape
696
700
  });
697
701
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -768,27 +772,24 @@ var SystemScopeType = z11.enum([
768
772
  "organisation.read-locations",
769
773
  "user.read",
770
774
  "user.create",
771
- "user.edit"
775
+ "user.edit",
776
+ "user.search"
772
777
  ]);
773
778
  var UserScopeType = SystemScopeType.extract([
774
779
  "user.read",
775
780
  "user.create",
776
- "user.edit"
781
+ "user.edit",
782
+ "user.search"
777
783
  ]);
778
784
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
779
785
  var UserScopeV2 = z11.discriminatedUnion("type", [
780
786
  z11.object({
781
787
  type: ScopesWithRoleOption,
782
- options: z11.object({
783
- accessLevel: JurisdictionFilter.optional(),
784
- role: userRole.optional()
785
- }).optional()
788
+ options: AllUserScopeOptions.optional()
786
789
  }),
787
790
  z11.object({
788
- type: UserScopeType.extract(["user.read"]),
789
- options: z11.object({
790
- accessLevel: JurisdictionFilter.optional()
791
- }).optional()
791
+ type: UserScopeType.extract(["user.read", "user.search"]),
792
+ options: AccessLevelOptions.optional()
792
793
  })
793
794
  ]);
794
795
  var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
@@ -2107,8 +2108,8 @@ var ApplicationConfig = z20.object({
2107
2108
  })
2108
2109
  ),
2109
2110
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2110
- USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2111
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2111
+ USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2112
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2112
2113
  SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
2113
2114
  ADDITIONAL_USER_FIELDS: z20.array(FieldConfig).optional().default([])
2114
2115
  });
@@ -2126,8 +2127,8 @@ var BackgroundConfig = z20.object({
2126
2127
  var LoginConfig = z20.object({
2127
2128
  COUNTRY: z20.string(),
2128
2129
  LANGUAGES: z20.array(z20.string()),
2129
- USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2130
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2130
+ USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2131
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2131
2132
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2132
2133
  LOGIN_BACKGROUND: BackgroundConfig,
2133
2134
  SENTRY: z20.string().optional()