@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/login.js CHANGED
@@ -9,60 +9,63 @@ module.exports = Object.assign(login, {
9
9
 
10
10
  *cds login* [ <app-url> ]
11
11
 
12
- Simplifies usage of multitenancy-related commands (e.g. *cds subscribe* and *cds push*)
13
- by providing them with automatic authentication: fetches and saves authentication
14
- tokens and provides relevant tokens to those commands. Alternatively saves username
15
- for apps running locally.
12
+ Simplifies usage of multitenancy-related commands (e.g. *cds subscribe* and
13
+ *cds push*) by providing them with automatic authentication: fetches and
14
+ saves authentication tokens and provides relevant tokens to those commands.
15
+ Alternatively saves username for apps running locally.
16
16
 
17
- Saves further settings for the current project (<app-url>, <tenant-subdomain>, and
18
- URLs for passcodes and tokens).
17
+ Saves further settings for the current project (<app-url>,
18
+ <tenant-subdomain>, and URLs for passcodes and tokens).
19
19
 
20
20
  *Multiple targets*
21
21
 
22
- When re-running this command with different app URLs and subdomains, previous
23
- logins are not affected, allowing simultaneous logins to different API endpoints
24
- on SAP Business Technology Platform, Cloud Foundry environment.
25
- *cds extend* and *cds activate* will be authenticated according to the given target.
22
+ When re-running this command with different app URLs and subdomains,
23
+ previous logins are not affected, allowing simultaneous logins to different
24
+ API endpoints on SAP Business Technology Platform, Cloud Foundry
25
+ environment. *cds pull* and *cds push* will be authenticated according
26
+ to the given target.
26
27
 
27
- If the Cloud-Foundry command-line client is installed, the SaaS-app URL <app-url>
28
- may be omitted. In that case, suitable apps from the org and space you're currently
29
- logged in to will be presented to determine <app-url>.
28
+ If the Cloud-Foundry command-line client is installed, the SaaS-app URL
29
+ <app-url> may be omitted. In that case, suitable apps from the org and space
30
+ you're currently logged in to will be presented to determine <app-url>.
30
31
 
31
32
  In case <app-url> does not start with a schema, 'https://' is assumed.
32
33
 
33
34
  *Token Expiration*
34
35
 
35
- If a refresh token has been provided with the original token and the original
36
- token has expired, it will be automatically renewed.
36
+ If a refresh token has been provided with the original token and the
37
+ original token has expired, it will be automatically renewed.
37
38
 
38
39
  *Storing Authentication Data*
39
40
 
40
- Authentication data for all logins is saved by <app-url> and <tenant-subdomain> in the
41
- desktop keyring (${(config.keyringDesignation)} on your platform) or, if requested, in config
42
- file ${config.paths.auth}.
41
+ Authentication data for all logins is saved by <app-url> and
42
+ <tenant-subdomain> in the desktop keyring (${(config.keyringDesignation)} on
43
+ your platform) or, if requested, in config file ${config.paths.auth}.
43
44
 
44
- To make use of keyring storage, the 'keytar' Node.js module must be installed.
45
- A corresponding hint will be given in case the module is not found.
45
+ To make use of keyring storage, the 'keytar' Node.js module must be
46
+ installed. A corresponding hint will be given in case the module is not
47
+ found.
46
48
 
47
49
  Project settings are saved by project directory in config file
48
50
  ${config.paths.settings}.
49
51
 
50
- Note that local storage of authentication data incurs a certain security risk:
51
- a malicious locally-running application might be able to perform any action with
52
- the SaaS app that you are authorized for with respect to your tenant.
52
+ Note that local storage of authentication data incurs a certain security
53
+ risk: a malicious locally-running application might be able to perform any
54
+ action with the SaaS app that you are authorized for with respect to your
55
+ tenant.
53
56
 
54
57
  # OPTIONS
55
58
 
56
59
  *-s* | *--subdomain* <tenant-subdomain>
57
60
 
58
- The subdomain to log in to. By default, it's determined from project settings.
59
- If no such setting is saved, the CF client is invoked to determine the respective subdomain.
61
+ The subdomain to log in to. By default, it's determined from project
62
+ settings. If no such setting is saved, the CF client is invoked to
63
+ determine the respective subdomain.
60
64
 
61
65
  *-d* | *--directory* <extension-project-directory>
62
66
 
63
67
  The extension-project folder (relevant for loading and saving settings).
64
- If omitted, either an existing subdirectory named as the subdomain or the current
65
- working directory will be used.
68
+ If omitted, the current working directory will be used.
66
69
 
67
70
  *-p* | *--passcode* <passcode>
68
71
 
@@ -70,65 +73,76 @@ module.exports = Object.assign(login, {
70
73
 
71
74
  *-u* | *--user* <name>[:[<password>]]
72
75
 
73
- Username and optionally password for authentication with Basic Auth in test scenarios.
76
+ Username and optionally password for authentication with Basic Auth in
77
+ test scenarios.
74
78
 
75
- When typing the colon but omitting <password>, the password is assumed empty.
76
- When omitting both, password will be queried interactively.
79
+ When typing the colon but omitting <password>, the password is assumed
80
+ empty. When omitting both, password will be queried interactively.
77
81
 
78
- For security reasons, username will only be saved for app URLs that look like localhost.
79
- The same is true for an empty password. Non-empty passwords will never be saved.
80
- If saved, a username will be associated with the project folder, not with the (potentially ambiguous) URL.
82
+ For security reasons, username will only be saved for app URLs that look
83
+ like localhost. In this case, the username will be associated with the
84
+ project folder, not with the (potentially ambiguous) URL.
85
+ An empty password will be saved under the same conditions as a username.
86
+ Non-empty passwords will never be saved.
81
87
 
82
- Note: Productive secrets should not be specified on a command line, since this might expose them to
83
- unauthorized users on the same machine!
88
+ Note: Productive secrets should not be specified on a command line,
89
+ since this might expose them to unauthorized users on the same machine!
84
90
 
85
91
  *-c* | *--client* <clientid>[:<clientsecret>]
86
92
 
87
- Client Credentials (Client ID and optionally Client Secret) for authentication.
88
- If omitted, Client Secret will be queried interactively.
93
+ Client Credentials (Client ID and optionally Client Secret) for
94
+ authentication. If omitted, Client Secret will be queried interactively.
89
95
 
90
96
  Obtain the Client Credentials from the UAA binding of MTXS.
91
97
 
92
98
  Client Credentials will not be saved, only the resulting token.
93
99
 
94
- Note: Productive secrets should not be specified on a command line, since this might expose them to
95
- unauthorized users on the same machine!
100
+ Note: Productive secrets should not be specified on a command line,
101
+ since this might expose them to unauthorized users on the same machine!
96
102
 
97
103
  *-m* | *--mtls* <clientid>[:<key>]
98
104
 
99
- Client Credentials (Client ID and optionally Client-Certificate Private Key in Base64 encoding)
100
- for authentication. If omitted, Private Key will be queried interactively (avoid newline characters
101
- when pasting it).
105
+ Client Credentials (Client ID and optionally Client-Certificate Private
106
+ Key in Base64 encoding) for authentication. If omitted, Private Key will
107
+ be queried interactively (avoid newline characters when pasting it).
102
108
 
103
109
  Obtain the Client Credentials from the UAA binding of MTXS.
104
110
 
105
111
  Client Credentials will not be saved, only the resulting token.
106
112
 
107
- Note: Productive secrets should not be specified on a command line, since this might expose them to
108
- unauthorized users on the same machine!
113
+ Note: Productive secrets should not be specified on a command line,
114
+ since this might expose them to unauthorized users on the same machine!
109
115
 
110
116
  *--plain*
111
117
 
112
- Instead of saving authentication data for this login to the desktop keyring,
113
- use plain-text storage, e.g. if you have not installed the 'keytar' module.
114
- Note that this is not recommended as it decreases the level of security: at
115
- least applications running as the current user can read the plain-text file,
116
- whereas the keyring (depending on the platform) can be locked and unlocked on owner
117
- request and may hide data saved by this command from other applications you run.
118
+ Instead of saving authentication data for this login to the desktop
119
+ keyring, use plain-text storage, e.g. if you have not installed the
120
+ 'keytar' module.
121
+
122
+ Note that this is not recommended as it decreases the level of security:
123
+ at least applications running as the current user can read the
124
+ plain-text file, whereas the keyring (depending on the platform) can be
125
+ locked and unlocked on owner request and may hide data saved by this
126
+ command from other applications you run.
118
127
 
119
- Be aware that on SAP Business Application Studio, --plain is enforced since keyring
120
- functionality is not supported. However, the underlying storage is encrypted.
128
+ Be aware that on SAP Business Application Studio, --plain is enforced,
129
+ since keyring functionality is not supported. However, the underlying
130
+ storage is encrypted.
121
131
 
122
- During any login, potential pre-existing authentication data for the same
132
+ During login, potential pre-existing authentication data for the same
123
133
  target is deleted from the other, non-selected storage. This allows
124
134
  migrating authentication data from one storage to the other by running
125
135
  the present command without a passcode.
126
136
 
127
137
  # SEE ALSO
128
138
 
129
- Supported commands: *cds subscribe*, *cds upgrade*, *cds pull*, *cds push*, and *cds unsubscribe*.
139
+ Supported commands: *cds subscribe*, *cds upgrade*, *cds pull*, *cds push*,
140
+ and *cds unsubscribe*.
141
+
130
142
  *cds logout* to remove any authentication data.
131
- https://cap.cloud.sap/docs/guides/extensibility/customization?q=mock#mock-users for information on suitable mock users.
143
+
144
+ https://cap.cloud.sap/docs/guides/extensibility/customization#mock-users for
145
+ information on suitable mock users.
132
146
 
133
147
  `}});
134
148
 
package/bin/logout.js CHANGED
@@ -8,16 +8,17 @@ module.exports = Object.assign(logout, {
8
8
 
9
9
  *cds logout* [ <extension-project-directory> ]
10
10
 
11
- Removes authentication data saved locally by *cds login* for use by *cds extend*
12
- and *cds activate*. In default mode, deletes only data for a specific app URL
13
- and subdomain, optionally including relevant project settings.
11
+ Removes authentication data saved locally by *cds login* for use with
12
+ *cds pull* and *cds push*. In default mode, deletes only data for a
13
+ specific app URL and subdomain, optionally including relevant project
14
+ settings.
14
15
 
15
- <app-url> and <tenant-subdomain> will be determined from project settings unless given
16
- by options.
16
+ <app-url> and <tenant-subdomain> will be determined from project settings
17
+ unless given by options.
17
18
 
18
19
  Project settings will be loaded by reference to the given folder.
19
- If omitted, the project setting are loaded from a subdirectory named as the subdomain
20
- or the current working directory.
20
+ If omitted, the project setting are loaded from a subdirectory named as the
21
+ subdomain or the current working directory.
21
22
 
22
23
  To access keyring storage, the 'keytar' Node.js module must be installed.
23
24
  If this is not the case, existing keyring entries will not be detected and
@@ -28,11 +29,13 @@ module.exports = Object.assign(logout, {
28
29
 
29
30
  *-l* | *--url* <app-url>
30
31
 
31
- The <app-url> to logout from. By default, it's determined from project settings.
32
+ The <app-url> to logout from. By default, it's determined from project
33
+ settings.
32
34
 
33
35
  *-s* | *--subdomain* <subdomain>
34
36
 
35
- The subdomain to logout from. By default, it's determined from project settings.
37
+ The subdomain to logout from. By default, it's determined from project
38
+ settings.
36
39
 
37
40
  *--delete-settings*
38
41
 
package/bin/migrate.js CHANGED
@@ -15,15 +15,20 @@ module.exports = Object.assign(migrate, {
15
15
 
16
16
  *-d* | *--directory* <extension-projects-directory>
17
17
 
18
- Specify the target directory of your migrated extension projects. By default, the migrated extension projects will not be stored.
18
+ Specify the target directory of your migrated extension projects. By
19
+ default, the migrated extension projects will not be stored.
19
20
 
20
21
  *--tag* <tag>
21
22
 
22
- Specify a default tag that is to be used to store the extension. If not specified "migrated" will be used.
23
+ Specify a default tag that is to be used to store the extension. If not
24
+ specified "migrated" will be used.
23
25
 
24
26
  *--tagRule* <tag rule>
25
27
 
26
- Specify a regular expression that describes the mapping from file names to tags, e. g. "extension-(.*)\.cds" to map from "extension-123.cds" to tag "123". If the expression does not match, the default tag will be used.
28
+ Specify a regular expression that describes the mapping from file names
29
+ to tags, e. g. "extension-(.*)\.cds" to map from "extension-123.cds" to
30
+ tag "123". If the expression does not match, the default tag will be
31
+ used.
27
32
 
28
33
  *--force*
29
34
 
@@ -35,7 +40,8 @@ module.exports = Object.assign(migrate, {
35
40
 
36
41
  *--skip-verification
37
42
 
38
- Skip verification step. Does not check for potential deployment differences.
43
+ Skip verification step. Does not check for potential deployment
44
+ differences.
39
45
 
40
46
  *--cleanup* (beta)
41
47
 
package/bin/pull.js CHANGED
@@ -8,7 +8,8 @@ module.exports = Object.assign(pull, {
8
8
  *cds pull* [ [--from] <app url> ]
9
9
 
10
10
  Pull the base model for your SaaS app extension.
11
- If the app URL is omitted, it is determined from the current user's active CDS or Cloud Foundry login.
11
+ If the app URL is omitted, it is determined from the current user's active
12
+ CDS or Cloud Foundry login.
12
13
 
13
14
  Authentication data will not be saved.
14
15
 
@@ -17,11 +18,13 @@ module.exports = Object.assign(pull, {
17
18
 
18
19
  *-d* | *--directory* <project-extension-directory>
19
20
 
20
- Specify the target directory of your extension project. By default, the current working directory is used.
21
+ Specify the target directory of your extension project. By default, the
22
+ current working directory is used.
21
23
 
22
24
  *-s* | *--subdomain* <tenant-subdomain>
23
25
 
24
- Specify your tenant's subdomain. By default, it's determined from the app URL.
26
+ Specify your tenant's subdomain. By default, it's determined from the
27
+ app URL.
25
28
 
26
29
  *-p* | *--passcode* <passcode>
27
30
 
@@ -29,7 +32,8 @@ module.exports = Object.assign(pull, {
29
32
 
30
33
  *-u* | *--user* <name>[:[<password>]]
31
34
 
32
- Username and optionally password for authentication with Basic Auth in test scenarios.
35
+ Username and optionally password for authentication with Basic Auth in
36
+ test scenarios.
33
37
 
34
38
  *-c* | *--client* <clientid>[:<clientsecret>]
35
39
 
@@ -38,8 +42,11 @@ module.exports = Object.assign(pull, {
38
42
  # SEE ALSO
39
43
 
40
44
  *cds push* to push an extension to the SaaS app.
45
+
41
46
  *cds login* for more information on authentication options.
42
- *cds login* to save project settings and authentication data, simplifying multiple runs of this command.
47
+
48
+ *cds login* to save project settings and authentication data, simplifying
49
+ multiple runs of this command.
43
50
 
44
51
  `});
45
52
 
package/bin/push.js CHANGED
@@ -9,15 +9,16 @@ module.exports = Object.assign(push, {
9
9
 
10
10
  Push your extension to the SaaS app in order to enable or update it.
11
11
 
12
- You may specify a project directory or a custom extension archive, either as a
13
- local file or as a URL to download it from.
14
- A download URL may contain Basic-Auth credentials as in 'https://user:pass@host'.
12
+ You may specify a project directory or a custom extension archive, either as
13
+ a local file or as a URL to download it from.
14
+ A download URL may contain Basic-Auth credentials as in
15
+ 'https://user:pass@host'.
15
16
 
16
17
  By default, the current working directory is used as project directory.
17
18
 
18
- Unless a custom archive is given, the extension project will be automatically built
19
- in order to update the generated extension archive. This ensures the most recent
20
- extension model is pushed.
19
+ Unless a custom archive is given, the extension project will be
20
+ automatically built in order to update the generated extension archive. This
21
+ ensures the most recent extension model is pushed.
21
22
 
22
23
  Any authentication data will not be saved.
23
24
 
@@ -26,7 +27,8 @@ module.exports = Object.assign(push, {
26
27
 
27
28
  *--to* <url>
28
29
 
29
- Specify the URL of the extensible SaaS app. Determined from the current user's active
30
+ Specify the URL of the extensible SaaS app. Determined from the current
31
+ user's active
30
32
  CDS or Cloud Foundry login by default.
31
33
 
32
34
  *-s* | *--subdomain* <tenant-subdomain>
@@ -39,7 +41,8 @@ module.exports = Object.assign(push, {
39
41
 
40
42
  *-u* | *--user* <name>[:[<password>]]
41
43
 
42
- Username and optionally password for authentication with Basic Auth in test scenarios.
44
+ Username and optionally password for authentication with Basic Auth in
45
+ test scenarios.
43
46
 
44
47
  *-c* | *--client* <clientid>[:<clientsecret>]
45
48
 
@@ -49,8 +52,11 @@ module.exports = Object.assign(push, {
49
52
  # SEE ALSO
50
53
 
51
54
  *cds pull* to get the CDS model of the SaaS app.
55
+
52
56
  *cds login* for more information on authentication options.
53
- *cds login* to save project settings and authentication data, simplifying multiple runs of this command.
57
+
58
+ *cds login* to save project settings and authentication data, simplifying
59
+ multiple runs of this command.
54
60
 
55
61
  `});
56
62
 
@@ -68,11 +74,16 @@ async function push([projectFolder], options = {}) {
68
74
  delete options.client;
69
75
 
70
76
  let extArchive;
71
- if (projectFolder && !isDir(projectFolder)) {
72
- extArchive = projectFolder;
73
- projectFolder = undefined;
77
+ if (projectFolder) {
78
+ if (isDir(projectFolder)) {
79
+ const cds = require('../lib/cds');
80
+ cds.root = projectFolder;
81
+ cds.env = cds.env.for('cds', projectFolder);
82
+ } else {
83
+ extArchive = projectFolder;
84
+ projectFolder = undefined;
85
+ }
74
86
  }
75
-
76
87
  const args = [{
77
88
  ...options,
78
89
  projectFolder,
package/bin/repl.js CHANGED
@@ -44,6 +44,7 @@ function repl (_, options={}) {
44
44
  Reflect.defineProperty (cds,'env',{ value:cds.env, enumerable:false })
45
45
  }
46
46
 
47
+ inspect.defaultOptions.colors = true
47
48
  inspect.defaultOptions.depth = 11
48
49
  function _writer (o) {
49
50
  if (!o || typeof o !== 'object') return o
package/bin/run.js ADDED
@@ -0,0 +1,25 @@
1
+ const serve = require ('./serve')
2
+ module.exports = Object.assign (
3
+ cds_run, serve, {help: `
4
+ # SYNOPSIS
5
+
6
+ *cds run* [<project>] [<options>]
7
+
8
+ Runs 'cds serve all' for the specified project. By default, <project> = cwd
9
+ is used.
10
+
11
+ # OPTIONS
12
+
13
+ - see _cds help serve_
14
+
15
+ # SEE ALSO
16
+
17
+ Actually, *cds run* is just a convenient shortcut for:
18
+ *cds serve* [--project <project>] [<options>] ...
19
+ Check out *cds serve --help* to learn more.
20
+
21
+ `})
22
+
23
+ function cds_run (projects, options) {
24
+ return serve (projects,{ project:true, ...options })
25
+ }
package/bin/subscribe.js CHANGED
@@ -10,31 +10,36 @@ module.exports = Object.assign(subscribe, {
10
10
 
11
11
  Subscribe a tenant to a multitenant SaaS app.
12
12
 
13
- Running *cds subscribe* with a URL is intended for non-productive use only, including against
14
- SaaS apps running on localhost with mock authentication.
13
+ Running *cds subscribe* with a URL is intended for non-productive use only,
14
+ including against SaaS apps running on localhost with mock authentication.
15
15
 
16
16
  # OPTIONS
17
17
 
18
18
  *-2* | *--to* <url>
19
19
 
20
- Specify the URL of the SaaS app. Determined from the current user's active CDS or
21
- Cloud Foundry login by default.
20
+ Specify the URL of the SaaS app. Determined from the current user's
21
+ active CDS or Cloud Foundry login by default.
22
22
 
23
23
  *-u* | *--user* <name>[:[<password>]]
24
24
 
25
- Username and optionally password for authentication with Basic Auth in test scenarios.
26
- Only relevant if <url> is given. May be omitted in case of dummy authentication.
25
+ Username and optionally password for authentication with Basic Auth in
26
+ test scenarios.
27
+
28
+ Only relevant if <url> is given. May be omitted in case of dummy
29
+ authentication.
30
+
27
31
  Tokens saved with *cds login* are not used for this command.
28
32
 
29
33
  *-l* | *--local*
30
34
 
31
- Run a locally-installed @sap/cds-mtxs and connect to it instead of a URL. Ignore settings
32
- saved with *cds login*.
35
+ Run a locally-installed @sap/cds-mtxs and connect to it instead of a
36
+ URL. Ignore settings saved with *cds login*.
33
37
 
34
38
 
35
39
  # SEE ALSO
36
40
 
37
41
  *cds login* for more information on authentication options.
42
+
38
43
  *cds login* to save project settings and Basic-Auth data, simplifying multiple runs of this command.
39
44
 
40
45
  `});
@@ -10,30 +10,37 @@ module.exports = Object.assign(unsubscribe, {
10
10
 
11
11
  Unsubscribe a tenant from a multitenant SaaS app.
12
12
 
13
- Running *cds unsubscribe* with a URL is intended for non-productive use only, including against
14
- SaaS apps running on localhost with mock authentication.
13
+ Running *cds unsubscribe* with a URL is intended for non-productive use
14
+ only, including against SaaS apps running on localhost with mock
15
+ authentication.
15
16
 
16
17
  # OPTIONS
17
18
 
18
19
  *-f* | *--from* <url>
19
20
 
20
- Specify the URL of the SaaS app. Determined from the current user's active CDS or
21
- Cloud Foundry login by default.
21
+ Specify the URL of the SaaS app. Determined from the current user's
22
+ active CDS or Cloud Foundry login by default.
22
23
 
23
24
  *-u* | *--user* <name>[:[<password>]]
24
25
 
25
- Username and optionally password for authentication with Basic Auth in test scenarios.
26
- Only relevant if <url> is given. Tokens saved with *cds login* are not used for this command.
26
+ Username and optionally password for authentication with Basic Auth in
27
+ test scenarios.
28
+
29
+ Only relevant if <url> is given. May be omitted in case of dummy
30
+ authentication.
31
+
32
+ Tokens saved with *cds login* are not used for this command.
27
33
 
28
34
  *-l* | *--local*
29
35
 
30
- Run a locally-installed @sap/cds-mtxs and connect to it instead of a URL. Ignore settings
31
- saved with *cds login*.
36
+ Run a locally-installed @sap/cds-mtxs and connect to it instead of a
37
+ URL. Ignore settings saved with *cds login*.
32
38
 
33
39
 
34
40
  # SEE ALSO
35
41
 
36
42
  *cds login* for more information on authentication options.
43
+
37
44
  *cds login* to save project settings and Basic-Auth data, simplifying multiple runs of this command.
38
45
 
39
46
  `});
package/bin/upgrade.js CHANGED
@@ -8,33 +8,39 @@ module.exports = Object.assign(upgrade, {
8
8
 
9
9
  *cds upgrade* <tenant>
10
10
 
11
- Upgrade a tenant subscribed to a multitenant SaaS app to its latest base model.
11
+ Upgrade a tenant subscribed to a multitenant SaaS app to its latest base
12
+ model.
12
13
 
13
- Running *cds upgrade* with a URL is intended for non-productive use only, including against
14
- SaaS apps running on localhost with mock authentication.
14
+ Running *cds upgrade* with a URL is intended for non-productive use only,
15
+ including against SaaS apps running on localhost with mock authentication.
15
16
 
16
17
  # OPTIONS
17
18
 
18
19
  *-a* | *--at* <url>
19
20
 
20
- Specify the URL of the SaaS app. Determined from the current user's active CDS or
21
- Cloud Foundry login by default.
21
+ Specify the URL of the SaaS app. Determined from the current user's
22
+ active CDS or Cloud Foundry login by default.
22
23
 
23
24
  *-u* | *--user* <name>[:[<password>]]
24
25
 
25
- Username and optionally password for authentication with Basic Auth in test scenarios.
26
- Only relevant if <url> is given. May be omitted in case of dummy authentication.
26
+ Username and optionally password for authentication with Basic Auth in
27
+ test scenarios.
28
+
29
+ Only relevant if <url> is given. May be omitted in case of dummy
30
+ authentication.
31
+
27
32
  Tokens saved with *cds login* are not used for this command.
28
33
 
29
34
  *-l* | *--local*
30
35
 
31
- Run a locally-installed @sap/cds-mtxs and connect to it instead of a URL. Ignore settings
32
- saved with *cds login*.
36
+ Run a locally-installed @sap/cds-mtxs and connect to it instead of a
37
+ URL. Ignore settings saved with *cds login*.
33
38
 
34
39
 
35
40
  # SEE ALSO
36
41
 
37
42
  *cds login* for more information on authentication options.
43
+
38
44
  *cds login* to save project settings and Basic-Auth data, simplifying multiple runs of this command.
39
45
 
40
46
  `});
@@ -0,0 +1,24 @@
1
+ // sorts, filters, and writes compilation messages to console
2
+ module.exports = (messages, options={}) => {
3
+ const { format } = require('../../lib/util/term')
4
+ const logLevel = options && options['log-level'] || require('../../lib').env.log.levels.cli || ''
5
+ const levels = {
6
+ debug: { Error:4, undefined:4, Warning:3, Info:2, Debug:1 },
7
+ info: { Error:4, undefined:4, Warning:3, Info:2 },
8
+ warn: { Error:4, undefined:4, Warning:3 },
9
+ error: { Error:4, undefined:4 },
10
+ } [logLevel.toLowerCase()] || { Error:4, undefined:4, Warning:3 }
11
+ const log = options.log || console.error
12
+
13
+ if (!Array.isArray (messages)) messages = [messages]
14
+ for (let m of messages.filter (m => m.severity in levels)) {
15
+ // show stack for resolution issues since there the requiring code location is in the stack
16
+ // check for standard Error classes, but not Error itself
17
+ const internalError = m.name === 'EvalError' || m.name === 'InternalError' || m.name === 'RangeError'
18
+ || m.name === 'ReferenceError' || m.name === 'SyntaxError' || m.name === 'TypeError'
19
+ || m.name === 'URIError'
20
+ const mf = format (m, m.severity, internalError, true)
21
+ log (mf)
22
+ }
23
+ }
24
+ /* eslint no-console:off */