@opencrvs/toolkit 2.0.0-rc.fef9d21 → 2.0.0-rc.ff777d6

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 (59) hide show
  1. package/create-countryconfig/index.js +103 -0
  2. package/create-countryconfig/package.json +21 -0
  3. package/dist/application-config/index.js +306 -130
  4. package/dist/cli.js +548 -178
  5. package/dist/commons/api/router.d.ts +3379 -239
  6. package/dist/commons/application-config/index.d.ts +17 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  8. package/dist/commons/conditionals/validate.d.ts +52 -2
  9. package/dist/commons/events/ActionDocument.d.ts +6 -0
  10. package/dist/commons/events/ActionInput.d.ts +114 -0
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  12. package/dist/commons/events/Draft.d.ts +4 -2
  13. package/dist/commons/events/EventDocument.d.ts +3 -0
  14. package/dist/commons/events/EventIndex.d.ts +0 -3
  15. package/dist/commons/events/EventMetadata.d.ts +0 -7
  16. package/dist/commons/events/FieldConfig.d.ts +387 -50
  17. package/dist/commons/events/FieldValue.d.ts +6 -0
  18. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  19. package/dist/commons/events/field.d.ts +53 -1
  20. package/dist/commons/events/index.d.ts +2 -0
  21. package/dist/commons/events/locations.d.ts +38 -1
  22. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  23. package/dist/commons/events/scopes.d.ts +24 -1
  24. package/dist/commons/events/state/flags.d.ts +16 -0
  25. package/dist/commons/events/state/index.d.ts +0 -4
  26. package/dist/commons/events/state/utils.d.ts +12 -289
  27. package/dist/commons/events/utils.d.ts +13 -2
  28. package/dist/conditionals/index.js +92 -9
  29. package/dist/events/index.js +1085 -262
  30. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  32. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  33. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  34. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  35. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  36. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  37. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  38. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  39. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  40. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  41. package/dist/migrations/v2.0/index.d.ts +5 -3
  42. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/index.js +546 -176
  44. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  46. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  47. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  48. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  49. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  50. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  51. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  52. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  53. package/dist/notification/index.js +842 -161
  54. package/dist/scopes/index.d.ts +91 -16
  55. package/dist/scopes/index.js +55 -12
  56. package/opencrvs-toolkit-2.0.0-rc.ff777d6.tgz +0 -0
  57. package/package.json +6 -2
  58. package/tsconfig.tsbuildinfo +1 -1
  59. package/opencrvs-toolkit-2.0.0-rc.fef9d21.tgz +0 -0
@@ -0,0 +1,103 @@
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 COUNTRYCONFIG_REPO_URL =
19
+ 'https://github.com/opencrvs/opencrvs-countryconfig.git'
20
+ const INFRASTRUCTURE_REPO_URL =
21
+ 'https://github.com/opencrvs/infrastructure.git'
22
+
23
+ const projectName = process.argv[2]
24
+
25
+ if (!projectName) {
26
+ console.error(
27
+ 'Please specify a project name:\n\n npm create @opencrvs/countryconfig <project-name>\n'
28
+ )
29
+ process.exit(1)
30
+ }
31
+
32
+ const countryconfigDirName = projectName + '-countryconfig'
33
+ const infrastructureDirName = projectName + '-infrastructure'
34
+
35
+ const countryconfigTargetDir = path.resolve(process.cwd(), countryconfigDirName)
36
+ const infrastructureTargetDir = path.resolve(process.cwd(), infrastructureDirName)
37
+
38
+ if (fs.existsSync(countryconfigTargetDir)) {
39
+ console.error('Error: Directory "' + countryconfigDirName + '" already exists.')
40
+ process.exit(1)
41
+ }
42
+
43
+ if (fs.existsSync(infrastructureTargetDir)) {
44
+ console.error('Error: Directory "' + infrastructureDirName + '" already exists.')
45
+ process.exit(1)
46
+ }
47
+
48
+ console.log('\nScaffolding OpenCRVS country config in ./' + countryconfigDirName + '...\n')
49
+
50
+ try {
51
+ execSync('git clone --depth 1 ' + COUNTRYCONFIG_REPO_URL + ' ' + countryconfigDirName, { stdio: 'inherit' })
52
+ } catch (err) {
53
+ console.error('Failed to clone the country config repository:', err.message)
54
+ process.exit(1)
55
+ }
56
+
57
+ try {
58
+ fs.rmSync(path.join(countryconfigTargetDir, '.git'), { recursive: true, force: true })
59
+ } catch (err) {
60
+ console.error('Failed to remove .git directory from country config:', err.message)
61
+ process.exit(1)
62
+ }
63
+
64
+ const pkgPath = path.join(countryconfigTargetDir, 'package.json')
65
+ if (fs.existsSync(pkgPath)) {
66
+ try {
67
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
68
+ pkg.name = countryconfigDirName
69
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
70
+ } catch (err) {
71
+ console.error('Failed to update package.json:', err.message)
72
+ process.exit(1)
73
+ }
74
+ } else {
75
+ console.warn('Warning: No package.json found in the cloned country config repository. Project name was not updated.')
76
+ }
77
+
78
+ console.log('\nScaffolding OpenCRVS infrastructure in ./' + infrastructureDirName + '...\n')
79
+
80
+ try {
81
+ execSync('git clone --depth 1 ' + INFRASTRUCTURE_REPO_URL + ' ' + infrastructureDirName, { stdio: 'inherit' })
82
+ } catch (err) {
83
+ console.error('Failed to clone the infrastructure repository:', err.message)
84
+ process.exit(1)
85
+ }
86
+
87
+ try {
88
+ fs.rmSync(path.join(infrastructureTargetDir, '.git'), { recursive: true, force: true })
89
+ } catch (err) {
90
+ console.error('Failed to remove .git directory from infrastructure:', err.message)
91
+ process.exit(1)
92
+ }
93
+
94
+ console.log('\nDone! Your project has been set up in two directories:\n')
95
+ console.log(' ./' + countryconfigDirName + ' -- country configuration')
96
+ console.log(' ./' + infrastructureDirName + ' -- server infrastructure\n')
97
+ console.log('To get started with the country config:\n')
98
+ console.log(' cd ' + countryconfigDirName)
99
+ console.log(' git init')
100
+ console.log(' npm install\n')
101
+ console.log('To get started with the infrastructure:\n')
102
+ console.log(' cd ' + infrastructureDirName)
103
+ console.log(' git init\n')
@@ -0,0 +1,21 @@
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
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/opencrvs/opencrvs-core.git"
11
+ },
12
+ "files": [
13
+ "index.js"
14
+ ],
15
+ "keywords": [
16
+ "opencrvs",
17
+ "countryconfig",
18
+ "create"
19
+ ],
20
+ "license": "MPL-2.0"
21
+ }