@sap/cds-dk 6.8.2 → 7.0.0

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 (218) hide show
  1. package/bin/activate.js +15 -7
  2. package/bin/add.js +29 -15
  3. package/bin/bind.js +49 -116
  4. package/bin/build.js +114 -0
  5. package/bin/cds.js +67 -24
  6. package/bin/compile/index.js +2 -2
  7. package/bin/deploy/index.js +46 -39
  8. package/bin/deploy/to-hana.js +11 -8
  9. package/bin/deploy/to-postgres.js +8 -2
  10. package/bin/deploy/to-sqlite.js +0 -1
  11. package/bin/env.js +75 -41
  12. package/bin/eval.js +3 -3
  13. package/bin/extend.js +17 -10
  14. package/bin/help.js +22 -21
  15. package/bin/import.js +10 -7
  16. package/bin/init.js +38 -17
  17. package/bin/login.js +69 -55
  18. package/bin/logout.js +12 -9
  19. package/bin/migrate.js +10 -4
  20. package/bin/pull.js +12 -5
  21. package/bin/push.js +24 -13
  22. package/bin/repl.js +1 -0
  23. package/bin/run.js +25 -0
  24. package/bin/subscribe.js +13 -8
  25. package/bin/unsubscribe.js +15 -8
  26. package/bin/upgrade.js +15 -9
  27. package/bin/util/log.js +24 -0
  28. package/bin/version.js +124 -0
  29. package/bin/watch.js +1 -35
  30. package/bin/watched.js +39 -0
  31. package/lib/bind/KubernetesApiAccessor.js +2 -2
  32. package/lib/bind/bindingManager.js +1 -1
  33. package/lib/bind/bindingUtil.js +0 -9
  34. package/lib/bind/cfKeyProvider.js +10 -72
  35. package/lib/bind/index.js +114 -0
  36. package/lib/bind/kubernetesCredentialsProvider.js +2 -2
  37. package/lib/bind/userCdsrcJsonStorageProvider.js +7 -44
  38. package/lib/build/buildTaskEngine.js +355 -0
  39. package/lib/build/buildTaskFactory.js +284 -0
  40. package/lib/build/buildTaskHandler.js +240 -0
  41. package/lib/build/buildTaskProvider.js +22 -0
  42. package/lib/build/buildTaskProviderFactory.js +182 -0
  43. package/lib/build/constants.js +56 -0
  44. package/lib/build/index.js +21 -0
  45. package/lib/build/provider/buildTaskHandlerEdmx.js +83 -0
  46. package/lib/build/provider/buildTaskHandlerFeatureToggles.js +132 -0
  47. package/lib/build/provider/buildTaskHandlerInternal.js +228 -0
  48. package/lib/build/provider/buildTaskProviderInternal.js +370 -0
  49. package/lib/build/provider/fiori/index.js +167 -0
  50. package/lib/build/provider/hana/2migration.js +179 -0
  51. package/lib/build/provider/hana/index.js +522 -0
  52. package/lib/build/provider/hana/migrationtable.js +472 -0
  53. package/lib/build/provider/hana/template/.hdiconfig-all +163 -0
  54. package/lib/build/provider/hana/template/.hdiconfig-cloud +137 -0
  55. package/lib/build/provider/hana/template/.hdinamespace +4 -0
  56. package/lib/build/provider/hana/template/package.json +12 -0
  57. package/lib/build/provider/hana/template/undeploy.json +5 -0
  58. package/lib/build/provider/java/index.js +93 -0
  59. package/lib/build/provider/java-cf/index.js +1 -0
  60. package/lib/build/provider/mtx/index.js +37 -0
  61. package/lib/build/provider/mtx/resourcesTarBuilder.js +94 -0
  62. package/lib/build/provider/mtx-extension/index.js +131 -0
  63. package/lib/build/provider/mtx-sidecar/index.js +138 -0
  64. package/lib/build/provider/node-cf/index.js +1 -0
  65. package/lib/build/provider/nodejs/index.js +178 -0
  66. package/lib/build/util.js +263 -0
  67. package/lib/cds.js +9 -21
  68. package/lib/client/auth_manager.js +39 -16
  69. package/lib/client/helper/dependency_helper.js +7 -6
  70. package/lib/client/push.js +2 -1
  71. package/lib/client/settings_manager.js +10 -39
  72. package/lib/deploy/to-hana/hana.js +273 -0
  73. package/lib/deploy/to-hana/hdiDeployUtil.js +68 -0
  74. package/lib/deploy/to-hana/mtaUtil.js +171 -0
  75. package/lib/import/asyncapi/importAsyncAPI.js +3 -2
  76. package/lib/import/asyncapi/index.js +5 -2
  77. package/lib/import/asyncapi/parserContext.js +67 -26
  78. package/lib/import/asyncapi/utils.js +34 -3
  79. package/lib/import/common.js +40 -30
  80. package/lib/import/importapi.js +36 -35
  81. package/lib/index.js +12 -17
  82. package/lib/init/constants.js +36 -71
  83. package/lib/init/index.js +18 -52
  84. package/lib/init/template/_merging/registry-mta.js +21 -3
  85. package/lib/init/template/approuter/files/mta.yaml.hbs +29 -29
  86. package/lib/init/template/approuter/files/values.yaml.hbs +5 -5
  87. package/lib/init/template/approuter/files/xs-app.json.hbs +8 -2
  88. package/lib/init/template/approuter/index.js +7 -8
  89. package/lib/init/template/auditlog/files/mta.yaml.hbs +5 -5
  90. package/lib/init/template/auditlog/files/package.json.hbs +13 -13
  91. package/lib/init/template/auditlog/index.js +3 -3
  92. package/lib/init/template/cf-manifest/files/manifest.yml.hbs +22 -22
  93. package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +3 -3
  94. package/lib/init/template/connectivity/files/mta.yaml.hbs +14 -0
  95. package/lib/init/template/connectivity/files/package.json.hbs +17 -0
  96. package/lib/init/template/connectivity/index.js +21 -4
  97. package/lib/init/template/data/index.js +5 -1
  98. package/lib/init/template/destination/files/mta.yaml.hbs +14 -0
  99. package/lib/init/template/destination/files/package.json.hbs +17 -0
  100. package/lib/init/template/{destinations → destination}/index.js +19 -13
  101. package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +3 -3
  102. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +5 -5
  103. package/lib/init/template/enterprise-messaging/files/package.json.hbs +9 -9
  104. package/lib/init/template/enterprise-messaging/files/xs-security.json.hbs +19 -0
  105. package/lib/init/template/enterprise-messaging/index.js +27 -6
  106. package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +3 -3
  107. package/lib/init/template/enterprise-messaging-shared/files/mta.yaml.hbs +5 -5
  108. package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +9 -9
  109. package/lib/init/template/enterprise-messaging-shared/index.js +4 -5
  110. package/lib/init/template/extensibility/files/package.json.hbs +10 -10
  111. package/lib/init/template/extensibility/index.js +8 -9
  112. package/lib/init/template/file-based-messaging/files/package.json.hbs +9 -9
  113. package/lib/init/template/file-based-messaging/index.js +3 -4
  114. package/lib/init/template/hana/files/db/package.json +1 -1
  115. package/lib/init/template/hana/files/mta.yaml.hbs +21 -21
  116. package/lib/init/template/hana/files/package.json.hbs +16 -22
  117. package/lib/init/template/hana/files/values.yaml.hbs +1 -1
  118. package/lib/init/template/hana/index.js +5 -15
  119. package/lib/init/template/helm/files/Chart.yaml.hbs +4 -4
  120. package/lib/init/template/helm/files/values.yaml.hbs +6 -6
  121. package/lib/init/template/helm/index.js +5 -10
  122. package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +2 -0
  123. package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +37 -31
  124. package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +13 -14
  125. package/lib/init/template/helm/subcharts/content-deployment/templates/secret.yaml +2 -2
  126. package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +1 -1
  127. package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
  128. package/lib/init/template/helm/subcharts/content-deployment/values.md +116 -116
  129. package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +2 -0
  130. package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +9 -9
  131. package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +2 -2
  132. package/lib/init/template/helm/subcharts/service-instance/values.md +15 -15
  133. package/lib/init/template/helm/subcharts/web-application/Chart.yaml +2 -0
  134. package/lib/init/template/helm/subcharts/web-application/templates/NOTES.txt +15 -0
  135. package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +23 -23
  136. package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
  137. package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +17 -17
  138. package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +24 -3
  139. package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
  140. package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +2 -2
  141. package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
  142. package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +3 -3
  143. package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +3 -3
  144. package/lib/init/template/helm/subcharts/web-application/values.md +141 -123
  145. package/lib/init/template/helm/subcharts/web-application/values.schema.json +7 -0
  146. package/lib/init/template/helm/subcharts/web-application/values.yaml +1 -0
  147. package/lib/init/template/html5-repo/index.js +4 -5
  148. package/lib/init/template/java/index.js +5 -5
  149. package/lib/init/template/kibana-logging/files/mta.yaml.hbs +5 -5
  150. package/lib/init/template/kibana-logging/files/package.json.hbs +9 -9
  151. package/lib/init/template/kibana-logging/index.js +3 -4
  152. package/lib/init/template/lint/index.js +3 -3
  153. package/lib/init/template/mta/files/mta.yaml.hbs +14 -14
  154. package/lib/init/template/mta/files/package.json +5 -0
  155. package/lib/init/template/mta/index.js +12 -13
  156. package/lib/init/template/mtx/index.js +2 -2
  157. package/lib/init/template/multitenancy/files/mta.yaml.hbs +29 -27
  158. package/lib/init/template/multitenancy/files/package.json.hbs +17 -14
  159. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +7 -7
  160. package/lib/init/template/multitenancy/files/values.yaml.hbs +19 -19
  161. package/lib/init/template/multitenancy/index.js +14 -16
  162. package/lib/init/template/nodejs/files/package.json.hbs +1 -1
  163. package/lib/init/template/nodejs/index.js +5 -8
  164. package/lib/init/template/redis-messaging/files/mta.yaml.hbs +5 -5
  165. package/lib/init/template/redis-messaging/files/package.json.hbs +9 -9
  166. package/lib/init/template/redis-messaging/index.js +4 -5
  167. package/lib/init/template/sample/files/app/_i18n/i18n.properties +43 -0
  168. package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +14 -0
  169. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +114 -0
  170. package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +8 -0
  171. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +11 -0
  172. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +129 -0
  173. package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +57 -0
  174. package/lib/init/template/sample/files/app/common.cds +263 -0
  175. package/lib/init/template/sample/files/app/index.html +30 -0
  176. package/lib/init/template/sample/files/app/services.cds +5 -0
  177. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -0
  178. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -0
  179. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -0
  180. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -0
  181. package/lib/init/template/sample/files/db/schema.cds +31 -0
  182. package/lib/init/template/sample/files/nodejs/admin-service.js +12 -0
  183. package/lib/init/template/sample/files/nodejs/cat-service.js +26 -0
  184. package/lib/init/template/sample/files/srv/admin-service.cds +5 -0
  185. package/lib/init/template/sample/files/srv/cat-service.cds +16 -0
  186. package/lib/init/template/sample/index.js +24 -0
  187. package/lib/init/template/sample-tiny/index.js +39 -0
  188. package/lib/init/template/samples/index.js +5 -56
  189. package/lib/init/template/sqlite/files/package.json.hbs +13 -13
  190. package/lib/init/template/sqlite/index.js +2 -2
  191. package/lib/init/template/templateBase.js +24 -1
  192. package/lib/init/template/toggles/files/package.json.hbs +10 -10
  193. package/lib/init/template/toggles/index.js +3 -3
  194. package/lib/init/template/typer/files/gitignore +1 -0
  195. package/lib/init/template/typer/files/package.json +8 -0
  196. package/lib/init/template/typer/files/xsconfig.json +9 -0
  197. package/lib/init/template/typer/index.js +36 -0
  198. package/lib/init/template/xsuaa/files/mta.yaml.hbs +12 -12
  199. package/lib/init/template/xsuaa/files/package.json.hbs +13 -13
  200. package/lib/init/template/xsuaa/files/values.yaml.hbs +8 -8
  201. package/lib/init/template/xsuaa/index.js +8 -19
  202. package/lib/init/util/merge.js +73 -59
  203. package/lib/init/util/mvn.js +21 -17
  204. package/lib/init/util/projectReader.js +49 -87
  205. package/lib/init/util/xml.js +14 -23
  206. package/lib/util/cfUtil.js +366 -0
  207. package/lib/util/command.js +3 -3
  208. package/lib/util/gitUtil.js +55 -0
  209. package/lib/util/version.js +27 -0
  210. package/npm-shrinkwrap.json +339 -277
  211. package/package.json +6 -6
  212. package/CHANGELOG.md +0 -1453
  213. package/bin/build/all.js +0 -88
  214. package/bin/build/index.js +0 -82
  215. package/lib/compile/index.js +0 -14
  216. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data/my.bookshop-Books.csv +0 -0
  217. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data-model.cds +0 -0
  218. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/srv/cat-service.cds.hbs +0 -0
package/bin/build/all.js DELETED
@@ -1,88 +0,0 @@
1
- module.exports = Object.assign(build, {
2
- options: ['--project', '--for', '--use', '--src', '--dest', '--options-model'],
3
- flags: ['--clean'],
4
- shortcuts: ['-in', '4', '', '', '-o'],
5
- help: `
6
- # SYNOPSIS
7
-
8
- *cds build/all* [<options>]
9
-
10
- **Deprecated - use cds build instead.**
11
-
12
- Builds the modules by compiling contained cds sources.
13
- The modules are folders in the project root.
14
- Cleaning the build target is always performed before actual build starts,
15
- the --clean option has been deprecated.
16
-
17
-
18
- # OPTIONS
19
-
20
- *-in* | *--project* <folder>
21
-
22
- use the specified folder as the project root.
23
- default = current working directory ./
24
-
25
- *-4* | *--for* <target>
26
-
27
- alias used to build the source, e.g. hana -> @sap/cds/build/hana.
28
-
29
- *--src*
30
-
31
- source folder used as build input
32
-
33
- *-o* | *--dest* <folder>
34
-
35
- writes output to the given folder. The folder is resolved based on "<project>/<cds.env.build.target>".
36
-
37
-
38
- *--options-model*
39
-
40
- list of root folders or files loaded defining the cds model.
41
-
42
-
43
- # EXAMPLES
44
-
45
- *cds* build/all
46
- *cds* build/all -o target
47
- *cds* build/all --for hana --src db --dest target --options-model db,srv,app
48
- `
49
- })
50
-
51
- async function build([project], options = {}) {
52
- options.project = options.project || project
53
- // switch-off error logging as CLI is logging any exceptions by default
54
- // otherwise errors are logged twice
55
- options.cli = true
56
-
57
- // remove/migrate deprecated CLI options of cds build and cds build/all
58
- if (options.clean === "false") {
59
- // eslint-disable-next-line no-console
60
- console.warn("[cds] - CLI option 'clean' is deprecated - build output folders are always cleaned before build.\n")
61
- }
62
-
63
- if (typeof options["options-model"] === "string") {
64
- options.opts = "model=[" + options["options-model"].split(",").map((entry) => entry.trim()) + "]"
65
- delete options["options-model"]
66
- }
67
-
68
- const cds = require('../../lib/cds')
69
- try {
70
- if (!cds.build) {
71
- const { CliError } = require('../../lib/client/helper/errors')
72
- throw new CliError('This application uses @sap/cds version >= 7, which is not compatible with the installed @sap/cds-dk version 6. Either update @sap/cds-dk to version 7 or downgrade @sap/cds to version 6 instead.')
73
- }
74
- if (typeof cds.build === 'function') {
75
- return await cds.build(options)
76
- }
77
- console.warn(`
78
- > WARNING: This application uses a very old version ${cds.version} of package '@sap/cds',
79
- > which will no longer be supported with the next major version of '@sap/cds-dk'.
80
- > We strongly recommend an upgrade to latest version 6 of '@sap/cds'.
81
- `)
82
- return await cds.build.build(options)
83
- } catch (e) {
84
- process.exitCode = 1
85
- cds._log(e.errors?.length ? e.errors : e, { 'log-level': cds.env.log.levels.cli })
86
- }
87
-
88
- }
@@ -1,82 +0,0 @@
1
- module.exports = Object.assign(build, {
2
- options: ['--clean', '--project', '--src', '--dest', '--for', '--use', '--opts', '--log-level', '--dry', '--options-model'],
3
- shortcuts: ['-c', '-in', '-s', '-o', '-4'],
4
- help: `
5
- # SYNOPSIS
6
-
7
- *cds build* [<project>] [<options>]
8
-
9
- Builds all modules in the current project by compiling contained CDS sources.
10
- The modules are folders in the project root directory. All well known modules (db, srv, app)
11
- or those configured by build tasks defined in _package.json_ or _.cdsrc.json_ are built.
12
-
13
- # OPTIONS
14
-
15
- *-4 | --for* hana | java | nodejs | mtx
16
-
17
- Name of the build task that is applied to the source folder, either explicitly configured in
18
- the build task list or generated out of the project setup
19
- For example, the "hana" build task will create SAP HANA artefacts.
20
- The module folder can be defined using option "--src", a default is used otherwise.
21
-
22
- *-s | --src* <folder>
23
-
24
- The module folder to build using the build task defined by option "--for".
25
- This option is only supported when building an individual module of the project.
26
- The folder is resolved based on "<project>/<cds.env.build.target>".
27
- A default is used based on the type of the build task, for example, the folder "db" is used for a
28
- "hana" build task, "srv" for "nodejs" or "java" build task.
29
-
30
- *-o | --dest* <folder>
31
-
32
- Output folder of the build task. The type of build task is defined by option "--for".
33
- The folder is resolved based on "<project>/<cds.env.build.target>".
34
- Default - folder defined by option "--src".
35
- Note: <cds.env.build.target> can be configured in _.cdsrc.json_ or _package.json_.
36
- For Node.js projects "gen" is used by default. The output is written to "<project>/gen/*<dest>*/*".
37
- For Java projects "." is used by default. The output is written to "<project>/*<dest>*/*".
38
-
39
- *--opts* <build task specific options>
40
-
41
- Add a comma-separated list of build task specific options in the format <opt1>=[value1,value2],<opt2>=value.
42
- For example, --opts model=[db,srv,schema.cds] loads and compiles the CDS model based on the given sources.
43
-
44
- *--log-level* <debug | info | warn | error>
45
-
46
- Choose which level of cds build messages to log, default is *warn*.
47
-
48
- *--production*
49
-
50
- Builds the project using the "production" profile - same when NODE_ENV environment variable is set to "production".
51
- E.g. HANA deployment artefacts will be created if "sql" has been set as database kind in cds configuration.
52
-
53
- *-in | --project* [<project>]
54
-
55
- Runs _cds build_ for the specified project, default is current working directory.
56
-
57
- *-c | --clean* deprecated
58
-
59
- Incremental builds are not supported.
60
- Build output folders are always cleaned before build.
61
-
62
-
63
- # EXAMPLES
64
-
65
- *cds* build
66
- *cds* build --production
67
- *cds* build --log-level info
68
- *cds* build --for hana
69
- *cds* build --for java --dest ../srv/target --opts model=[db/model,srv,schema]
70
- `})
71
-
72
- /**
73
- * Redirect to modular build system.
74
- */
75
- function build(project, options = {}) {
76
- if (options.dry) {
77
- // eslint-disable-next-line no-console
78
- console.warn("[cds] - CLI option 'dry' is no longer supported.\n")
79
- delete options.dry
80
- }
81
- return require('./all')(project, options)
82
- }
@@ -1,14 +0,0 @@
1
- const cds = require('../cds')
2
- const comp_to = cds.compile.to
3
- const { defineProperty } = Object
4
-
5
- 'xsuaa' in comp_to || defineProperty (comp_to, 'xsuaa', {enumerable:true, get:()=> require('./to-xsuaa')})
6
- 'openapi' in comp_to || defineProperty (comp_to, 'openapi', {enumerable:true, get:()=> require('./openapi')})
7
- 'asyncapi' in comp_to || defineProperty (comp_to, 'asyncapi', {enumerable:true, get:()=> require('./asyncapi')})
8
-
9
- 'edmx-v2' in comp_to || defineProperty (comp_to, 'edmx-v2', {enumerable:true, value: (csn,o) => comp_to.edmx(csn,{...o,flavor:'v2'})})
10
- 'edmx-v4' in comp_to || defineProperty (comp_to, 'edmx-v4', {enumerable:true, value: (csn,o) => comp_to.edmx(csn,{...o,flavor:'v4'})})
11
- 'edmx-w4' in comp_to || defineProperty (comp_to, 'edmx-w4', {enumerable:true, value: (csn,o) => comp_to.edmx(csn,{...o,flavor:'w4'})})
12
- 'edmx-x4' in comp_to || defineProperty (comp_to, 'edmx-x4', {enumerable:true, value: (csn,o) => comp_to.edmx(csn,{...o,flavor:'x4'})})
13
-
14
- module.exports = cds