@sap/cds-dk 7.3.0 → 7.3.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/bin/add.js +1 -1
- package/bin/extend.js +5 -1
- package/bin/init.js +31 -37
- package/bin/repl.js +23 -43
- package/bin/watch.js +5 -9
- package/lib/bind/bindingResolver.js +2 -1
- package/lib/bind/index.js +1 -1
- package/lib/build/buildPlugin.js +18 -3
- package/lib/build/buildTaskEngine.js +2 -1
- package/lib/build/buildTaskFactory.js +33 -9
- package/lib/build/buildTaskProvider.js +1 -1
- package/lib/build/buildTaskProviderFactory.js +15 -61
- package/lib/build/constants.js +2 -0
- package/lib/build/index.js +5 -2
- package/lib/build/plugins.js +35 -0
- package/lib/build/provider/edmxBuildPlugin.js +5 -1
- package/lib/build/provider/featureToggleBuildPlugin.js +2 -2
- package/lib/build/provider/internalBuildPlugin.js +4 -0
- package/lib/build/provider/internalBuildTaskProvider.js +1 -1
- package/lib/build/provider/java/index.js +12 -6
- package/lib/build/util.js +5 -0
- package/lib/client/download_legacy.js +2 -7
- package/lib/client/params.js +1 -0
- package/lib/client/settings_manager.js +16 -14
- package/lib/compile/openapi/csdl2openapi.js +1 -1
- package/lib/index.js +6 -0
- package/lib/init/constants.js +2 -1
- package/lib/init/template/_merging/registry-mta.js +12 -0
- package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +4 -4
- package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +4 -2
- package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +4 -3
- package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +9 -83
- package/lib/init/template/helm/subcharts/content-deployment/values.yaml +54 -15
- package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +4 -4
- package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +1 -1
- package/lib/init/template/helm/subcharts/service-instance/values.schema.json +0 -17
- package/lib/init/template/helm/subcharts/service-instance/values.yaml +28 -0
- package/lib/init/template/helm/subcharts/web-application/Chart.yaml +5 -5
- package/lib/init/template/helm/subcharts/web-application/templates/_api.tpl +60 -0
- package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +34 -73
- package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
- package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +96 -17
- package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +19 -3
- package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/templates/rbac.yaml +26 -0
- package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +1 -1
- package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
- package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +1 -1
- package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +21 -3
- package/lib/init/template/helm/subcharts/web-application/templates/virtual-service.yaml +36 -0
- package/lib/init/template/helm/subcharts/web-application/values.schema.json +535 -142
- package/lib/init/template/helm/subcharts/web-application/values.yaml +168 -44
- package/lib/init/template/mta/index.js +2 -2
- package/lib/init/template/nodejs/files/.vscode/launch.json +0 -3
- package/lib/init/template/notifications/files/mta.yaml.hbs +17 -0
- package/lib/init/template/notifications/files/notificationtypes.json.hbs +16 -0
- package/lib/init/template/notifications/files/package.json.hbs +14 -0
- package/lib/init/template/notifications/index.js +52 -0
- package/lib/util/pruneAxiosErrors.js +4 -1
- package/lib/util/term.js +1 -2
- package/lib/watch/livereload-server.js +38 -2
- package/lib/watch/node-watch.js +3 -2
- package/npm-shrinkwrap.json +383 -2190
- package/package.json +2 -2
- package/lib/init/template/helm/subcharts/content-deployment/templating.md +0 -37
- package/lib/init/template/helm/subcharts/content-deployment/values-lint.yaml +0 -5
- package/lib/init/template/helm/subcharts/content-deployment/values.md +0 -1011
- package/lib/init/template/helm/subcharts/service-instance/templating.md +0 -18
- package/lib/init/template/helm/subcharts/service-instance/values-lint.yaml +0 -2
- package/lib/init/template/helm/subcharts/service-instance/values.md +0 -186
- package/lib/init/template/helm/subcharts/web-application/templating.md +0 -51
- package/lib/init/template/helm/subcharts/web-application/values-lint.yaml +0 -8
- package/lib/init/template/helm/subcharts/web-application/values.md +0 -1363
|
@@ -51,7 +51,11 @@ class EdmxBuildPlugin extends FeatureToggleBuildPlugin {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
_isOdataProtocol(srv) {
|
|
54
|
-
|
|
54
|
+
let protocols = cds.service.protocols.protocol4(srv)
|
|
55
|
+
if (typeof protocols === "string") {
|
|
56
|
+
protocols = [protocols]
|
|
57
|
+
}
|
|
58
|
+
return protocols.some(p => p && p.startsWith('odata'))
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
_options4odata() {
|
|
@@ -125,8 +125,8 @@ class FeatureToggleBuildPlugin extends InternalBuildPlugin {
|
|
|
125
125
|
_validateFeature(ftCsn, baseCsn) {
|
|
126
126
|
// features must not have other dependencies than base model dependencies - cross feature dependencies are not supported
|
|
127
127
|
// do not pass options.messages in order to avoid duplicate compiler messages
|
|
128
|
-
// version 2.13.9 of compileSources does not read the requires definition of parsed CSNs
|
|
129
|
-
cds.compiler.compileSources({
|
|
128
|
+
// version 2.13.9 of compileSources does not read the 'requires' definition of parsed CSNs
|
|
129
|
+
cds.compiler.compileSources({ [ftCsn.requires[0]]: baseCsn, 'feature.csn': ftCsn }, this.options())
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -22,6 +22,10 @@ class InternalBuildPlugin extends BuildPlugin {
|
|
|
22
22
|
return InternalBuildPlugin.PRIORITY_MAX_VALUE
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
init() {
|
|
26
|
+
// REVISIT: no default gen folder for now
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
async clean() {
|
|
26
30
|
// build results are deleted by the BuildTaskEngine if the build.target !== '.'
|
|
27
31
|
// make sure that src is not a subfolder of dest
|
|
@@ -43,7 +43,7 @@ Upgrade to @sap/cds-mtxs following the migration guide https://cap.cloud.sap/doc
|
|
|
43
43
|
InternalBuildTaskProvider._setDefaultModel(task)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
getPluginClass(task) {
|
|
47
47
|
return require(`./${InternalBuildTaskProvider._getForValueFromTask(task)}`)
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -2,8 +2,8 @@ const fs = require('fs')
|
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const cds = require('../../../cds')
|
|
4
4
|
const EdmxBuildPlugin = require('../edmxBuildPlugin')
|
|
5
|
-
const { OUTPUT_MODE, OUTPUT_MODE_RESULT, FILE_EXT_CDS, CONTENT_LANGUAGE_BUNDLES, CONTENT_DEFAULT_CSN, DEFAULT_CSN_FILE_NAME,
|
|
6
|
-
OUTPUT_MODE_FILESYSTEM, FLAVOR_LOCALIZED_EDMX } = require('../../constants')
|
|
5
|
+
const { OUTPUT_MODE, OUTPUT_MODE_RESULT, FILE_EXT_CDS, CONTENT_LANGUAGE_BUNDLES, CONTENT_DEFAULT_CSN, DEFAULT_CSN_FILE_NAME,
|
|
6
|
+
OUTPUT_MODE_FILESYSTEM, FLAVOR_LOCALIZED_EDMX, CONTENT_EDMX, CONTENT_LOCALIZED_EDMX } = require('../../constants')
|
|
7
7
|
const { getI18nDefaultFolder } = require('../../util')
|
|
8
8
|
const DEFAULT_COMPILE_DEST_FOLDER = path.normalize('src/main/resources/edmx')
|
|
9
9
|
|
|
@@ -20,11 +20,17 @@ class JavaBuildPlugin extends EdmxBuildPlugin {
|
|
|
20
20
|
if (!model) {
|
|
21
21
|
return
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
// generate edmx files containing all features
|
|
25
23
|
const odata = await this._compileForOdata(model, compileDest)
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
|
|
25
|
+
if (!this.hasBuildOption(CONTENT_EDMX, false)) {
|
|
26
|
+
// generate edmx files containing all features
|
|
27
|
+
// localized edmx for backward compatibility
|
|
28
|
+
if (!this.hasBuildOption(CONTENT_LOCALIZED_EDMX, false)) {
|
|
29
|
+
await this.compileToEdmx(odata, compileDest, { [FLAVOR_LOCALIZED_EDMX]: true })
|
|
30
|
+
}
|
|
31
|
+
// non-localized edmx
|
|
32
|
+
await this.compileToEdmx(odata, path.join(compileDest, 'odata', cds.env.odata.version), { [FLAVOR_LOCALIZED_EDMX]: false })
|
|
33
|
+
}
|
|
28
34
|
|
|
29
35
|
if (!this.hasBuildOption(CONTENT_LANGUAGE_BUNDLES, false)) {
|
|
30
36
|
// collect and write language bundles containing all features
|
package/lib/build/util.js
CHANGED
|
@@ -208,6 +208,10 @@ function _locationString(loc) {
|
|
|
208
208
|
: `${loc.file}:${loc.line}.${loc.col}-${loc.endLine}.${loc.endCol}`;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
async function pathExists(path) {
|
|
212
|
+
return fs.promises.access(path).then(() => true).catch(() => false);
|
|
213
|
+
}
|
|
214
|
+
|
|
211
215
|
/**
|
|
212
216
|
* Class for individual build message.
|
|
213
217
|
*
|
|
@@ -271,6 +275,7 @@ module.exports = {
|
|
|
271
275
|
getI18nDefaultFolder,
|
|
272
276
|
isClassicMtx,
|
|
273
277
|
normalizePath,
|
|
278
|
+
pathExists,
|
|
274
279
|
BuildMessage,
|
|
275
280
|
BuildError
|
|
276
281
|
}
|
|
@@ -13,10 +13,6 @@ const DOWNLOAD_FILE_NAME = 'migrated_projects.tgz'; // TODO try to add tenant la
|
|
|
13
13
|
module.exports = class Download extends BaseCommand {
|
|
14
14
|
|
|
15
15
|
static async run(paramValues) {
|
|
16
|
-
if (!tar) {
|
|
17
|
-
throw `cds pull requires @sap/cds version >= 6.2. Current version is ${cds.version}\n`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
const params = await login(paramValues);
|
|
21
17
|
|
|
22
18
|
const projectFolder = params.get('projectFolder');
|
|
@@ -31,17 +27,16 @@ module.exports = class Download extends BaseCommand {
|
|
|
31
27
|
const downloadedTgz = await this.getTgz(params);
|
|
32
28
|
await fs.promises.writeFile(downloadPath, downloadedTgz);
|
|
33
29
|
|
|
34
|
-
//await tar.xz(baseModelTgz).to(target); // expand if feature is requested later
|
|
35
|
-
|
|
36
30
|
console.log(`Finished.`);
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
static async getTgz(params) {
|
|
40
34
|
const tagRule = params.get('tagRule');
|
|
35
|
+
const defaultTag = params.get('defaultTag');
|
|
41
36
|
const downloadUrl = `${(params.get('appUrl'))}/-/cds/extensibility/getMigratedProjects`;
|
|
42
37
|
const options = { ...params.get('reqAuth'), responseType: 'arraybuffer' };
|
|
43
38
|
|
|
44
|
-
return axios.post(downloadUrl, { tagRule }, options)
|
|
39
|
+
return axios.post(downloadUrl, { tagRule, defaultTag }, options)
|
|
45
40
|
.then(response => Buffer.from(response.data))
|
|
46
41
|
.catch(error => this.handleHttpError(error, params, { url: downloadUrl }));
|
|
47
42
|
}
|
package/lib/client/params.js
CHANGED
|
@@ -163,6 +163,7 @@ class BasicParams {
|
|
|
163
163
|
this.directory = this.projectFolder.newAlias('directory');
|
|
164
164
|
|
|
165
165
|
this.tagRule = new Param('tagRule', '');
|
|
166
|
+
this.defaultTag = new Param('defaultTag', '');
|
|
166
167
|
|
|
167
168
|
// - non-persisted, internal
|
|
168
169
|
this.reqAuth = new Param('reqAuth', null, { obfuscate: ObfuscationLevel.full, internal: true });
|
|
@@ -215,29 +215,31 @@ class SettingsManager {
|
|
|
215
215
|
|
|
216
216
|
static async updateUrls(params, logout, loadedAppUrl) {
|
|
217
217
|
async function addAppUrl() {
|
|
218
|
-
// Prefix URL schema
|
|
219
|
-
if (params.has('appUrl')) {
|
|
220
|
-
const appUrl = params.get('appUrl');
|
|
221
|
-
if (!schemaRegex.test(appUrl)) {
|
|
222
|
-
if (localhostRegex.test(appUrl)) {
|
|
223
|
-
params.set('appUrl', httpSchema + appUrl);
|
|
224
|
-
} else {
|
|
225
|
-
params.set('appUrl', httpsSchema + appUrl);
|
|
226
|
-
}
|
|
227
|
-
DEBUG?.(`Added schema to app URL: ${params.get('appUrl')}`);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
218
|
if (!logout && !params.has('appUrl')) {
|
|
232
219
|
// Get appUrl from CF
|
|
233
220
|
DEBUG?.('App URL not given');
|
|
234
221
|
await getAppUrlAndSubdomainFromSuggestions(params);
|
|
235
222
|
}
|
|
236
223
|
|
|
237
|
-
// Check required param: appUrl
|
|
238
224
|
if (!params.has('appUrl')) {
|
|
239
225
|
throw 'App URL not given. Please specify it or log in to Cloud Foundry and repeat this command.';
|
|
240
226
|
}
|
|
227
|
+
|
|
228
|
+
// Prefix URL schema
|
|
229
|
+
let appUrl = params.get('appUrl');
|
|
230
|
+
if (appUrl.endsWith('/')) {
|
|
231
|
+
appUrl = appUrl.replace(/\/+$/, '');
|
|
232
|
+
DEBUG?.(`Removed trailing slash from app URL: ${appUrl}`);
|
|
233
|
+
}
|
|
234
|
+
if (!schemaRegex.test(appUrl)) {
|
|
235
|
+
if (localhostRegex.test(appUrl)) {
|
|
236
|
+
appUrl = httpSchema + appUrl;
|
|
237
|
+
} else {
|
|
238
|
+
appUrl = httpsSchema + appUrl;
|
|
239
|
+
}
|
|
240
|
+
DEBUG?.(`Added schema to app URL: ${appUrl}`);
|
|
241
|
+
}
|
|
242
|
+
params.set('appUrl', appUrl);
|
|
241
243
|
}
|
|
242
244
|
async function renewTokenUrl() {
|
|
243
245
|
const renewUrl = params.get('appUrl') !== loadedAppUrl;
|
|
@@ -64,7 +64,7 @@ module.exports.csdl2openapi = function (
|
|
|
64
64
|
csdl = JSON.parse(JSON.stringify(csdl))
|
|
65
65
|
csdl.$Version = odataVersion ? odataVersion : '4.01'
|
|
66
66
|
serviceRoot = serviceRoot || (scheme + '://' + host + basePath);
|
|
67
|
-
const queryOptionPrefix = csdl.$Version <= '4.
|
|
67
|
+
const queryOptionPrefix = csdl.$Version <= '4.01' ? '$' : '';
|
|
68
68
|
const typesToInline = {}; // filled in schema() and used in inlineTypes()
|
|
69
69
|
const boundOverloads = {};
|
|
70
70
|
const derivedTypes = {};
|
package/lib/index.js
CHANGED
|
@@ -23,3 +23,9 @@ cds.schema = cds.schema || {} // backward compatibility
|
|
|
23
23
|
cds.extend (cds.schema) .with ( {
|
|
24
24
|
overlay4: require('./env/schema')
|
|
25
25
|
})
|
|
26
|
+
|
|
27
|
+
// set build API, potentially removing the old API facade from sap/cds 7
|
|
28
|
+
delete cds.__proto__?.build
|
|
29
|
+
cds.extend (cds.constructor) .with (class {
|
|
30
|
+
get build() { return super.build = require('./build') }
|
|
31
|
+
})
|
package/lib/init/constants.js
CHANGED
|
@@ -112,6 +112,17 @@ const hdiContainer = {
|
|
|
112
112
|
}]
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
const notificationTypesDeployer = {
|
|
116
|
+
in: 'modules',
|
|
117
|
+
where: [{
|
|
118
|
+
property: 'name',
|
|
119
|
+
isEqualTo: 'notification-content-deployment'
|
|
120
|
+
}, {
|
|
121
|
+
property: 'type',
|
|
122
|
+
isEqualTo: 'nodejs'
|
|
123
|
+
}]
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
const serviceManager = {
|
|
116
127
|
in: 'resources',
|
|
117
128
|
where: [{
|
|
@@ -273,6 +284,7 @@ module.exports = {
|
|
|
273
284
|
enterpriseMessaging,
|
|
274
285
|
hdbDeployer,
|
|
275
286
|
hdiContainer,
|
|
287
|
+
notificationTypesDeployer,
|
|
276
288
|
serviceManager,
|
|
277
289
|
postgres,
|
|
278
290
|
postgresDeployer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apiVersion: v2
|
|
2
|
-
name: content-deployment
|
|
3
2
|
description: A Helm Chart for creating a Content Deployment job
|
|
4
|
-
|
|
5
|
-
version: 0.1.0
|
|
3
|
+
name: content-deployment
|
|
6
4
|
sources:
|
|
7
|
-
-
|
|
5
|
+
- https://github.tools.sap/unified-runtime/content-deployment
|
|
6
|
+
type: application
|
|
7
|
+
version: 1.3.0
|
|
@@ -118,6 +118,8 @@ Name of the imagePullSecret
|
|
|
118
118
|
{{- $ips.global.name }}
|
|
119
119
|
{{- else if or $ips.local.dockerconfigjson $ips.global.dockerconfigjson }}
|
|
120
120
|
{{- include "content-deployment.internal.fullname" . }}
|
|
121
|
+
{{- else }}
|
|
122
|
+
{{- "image-pull-secret" }}
|
|
121
123
|
{{- end }}
|
|
122
124
|
{{- end }}
|
|
123
125
|
|
|
@@ -128,9 +130,9 @@ Calculate the final image name
|
|
|
128
130
|
{{- $tag := .Values.image.tag | default .Values.global.image.tag | default "latest" }}
|
|
129
131
|
{{- $registry := .Values.image.registry | default .Values.global.image.registry }}
|
|
130
132
|
{{- if $registry }}
|
|
131
|
-
{{- $registry | trimSuffix "/" }}/{{ .Values.image.repository }}:{{ $tag }}
|
|
133
|
+
{{- $registry | trimSuffix "/" | trimPrefix "https://" }}/{{ .Values.image.repository | trimSuffix "/" }}:{{ $tag }}
|
|
132
134
|
{{- else }}
|
|
133
|
-
{{- .Values.image.repository }}:{{ $tag }}
|
|
135
|
+
{{- .Values.image.repository | trimSuffix "/" | trimPrefix "https://" }}:{{ $tag }}
|
|
134
136
|
{{- end }}
|
|
135
137
|
{{- end }}
|
|
136
138
|
|
|
@@ -50,15 +50,16 @@ spec:
|
|
|
50
50
|
drop:
|
|
51
51
|
- ALL
|
|
52
52
|
privileged: false
|
|
53
|
+
runAsNonRoot: true
|
|
54
|
+
{{- if .Values.runAsUser }}
|
|
55
|
+
runAsUser: {{ .Values.runAsUser }}
|
|
56
|
+
{{- end }}
|
|
53
57
|
readOnlyRootFilesystem: false
|
|
54
58
|
volumeMounts:
|
|
55
59
|
- mountPath: /tmp
|
|
56
60
|
name: tmp
|
|
57
61
|
{{- include "content-deployment.internal.serviceMounts" . | nindent 8 }}
|
|
58
62
|
restartPolicy: OnFailure
|
|
59
|
-
securityContext:
|
|
60
|
-
runAsNonRoot: true
|
|
61
|
-
runAsUser: 1000
|
|
62
63
|
volumes:
|
|
63
64
|
- name: tmp
|
|
64
65
|
emptyDir: {}
|