@sap/cds-dk 6.5.2 → 6.6.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.
- package/CHANGELOG.md +40 -0
- package/bin/activate.js +7 -0
- package/bin/add.js +1 -2
- package/bin/build/all.js +14 -9
- package/bin/cds.js +11 -8
- package/bin/compile/index.js +13 -3
- package/bin/env.js +16 -25
- package/bin/extend.js +8 -0
- package/bin/init.js +0 -3
- package/bin/login.js +3 -7
- package/bin/logout.js +2 -7
- package/bin/watch.js +4 -5
- package/lib/client/activate.js +1 -1
- package/lib/client/helper/errors.js +4 -1
- package/lib/client/params.js +4 -3
- package/lib/client/pull.js +31 -5
- package/lib/client/push.js +3 -3
- package/lib/client/settings_manager.js +6 -6
- package/lib/client/subscription.js +1 -1
- package/lib/compile/asyncapi/channels.js +22 -0
- package/lib/compile/asyncapi/components/messageTraits/index.js +89 -0
- package/lib/compile/asyncapi/components/messages/index.js +150 -0
- package/lib/compile/asyncapi/components/schemas/annotations.js +13 -0
- package/lib/compile/asyncapi/components/schemas/array.js +8 -0
- package/lib/compile/asyncapi/components/schemas/cache.js +14 -0
- package/lib/compile/asyncapi/components/schemas/definition.js +187 -0
- package/lib/compile/asyncapi/components/schemas/enum.js +16 -0
- package/lib/compile/asyncapi/components/schemas/examples.js +10 -0
- package/lib/compile/asyncapi/components/schemas/index.js +14 -0
- package/lib/compile/asyncapi/components/schemas/localized.js +29 -0
- package/lib/compile/asyncapi/components/schemas/primitiveElement.js +41 -0
- package/lib/compile/asyncapi/components/schemas/ref.js +45 -0
- package/lib/compile/asyncapi/components/schemas/utils.js +108 -0
- package/lib/compile/asyncapi/index.js +226 -0
- package/lib/compile/asyncapi/message.js +13 -0
- package/lib/compile/asyncapi/utils.js +27 -0
- package/lib/compile/index.js +1 -0
- package/lib/compile/openapi/csdl2openapi.js +42 -18
- package/lib/import/message.js +4 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +8 -3
- package/lib/import/odata/v2parser.js +131 -50
- package/lib/import/odata/v4parser.js +292 -112
- package/lib/import/openapi/importOpenAPI.js +14 -14
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +11 -21
- package/lib/init/template/_merging/registry-mta.js +15 -26
- package/lib/init/template/approuter/files/package.json +2 -2
- package/lib/init/template/approuter/index.js +6 -12
- package/lib/init/template/auditlog/files/auditlog.yaml +4 -1
- package/lib/init/template/auditlog/index.js +23 -8
- package/lib/init/template/cf-manifest/index.js +4 -14
- package/lib/init/template/connectivity/files/connectivity-proxy-info.yaml +2 -6
- package/lib/init/template/connectivity/files/values.yaml.hbs +5 -8
- package/lib/init/template/connectivity/index.js +2 -9
- package/lib/init/template/data/index.js +0 -4
- package/lib/init/template/destinations/files/destination.yaml +4 -1
- package/lib/init/template/destinations/index.js +25 -10
- package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +4 -1
- package/lib/init/template/enterprise-messaging/files/values.yaml +1 -2
- package/lib/init/template/enterprise-messaging/index.js +28 -20
- package/lib/init/template/extensibility/index.js +23 -31
- package/lib/init/template/hana/files/hana.yaml +4 -1
- package/lib/init/template/hana/index.js +44 -24
- package/lib/init/template/helm/chart/templates/_helpers.tpl +12 -0
- package/lib/init/template/helm/chart/values.root.schema.json +40 -0
- package/lib/init/template/helm/chart/values.schema.json +32 -69
- package/lib/init/template/helm/index.js +26 -16
- package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +13 -26
- package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +2 -0
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/templating.md +37 -0
- package/lib/init/template/helm/subcharts/content-deployment/values.md +182 -185
- package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +18 -22
- package/lib/init/template/helm/subcharts/content-deployment/values.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +5 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +65 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +23 -0
- package/lib/init/template/helm/subcharts/service-instance/templating.md +18 -0
- package/lib/init/template/helm/subcharts/service-instance/values-lint.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/values.md +186 -0
- package/lib/init/template/helm/subcharts/service-instance/values.schema.json +102 -0
- package/lib/init/template/helm/subcharts/service-instance/values.yaml +15 -0
- package/lib/init/template/html5-repo/files/html5-apps-deployer-configmap.yaml +2 -2
- package/lib/init/template/html5-repo/files/html5-apps-repo-host.yaml +4 -1
- package/lib/init/template/html5-repo/index.js +30 -21
- package/lib/init/template/java/index.js +3 -6
- package/lib/init/template/kibana-logging/index.js +7 -10
- package/lib/init/template/lint/index.js +2 -3
- package/lib/init/template/mta/files/mta.yaml.hbs +4 -2
- package/lib/init/template/mta/index.js +7 -11
- package/lib/init/template/mtx/index.js +0 -5
- package/lib/init/template/multitenancy/files/java/package.json +16 -7
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +11 -3
- package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +9 -0
- package/lib/init/template/multitenancy/files/saas-registry.yaml +4 -17
- package/lib/init/template/multitenancy/files/service-manager.yaml +4 -1
- package/lib/init/template/multitenancy/files/values.yaml.hbs +15 -3
- package/lib/init/template/multitenancy/index.js +56 -31
- package/lib/init/template/nodejs/index.js +4 -7
- package/lib/init/template/notebook/index.js +1 -3
- package/lib/init/template/pipeline/index.js +2 -5
- package/lib/init/template/samples/index.js +6 -11
- package/lib/init/template/templateBase.js +10 -17
- package/lib/init/template/toggles/index.js +2 -6
- package/lib/init/template/xsuaa/files/values.yaml.hbs +0 -1
- package/lib/init/template/xsuaa/files/xsuaa.yaml +4 -1
- package/lib/init/template/xsuaa/index.js +27 -23
- package/lib/init/types.d.ts +0 -81
- package/lib/init/util/merge.js +23 -25
- package/lib/init/util/mvnArchetypeUtil.js +34 -2
- package/lib/init/util/projectReader.js +27 -24
- package/lib/lint/Linter.js +31 -13
- package/lib/watch/livereload-server.js +29 -17
- package/lib/watch/node-watch.js +51 -49
- package/npm-shrinkwrap.json +548 -467
- package/package.json +4 -4
- package/readme.md +5 -0
- package/lib/init/template/connectivity/files/connectivity-binding.yaml +0 -9
- package/lib/init/template/connectivity/files/connectivity.yaml +0 -1
- package/lib/init/template/multitenancy/files/xsuaa.yaml +0 -1
- /package/lib/init/template/hana/files/{chart.yaml → hana-deployer.yaml} +0 -0
- /package/lib/init/template/html5-repo/files/{chart.yaml → html5-apps-deployer.yaml} +0 -0
- /package/lib/init/template/multitenancy/files/{chart.yaml → sidecar.yaml} +0 -0
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const { exists } = require('../../../cds').utils
|
|
3
|
-
const
|
|
3
|
+
const { readProject } = require('../../util/projectReader')
|
|
4
4
|
const { mergeYAML } = require('../../util/merge')
|
|
5
5
|
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
6
6
|
const { OPTION_DESTINATIONS } = require('../../constants')
|
|
7
7
|
|
|
8
8
|
module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
9
|
-
|
|
10
|
-
super(projectPath, generator, __dirname)
|
|
11
|
-
this.projectReader = new ProjectReader(projectPath)
|
|
12
|
-
}
|
|
9
|
+
|
|
13
10
|
|
|
14
11
|
getDependencies() {
|
|
15
12
|
return [OPTION_DESTINATIONS]
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
async canRun() {
|
|
19
|
-
const projectDescriptor = await
|
|
16
|
+
const projectDescriptor = await readProject(this.options)
|
|
20
17
|
const { hasMta, hasHelm } = projectDescriptor.cap
|
|
21
18
|
if (!hasHelm && hasMta) {
|
|
22
19
|
throw `'cds add html5-repo' is not available for Cloud Foundry yet`
|
|
@@ -24,9 +21,9 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
24
21
|
return true
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
static hasFacet(
|
|
24
|
+
static hasFacet() {
|
|
28
25
|
// REVISIT: Should be detectable without helm charts
|
|
29
|
-
return exists(join(
|
|
26
|
+
return exists(join('chart', 'templates', 'html5-apps-deployer-configmap.yaml'))
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
async run() {
|
|
@@ -34,7 +31,7 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
async runDependentMerging(context = {}) {
|
|
37
|
-
const projectDescriptor = await
|
|
34
|
+
const projectDescriptor = await readProject(this.options)
|
|
38
35
|
const { appName, hasHelm } = projectDescriptor.cap
|
|
39
36
|
|
|
40
37
|
if (hasHelm) {
|
|
@@ -48,7 +45,7 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
48
45
|
await mergeYAML(
|
|
49
46
|
join(this.projectPath, 'chart', 'values.yaml'),
|
|
50
47
|
{
|
|
51
|
-
|
|
48
|
+
'html5-apps-repo-host': {
|
|
52
49
|
serviceOfferingName: 'html5-apps-repo',
|
|
53
50
|
servicePlanName: 'app-host'
|
|
54
51
|
},
|
|
@@ -59,8 +56,7 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
59
56
|
envFrom: [
|
|
60
57
|
{
|
|
61
58
|
configMapRef: {
|
|
62
|
-
name: "{{ .Release.Name }}-html5-apps-deployer-configmap"
|
|
63
|
-
tpl: true
|
|
59
|
+
name: "{{ .Release.Name }}-html5-apps-deployer-configmap"
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
],
|
|
@@ -81,21 +77,18 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
81
77
|
backendDestinations: {},
|
|
82
78
|
}
|
|
83
79
|
)
|
|
84
|
-
|
|
80
|
+
|
|
85
81
|
// copy content deployment chart if it is not present
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
await copyAndTrack(contentDeploymentResourcePath, contentDeploymentSubchartPath, context);
|
|
90
|
-
}
|
|
82
|
+
const HelmTemplate = require(`../helm`);
|
|
83
|
+
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
84
|
+
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('content-deployment');
|
|
91
85
|
|
|
92
86
|
// add dependency entry in chart.yaml
|
|
93
87
|
await mergeYAML(
|
|
94
88
|
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
95
|
-
join(__dirname, 'files', '
|
|
89
|
+
join(__dirname, 'files', 'html5-apps-deployer.yaml'),
|
|
96
90
|
projectDescriptor,
|
|
97
91
|
{ additions: [{
|
|
98
|
-
ref: `content-deployment-html5-apps-deployer`,
|
|
99
92
|
in: `dependencies`,
|
|
100
93
|
where: [{
|
|
101
94
|
property: 'alias',
|
|
@@ -104,8 +97,24 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
104
97
|
}]}
|
|
105
98
|
)
|
|
106
99
|
|
|
100
|
+
// copy service-instance chart
|
|
101
|
+
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
102
|
+
|
|
103
|
+
// add dependency entry in chart.yaml
|
|
104
|
+
await mergeYAML(
|
|
105
|
+
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
106
|
+
join(__dirname, 'files', 'html5-apps-repo-host.yaml'),
|
|
107
|
+
projectDescriptor,
|
|
108
|
+
{ additions: [{
|
|
109
|
+
in: `dependencies`,
|
|
110
|
+
where: [{
|
|
111
|
+
property: 'alias',
|
|
112
|
+
isEqualTo: 'html5-apps-repo-host'
|
|
113
|
+
}]
|
|
114
|
+
}]}
|
|
115
|
+
)
|
|
116
|
+
|
|
107
117
|
await copyAndTrack(join(__dirname, 'files', 'html5-apps-deployer-configmap.yaml'), join(this.projectPath, 'chart', 'templates', 'html5-apps-deployer-configmap.yaml'), context)
|
|
108
|
-
await copyAndTrack(join(__dirname, 'files', 'html5-apps-repo-host.yaml'), join(this.projectPath, 'chart', 'templates', 'html5-apps-repo-host.yaml'), context)
|
|
109
118
|
if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
110
119
|
}
|
|
111
120
|
}
|
|
@@ -12,12 +12,9 @@ const LOG = console
|
|
|
12
12
|
const { COMMAND_ADD, URLS, OPTION_JAVA, OPTION_NODEJS } = require('../../constants');
|
|
13
13
|
|
|
14
14
|
module.exports = class JavaTemplate extends require('../templateBase') {
|
|
15
|
-
constructor(projectPath, generator) {
|
|
16
|
-
super(projectPath, generator, __dirname);
|
|
17
|
-
}
|
|
18
15
|
|
|
19
|
-
static hasFacet(
|
|
20
|
-
return exists(
|
|
16
|
+
static hasFacet() {
|
|
17
|
+
return exists('pom.xml')
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
async canRun() {
|
|
@@ -33,7 +30,7 @@ module.exports = class JavaTemplate extends require('../templateBase') {
|
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
async run() {
|
|
36
|
-
const mvnCmdArgs = mvnArchetypeUtil.getGenerateCmdArgs(this.projectName, this.options);
|
|
33
|
+
const mvnCmdArgs = await mvnArchetypeUtil.getGenerateCmdArgs(this.projectName, this.options);
|
|
37
34
|
const { cmdLine, artifactId, archetypeVersion } = mvnCmdArgs
|
|
38
35
|
|
|
39
36
|
LOG.info(`Using Maven archetype version ${archetypeVersion}`);
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const
|
|
3
|
+
const { readProject } = require('../../util/projectReader')
|
|
4
4
|
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
5
5
|
const { PROJECT_TYPE, } = require('../../constants')
|
|
6
6
|
const { srvNode, srvJava, kibanaLogging } = require('../_merging/registry-mta')
|
|
7
7
|
|
|
8
|
-
module.exports = class
|
|
9
|
-
|
|
10
|
-
super(projectPath, generator, __dirname)
|
|
11
|
-
this.projectReader = new ProjectReader(projectPath)
|
|
12
|
-
}
|
|
8
|
+
module.exports = class KibanaLoggingTemplate extends require('../templateBase') {
|
|
9
|
+
|
|
13
10
|
|
|
14
11
|
async canRun() {
|
|
15
|
-
const projectDescriptor = await
|
|
12
|
+
const projectDescriptor = await readProject(this.options)
|
|
16
13
|
const { hasMta, hasHelm } = projectDescriptor.cap
|
|
17
14
|
if (hasHelm && !hasMta) {
|
|
18
15
|
throw `'cds add kibana-logging' is not available for Kyma yet`
|
|
@@ -21,7 +18,7 @@ module.exports = class KibanaTemplate extends require('../templateBase') {
|
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
async run() {
|
|
24
|
-
const projectType =
|
|
21
|
+
const projectType = this.getProjectType()
|
|
25
22
|
|
|
26
23
|
switch (projectType) {
|
|
27
24
|
case PROJECT_TYPE.java:
|
|
@@ -30,7 +27,7 @@ module.exports = class KibanaTemplate extends require('../templateBase') {
|
|
|
30
27
|
// TODO: implement
|
|
31
28
|
break
|
|
32
29
|
case PROJECT_TYPE.nodejs: {
|
|
33
|
-
const projectDescriptor = await
|
|
30
|
+
const projectDescriptor = await readProject(this.options);
|
|
34
31
|
const { for: forProfile } = projectDescriptor.cap
|
|
35
32
|
const cdsTemplateFile = forProfile ? 'cds.profile.package.json.hbs' : 'cds.package.json'
|
|
36
33
|
const cdsTemplatePath = join(__dirname, 'files', cdsTemplateFile)
|
|
@@ -41,7 +38,7 @@ module.exports = class KibanaTemplate extends require('../templateBase') {
|
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
async runDependentMerging() {
|
|
44
|
-
const projectDescriptor = await
|
|
41
|
+
const projectDescriptor = await readProject(this.options)
|
|
45
42
|
const { hasMta, isNodejs } = projectDescriptor.cap
|
|
46
43
|
|
|
47
44
|
if (hasMta) {
|
|
@@ -19,9 +19,8 @@ const VSCODE_FILE_ASSOCIATIONS = {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
module.exports = class LintTemplate extends require('../templateBase') {
|
|
22
|
-
constructor(
|
|
23
|
-
super(
|
|
24
|
-
this.projectPath = projectPath;
|
|
22
|
+
constructor(generator) {
|
|
23
|
+
super(generator);
|
|
25
24
|
this.customPath = path.join(this.projectPath, ".eslint");
|
|
26
25
|
this.docsPath = path.join(this.customPath, "docs");
|
|
27
26
|
this.rulesPath = path.join(this.customPath, "rules");
|
|
@@ -24,9 +24,11 @@ modules:
|
|
|
24
24
|
{{/cap.isNodejs}}
|
|
25
25
|
{{#cap.isJava}}
|
|
26
26
|
parameters:
|
|
27
|
-
buildpack:
|
|
27
|
+
buildpack: sap_java_buildpack
|
|
28
28
|
properties:
|
|
29
|
-
SPRING_PROFILES_ACTIVE: cloud
|
|
29
|
+
SPRING_PROFILES_ACTIVE: cloud,sandbox
|
|
30
|
+
JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jre.SAPMachineJRE']"
|
|
31
|
+
JBP_CONFIG_SAP_MACHINE_JRE: '{ use_offline_repository: false, version: 17.+ }'
|
|
30
32
|
build-parameters:
|
|
31
33
|
builder: custom
|
|
32
34
|
commands:
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
const { join } = require('path');
|
|
2
2
|
const { exists } = require('../../../cds').utils
|
|
3
3
|
const { copyFiles } = require('../../util/templateUtil')
|
|
4
|
-
const
|
|
4
|
+
const { readProject } = require('../../util/projectReader');
|
|
5
5
|
|
|
6
6
|
module.exports = class MtaTemplate extends require('../templateBase') {
|
|
7
|
-
constructor(projectPath, generator) {
|
|
8
|
-
super(projectPath, generator, __dirname);
|
|
9
|
-
this.projectReader = new ProjectReader(projectPath);
|
|
10
|
-
}
|
|
11
7
|
|
|
12
|
-
static hasFacet(_,
|
|
8
|
+
static hasFacet(_, options) {
|
|
13
9
|
if (!options?.add.has('mta') && options?.add.has('helm')) return false
|
|
14
|
-
return exists(
|
|
10
|
+
return exists('mta.yaml')
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
async run() {
|
|
18
|
-
const projectDescriptor = await
|
|
19
|
-
if (!exists(
|
|
14
|
+
const projectDescriptor = await readProject()
|
|
15
|
+
if (!exists('mta.yaml')) {
|
|
20
16
|
await copyFiles(join(__dirname, 'files'), this.projectPath, projectDescriptor);
|
|
21
17
|
}
|
|
22
18
|
|
|
@@ -24,8 +20,8 @@ module.exports = class MtaTemplate extends require('../templateBase') {
|
|
|
24
20
|
const dependentFacets = ['approuter', 'hana', 'xsuaa', 'multitenancy', 'extensibility', 'enterprise-messaging']
|
|
25
21
|
for (const facet of dependentFacets) {
|
|
26
22
|
const Template = require('../'+facet)
|
|
27
|
-
const template = new Template(this.
|
|
28
|
-
if (Template.hasFacet(await this.getEnv(), this.
|
|
23
|
+
const template = new Template(this.generator)
|
|
24
|
+
if (Template.hasFacet(await this.getEnv(), this.options)) await template.runDependentMerging()
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
27
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
const ProjectReader = require('../../util/projectReader')
|
|
2
1
|
const { OPTION_MULTITENANCY, OPTION_TOGGLES, OPTION_EXTENSIBILITY } = require('../../constants')
|
|
3
2
|
|
|
4
3
|
module.exports = class MtxTemplate extends require('../templateBase') {
|
|
5
|
-
constructor(projectPath, generator) {
|
|
6
|
-
super(projectPath, generator, __dirname)
|
|
7
|
-
this.projectReader = new ProjectReader(projectPath)
|
|
8
|
-
}
|
|
9
4
|
|
|
10
5
|
getDependencies() {
|
|
11
6
|
return [OPTION_MULTITENANCY, OPTION_TOGGLES, OPTION_EXTENSIBILITY]
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cap-mtx-sidecar",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@sap/cds": "^6
|
|
5
|
-
"@sap/cds-mtxs": "^1
|
|
6
|
-
"@sap/
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"hdb": "^0.19.5",
|
|
4
|
+
"@sap/cds": "^6",
|
|
5
|
+
"@sap/cds-mtxs": "^1",
|
|
6
|
+
"@sap/xssec": "^3",
|
|
7
|
+
"express": "^4",
|
|
8
|
+
"hdb": "^0",
|
|
10
9
|
"passport": "^0.6.0"
|
|
11
10
|
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"sqlite3": "^5"
|
|
13
|
+
},
|
|
12
14
|
"scripts": {
|
|
13
15
|
"start": "cds run",
|
|
14
16
|
"build": "npm ci && npx -p @sap/cds-dk@^6 cds build ../.. --for mtx-sidecar --production && cd gen && npm ci"
|
|
15
17
|
},
|
|
16
18
|
"cds": {
|
|
17
19
|
"requires": {
|
|
18
|
-
"
|
|
20
|
+
"[production]": {
|
|
21
|
+
"db": "hana-mt",
|
|
22
|
+
"auth": "xsuaa"
|
|
23
|
+
},
|
|
24
|
+
"[development]": {
|
|
25
|
+
"db": "sqlite",
|
|
26
|
+
"auth": "dummy"
|
|
27
|
+
},
|
|
19
28
|
"cds.xt.ModelProviderService": "in-sidecar",
|
|
20
29
|
"cds.xt.DeploymentService": true,
|
|
21
30
|
"cds.xt.SaasProvisioningService": true
|
|
@@ -15,9 +15,11 @@ modules:
|
|
|
15
15
|
- name: srv-api # required by consumers of CAP services (e.g. approuter)
|
|
16
16
|
properties:
|
|
17
17
|
srv-url: ${default-url}
|
|
18
|
+
{{#cap.isNodejs}}
|
|
18
19
|
- name: mtx-api # potentially required by approuter
|
|
19
20
|
properties:
|
|
20
21
|
mtx-url: ${default-url}
|
|
22
|
+
{{/cap.isNodejs}}
|
|
21
23
|
|
|
22
24
|
{{#cap.isJava}}
|
|
23
25
|
- name: {{cap.appName}}-mtx-sidecar
|
|
@@ -35,6 +37,11 @@ modules:
|
|
|
35
37
|
- name: mtx-sidecar
|
|
36
38
|
properties:
|
|
37
39
|
url: ${default-url}
|
|
40
|
+
{{#cap.isJava}}
|
|
41
|
+
- name: mtx-api # potentially required by approuter
|
|
42
|
+
properties:
|
|
43
|
+
mtx-url: ${default-url}
|
|
44
|
+
{{/cap.isJava}}
|
|
38
45
|
{{#cap.hasXsuaa}}
|
|
39
46
|
requires:
|
|
40
47
|
- name: {{cap.appName}}-auth
|
|
@@ -69,6 +76,7 @@ resources:
|
|
|
69
76
|
getDependencies: ~{srv-api/srv-url}/mt/v1.0/subscriptions/dependencies
|
|
70
77
|
onSubscription: ~{srv-api/srv-url}/mt/v1.0/subscriptions/tenants/{tenantId}
|
|
71
78
|
{{/cap.isJava}}
|
|
72
|
-
onSubscriptionAsync:
|
|
73
|
-
onUnSubscriptionAsync:
|
|
74
|
-
|
|
79
|
+
onSubscriptionAsync: true
|
|
80
|
+
onUnSubscriptionAsync: true
|
|
81
|
+
onUpdateDependenciesAsync: true
|
|
82
|
+
callbackTimeoutMillis: 300000 # Increase if your deployments are taking longer than that
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"onSubscriptionAsync" false
|
|
6
|
-
"onUnSubscriptionAsync" false
|
|
7
|
-
"callbackTimeoutMillis" 300000
|
|
8
|
-
}}
|
|
9
|
-
{{- $defaultParameters := dict
|
|
10
|
-
"xsappname" .Values.xsuaa.parameters.xsappname
|
|
11
|
-
"appName" .Values.xsuaa.parameters.xsappname
|
|
12
|
-
"displayName" .Chart.Name
|
|
13
|
-
"description" .Chart.Description
|
|
14
|
-
"category" "CAP Application"
|
|
15
|
-
"appUrls" $defaultAppUrls
|
|
16
|
-
}}
|
|
17
|
-
{{- include "cap.service-instance" (merge (dict "defaultParameters" $defaultParameters ) .) }}
|
|
1
|
+
dependencies:
|
|
2
|
+
- name: service-instance
|
|
3
|
+
alias: saas-registry
|
|
4
|
+
version: 0.1.0
|
|
@@ -10,13 +10,19 @@ xsuaa:
|
|
|
10
10
|
parameters:
|
|
11
11
|
tenant-mode: shared
|
|
12
12
|
{{/cap.hasXsuaa}}
|
|
13
|
-
|
|
13
|
+
service-manager:
|
|
14
14
|
serviceOfferingName: service-manager
|
|
15
15
|
servicePlanName: container
|
|
16
|
-
|
|
16
|
+
saas-registry:
|
|
17
17
|
serviceOfferingName: saas-registry
|
|
18
18
|
servicePlanName: application
|
|
19
|
-
|
|
19
|
+
saasRegistryParameters:
|
|
20
|
+
xsappname: {{cap.appName}}
|
|
21
|
+
appName: {{cap.appName}}
|
|
22
|
+
displayName: {{cap.appName}}
|
|
23
|
+
description: {{cap.appDescription}}
|
|
24
|
+
category: "CAP Application"
|
|
25
|
+
appUrls:
|
|
20
26
|
{{#cap.isNodejs}}
|
|
21
27
|
getDependencies: "/-/cds/saas-provisioning/dependencies"
|
|
22
28
|
onSubscription: "/-/cds/saas-provisioning/tenant/{tenantId}"
|
|
@@ -24,6 +30,12 @@ saas_registry:
|
|
|
24
30
|
{{#cap.isJava}}
|
|
25
31
|
getDependencies: "/mt/v1.0/subscriptions/dependencies"
|
|
26
32
|
onSubscription: "/mt/v1.0/subscriptions/tenants/{tenantId}"
|
|
33
|
+
{{/cap.isJava}}
|
|
34
|
+
onSubscriptionAsync: true
|
|
35
|
+
onUnSubscriptionAsync: true
|
|
36
|
+
onUpdateDependenciesAsync: true
|
|
37
|
+
callbackTimeoutMillis: 300000
|
|
38
|
+
{{#cap.isJava}}
|
|
27
39
|
sidecar:
|
|
28
40
|
bindings:
|
|
29
41
|
{{#cap.hasXsuaa}}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { copy, exists } = cds.utils
|
|
4
|
-
const
|
|
4
|
+
const { readProject } = require('../../util/projectReader')
|
|
5
5
|
const { mergeJSON, mergeYAML, sortDependencies } = require('../../util/merge')
|
|
6
6
|
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
7
7
|
const {
|
|
8
8
|
srvNode, srvJava, // Server
|
|
9
9
|
mtxSidecar, // Additional Modules
|
|
10
10
|
saasRegistry, serviceManager, xsuaa, // BTP Services
|
|
11
|
-
|
|
11
|
+
providedMtxAPISrv, providedMtxAPISidecar, srvAPI, providedMtxSidecarAPI, requiredMtxSidecarAPI // APIs
|
|
12
12
|
} = require('../_merging/registry-mta');
|
|
13
13
|
|
|
14
14
|
module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
15
|
-
constructor(projectPath, generator) {
|
|
16
|
-
super(projectPath, generator, __dirname)
|
|
17
|
-
this.projectReader = new ProjectReader(projectPath)
|
|
18
|
-
}
|
|
19
15
|
|
|
20
|
-
static hasFacet(env,
|
|
16
|
+
static hasFacet(env, options) {
|
|
21
17
|
// REVISIT: Check if this can be simplified
|
|
22
18
|
return options?.add?.has('mtx') || options?.add?.has('multitenancy') ||
|
|
23
19
|
!!env.requires?.multitenancy || !!env.requires?.db?.multiTenant ||
|
|
24
|
-
this.isJava && exists(join(
|
|
20
|
+
this.isJava && exists(join('mtx', 'sidecar')) || false
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
async run() {
|
|
28
|
-
const projectDescriptor = await
|
|
24
|
+
const projectDescriptor = await readProject(this.options)
|
|
29
25
|
const { for: forProfile, isNodejs, isJava } = projectDescriptor.cap
|
|
30
26
|
if (isNodejs) {
|
|
31
27
|
const packageJSONPath = join(this.projectPath, 'package.json')
|
|
@@ -42,7 +38,7 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
async runDependentMerging(context = {}) {
|
|
45
|
-
const projectDescriptor = await
|
|
41
|
+
const projectDescriptor = await readProject()
|
|
46
42
|
const { isNodejs, isJava, hasMta, hasHelm, hasApprouter, hasXsuaa, hasHana } = projectDescriptor.cap
|
|
47
43
|
|
|
48
44
|
if (hasMta) {
|
|
@@ -50,7 +46,7 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
50
46
|
const srv = isNodejs ? srvNode : srvJava
|
|
51
47
|
const services = [saasRegistry]
|
|
52
48
|
if (hasXsuaa) services.push(xsuaa)
|
|
53
|
-
const apis = isNodejs ? [
|
|
49
|
+
const apis = isNodejs ? [providedMtxAPISrv] : [srvAPI, providedMtxAPISidecar, providedMtxSidecarAPI, requiredMtxSidecarAPI]
|
|
54
50
|
const additions = [...modules, ...services, ...apis]
|
|
55
51
|
|
|
56
52
|
const overwrites = hasXsuaa ? [{ item: [xsuaa, 'parameters.config.tenant-mode'], withValue: 'shared'}] : []
|
|
@@ -106,6 +102,16 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
]
|
|
105
|
+
},
|
|
106
|
+
"saas-registry": {
|
|
107
|
+
parametersFrom: [
|
|
108
|
+
{
|
|
109
|
+
secretKeyRef: {
|
|
110
|
+
name: "{{ .Release.Name }}-saas-registry-secret",
|
|
111
|
+
key: "parameters"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
109
115
|
}
|
|
110
116
|
},
|
|
111
117
|
projectDescriptor
|
|
@@ -114,11 +120,10 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
114
120
|
if (isJava) {
|
|
115
121
|
await mergeYAML(
|
|
116
122
|
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
117
|
-
join(__dirname, 'files', '
|
|
123
|
+
join(__dirname, 'files', 'sidecar.yaml'),
|
|
118
124
|
projectDescriptor,
|
|
119
125
|
{
|
|
120
126
|
additions: [{
|
|
121
|
-
ref: `web-application-sidecar`,
|
|
122
127
|
in: `dependencies`,
|
|
123
128
|
where: [{
|
|
124
129
|
property: 'alias',
|
|
@@ -129,6 +134,38 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
129
134
|
)
|
|
130
135
|
}
|
|
131
136
|
|
|
137
|
+
// copy service-instance chart
|
|
138
|
+
const HelmTemplate = require(`../helm`);
|
|
139
|
+
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
140
|
+
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
141
|
+
|
|
142
|
+
// add dependency entry in chart.yaml
|
|
143
|
+
await mergeYAML(
|
|
144
|
+
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
145
|
+
join(__dirname, 'files', 'saas-registry.yaml'),
|
|
146
|
+
projectDescriptor,
|
|
147
|
+
{ additions: [{
|
|
148
|
+
in: `dependencies`,
|
|
149
|
+
where: [{
|
|
150
|
+
property: 'alias',
|
|
151
|
+
isEqualTo: 'saas-registry'
|
|
152
|
+
}]
|
|
153
|
+
}]}
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
await mergeYAML(
|
|
157
|
+
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
158
|
+
join(__dirname, 'files', 'service-manager.yaml'),
|
|
159
|
+
projectDescriptor,
|
|
160
|
+
{ additions: [{
|
|
161
|
+
in: `dependencies`,
|
|
162
|
+
where: [{
|
|
163
|
+
property: 'alias',
|
|
164
|
+
isEqualTo: 'service-manager'
|
|
165
|
+
}]
|
|
166
|
+
}]}
|
|
167
|
+
);
|
|
168
|
+
|
|
132
169
|
const mtxsConfigmapPath = isNodejs
|
|
133
170
|
? join(__dirname, 'files', 'mtxs-configmap.yaml')
|
|
134
171
|
: join(__dirname, 'files', 'java', 'mtxs-configmap.yaml');
|
|
@@ -140,29 +177,25 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
140
177
|
context
|
|
141
178
|
)
|
|
142
179
|
|
|
180
|
+
// add saas registry secret
|
|
143
181
|
await copyAndTrack(
|
|
144
|
-
join(__dirname, 'files', '
|
|
145
|
-
join(this.projectPath, 'chart', 'templates', '
|
|
182
|
+
join(__dirname, 'files', 'saas-registry-secret.yaml'),
|
|
183
|
+
join(this.projectPath, 'chart', 'templates', 'saas-registry-secret.yaml'),
|
|
146
184
|
context
|
|
147
|
-
)
|
|
185
|
+
);
|
|
148
186
|
|
|
149
|
-
await copyAndTrack(
|
|
150
|
-
join(__dirname, 'files', 'saas-registry.yaml'),
|
|
151
|
-
join(this.projectPath, 'chart', 'templates', 'saas-registry.yaml'),
|
|
152
|
-
context
|
|
153
|
-
)
|
|
154
187
|
if (isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
155
188
|
}
|
|
156
189
|
|
|
157
190
|
if (hasApprouter) {
|
|
158
191
|
const ApprouterTemplate = require(`../approuter`)
|
|
159
|
-
const template = new ApprouterTemplate(this.
|
|
192
|
+
const template = new ApprouterTemplate(this.generator)
|
|
160
193
|
await template.runDependentMerging(context)
|
|
161
194
|
}
|
|
162
195
|
|
|
163
196
|
if (hasHana) {
|
|
164
197
|
const HanaTemplate = require(`../hana`)
|
|
165
|
-
const template = new HanaTemplate(this.
|
|
198
|
+
const template = new HanaTemplate(this.generator)
|
|
166
199
|
await template.runDependentMerging(context)
|
|
167
200
|
}
|
|
168
201
|
|
|
@@ -173,7 +206,6 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
173
206
|
projectDescriptor,
|
|
174
207
|
{
|
|
175
208
|
additions: [{
|
|
176
|
-
ref: 'scope-mtcallback',
|
|
177
209
|
in: 'scopes',
|
|
178
210
|
where: [{ property: 'name', isEqualTo: '$XSAPPNAME.mtcallback' }],
|
|
179
211
|
}]
|
|
@@ -182,13 +214,6 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
182
214
|
}
|
|
183
215
|
|
|
184
216
|
if (hasXsuaa && hasHelm) {
|
|
185
|
-
// REVISIT: Shared xs-security.json location for Helm and MTA?
|
|
186
|
-
await copyAndTrack(
|
|
187
|
-
join(this.projectPath, 'xs-security.json'),
|
|
188
|
-
join(this.projectPath, 'chart', 'xs-security.json'),
|
|
189
|
-
context
|
|
190
|
-
)
|
|
191
|
-
|
|
192
217
|
await mergeYAML(
|
|
193
218
|
join(this.projectPath, 'chart', 'values.yaml'),
|
|
194
219
|
{
|
|
@@ -4,10 +4,7 @@ const { COMMAND_ADD, OPTION_JAVA, OPTION_NODEJS, URLS } = require('../../constan
|
|
|
4
4
|
const { copyFiles } = require('../../util/templateUtil')
|
|
5
5
|
const LOG = console
|
|
6
6
|
|
|
7
|
-
module.exports = class
|
|
8
|
-
constructor(projectPath, generator) {
|
|
9
|
-
super(projectPath, generator, __dirname);
|
|
10
|
-
}
|
|
7
|
+
module.exports = class NodejsTemplate extends require('../templateBase') {
|
|
11
8
|
|
|
12
9
|
static hasFacet() {
|
|
13
10
|
// TODO: Implement
|
|
@@ -31,9 +28,9 @@ module.exports = class NodeJSTemplate extends require('../templateBase') {
|
|
|
31
28
|
const { projectPath, projectName } = this
|
|
32
29
|
await copyFiles(join(__dirname, 'files'), projectPath, { projectName }, this.options.force)
|
|
33
30
|
|
|
34
|
-
await mkdirp(
|
|
35
|
-
await mkdirp(
|
|
36
|
-
await mkdirp(
|
|
31
|
+
await mkdirp(env.folders.db);
|
|
32
|
+
await mkdirp(env.folders.srv);
|
|
33
|
+
await mkdirp(env.folders.app);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
async finalize() {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const term = require('../../../util/term');
|
|
2
2
|
|
|
3
3
|
module.exports = class NotebookTemplate extends require('../templateBase') {
|
|
4
|
-
|
|
5
|
-
super(projectPath, generator, __dirname);
|
|
6
|
-
}
|
|
4
|
+
|
|
7
5
|
|
|
8
6
|
async canRun() {
|
|
9
7
|
console.log(term.warn('CAP Jupyter Notebooks have been replaced by Custom CAP Notebooks for VS Code!'));
|
|
@@ -5,17 +5,14 @@ const { URLS } = require('../../constants')
|
|
|
5
5
|
const LOG = console
|
|
6
6
|
|
|
7
7
|
module.exports = class PipelineTemplate extends require('../templateBase') {
|
|
8
|
-
|
|
9
|
-
super(projectPath, generator, __dirname);
|
|
10
|
-
}
|
|
8
|
+
|
|
11
9
|
|
|
12
10
|
async canRun() {
|
|
13
11
|
if (this.options.force) {
|
|
14
12
|
return true;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
if (exists(join(
|
|
18
|
-
exists(join(this.projectPath, '.pipeline/config.yml'))) {
|
|
15
|
+
if (exists('Jenkinsfile') || exists(join('.pipeline', 'config.yml'))) {
|
|
19
16
|
throw new Error(`Pipeline support file exists. Use --force to overwrite.`);
|
|
20
17
|
}
|
|
21
18
|
|