@sap/cds-dk 6.0.2 → 6.1.1

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 (105) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/bin/add.js +29 -16
  3. package/bin/cds.js +7 -3
  4. package/bin/compile/index.js +6 -1
  5. package/bin/deploy/index.js +7 -1
  6. package/bin/fix-redirects.js +4 -2
  7. package/bin/init.js +5 -0
  8. package/bin/login.js +8 -2
  9. package/bin/pull.js +58 -0
  10. package/bin/push.js +52 -0
  11. package/bin/subscribe.js +45 -0
  12. package/lib/bind/bindingResolver.js +1 -2
  13. package/lib/bind/bindingUtil.js +1 -2
  14. package/lib/bind/cfKeyProvider.js +3 -3
  15. package/lib/client/activate.js +1 -1
  16. package/lib/client/auth_manager.js +7 -3
  17. package/lib/client/extend.js +1 -1
  18. package/lib/client/helper/cf_helper.js +1 -0
  19. package/lib/client/helper/url_helper.js +7 -3
  20. package/lib/client/index.js +1 -1
  21. package/lib/client/params.js +4 -2
  22. package/lib/client/pull.js +51 -0
  23. package/lib/client/push.js +49 -0
  24. package/lib/client/settings_manager.js +74 -21
  25. package/lib/compile/openapi/csdl2openapi.js +135 -163
  26. package/lib/compile/openapi/index.js +0 -1
  27. package/lib/import/common.js +9 -1
  28. package/lib/import/odata/metadataconverter/MetadataConverter.js +17 -4
  29. package/lib/import/odata/v2parser.js +0 -1
  30. package/lib/import/odata/v4parser.js +103 -29
  31. package/lib/import/openapi/importOpenAPI.js +3 -3
  32. package/lib/init/constants.js +9 -3
  33. package/lib/init/template/_merging/registry-mta.js +290 -0
  34. package/lib/init/template/approuter/index.js +22 -32
  35. package/lib/init/template/auditlog/index.js +7 -9
  36. package/lib/init/template/extensibility/files/cds.package.json +7 -0
  37. package/lib/init/template/extensibility/files/cds.package.json.hbs +9 -0
  38. package/lib/init/template/extensibility/files/xs-security.json.hbs +26 -0
  39. package/lib/init/template/extensibility/index.js +48 -0
  40. package/lib/init/template/hana/files/java/cdsrc.json.hbs +1 -1
  41. package/lib/init/template/hana/files/java/profile.cdsrc.json.hbs +2 -2
  42. package/lib/init/template/hana/files/mta.yaml.hbs +10 -0
  43. package/lib/init/template/hana/files/nodejs/cds.package.json.hbs +1 -1
  44. package/lib/init/template/hana/files/nodejs/cds.profile.package.json.hbs +2 -2
  45. package/lib/init/template/hana/index.js +76 -63
  46. package/lib/init/template/kibana-logging/index.js +31 -37
  47. package/lib/init/template/lint/files/.eslint/rules/no-entity-moo.js +14 -14
  48. package/lib/init/template/lint/index.js +1 -1
  49. package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
  50. package/lib/init/template/mta/index.js +13 -7
  51. package/lib/init/template/mtx/index.js +2 -142
  52. package/lib/init/template/multitenancy/files/cds.package.json +7 -0
  53. package/lib/init/template/multitenancy/files/cds.package.json.hbs +9 -0
  54. package/lib/init/template/{mtx → multitenancy}/files/dependencies.package.json +1 -1
  55. package/lib/init/template/multitenancy/files/java/.cdsrc.json +19 -0
  56. package/lib/init/template/multitenancy/files/java/package.json +31 -0
  57. package/lib/init/template/{mtx → multitenancy}/files/mta.yaml.hbs +13 -6
  58. package/lib/init/template/multitenancy/files/xs-security.json.hbs +18 -0
  59. package/lib/init/template/multitenancy/index.js +109 -0
  60. package/lib/init/template/nodejs/files/package.json.hbs +3 -0
  61. package/lib/init/template/templateBase.js +4 -3
  62. package/lib/init/template/toggles/files/cds.package.json +7 -0
  63. package/lib/init/template/toggles/files/cds.package.json.hbs +9 -0
  64. package/lib/init/template/toggles/index.js +24 -0
  65. package/lib/init/template/xsuaa/files/mta.yaml.hbs +10 -0
  66. package/lib/init/template/xsuaa/index.js +44 -33
  67. package/lib/init/util/projectReader.js +13 -8
  68. package/lib/init/util/templateUtil.js +112 -110
  69. package/lib/k8s/ChartAdder.js +11 -3
  70. package/lib/k8s/ChartBuilder.js +6 -0
  71. package/lib/k8s/buildModel.js +1 -3
  72. package/lib/k8s/connectivity/index.js +11 -5
  73. package/lib/k8s/connectivity/templates/connectivity-proxy-info.yaml +7 -3
  74. package/lib/k8s/deployment/index.js +2 -4
  75. package/lib/k8s/deployment/subchart/Chart.yaml +1 -1
  76. package/lib/k8s/deployment/subchart/templates/_helpers.tpl +22 -11
  77. package/lib/k8s/deployment/subchart/templates/deployment.yaml +12 -5
  78. package/lib/k8s/deployment/subchart/templates/network-policy.yaml +3 -1
  79. package/lib/k8s/deployment/subchart/templates/pod-disruption-budget.yaml +1 -1
  80. package/lib/k8s/deployment/subchart/values.md +812 -0
  81. package/lib/k8s/deployment/subchart/values.schema.json +125 -30
  82. package/lib/k8s/deployment/subchart/values.yaml +7 -3
  83. package/lib/k8s/hana-deployer/index.js +10 -0
  84. package/lib/k8s/hana-deployer/templates/hana-deployer-job.yaml +8 -0
  85. package/lib/k8s/html5-apps-deployer/index.js +10 -0
  86. package/lib/k8s/html5-apps-deployer/templates/html5-apps-deployer-job.yaml +8 -0
  87. package/lib/k8s/index.js +2 -2
  88. package/lib/k8s/resources/helm/chart/templates/_deployment_helpers.tpl +1 -159
  89. package/lib/k8s/resources/helm/chart/templates/_helpers.tpl +0 -33
  90. package/lib/k8s/resources/helm/chart/templates/_sapcp_helpers.tpl +1 -1
  91. package/lib/k8s/resources/helm/chart/values.schema.json +449 -0
  92. package/lib/k8s/xsuaa/lib.js +10 -7
  93. package/lib/lint/Linter.js +155 -158
  94. package/lib/lint/generators.js +1 -1
  95. package/lib/lint/io.js +13 -5
  96. package/npm-shrinkwrap.json +1053 -136
  97. package/package.json +5 -4
  98. package/lib/init/template/_merging/existences.js +0 -297
  99. package/lib/init/template/mtx/files/cds.package.json +0 -12
  100. package/lib/init/template/mtx/files/cds.package.json.hbs +0 -14
  101. package/lib/init/template/mtx/files/java/.cdsrc.json +0 -17
  102. package/lib/init/template/mtx/files/java/package.json +0 -43
  103. package/lib/init/template/mtx/files/java/server.js +0 -30
  104. package/lib/init/template/mtx/files/xs-security.json.hbs +0 -48
  105. package/lib/lint/.eslintrc.js +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "6.0.2",
3
+ "version": "6.1.1",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -16,13 +16,14 @@
16
16
  },
17
17
  "main": "lib/index.js",
18
18
  "dependencies": {
19
- "@sap/cds": "^6.0.2",
19
+ "@sap/cds": "^6.1.0",
20
20
  "@sap/cds-foss": "^4",
21
- "@sap/eslint-plugin-cds": "^2.3.3",
21
+ "@sap/eslint-plugin-cds": "^2.5.0",
22
22
  "axios": ">=0.21",
23
23
  "connect-livereload": "^0.6.1",
24
24
  "eslint": "^8",
25
25
  "express": "^4.17.1",
26
+ "glob": "^8.0.3",
26
27
  "htmlparser2": "^8.0.0",
27
28
  "livereload-js": "^3.3.1",
28
29
  "md5": "^2.3.0",
@@ -33,7 +34,7 @@
33
34
  "xml-js": "^1.6.11"
34
35
  },
35
36
  "optionalDependencies": {
36
- "sqlite3": "^5.0.4"
37
+ "sqlite3": "5.0.11"
37
38
  },
38
39
  "files": [
39
40
  "bin/",
@@ -1,297 +0,0 @@
1
- // This file describes so-called "modules" and "resources" commonly
2
- // found in mta.yaml files.
3
- // The following matchers contain the *required* constraints to
4
- // identify a YAML node as a semantic equivalent of the matcher.
5
-
6
- const srvNode = {
7
- ref: "srv",
8
- keyPath: ["modules"],
9
- constraints: [{
10
- comparisonKeyPath: ["type"],
11
- value: "nodejs"
12
- }],
13
- }
14
-
15
- const srvJava = {
16
- ref: "srv",
17
- keyPath: ["modules"],
18
- constraints: [{
19
- comparisonKeyPath: ["type"],
20
- value: "java"
21
- }],
22
- }
23
-
24
- const approuter = {
25
- ref: "approuter",
26
- keyPath: ["modules"],
27
- constraints: [{
28
- comparisonKeyPath: ["type"],
29
- value: "approuter.nodejs"
30
- }]
31
- }
32
-
33
- const xsuaa = {
34
- ref: "uaa-resource",
35
- keyPath: ["resources"],
36
- constraints: [{
37
- comparisonKeyPath: ["type"],
38
- value: "org.cloudfoundry.managed-service",
39
- }, {
40
- comparisonKeyPath: ["parameters", "service"],
41
- value: "xsuaa",
42
- }, {
43
- comparisonKeyPath: ["parameters", "service-plan"],
44
- value: "application"
45
- }]
46
- }
47
-
48
- const auditlog = {
49
- ref: "auditlog-resource",
50
- keyPath: ["resources"],
51
- constraints: [{
52
- comparisonKeyPath: ["type"],
53
- value: "org.cloudfoundry.managed-service",
54
- }, {
55
- comparisonKeyPath: ["parameters", "service"],
56
- value: "auditlog-api",
57
- }]
58
- }
59
-
60
- const kibanaLogging = {
61
- ref: "cf-logging",
62
- keyPath: ["resources"],
63
- constraints: [{
64
- comparisonKeyPath: ["type"],
65
- value: "org.cloudfoundry.managed-service",
66
- }, {
67
- comparisonKeyPath: ["parameters", "service"],
68
- value: "application-logs",
69
- }, {
70
- comparisonKeyPath: ["parameters", "service-plan"],
71
- value: "lite",
72
- }]
73
- }
74
-
75
- const hdbDeployer = {
76
- ref: "deployer",
77
- keyPath: ["modules"],
78
- constraints: [{
79
- comparisonKeyPath: ["type"],
80
- value: "hdb"
81
- }]
82
- }
83
-
84
- const hdiContainer = {
85
- ref: "hdi-container-resource",
86
- keyPath: ["resources"],
87
- constraints: [{
88
- comparisonKeyPath: ["type"],
89
- value: "com.sap.xs.hdi-container",
90
- }]
91
- }
92
-
93
- const serviceManager = {
94
- ref: "service-manager-resource",
95
- keyPath: ["resources"],
96
- constraints: [{
97
- comparisonKeyPath: ["type"],
98
- value: "org.cloudfoundry.managed-service",
99
- }, {
100
- comparisonKeyPath: ["parameters", "service"],
101
- value: "service-manager",
102
- }, {
103
- comparisonKeyPath: ["parameters", "service-plan"],
104
- value: "container"
105
- }]
106
- }
107
-
108
- const saasRegistry = {
109
- ref: "registry-resource",
110
- keyPath: ["resources"],
111
- constraints: [{
112
- comparisonKeyPath: ["type"],
113
- value: "org.cloudfoundry.managed-service",
114
- }, {
115
- comparisonKeyPath: ["parameters", "service"],
116
- value: "saas-registry",
117
- }, {
118
- comparisonKeyPath: ["parameters", "service-plan"],
119
- value: "application"
120
- }]
121
- }
122
-
123
- const srvAPI = {
124
- ref: "srvAPI",
125
- keyPath: ["provides"],
126
- constraints: [{
127
- comparisonKeyPath: ["name"],
128
- value: "srv-api"
129
- }, {
130
- comparisonKeyPath: ["properties", "srv-url"],
131
- value: "${default-url}"
132
- }]
133
- }
134
-
135
- const mtxSidecar = {
136
- ref: "sidecar",
137
- keyPath: ["modules"],
138
- constraints: [{
139
- comparisonKeyPath: ["type"],
140
- value: `nodejs`
141
- }]
142
- }
143
-
144
- const providedMtxAPI = {
145
- ref: "provided-mtx-api",
146
- keyPath: ["provides"],
147
- constraints: [{
148
- comparisonKeyPath: ["name"],
149
- value: "mtx-api"
150
- }, {
151
- comparisonKeyPath: ["properties", "mtx-url"],
152
- value: "${default-url}"
153
- }]
154
- }
155
-
156
- const requiredMtxAPI = {
157
- ref: "required-mtx-api",
158
- in: approuter,
159
- keyPath: ["requires"],
160
- constraints: [{
161
- comparisonKeyPath: ["properties", "name"],
162
- value: "mtx-api"
163
- }, {
164
- comparisonKeyPath: ["properties", "url"],
165
- value: "~{mtx-url}"
166
- }]
167
- }
168
-
169
- const providedAppAPI = {
170
- ref: "provided-app-api",
171
- in: approuter,
172
- keyPath: ["provides"],
173
- constraints: [{
174
- comparisonKeyPath: ["name"],
175
- value: "app-api"
176
- }, {
177
- comparisonKeyPath: ["properties", "app-protocol"],
178
- value: "${protocol}"
179
- }, {
180
- comparisonKeyPath: ["properties", "app-uri"],
181
- value: "${default-uri}"
182
- }],
183
- }
184
-
185
- const requiredAppAPI = {
186
- ref: "required-app-api",
187
- in: srvNode,
188
- keyPath: ["requires"],
189
- constraints: [{
190
- comparisonKeyPath: ["name"],
191
- value: "app-api"
192
- }, {
193
- comparisonKeyPath: ["properties", "SUBSCRIPTION_URL"],
194
- value: "~{app-protocol}://\\${tenant_subdomain}-~{app-uri}"
195
- }]
196
- }
197
-
198
- const providedMtxSidecarAPI = {
199
- ref: "provided-mtx-sidecar-api",
200
- in: mtxSidecar,
201
- keyPath: ["requires"],
202
- constraints: [{
203
- comparisonKeyPath: ["properties", "url"],
204
- value: "${default-url}"
205
- }]
206
- }
207
-
208
- const requiredMtxSidecarAPI = {
209
- ref: "required-mtx-sidecar-api",
210
- in: srvJava,
211
- keyPath: ["requires"],
212
- constraints: [{
213
- comparisonKeyPath: ["properties", "CDS_MULTITENANCY_SIDECAR_URL"],
214
- value: "~{url}"
215
- }]
216
- }
217
-
218
- const requiredJavaApprouterAPI = {
219
- ref: "required-java-approuter-api",
220
- in: srvJava,
221
- keyPath: ["requires"],
222
- constraints: [{
223
- comparisonKeyPath: ["properties", "CDS_MULTITENANCY_APPUI_URL"],
224
- value: "~{url}"
225
- }]
226
- }
227
-
228
- const providedJavaApprouterAPI = {
229
- ref: "provided-java-approuter-api",
230
- in: approuter,
231
- keyPath: ["requires"],
232
- constraints: [{
233
- comparisonKeyPath: ["properties", "url"],
234
- value: "${default-url}"
235
- }]
236
- }
237
-
238
- const approuterExtensibility = {
239
- ref: "approuter-extensibility",
240
- keyPath: ["routes"],
241
- constraints: [{
242
- comparisonKeyPath: ["source"],
243
- value: "^/extend/(.*)"
244
- }, {
245
- comparisonKeyPath: ["destination"],
246
- value: "mtx-api",
247
- }, {
248
- comparisonKeyPath: ["target"],
249
- value: "$1",
250
- }, {
251
- comparisonKeyPath: ["authenticationType"],
252
- value: "none",
253
- }]
254
- }
255
-
256
- const approuterExtensibilityJava = {
257
- ref: "approuter-extensibility-java",
258
- keyPath: ["routes"],
259
- constraints: [{
260
- comparisonKeyPath: ["source"],
261
- value: "^/extend/(.*)"
262
- }, {
263
- comparisonKeyPath: ["destination"],
264
- value: "mtx-api",
265
- }, {
266
- comparisonKeyPath: ["target"],
267
- value: "$1",
268
- }, {
269
- comparisonKeyPath: ["authenticationType"],
270
- value: "none",
271
- }]
272
- }
273
-
274
- module.exports = {
275
- srvNode,
276
- srvJava,
277
- approuter,
278
- xsuaa,
279
- auditlog,
280
- hdbDeployer,
281
- hdiContainer,
282
- serviceManager,
283
- saasRegistry,
284
- srvAPI,
285
- mtxSidecar,
286
- providedMtxAPI,
287
- requiredMtxAPI,
288
- providedMtxSidecarAPI,
289
- requiredMtxSidecarAPI,
290
- providedAppAPI,
291
- requiredAppAPI,
292
- requiredJavaApprouterAPI,
293
- providedJavaApprouterAPI,
294
- kibanaLogging,
295
- approuterExtensibility,
296
- approuterExtensibilityJava
297
- }
@@ -1,12 +0,0 @@
1
- {
2
- "cds": {
3
- "requires": {
4
- "multitenancy": true
5
- },
6
- "mtx": {
7
- "element-prefix": "Z_",
8
- "namespace-blocklist": [],
9
- "extension-allowlist": []
10
- }
11
- }
12
- }
@@ -1,14 +0,0 @@
1
- {
2
- "cds": {
3
- "requires": {
4
- "[{{cap.for}}]": {
5
- "multitenancy": true
6
- }
7
- },
8
- "mtx": {
9
- "element-prefix": "Z_",
10
- "namespace-blocklist": [],
11
- "extension-allowlist": []
12
- }
13
- }
14
- }
@@ -1,17 +0,0 @@
1
- {
2
- "build": {
3
- "tasks": [
4
- {
5
- "for": "java-cf"
6
- },
7
- {
8
- "for": "mtx",
9
- "src": ".",
10
- "dest": "mtx-sidecar"
11
- },
12
- {
13
- "for": "hana"
14
- }
15
- ]
16
- }
17
- }
@@ -1,43 +0,0 @@
1
- {
2
- "name": "cap-mtx-sidecar",
3
- "dependencies": {
4
- "@sap/cds": "^6.0.0",
5
- "@sap/cds-mtx": "^2.5.6",
6
- "@sap/hdi-deploy": "^4.3.3",
7
- "@sap/instance-manager": "^3.3.3",
8
- "@sap/xssec": "^3.2.13",
9
- "@sap/hana-client": "^2.12.25",
10
- "express": "^4.18.1",
11
- "passport": "^0.6.0"
12
- },
13
- "scripts": {
14
- "start": "node server.js"
15
- },
16
- "engines": {
17
- "node": "^16.15.0"
18
- },
19
- "cds": {
20
- "features": {
21
- "kibana_formatter": true
22
- },
23
- "build": {
24
- "tasks": [
25
- {
26
- "for": "hana"
27
- },
28
- {
29
- "for": "java-cf"
30
- }
31
- ]
32
- },
33
- "requires": {
34
- "auth": {
35
- "kind": "xsuaa"
36
- },
37
- "db": {
38
- "kind": "hana-mt"
39
- },
40
- "multitenancy": true
41
- }
42
- }
43
- }
@@ -1,30 +0,0 @@
1
- const app = require('express')();
2
- const cds = require('@sap/cds');
3
-
4
- const main = async () => {
5
- app.use(defaults.correlate);
6
-
7
- await cds.connect.to('db');
8
- const PORT = process.env.PORT || 4004;
9
- await cds.mtx.in(app);
10
-
11
- app.listen(PORT);
12
- }
13
-
14
- const defaults = {
15
- get correlate() {
16
- return (req, _, next) => {
17
- if (!cds.context) cds.context = {}
18
- const id = cds.context.id
19
- || req.headers['x-correlation-id'] || req.headers['x-correlationid']
20
- || req.headers['x-request-id'] || req.headers['x-vcap-request-id']
21
- || cds.utils.uuid()
22
- cds.context.id = req.headers['x-correlation-id'] = id
23
- if (!cds.context._) cds.context._ = {}
24
- if (!cds.context._.req) cds.context._.req = req
25
- next();
26
- }
27
- }
28
- }
29
-
30
- main();
@@ -1,48 +0,0 @@
1
- {
2
- "scopes": [
3
- {
4
- "name": "$XSAPPNAME.mtcallback",
5
- "description": "Subscribe to applications",
6
- "grant-as-authority-to-apps": [
7
- "$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
8
- ]
9
- },
10
- {
11
- "name": "$XSAPPNAME.mtdeployment",
12
- "description": "Deploy applications"
13
- },
14
- {
15
- "name": "$XSAPPNAME.MtxDiagnose",
16
- "description": "Diagnose MTX"
17
- },
18
- {
19
- "name": "$XSAPPNAME.ExtendCDS",
20
- "description": "Extend CDS applications"
21
- },
22
- {
23
- "name": "$XSAPPNAME.ExtendCDSdelete",
24
- "description": "Extend CDS applications with undeployments"
25
- }
26
- ],
27
- "authorities": [
28
- "$XSAPPNAME.MtxDiagnose",
29
- "$XSAPPNAME.mtdeployment",
30
- "$XSAPPNAME.mtcallback"
31
- ],
32
- "role-templates": [
33
- {
34
- "name": "ExtensionDeveloper",
35
- "description": "Extend application",
36
- "scope-references": [
37
- "$XSAPPNAME.ExtendCDS"
38
- ]
39
- },
40
- {
41
- "name": "ExtensionDeveloperUndeploy",
42
- "description": "Undeploy extension",
43
- "scope-references": [
44
- "$XSAPPNAME.ExtendCDSdelete"
45
- ]
46
- }
47
- ]
48
- }
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- "extends": ["plugin:@sap/cds/recommended"]
3
- }