@sap/cds-dk 9.4.1 → 9.4.3
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 +35 -0
- package/bin/data-products/index.js +10 -2
- package/bin/data-products/prepare-csn.js +63 -26
- package/bin/help.js +2 -2
- package/bin/import.js +7 -2
- package/bin/up.js +25 -4
- package/bin/util/containerize.js +142 -0
- package/lib/build/buildTaskEngine.js +5 -2
- package/lib/build/plugin.js +1 -1
- package/lib/build/plugins/helm/index.js +6 -7
- package/lib/build/provider/hana/index.js +10 -2
- package/lib/import/common.js +3 -3
- package/lib/import/message.js +1 -1
- package/lib/init/constants.js +3 -1
- package/lib/init/index.js +4 -5
- package/lib/init/projectReader.js +101 -77
- package/lib/init/registries/mta.js +3 -0
- package/lib/init/registries/xs-app.js +7 -1
- package/lib/init/template/ams/index.js +7 -6
- package/lib/init/template/app-frontend/files/mta.yaml.hbs +0 -7
- package/lib/init/template/app-frontend/index.js +2 -2
- package/lib/init/template/application-logging/index.js +13 -10
- package/lib/init/template/approuter/files/mta.yaml.hbs +7 -0
- package/lib/init/template/approuter/index.js +30 -18
- package/lib/init/template/attachments/index.js +3 -3
- 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/containerize/files/containerize.yaml.hbs +1 -2
- package/lib/init/template/destination/index.js +5 -9
- 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/files/kyma-setup/action.yaml +0 -2
- package/lib/init/template/github-actions/index.js +3 -3
- package/lib/init/template/hana/index.js +19 -22
- package/lib/init/template/helm/index.js +47 -50
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +0 -10
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +3 -7
- package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -0
- package/lib/init/template/html5-repo/files/xs-app.json.hbs +5 -3
- package/lib/init/template/html5-repo/index.js +10 -8
- package/lib/init/template/http/index.js +31 -10
- package/lib/init/template/ias/files/mta.yaml.hbs +3 -0
- package/lib/init/template/ias/files/values.yaml.hbs +4 -1
- package/lib/init/template/ias/index.js +10 -11
- 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/index.js +8 -10
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/pipeline/index.js +5 -1
- package/lib/init/template/portal/files/mta.yaml.hbs +6 -0
- 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/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/workzone-standard/index.js +5 -6
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +0 -2
- package/lib/init/template/xsuaa/index.js +24 -19
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/util/question.js +1 -1
- package/npm-shrinkwrap.json +22 -22
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ module.exports = new class ProjectReader {
|
|
|
15
15
|
|
|
16
16
|
#setPackageInfo() {
|
|
17
17
|
this.isJava = (exists('pom.xml') || cds.cli.options?.add?.has('java'))
|
|
18
|
-
|
|
18
|
+
&& !cds.env.for('cds').profiles.includes('node') // opt-out for hybrid projects like sflight
|
|
19
19
|
|
|
20
20
|
// 1. Use project name and static default values
|
|
21
21
|
this.appVersion = this.isJava ? '1.0.0-SNAPSHOT' : '1.0.0'
|
|
@@ -32,7 +32,7 @@ module.exports = new class ProjectReader {
|
|
|
32
32
|
const v = version?.[0] === '${revision}' ? properties?.[0]?.revision[0] : version?.[0] ?? '1.0.0-SNAPSHOT'
|
|
33
33
|
if (v && REGEX_JAVA_VERSION.test(v)) this.appVersion = v
|
|
34
34
|
this.jdkVersion = properties?.[0]?.['jdk.version']?.[0]?._text?.[0] ?? JAVA_LTS_VERSIONS[JAVA_LTS_VERSIONS.length - 1]
|
|
35
|
-
if (artifactId?.[0])
|
|
35
|
+
if (artifactId?.[0]) this.appName = this.appId = artifactId?.[0]?.split(/-parent/)[0]
|
|
36
36
|
if (description?.[0]) this.appDescription = description[0]
|
|
37
37
|
}
|
|
38
38
|
else if (exists('package.json')) {
|
|
@@ -60,58 +60,6 @@ module.exports = new class ProjectReader {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* @typedef {Object} ProjectConfig
|
|
65
|
-
* @property {string} appVersion The version of the application.
|
|
66
|
-
* @property {string} appName The name of the application.
|
|
67
|
-
* @property {string} appId The ID of the application.
|
|
68
|
-
* @property {string} appDescription The description of the application.
|
|
69
|
-
* @property {'java' | 'nodejs'} language The programming language of the project.
|
|
70
|
-
* @property {string} srvPath The path to the server module.
|
|
71
|
-
* @property {string} archiveName The name of the archive.
|
|
72
|
-
* @property {Object} db Database configuration.
|
|
73
|
-
* @property {string} configFile The name of the configuration file. This is typically the `package.json` for Node.js and `.cdsrc.json` for Java.
|
|
74
|
-
* @property {string} appPath The path to the app folder.
|
|
75
|
-
* @property {string} approuterPath The path to the approuter folder.
|
|
76
|
-
* @property {boolean} hasUIEmbedded Indicates if the project uses an embedded UI.
|
|
77
|
-
* @property {boolean} hasUIModule Indicates if the project is using a modular UI.
|
|
78
|
-
* @property {boolean} hasUI Indicates if the project has a UI.
|
|
79
|
-
* @property {boolean} hasUI5 Indicates if the project is a UI5 project.
|
|
80
|
-
* @property {boolean} isUI5 Indicates if the project is a UI5 project.
|
|
81
|
-
* @property {boolean} isJava Indicates if the project is using Java.
|
|
82
|
-
* @property {boolean} isNodejs Indicates if the project is using Node.js.
|
|
83
|
-
* @property {boolean} isESM Indicates if the project is an ESM project (type 'module')
|
|
84
|
-
* @property {boolean} hasEsmStyle Indicates if code supports ESM-style imports and exports. This is true for ESM and Typescript projects.
|
|
85
|
-
* @property {boolean} isTypescript Indicates if the project is a Typescript project.
|
|
86
|
-
* @property {boolean} hasTyper Indicates if code supports CDS typer.
|
|
87
|
-
* @property {boolean} hasHelmUnifiedRuntime Indicates if the project uses Unified Runtime Helm deployment.
|
|
88
|
-
* @property {boolean} hasHelm Indicates if the project uses CAP Helm deployment.
|
|
89
|
-
* @property {boolean} hasMta Indicates if the project uses MTA deployment.
|
|
90
|
-
* @property {boolean} hasConnectivity Indicates if the project uses connectivity.
|
|
91
|
-
* @property {boolean} hasMultitenancy Indicates if the project is multitenant.
|
|
92
|
-
* @property {boolean} hasToggles Indicates if the project uses feature toggles.
|
|
93
|
-
* @property {boolean} hasExtensibility Indicates if the project is extensible.
|
|
94
|
-
* @property {boolean} hasXsuaa Indicates if the project uses XSUAA.
|
|
95
|
-
* @property {boolean} hasHana Indicates if the project uses HANA.
|
|
96
|
-
* @property {boolean} hasPostgres Indicates if the project uses PostgreSQL.
|
|
97
|
-
* @property {boolean} hasEnterpriseMessaging Indicates if the project uses SAP BTP Event Mesh.
|
|
98
|
-
* @property {boolean} hasAttachments Indicates if the project uses SAP BTP Object Store Service.
|
|
99
|
-
* @property {boolean} hasApprouter Indicates if the project uses the SAP Application Router.
|
|
100
|
-
* @property {boolean} hasHtml5Repo Indicates if the project uses the SAP BTP HTML5 Application Repository.
|
|
101
|
-
* @property {boolean} hasPortal Indicates if the project uses the SAP Cloud Portal service.
|
|
102
|
-
* @property {boolean} hasWorkzoneStandard Indicates if the project uses the SAP Build Work Zone, Standard Edition service.
|
|
103
|
-
* @property {boolean} hasDestination Indicates if the project uses the SAP BTP Destination service.
|
|
104
|
-
* @property {boolean} hasMTXRoute Indicates if the approuter should have a multitenant route.
|
|
105
|
-
* @property {boolean} hasMTXRouteJava Indicates if the approuter should have a multitenant subscription route (java).
|
|
106
|
-
* @property {boolean} hasMalwareScanner Indicates if the project uses the SAP Malware Scanning service.
|
|
107
|
-
* @property {boolean} hasDynatrace Indicates if the project uses Dynatrace.
|
|
108
|
-
* @property {boolean} hasCloudLogging Indicates if the project uses Cloud Logging.
|
|
109
|
-
* @property {String} extendsApp Indicates which project is extended if any.
|
|
110
|
-
* @property {String} githubSlug GitHub org/repo.
|
|
111
|
-
* @property {boolean} isMonorepoMicroservice Indicates if the project is a monorepo microservice.
|
|
112
|
-
* @property {String} npmWorkspaceRoot The root path of the monorepo workspace.
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
63
|
/**
|
|
116
64
|
* Reads the project configuration and constructs a project object.
|
|
117
65
|
* This function dynamically resolves project properties and returns an object with these properties.
|
|
@@ -125,10 +73,10 @@ module.exports = new class ProjectReader {
|
|
|
125
73
|
TRACE?.({ env })
|
|
126
74
|
|
|
127
75
|
const pkgJson = () => exists('package.json') ? JSON.parse(fs.readFileSync(join(cds.root, 'package.json'))) : {}
|
|
128
|
-
const _isESM
|
|
76
|
+
const _isESM = () => pkgJson().type === 'module'
|
|
129
77
|
const _isTypescript = () => !!pkgJson().dependencies?.typescript || !!pkgJson().devDependencies?.typescript
|
|
130
|
-
const _hasTyper
|
|
131
|
-
const _inProd = plugin => require(`./template/${plugin}`).hasInProduction(env) || cds.cli.argv
|
|
78
|
+
const _hasTyper = () => !!pkgJson().dependencies?.['@cap-js/cds-typer'] || !!pkgJson().devDependencies?.['@cap-js/cds-typer']
|
|
79
|
+
const _inProd = plugin => require(`./template/${plugin}`).hasInProduction(env) || cds.cli.argv[0]?.includes(plugin) || cds.cli.options.add?.has(plugin)
|
|
132
80
|
const _uiEmbedded = () => exists(join(env.folders.app, 'xs-app.json'))
|
|
133
81
|
const _uiModule = () => !_uiEmbedded() && isdir(env.folders.app) && fs.readdirSync(resolve(cds.root, env.folders.app)).length > 0
|
|
134
82
|
const _isJava = () => this.isJava
|
|
@@ -173,9 +121,22 @@ module.exports = new class ProjectReader {
|
|
|
173
121
|
const manifestPath = path.resolve(cds.root, cds.env.folders.app, app, 'webapp/manifest.json')
|
|
174
122
|
const manifest = exists(manifestPath) ? JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) : {}
|
|
175
123
|
const inbounds = manifest?.['sap.app']?.crossNavigation?.inbounds
|
|
176
|
-
const [firstInbound] = Object.values(inbounds ?? { intent: { semanticObject: 'Books', action: 'display' }})
|
|
124
|
+
const [firstInbound] = Object.values(inbounds ?? { intent: { semanticObject: 'Books', action: 'display' } })
|
|
177
125
|
const vizId = firstInbound.semanticObject + '-' + firstInbound.action
|
|
178
|
-
|
|
126
|
+
// Try to read archiveName from ui5-deploy.yaml if it exists
|
|
127
|
+
let archiveName = ''
|
|
128
|
+
const ui5DeployPath = path.resolve(cds.root, cds.env.folders.app, app, 'ui5-deploy.yaml')
|
|
129
|
+
if (exists(ui5DeployPath)) {
|
|
130
|
+
const ui5Deploy = cds.load.yaml(ui5DeployPath)
|
|
131
|
+
const customTasks = ui5Deploy?.builder?.customTasks
|
|
132
|
+
if (Array.isArray(customTasks)) {
|
|
133
|
+
const zipperTask = customTasks.find(t => t.name === 'ui5-task-zipper')
|
|
134
|
+
if (zipperTask?.configuration?.archiveName) {
|
|
135
|
+
archiveName = `${zipperTask.configuration.archiveName}.zip`
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { app, strippedApp: app.replace(/-/g, ''), vizId, isNotLast: i < apps.length - 1, manifestAppId: manifest?.['sap.app']?.id ?? app, archiveName }
|
|
179
140
|
})
|
|
180
141
|
},
|
|
181
142
|
appUIPaths: () => {
|
|
@@ -185,7 +146,7 @@ module.exports = new class ProjectReader {
|
|
|
185
146
|
isdir(path.join(cds.root, cds.env.folders.app, e)) && isApp(e)
|
|
186
147
|
)
|
|
187
148
|
},
|
|
188
|
-
hasIndexHtml: () => {},
|
|
149
|
+
hasIndexHtml: () => { },
|
|
189
150
|
appPath: () => env.folders.app,
|
|
190
151
|
appVersion: () => appVersion,
|
|
191
152
|
jdkVersion: () => jdkVersion,
|
|
@@ -204,6 +165,7 @@ module.exports = new class ProjectReader {
|
|
|
204
165
|
sap: () => cds.cli.options.sap,
|
|
205
166
|
imageRegistry: () => exists('chart/values.yaml') ? cds.load.yaml(join(cds.root, 'chart/values.yaml')).global?.image?.registry ?? '<your-container-registry-server>' : '<your-container-registry-server>',
|
|
206
167
|
extendsApp: _extends,
|
|
168
|
+
isBas: () => Object.entries(process.env).some(([key, value]) => key === 'WS_BASE_URL' && value.includes('applicationstudio') || /THEIA_(DEFAULT_)?PLUGINS/.test(key)),
|
|
207
169
|
npmWorkspaceRoot: () => {
|
|
208
170
|
if (this.cachedWorkspaceRoot) return this.cachedWorkspaceRoot
|
|
209
171
|
this.cachedWorkspaceRoot = execSync('npm prefix', { encoding: 'utf8', cwd: cds.root, stdio: 'pipe' }).trim()
|
|
@@ -212,7 +174,7 @@ module.exports = new class ProjectReader {
|
|
|
212
174
|
isMonorepoMicroservice: function () {
|
|
213
175
|
return this.npmWorkspaceRoot() !== cds.root
|
|
214
176
|
},
|
|
215
|
-
hasRoles: () => {}, roles: () => {}, // for xs-security generation
|
|
177
|
+
hasRoles: () => { }, roles: () => { }, // for xs-security generation
|
|
216
178
|
hasCustomRoleCollections: () => exists('xs-security.json') && !!JSON.parse(fs.readFileSync(path.join(cds.root, 'xs-security.json')))['role-collections']
|
|
217
179
|
}
|
|
218
180
|
|
|
@@ -221,10 +183,18 @@ module.exports = new class ProjectReader {
|
|
|
221
183
|
// E.g. `cds add hana` can be checked using `hasHana` or `isHana`
|
|
222
184
|
const project = (() => {
|
|
223
185
|
const defined = {}
|
|
224
|
-
const _get = property => {
|
|
186
|
+
const _get = property => {
|
|
187
|
+
const p = property
|
|
225
188
|
if (p in reserved) return reserved[p]()
|
|
226
|
-
for (const prefix of ['has', 'is']) if (p.startsWith(prefix) && p.length > prefix.length) {
|
|
227
|
-
|
|
189
|
+
for (const prefix of ['has', 'is', 'add']) if (p.startsWith(prefix) && p.length > prefix.length) {
|
|
190
|
+
const facet = p.slice(prefix.length).replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
|
|
191
|
+
const inProd = _inProd(facet)
|
|
192
|
+
if (prefix === 'add') {
|
|
193
|
+
const adding = facet => cds.cli.argv[0]?.includes(facet) || cds.cli.options.add?.has(facet)
|
|
194
|
+
const caller = new Error().stack.split('\n')[3].replace(/\\/g, '/').match(/lib\/init\/template\/([^/]+)\/index\.js/)[1]
|
|
195
|
+
return inProd && (adding(facet) || adding(caller))
|
|
196
|
+
}
|
|
197
|
+
return inProd
|
|
228
198
|
}
|
|
229
199
|
}
|
|
230
200
|
return new Proxy({}, {
|
|
@@ -245,23 +215,23 @@ module.exports = new class ProjectReader {
|
|
|
245
215
|
* @param {string[]?} roots array of directories to search for application.yaml, like `srv`
|
|
246
216
|
* @returns {Promise<object[]>} array of objects with `cds` property
|
|
247
217
|
*/
|
|
248
|
-
module.exports._readSpringBootConfig = async function (roots=[cds.env.folders.srv]) {
|
|
218
|
+
module.exports._readSpringBootConfig = async function (roots = [cds.env.folders.srv]) {
|
|
249
219
|
const configNodes = []
|
|
250
220
|
const rootDirs = roots.map(d => join(cds.root, d))
|
|
251
221
|
for (let r of rootDirs) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
222
|
+
const file = isfile(join(r, './src/main/resources/application.yaml'))
|
|
223
|
+
if (file) {
|
|
224
|
+
const yaml = cds.load.yaml(file)
|
|
225
|
+
for (let yamlDoc of Array.isArray(yaml) ? yaml : [yaml]) {
|
|
226
|
+
let cds = yamlDoc?.cds;
|
|
227
|
+
if (!cds) continue
|
|
228
|
+
cds = _normalizeSpringBootCfg(cds)
|
|
229
|
+
configNodes.push({ cds })
|
|
230
|
+
}
|
|
260
231
|
}
|
|
261
|
-
}
|
|
262
232
|
}
|
|
263
233
|
return configNodes
|
|
264
|
-
|
|
234
|
+
}
|
|
265
235
|
|
|
266
236
|
/**
|
|
267
237
|
* Normalize SpringBoot's dots in keys to express nested objects
|
|
@@ -271,7 +241,7 @@ module.exports._readSpringBootConfig = async function (roots=[cds.env.folders.sr
|
|
|
271
241
|
* @returns {object}
|
|
272
242
|
*/
|
|
273
243
|
function _normalizeSpringBootCfg(obj) {
|
|
274
|
-
if (typeof obj !== 'object')
|
|
244
|
+
if (typeof obj !== 'object') return obj
|
|
275
245
|
Object.keys(obj).forEach(k => {
|
|
276
246
|
const prop = k.split('.')
|
|
277
247
|
const last = prop.pop()
|
|
@@ -284,7 +254,61 @@ function _normalizeSpringBootCfg(obj) {
|
|
|
284
254
|
// recursively normalize
|
|
285
255
|
_normalizeSpringBootCfg(obj[k])
|
|
286
256
|
// delete the original property from object if it was rewritten
|
|
287
|
-
if (prop.length)
|
|
257
|
+
if (prop.length) delete obj[k]
|
|
288
258
|
})
|
|
289
259
|
return obj
|
|
290
260
|
}
|
|
261
|
+
|
|
262
|
+
/* Types */
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @typedef {Object} ProjectConfig
|
|
266
|
+
* @property {string} appVersion The version of the application.
|
|
267
|
+
* @property {string} appName The name of the application.
|
|
268
|
+
* @property {string} appId The ID of the application.
|
|
269
|
+
* @property {string} appDescription The description of the application.
|
|
270
|
+
* @property {'java' | 'nodejs'} language The programming language of the project.
|
|
271
|
+
* @property {string} srvPath The path to the server module.
|
|
272
|
+
* @property {string} archiveName The name of the archive.
|
|
273
|
+
* @property {Object} db Database configuration.
|
|
274
|
+
* @property {string} configFile The name of the configuration file. This is typically the `package.json` for Node.js and `.cdsrc.json` for Java.
|
|
275
|
+
* @property {string} appPath The path to the app folder.
|
|
276
|
+
* @property {string} approuterPath The path to the approuter folder.
|
|
277
|
+
* @property {boolean} hasUIEmbedded Indicates if the project uses an embedded UI.
|
|
278
|
+
* @property {boolean} hasUIModule Indicates if the project is using a modular UI.
|
|
279
|
+
* @property {boolean} hasUI Indicates if the project has a UI.
|
|
280
|
+
* @property {boolean} hasUI5 Indicates if the project is a UI5 project.
|
|
281
|
+
* @property {boolean} isUI5 Indicates if the project is a UI5 project.
|
|
282
|
+
* @property {boolean} isJava Indicates if the project is using Java.
|
|
283
|
+
* @property {boolean} isNodejs Indicates if the project is using Node.js.
|
|
284
|
+
* @property {boolean} isESM Indicates if the project is an ESM project (type 'module')
|
|
285
|
+
* @property {boolean} hasEsmStyle Indicates if code supports ESM-style imports and exports. This is true for ESM and Typescript projects.
|
|
286
|
+
* @property {boolean} isTypescript Indicates if the project is a Typescript project.
|
|
287
|
+
* @property {boolean} hasTyper Indicates if code supports CDS typer.
|
|
288
|
+
* @property {boolean} hasHelmUnifiedRuntime Indicates if the project uses Unified Runtime Helm deployment.
|
|
289
|
+
* @property {boolean} hasHelm Indicates if the project uses CAP Helm deployment.
|
|
290
|
+
* @property {boolean} hasMta Indicates if the project uses MTA deployment.
|
|
291
|
+
* @property {boolean} hasConnectivity Indicates if the project uses connectivity.
|
|
292
|
+
* @property {boolean} hasMultitenancy Indicates if the project is multitenant.
|
|
293
|
+
* @property {boolean} hasToggles Indicates if the project uses feature toggles.
|
|
294
|
+
* @property {boolean} hasExtensibility Indicates if the project is extensible.
|
|
295
|
+
* @property {boolean} hasXsuaa Indicates if the project uses XSUAA.
|
|
296
|
+
* @property {boolean} hasHana Indicates if the project uses HANA.
|
|
297
|
+
* @property {boolean} hasPostgres Indicates if the project uses PostgreSQL.
|
|
298
|
+
* @property {boolean} hasEnterpriseMessaging Indicates if the project uses SAP BTP Event Mesh.
|
|
299
|
+
* @property {boolean} hasAttachments Indicates if the project uses SAP BTP Object Store Service.
|
|
300
|
+
* @property {boolean} hasApprouter Indicates if the project uses the SAP Application Router.
|
|
301
|
+
* @property {boolean} hasHtml5Repo Indicates if the project uses the SAP BTP HTML5 Application Repository.
|
|
302
|
+
* @property {boolean} hasPortal Indicates if the project uses the SAP Cloud Portal service.
|
|
303
|
+
* @property {boolean} hasWorkzoneStandard Indicates if the project uses the SAP Build Work Zone, Standard Edition service.
|
|
304
|
+
* @property {boolean} hasDestination Indicates if the project uses the SAP BTP Destination service.
|
|
305
|
+
* @property {boolean} hasMTXRoute Indicates if the approuter should have a multitenant route.
|
|
306
|
+
* @property {boolean} hasMTXRouteJava Indicates if the approuter should have a multitenant subscription route (java).
|
|
307
|
+
* @property {boolean} hasMalwareScanner Indicates if the project uses the SAP Malware Scanning service.
|
|
308
|
+
* @property {boolean} hasDynatrace Indicates if the project uses Dynatrace.
|
|
309
|
+
* @property {boolean} hasCloudLogging Indicates if the project uses Cloud Logging.
|
|
310
|
+
* @property {String} extendsApp Indicates which project is extended if any.
|
|
311
|
+
* @property {String} githubSlug GitHub org/repo.
|
|
312
|
+
* @property {boolean} isMonorepoMicroservice Indicates if the project is a monorepo microservice.
|
|
313
|
+
* @property {String} npmWorkspaceRoot The root path of the monorepo workspace.
|
|
314
|
+
*/
|
|
@@ -15,6 +15,8 @@ const appFront = {
|
|
|
15
15
|
where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'app-front' }
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const ias = { in: 'resources', where: { 'parameters.service': 'identity' } }
|
|
19
|
+
|
|
18
20
|
const xsuaa = {
|
|
19
21
|
in: 'resources',
|
|
20
22
|
where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'xsuaa', 'parameters.service-plan': 'application' }
|
|
@@ -208,6 +210,7 @@ const auditlog = {
|
|
|
208
210
|
module.exports = {
|
|
209
211
|
srv4,
|
|
210
212
|
approuter,
|
|
213
|
+
ias,
|
|
211
214
|
xsuaa,
|
|
212
215
|
xsuaa4,
|
|
213
216
|
destination,
|
|
@@ -14,7 +14,8 @@ module.exports = class AmsTemplate extends require('../../plugin') {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
static hasInProduction(env) {
|
|
17
|
-
|
|
17
|
+
const { dependencies, devDependencies } = readProject()
|
|
18
|
+
return env.requires?.auth?.ams || devDependencies?.['@sap/ams-dev'] || dependencies?.['@sap/ams']
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
async run() {
|
|
@@ -27,21 +28,21 @@ module.exports = class AmsTemplate extends require('../../plugin') {
|
|
|
27
28
|
|
|
28
29
|
async combine() {
|
|
29
30
|
const project = readProject()
|
|
30
|
-
const {
|
|
31
|
+
const { addMta, addCfManifest, addHelm, addHelmUnifiedRuntime, addContainerize } = project
|
|
31
32
|
|
|
32
|
-
if (
|
|
33
|
+
if (addMta) {
|
|
33
34
|
await this.#combineWithMta(project)
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
if (
|
|
37
|
+
if (addCfManifest) {
|
|
37
38
|
await this.#combineWithCfManifest(project)
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
if (
|
|
41
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
41
42
|
await this.#combineWithHelm(project)
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
if (
|
|
45
|
+
if (addContainerize) {
|
|
45
46
|
await this.#combineWithContainerize(project)
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -29,13 +29,6 @@ modules:
|
|
|
29
29
|
{{#hasXsuaa}}
|
|
30
30
|
- name: {{appName}}-auth
|
|
31
31
|
{{/hasXsuaa}}
|
|
32
|
-
{{#hasIas}}
|
|
33
|
-
- name: {{appName}}-ias
|
|
34
|
-
parameters:
|
|
35
|
-
config:
|
|
36
|
-
credential-type: X509_GENERATED
|
|
37
|
-
app-identifier: app-deployer
|
|
38
|
-
{{/hasIas}}
|
|
39
32
|
- name: {{appName}}-app-front
|
|
40
33
|
parameters:
|
|
41
34
|
content-target: true
|
|
@@ -49,7 +49,7 @@ module.exports = class extends require('../../plugin') {
|
|
|
49
49
|
|
|
50
50
|
async combine() {
|
|
51
51
|
const project = readProject()
|
|
52
|
-
const { srvPath, appPath,
|
|
52
|
+
const { srvPath, appPath, addMta, apps } = project
|
|
53
53
|
|
|
54
54
|
await Promise.all(apps.map(async ({ app }) => {
|
|
55
55
|
project.app = app
|
|
@@ -63,7 +63,7 @@ module.exports = class extends require('../../plugin') {
|
|
|
63
63
|
// await merge({ cds: { requires: { 'app-front':true } } }).into('mtx/sidecar/package.json')
|
|
64
64
|
// }
|
|
65
65
|
|
|
66
|
-
if (
|
|
66
|
+
if (addMta) {
|
|
67
67
|
const srv = srv4(srvPath)
|
|
68
68
|
project.apps = apps
|
|
69
69
|
const appModules = project.apps.map(app => ({
|
|
@@ -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'],
|
|
@@ -5,7 +5,7 @@ const { readProject } = require('../../projectReader')
|
|
|
5
5
|
const { sort, merge } = require('../../merge')
|
|
6
6
|
const {
|
|
7
7
|
srv4, mtxSidecar4, approuter, // Modules
|
|
8
|
-
xsuaa, // BTP Services
|
|
8
|
+
xsuaa, ias, // BTP Services
|
|
9
9
|
requiredMtxApi, requiredJavaApprouterApi4, providedJavaApprouterApi, // APIs
|
|
10
10
|
requiredAppApi4, providedAppApi,
|
|
11
11
|
approuterMTXRoute,
|
|
@@ -31,37 +31,49 @@ 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
|
+
addIas, addXsuaa, hasXsuaa, hasIas, 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 || addIas) && 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
|
-
if (hasXsuaa) additions.push(xsuaa)
|
|
47
52
|
const relationships = []
|
|
48
|
-
if (hasXsuaa)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
53
|
+
if (hasXsuaa) {
|
|
54
|
+
additions.push(xsuaa)
|
|
55
|
+
relationships.push({
|
|
56
|
+
insert: [xsuaa, 'name'],
|
|
57
|
+
into: [approuter, 'requires', 'name']
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
if (hasIas) {
|
|
61
|
+
additions.push(ias)
|
|
62
|
+
relationships.push({
|
|
63
|
+
insert: [ias, 'name'],
|
|
64
|
+
into: [approuter, 'requires', 'name']
|
|
65
|
+
})
|
|
66
|
+
}
|
|
55
67
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
56
68
|
with: project, additions, relationships,
|
|
57
69
|
})
|
|
58
70
|
}
|
|
59
71
|
|
|
60
|
-
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
72
|
+
if (addHelm || addHelmUnifiedRuntime || addMultitenancy && (hasHelm || hasHelmUnifiedRuntime)) {
|
|
61
73
|
await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
62
74
|
}
|
|
63
75
|
|
|
64
|
-
if (
|
|
76
|
+
if (addContainerize) {
|
|
65
77
|
const additions = [{
|
|
66
78
|
in: 'modules',
|
|
67
79
|
where: { name: `${project.appName}-approuter` }
|
|
@@ -26,9 +26,9 @@ module.exports = class AttachmentsTemplate extends require('../../plugin') {
|
|
|
26
26
|
|
|
27
27
|
async combine() {
|
|
28
28
|
const project = readProject()
|
|
29
|
-
const {
|
|
29
|
+
const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
|
|
30
30
|
|
|
31
|
-
if (
|
|
31
|
+
if (addMta) {
|
|
32
32
|
const srv = srv4(srvPath)
|
|
33
33
|
const additions = [srv, attachments]
|
|
34
34
|
const relationships = [{
|
|
@@ -40,7 +40,7 @@ module.exports = class AttachmentsTemplate extends require('../../plugin') {
|
|
|
40
40
|
})
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (
|
|
43
|
+
if (addHelm || addHelmUnifiedRuntime) {
|
|
44
44
|
await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
|
|
45
45
|
}
|
|
46
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, addHelmUnifiedRuntime, 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 || addHelmUnifiedRuntime) {
|
|
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: [{
|