@sap/cds-dk 9.3.2 → 9.4.2
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.
- package/CHANGELOG.md +59 -0
- package/bin/bind.js +1 -1
- package/bin/cds.js +3 -0
- package/bin/compile/index.js +53 -3
- package/bin/data-products/get-csn-via-dp-cli.js +41 -0
- package/bin/data-products/get-csn.js +76 -0
- package/bin/data-products/import.js +114 -0
- package/bin/data-products/index.js +30 -0
- package/bin/data-products/merge-csns.js +46 -0
- package/bin/data-products/prepare-csn.js +282 -0
- package/bin/data-products/prepare-files.js +69 -0
- package/bin/export.js +240 -0
- package/bin/help/export.md +37 -0
- package/bin/help/import.md +11 -0
- package/bin/help/minify.md +23 -0
- package/bin/import.js +13 -3
- package/bin/inspect.js +226 -0
- package/bin/minify.js +123 -0
- package/bin/up.js +2 -2
- package/bin/util/cli.js +132 -0
- package/bin/util/log.js +2 -0
- package/bin/version.js +2 -1
- package/bin/watch.js +21 -3
- package/lib/bind/shared.js +3 -1
- package/lib/build/buildTaskEngine.js +2 -1
- package/lib/build/plugins/helm/files/templates/NOTES.txt +1 -1
- package/lib/build/plugins/helm/index.js +1 -2
- package/lib/build/provider/internalBuildTaskProvider.js +3 -3
- package/lib/build/provider/nodejs/index.js +62 -3
- package/lib/deploy/index.js +1 -1
- package/lib/deploy/to-hana/hana.js +18 -16
- package/lib/import/odata/v2parser.js +2 -2
- package/lib/import/odata/v4parser.js +21 -2
- package/lib/import/odata.package.json +4 -4
- package/lib/init/constants.js +4 -1
- package/lib/init/index.js +6 -5
- package/lib/init/mvn.js +3 -2
- package/lib/init/projectReader.js +65 -55
- package/lib/init/registries/mta.js +6 -0
- package/lib/init/template/ams/files/manifest.yml.hbs +1 -1
- package/lib/init/template/ams/files/mta.yaml.hbs +1 -1
- package/lib/init/template/ams/index.js +7 -6
- package/lib/init/template/app-frontend/files/app-package.json.hbs +20 -0
- package/lib/init/template/app-frontend/files/index.html.hbs +34 -0
- package/lib/init/template/app-frontend/files/manifest.json +13 -0
- package/lib/init/template/app-frontend/files/mta.yaml.hbs +64 -0
- package/lib/init/template/app-frontend/files/package.json.hbs +17 -0
- package/lib/init/template/app-frontend/files/ui5-deploy.yaml.hbs +25 -0
- package/lib/init/template/app-frontend/files/ui5.yaml.hbs +6 -0
- package/lib/init/template/app-frontend/files/values.yaml.hbs +20 -0
- package/lib/init/template/app-frontend/files/xs-app.json.hbs +17 -0
- package/lib/init/template/app-frontend/index.js +98 -0
- package/lib/init/template/application-logging/index.js +13 -10
- package/lib/init/template/approuter/files/mta.yaml.hbs +0 -2
- package/lib/init/template/approuter/index.js +15 -9
- package/lib/init/template/attachments/index.js +7 -13
- package/lib/init/template/audit-logging/files/package.json.hbs +5 -0
- package/lib/init/template/audit-logging/index.js +4 -4
- package/lib/init/template/cloud-logging/index.js +13 -10
- package/lib/init/template/connectivity/index.js +3 -3
- package/lib/init/template/destination/index.js +6 -6
- package/lib/init/template/dynatrace/index.js +13 -10
- package/lib/init/template/enterprise-messaging/index.js +5 -5
- package/lib/init/template/enterprise-messaging-shared/index.js +4 -4
- package/lib/init/template/extensibility/index.js +2 -2
- package/lib/init/template/file-based-messaging/index.js +2 -2
- package/lib/init/template/github-actions/index.js +3 -3
- package/lib/init/template/hana/index.js +19 -22
- package/lib/init/template/handler/index.js +1 -0
- package/lib/init/template/helm/index.js +34 -21
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +0 -1
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +10 -2
- package/lib/init/template/html5-repo/index.js +8 -6
- package/lib/init/template/http/index.js +31 -10
- package/lib/init/template/ias/files/manifest.yml.hbs +1 -1
- package/lib/init/template/ias/files/mta.yaml.hbs +9 -5
- package/lib/init/template/ias/files/values.yaml.hbs +14 -2
- package/lib/init/template/ias/index.js +8 -8
- package/lib/init/template/kafka/index.js +3 -3
- package/lib/init/template/local-messaging/index.js +2 -2
- package/lib/init/template/malware-scanner/index.js +3 -7
- package/lib/init/template/mta/files/mta.yaml.hbs +10 -0
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +16 -3
- package/lib/init/template/multitenancy/files/package.json.hbs +5 -0
- package/lib/init/template/multitenancy/files/values.yaml.hbs +1 -6
- package/lib/init/template/multitenancy/index.js +8 -10
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/files/mta.yaml.hbs +18 -2
- package/lib/init/template/portal/index.js +7 -7
- package/lib/init/template/postgres/index.js +4 -4
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/redis-messaging/index.js +2 -2
- package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +2 -2
- package/lib/init/template/sample/files/db/schema.cds +5 -8
- package/lib/init/template/sample/files/javascript/admin-service.js.hbs +24 -0
- package/lib/init/template/sample/files/javascript/cat-service.js.hbs +43 -0
- package/lib/init/template/sample/files/typescript/admin-service.ts.hbs +16 -0
- package/lib/init/template/sample/files/typescript/cat-service.ts.hbs +31 -0
- package/lib/init/template/test/files/test/test.xs.hbs +1 -1
- package/lib/init/template/test/index.js +2 -2
- package/lib/init/template/tiny-sample/index.js +1 -1
- package/lib/init/template/typer/files/xsconfig.json +2 -1
- package/lib/init/template/typescript/files/package.json +1 -1
- package/lib/init/template/typescript/files/tsconfig.json +4 -1
- package/lib/init/template/workzone-standard/files/mta.yaml.hbs +4 -0
- package/lib/init/template/workzone-standard/index.js +8 -8
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +0 -2
- package/lib/init/template/xsuaa/files/package.json.hbs +3 -0
- package/lib/init/template/xsuaa/index.js +23 -18
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/util/term.js +2 -4
- package/npm-shrinkwrap.json +28 -28
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
parameters:
|
|
3
|
+
deploy_mode: html5-repo
|
|
4
|
+
modules:
|
|
5
|
+
- name: {{appName}}-srv
|
|
6
|
+
type: {{language}}
|
|
7
|
+
path: {{& srvPath}}
|
|
8
|
+
|
|
9
|
+
- name: {{appName}}
|
|
10
|
+
type: approuter.nodejs
|
|
11
|
+
path: {{& approuterPath}}
|
|
12
|
+
requires:
|
|
13
|
+
- name: {{appName}}-html5-runtime
|
|
14
|
+
|
|
15
|
+
- name: {{appName}}-app-deployer
|
|
16
|
+
type: com.sap.application.content
|
|
17
|
+
path: {{#isNodejs}}gen{{/isNodejs}}{{#isJava}}.{{/isJava}}
|
|
18
|
+
build-parameters:
|
|
19
|
+
build-result: {{#isNodejs}}{{& appPath }}{{/isNodejs}}{{#isJava}}resources{{/isJava}}
|
|
20
|
+
requires:
|
|
21
|
+
{{#apps}}
|
|
22
|
+
- name: {{strippedAppName}}{{strippedApp}}
|
|
23
|
+
artifacts:
|
|
24
|
+
- {{app}}.zip
|
|
25
|
+
target-path: {{#isNodejs}}{{& appPath }}{{/isNodejs}}{{#isJava}}resources{{/isJava}}
|
|
26
|
+
{{/apps}}
|
|
27
|
+
requires:
|
|
28
|
+
- name: srv-api
|
|
29
|
+
{{#hasXsuaa}}
|
|
30
|
+
- name: {{appName}}-auth
|
|
31
|
+
{{/hasXsuaa}}
|
|
32
|
+
- name: {{appName}}-app-front
|
|
33
|
+
parameters:
|
|
34
|
+
content-target: true
|
|
35
|
+
parameters:
|
|
36
|
+
config:
|
|
37
|
+
destinations:
|
|
38
|
+
- name: srv-api
|
|
39
|
+
url: ~{srv-api/srv-url}
|
|
40
|
+
forwardAuthToken: true
|
|
41
|
+
{{#hasUI5}}
|
|
42
|
+
- name: ui5
|
|
43
|
+
url: https://ui5.sap.com
|
|
44
|
+
{{/hasUI5}}
|
|
45
|
+
|
|
46
|
+
{{#apps}}
|
|
47
|
+
- name: {{strippedAppName}}{{strippedApp}}
|
|
48
|
+
type: html5
|
|
49
|
+
path: {{& appPath}}{{app}}
|
|
50
|
+
build-parameters:
|
|
51
|
+
build-result: dist
|
|
52
|
+
builder: custom
|
|
53
|
+
commands:
|
|
54
|
+
- npm ci
|
|
55
|
+
- npm run build
|
|
56
|
+
supported-platforms: []
|
|
57
|
+
{{/apps}}
|
|
58
|
+
|
|
59
|
+
resources:
|
|
60
|
+
- name: {{appName}}-app-front
|
|
61
|
+
type: org.cloudfoundry.managed-service
|
|
62
|
+
parameters:
|
|
63
|
+
service: app-front
|
|
64
|
+
service-plan: developer
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
|
|
3
|
+
specVersion: '3.1'
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{app}}
|
|
6
|
+
type: application
|
|
7
|
+
resources:
|
|
8
|
+
configuration:
|
|
9
|
+
propertiesFileSourceEncoding: UTF-8
|
|
10
|
+
builder:
|
|
11
|
+
resources:
|
|
12
|
+
excludes:
|
|
13
|
+
- "/test/**"
|
|
14
|
+
- "/localService/**"
|
|
15
|
+
customTasks:
|
|
16
|
+
- name: ui5-task-zipper
|
|
17
|
+
afterTask: generateVersionInfo
|
|
18
|
+
configuration:
|
|
19
|
+
archiveName: {{app}}
|
|
20
|
+
additionalFiles:
|
|
21
|
+
- xs-app.json
|
|
22
|
+
{{#isTypescript}}
|
|
23
|
+
- name: ui5-tooling-transpile-task
|
|
24
|
+
afterTask: replaceVersion
|
|
25
|
+
{{/isTypescript}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
app-front:
|
|
3
|
+
serviceOfferingName: app-front
|
|
4
|
+
servicePlanName: developer
|
|
5
|
+
html5-apps-deployer:
|
|
6
|
+
env:
|
|
7
|
+
SAP_CLOUD_SERVICE: {{strippedAppName}}.service
|
|
8
|
+
image:
|
|
9
|
+
repository: {{appName}}-html5-deployer
|
|
10
|
+
bindings:
|
|
11
|
+
app-front:
|
|
12
|
+
serviceInstanceName: app-front
|
|
13
|
+
{{=<% %>=}}
|
|
14
|
+
envFrom:
|
|
15
|
+
- configMapRef:
|
|
16
|
+
name: "{{ .Release.Name }}-app-front-configmap"
|
|
17
|
+
<%={{ }}=%>
|
|
18
|
+
backendDestinations:
|
|
19
|
+
srv-api:
|
|
20
|
+
service: srv
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"welcomeFile": "/index.html",
|
|
3
|
+
"authenticationMethod": "route",
|
|
4
|
+
"routes": [
|
|
5
|
+
{
|
|
6
|
+
"source": "^/?odata/(.*)$",
|
|
7
|
+
"target": "/odata/$1",
|
|
8
|
+
"destination": "srv-api"{{#hasXsuaa}},
|
|
9
|
+
"authenticationType": "xsuaa"{{/hasXsuaa}},
|
|
10
|
+
"csrfProtection": false
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"source": ".*",
|
|
14
|
+
"service": "app-front"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const { join } = require('path')
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge } = require('../../merge')
|
|
4
|
+
const { srv4, appDeployer, appFront } = require('../../registries/mta')
|
|
5
|
+
const { odataApi } = require('../../registries/xs-app')
|
|
6
|
+
const { renderAndCopy } = require('../../template')
|
|
7
|
+
const { exists } = require('../../../cds').utils
|
|
8
|
+
|
|
9
|
+
module.exports = class extends require('../../plugin') {
|
|
10
|
+
|
|
11
|
+
static help() {
|
|
12
|
+
return 'SAP BTP AppFront service' // TODO: Product name?
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static hasInProduction(env) {
|
|
16
|
+
return !!env.requires['app-front']
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async run() {
|
|
20
|
+
const project = readProject()
|
|
21
|
+
const { appUIPaths, apps, appPath, configFile, hasUI5 } = project
|
|
22
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
23
|
+
|
|
24
|
+
if (hasUI5) {
|
|
25
|
+
for (const { app } of apps) {
|
|
26
|
+
project.app = app
|
|
27
|
+
await merge(__dirname, 'files/ui5.yaml.hbs').into(join(appPath, app, 'ui5.yaml'), { project })
|
|
28
|
+
}
|
|
29
|
+
for (const { app } of apps) {
|
|
30
|
+
project.app = app
|
|
31
|
+
await merge(__dirname, 'files/ui5-deploy.yaml.hbs').into(join(appPath, app, 'ui5-deploy.yaml'), { project })
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
for (const { app } of apps) {
|
|
36
|
+
project.app = app
|
|
37
|
+
await merge(__dirname, 'files/app-package.json.hbs').into(join(appPath, app, 'package.json'), { project })
|
|
38
|
+
if (hasUI5) {
|
|
39
|
+
await renderAndCopy(join(__dirname, 'files/index.html.hbs'), join(appPath, app, 'webapp/index.html'), project)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// app deployer requires a manifest.json
|
|
44
|
+
await Promise.all(appUIPaths.map(p =>
|
|
45
|
+
merge(__dirname, 'files/manifest.json')
|
|
46
|
+
.into(join(appPath, p, 'webapp/manifest.json'), { project })
|
|
47
|
+
))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async combine() {
|
|
51
|
+
const project = readProject()
|
|
52
|
+
const { srvPath, appPath, addMta, apps } = project
|
|
53
|
+
|
|
54
|
+
await Promise.all(apps.map(async ({ app }) => {
|
|
55
|
+
project.app = app
|
|
56
|
+
project.hasIndexHtml = exists(join(appPath, app, 'webapp/index.html'))
|
|
57
|
+
const additions = [odataApi]
|
|
58
|
+
await merge(__dirname, 'files/xs-app.json.hbs').into(join(appPath, app, 'xs-app.json'), { with: project, additions })
|
|
59
|
+
}))
|
|
60
|
+
|
|
61
|
+
// later -> rather consider adding to app-front package.json
|
|
62
|
+
// if (hasMultitenancy) {
|
|
63
|
+
// await merge({ cds: { requires: { 'app-front':true } } }).into('mtx/sidecar/package.json')
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
if (addMta) {
|
|
67
|
+
const srv = srv4(srvPath)
|
|
68
|
+
project.apps = apps
|
|
69
|
+
const appModules = project.apps.map(app => ({
|
|
70
|
+
in: 'modules',
|
|
71
|
+
where: { type: 'html5', path: `${appPath}${app.app}` }
|
|
72
|
+
}))
|
|
73
|
+
const additions = [srv, appDeployer, appFront, ...appModules]
|
|
74
|
+
const relationships = [{
|
|
75
|
+
insert: [appFront, 'name'],
|
|
76
|
+
into: [appDeployer, 'requires', 'name'],
|
|
77
|
+
}]
|
|
78
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
79
|
+
with: project,
|
|
80
|
+
additions,
|
|
81
|
+
relationships
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// When Helm support is added
|
|
86
|
+
// if (hasContainerize) {
|
|
87
|
+
// const additions = [{
|
|
88
|
+
// in: 'modules',
|
|
89
|
+
// where: { name: `${project.appName}-content-deployer` }
|
|
90
|
+
// }]
|
|
91
|
+
// await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project, additions })
|
|
92
|
+
// }
|
|
93
|
+
// if (hasHelm || hasHelmUnifiedRuntime) {
|
|
94
|
+
// await renderAndCopy(join(__dirname, 'files/ui-resources'), 'ui-resources', project)
|
|
95
|
+
// await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
96
|
+
// }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -28,16 +28,19 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
|
|
|
28
28
|
|
|
29
29
|
async combine() {
|
|
30
30
|
const project = readProject()
|
|
31
|
-
const {
|
|
31
|
+
const { addMta, addApprouter, isJava, addMultitenancy, srvPath } = project
|
|
32
32
|
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
if (addMta || addMultitenancy) {
|
|
34
|
+
const additions = [], relationships = []
|
|
35
|
+
if (addMta) {
|
|
36
|
+
const srv = srv4(srvPath)
|
|
37
|
+
additions.push(srv, applicationLogging)
|
|
38
|
+
relationships.push({
|
|
39
|
+
insert: [applicationLogging, 'name'],
|
|
40
|
+
into: [srv, 'requires', 'name']
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
if (addMultitenancy) {
|
|
41
44
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
42
45
|
additions.push(mtxSidecar)
|
|
43
46
|
relationships.push({
|
|
@@ -45,7 +48,7 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
|
|
|
45
48
|
into: [mtxSidecar, 'requires', 'name']
|
|
46
49
|
})
|
|
47
50
|
}
|
|
48
|
-
if (
|
|
51
|
+
if (addApprouter) {
|
|
49
52
|
additions.push(approuter)
|
|
50
53
|
relationships.push({
|
|
51
54
|
insert: [applicationLogging, 'name'],
|
|
@@ -10,7 +10,6 @@ modules:
|
|
|
10
10
|
{{/hasMultitenancy}}
|
|
11
11
|
{{/isJava}}
|
|
12
12
|
requires:
|
|
13
|
-
- name: {{appName}}-auth
|
|
14
13
|
{{#isJava}}
|
|
15
14
|
- name: app-api{{#hasMultitenancy}}
|
|
16
15
|
properties:
|
|
@@ -84,4 +83,3 @@ resources:
|
|
|
84
83
|
oauth2-configuration:
|
|
85
84
|
redirect-uris:
|
|
86
85
|
- https://*~{app-api/app-uri}/**
|
|
87
|
-
|
|
@@ -31,17 +31,23 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
async combine() {
|
|
34
|
-
const project = readProject(
|
|
35
|
-
const {
|
|
34
|
+
const project = readProject()
|
|
35
|
+
const {
|
|
36
|
+
isNodejs, isJava,
|
|
37
|
+
addXsuaa, hasXsuaa, addMultitenancy, hasMTXRoute, hasMTXRouteJava,
|
|
38
|
+
addMta, addHelm, addHelmUnifiedRuntime, hasMta, hasHelm, hasHelmUnifiedRuntime,
|
|
39
|
+
addContainerize, srvPath, approuterPath
|
|
40
|
+
} = project
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
|
|
43
|
+
if (addMta || (addMultitenancy || addXsuaa) && hasMta) {
|
|
38
44
|
const srv = srv4(srvPath)
|
|
39
|
-
const apis = isJava &&
|
|
45
|
+
const apis = isJava && addMultitenancy ? [requiredJavaApprouterApi4(srv), providedJavaApprouterApi] : []
|
|
40
46
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
41
|
-
if (isNodejs &&
|
|
42
|
-
if (isJava &&
|
|
47
|
+
if (isNodejs && addMultitenancy) apis.push(requiredMtxApi, requiredAppApi4(mtxSidecar), providedAppApi)
|
|
48
|
+
if (isJava && addMultitenancy) apis.push(requiredMtxApi)
|
|
43
49
|
const modules = [srv, approuter]
|
|
44
|
-
if (
|
|
50
|
+
if (addMultitenancy) modules.push(mtxSidecar)
|
|
45
51
|
const additions = [...modules, ...apis]
|
|
46
52
|
if (hasXsuaa) additions.push(xsuaa)
|
|
47
53
|
const relationships = []
|
|
@@ -57,11 +63,11 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
|
|
|
57
63
|
})
|
|
58
64
|
}
|
|
59
65
|
|
|
60
|
-
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
66
|
+
if (addHelm || addHelmUnifiedRuntime || addMultitenancy && (hasHelm || hasHelmUnifiedRuntime)) {
|
|
61
67
|
await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
if (
|
|
70
|
+
if (addContainerize) {
|
|
65
71
|
const additions = [{
|
|
66
72
|
in: 'modules',
|
|
67
73
|
where: { name: `${project.appName}-approuter` }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { readProject } = require('../../projectReader')
|
|
2
2
|
const { merge } = require('../../merge')
|
|
3
3
|
const { srv4, attachments } = require('../../registries/mta')
|
|
4
|
+
const { mvn } = require('../../add')
|
|
4
5
|
|
|
5
6
|
module.exports = class AttachmentsTemplate extends require('../../plugin') {
|
|
6
7
|
|
|
@@ -16,25 +17,18 @@ module.exports = class AttachmentsTemplate extends require('../../plugin') {
|
|
|
16
17
|
return !!env.requires?.attachments || readProject().dependencies?.['@cap-js/attachments']
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
async canRun() {
|
|
20
|
-
const { isJava } = readProject()
|
|
21
|
-
if (isJava) throw `'cds add attachments' is not available for Java yet`
|
|
22
|
-
return true
|
|
23
|
-
}
|
|
24
|
-
|
|
25
20
|
async run() {
|
|
26
21
|
const project = readProject()
|
|
27
|
-
const { isNodejs } = project
|
|
28
|
-
if (isNodejs)
|
|
29
|
-
|
|
30
|
-
}
|
|
22
|
+
const { isNodejs, isJava } = project
|
|
23
|
+
if (isNodejs) await merge(__dirname, 'files/package.json.hbs').into('package.json')
|
|
24
|
+
if (isJava) await mvn.add('attachments')
|
|
31
25
|
}
|
|
32
26
|
|
|
33
27
|
async combine() {
|
|
34
28
|
const project = readProject()
|
|
35
|
-
const {
|
|
29
|
+
const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
|
|
36
30
|
|
|
37
|
-
if (
|
|
31
|
+
if (addMta) {
|
|
38
32
|
const srv = srv4(srvPath)
|
|
39
33
|
const additions = [srv, attachments]
|
|
40
34
|
const relationships = [{
|
|
@@ -46,7 +40,7 @@ module.exports = class AttachmentsTemplate extends require('../../plugin') {
|
|
|
46
40
|
})
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
if (
|
|
43
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
50
44
|
await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
|
|
51
45
|
}
|
|
52
46
|
}
|
|
@@ -33,15 +33,15 @@ module.exports = class AuditLoggingTemplate extends require('../../plugin') {
|
|
|
33
33
|
|
|
34
34
|
async combine() {
|
|
35
35
|
const project = readProject()
|
|
36
|
-
const {
|
|
36
|
+
const { addMta, addHelm, addMultitenancy, srvPath } = project
|
|
37
37
|
const { plan = 'premium' } = cds.cli.options
|
|
38
38
|
project.servicePlan = plan
|
|
39
39
|
|
|
40
|
-
if (
|
|
40
|
+
if (addMultitenancy) {
|
|
41
41
|
await merge(__dirname, 'files/package.sidecar.json').into('mtx/sidecar/package.json')
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if (
|
|
44
|
+
if (addMta) {
|
|
45
45
|
const srv = srv4(srvPath)
|
|
46
46
|
await merge(join(__dirname, 'files/mta.yaml.hbs')).into('mta.yaml', {
|
|
47
47
|
with: project,
|
|
@@ -53,7 +53,7 @@ module.exports = class AuditLoggingTemplate extends require('../../plugin') {
|
|
|
53
53
|
]
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
|
-
if (
|
|
56
|
+
if (addHelm) {
|
|
57
57
|
await merge({
|
|
58
58
|
srv: { bindings: { auditlog: { serviceInstanceName: 'auditlog' }}},
|
|
59
59
|
auditlog: {
|
|
@@ -37,9 +37,9 @@ module.exports = class extends require('../../plugin') {
|
|
|
37
37
|
|
|
38
38
|
async combine() {
|
|
39
39
|
const project = readProject()
|
|
40
|
-
const { hasMta,
|
|
40
|
+
const { hasMta, addMta, addHelm, addHelmUnifiedRuntime, addApprouter, isJava, addMultitenancy, srvPath } = project
|
|
41
41
|
|
|
42
|
-
if (hasMta) {
|
|
42
|
+
if (addMta || (addMultitenancy || addApprouter) && hasMta) {
|
|
43
43
|
const cloudLogging = {
|
|
44
44
|
in: 'resources',
|
|
45
45
|
where: {
|
|
@@ -47,13 +47,16 @@ module.exports = class extends require('../../plugin') {
|
|
|
47
47
|
'parameters.service': 'cloud-logging'
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
const additions = [cloudLogging], relationships = []
|
|
50
51
|
const srv = srv4(srvPath)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
if (addMta) {
|
|
53
|
+
additions.push(srv)
|
|
54
|
+
relationships.push({
|
|
55
|
+
insert: [cloudLogging, 'name'],
|
|
56
|
+
into: [srv, 'requires', 'name']
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
if (addMultitenancy) {
|
|
57
60
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
58
61
|
additions.push(mtxSidecar)
|
|
59
62
|
relationships.push({
|
|
@@ -61,7 +64,7 @@ module.exports = class extends require('../../plugin') {
|
|
|
61
64
|
into: [mtxSidecar, 'requires', 'name']
|
|
62
65
|
})
|
|
63
66
|
}
|
|
64
|
-
if (
|
|
67
|
+
if (addApprouter) {
|
|
65
68
|
additions.push(approuter)
|
|
66
69
|
relationships.push({
|
|
67
70
|
insert: [cloudLogging, 'name'],
|
|
@@ -74,7 +77,7 @@ module.exports = class extends require('../../plugin') {
|
|
|
74
77
|
with: project, additions, relationships
|
|
75
78
|
})
|
|
76
79
|
}
|
|
77
|
-
if (
|
|
80
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
78
81
|
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml')
|
|
79
82
|
}
|
|
80
83
|
}
|
|
@@ -20,9 +20,9 @@ module.exports = class ConnectivityTemplate extends require('../../plugin') {
|
|
|
20
20
|
|
|
21
21
|
async combine() {
|
|
22
22
|
const project = readProject()
|
|
23
|
-
const { srvPath,
|
|
23
|
+
const { srvPath, addHelm, addHelmUnifiedRuntime, addMta } = project
|
|
24
24
|
|
|
25
|
-
if (
|
|
25
|
+
if (addMta) {
|
|
26
26
|
const srv = srv4(srvPath)
|
|
27
27
|
const additions = [srv, connectivity]
|
|
28
28
|
const relationships = [{
|
|
@@ -32,7 +32,7 @@ module.exports = class ConnectivityTemplate extends require('../../plugin') {
|
|
|
32
32
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, relationships })
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
36
36
|
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', {
|
|
37
37
|
project,
|
|
38
38
|
additions: [{
|
|
@@ -24,26 +24,26 @@ module.exports = class DestinationTemplate extends require('../../plugin') {
|
|
|
24
24
|
|
|
25
25
|
async combine() {
|
|
26
26
|
const project = readProject()
|
|
27
|
-
const {
|
|
27
|
+
const { addHelm, addApprouter, addMultitenancy, addHelmUnifiedRuntime, addMta, hasMta, srvPath, isJava } = project
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (addMultitenancy) {
|
|
30
30
|
await merge({ cds: { requires: { destinations:true } } }).into('mtx/sidecar/package.json')
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (hasMta) {
|
|
33
|
+
if (addMta || (addApprouter || addMultitenancy) && hasMta) {
|
|
34
34
|
const srv = srv4(srvPath)
|
|
35
35
|
const additions = [srv, destination]
|
|
36
36
|
const relationships = [{
|
|
37
37
|
insert: [destination, 'name'],
|
|
38
38
|
into: [srv, 'requires', 'name']
|
|
39
39
|
}]
|
|
40
|
-
if (
|
|
40
|
+
if (addApprouter) {
|
|
41
41
|
relationships.push({
|
|
42
42
|
insert: [destination, 'name'],
|
|
43
43
|
into: [approuter, 'requires', 'name']
|
|
44
44
|
})
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (addMultitenancy) {
|
|
47
47
|
relationships.push({
|
|
48
48
|
insert: [destination, 'name'],
|
|
49
49
|
into: [mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar'), 'requires', 'name']
|
|
@@ -52,7 +52,7 @@ module.exports = class DestinationTemplate extends require('../../plugin') {
|
|
|
52
52
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { with: project, additions, relationships })
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
if (
|
|
55
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
56
56
|
await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -24,9 +24,9 @@ module.exports = class extends require('../../plugin') {
|
|
|
24
24
|
|
|
25
25
|
async combine() {
|
|
26
26
|
const project = readProject()
|
|
27
|
-
const { appName,
|
|
27
|
+
const { appName, addMta, addHelm, addHelmUnifiedRuntime, isJava, addMultitenancy, srvPath } = project
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (addMta || addMultitenancy) {
|
|
30
30
|
const dynatrace = {
|
|
31
31
|
in: 'resources',
|
|
32
32
|
where: {
|
|
@@ -34,13 +34,16 @@ module.exports = class extends require('../../plugin') {
|
|
|
34
34
|
'parameters.service': 'dynatrace'
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
const additions = [dynatrace], relationships = []
|
|
38
|
+
if (addMta) {
|
|
39
|
+
const srv = srv4(srvPath)
|
|
40
|
+
additions.push(srv)
|
|
41
|
+
relationships.push({
|
|
42
|
+
insert: [dynatrace, 'name'],
|
|
43
|
+
into: [srv, 'requires', 'name']
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
if (addMultitenancy) {
|
|
44
47
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
45
48
|
additions.push(mtxSidecar)
|
|
46
49
|
relationships.push({
|
|
@@ -54,7 +57,7 @@ module.exports = class extends require('../../plugin') {
|
|
|
54
57
|
})
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
if (
|
|
60
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
58
61
|
await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
|
|
59
62
|
}
|
|
60
63
|
}
|
|
@@ -41,9 +41,9 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
|
|
|
41
41
|
|
|
42
42
|
async combine() {
|
|
43
43
|
const project = readProject()
|
|
44
|
-
const {
|
|
44
|
+
const { addXsuaa, addHelm, addHelmUnifiedRuntime, addMta, srvPath, appName } = project
|
|
45
45
|
|
|
46
|
-
if (
|
|
46
|
+
if (addMta) {
|
|
47
47
|
const srv = srv4(srvPath)
|
|
48
48
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
49
49
|
project,
|
|
@@ -55,8 +55,8 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
|
|
|
55
55
|
})
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
58
|
+
if (addXsuaa || addMta) {
|
|
59
|
+
if (addMta) {
|
|
60
60
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
61
61
|
project,
|
|
62
62
|
additions: [xsuaa]
|
|
@@ -72,7 +72,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
|
|
|
72
72
|
})
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
if (
|
|
75
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
76
76
|
await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -34,7 +34,7 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
|
|
|
34
34
|
const project = readProject()
|
|
35
35
|
const { configFile, isNodejs } = project
|
|
36
36
|
if (isNodejs) {
|
|
37
|
-
project.shortcut = typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
|
|
37
|
+
project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
|
|
38
38
|
project.cloudevents = cds.cli.options.cloudevents
|
|
39
39
|
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
40
40
|
}
|
|
@@ -42,9 +42,9 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
|
|
|
42
42
|
|
|
43
43
|
async combine() {
|
|
44
44
|
const project = readProject()
|
|
45
|
-
const {
|
|
45
|
+
const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
|
|
46
46
|
|
|
47
|
-
if (
|
|
47
|
+
if (addMta) {
|
|
48
48
|
const srv = srv4(srvPath)
|
|
49
49
|
await merge(__dirname, 'files', 'mta.yaml.hbs').into('mta.yaml', {
|
|
50
50
|
project,
|
|
@@ -56,7 +56,7 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
|
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if (
|
|
59
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
60
60
|
await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
|
|
61
61
|
}
|
|
62
62
|
|