@sap/cds-dk 9.7.1 → 9.8.0
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 +44 -1
- package/bin/bind.js +7 -2
- package/bin/build.js +14 -4
- package/bin/cds.js +2 -2
- package/bin/completion/completionFs.js +1 -1
- package/bin/completion/index.js +2 -2
- package/bin/data-products/get-csn-via-dp-cli.js +1 -1
- package/bin/debug.js +1 -1
- package/bin/deploy/index.js +3 -2
- package/bin/gen.js +1 -1
- package/bin/help.js +1 -1
- package/bin/import.js +3 -0
- package/bin/minify.js +1 -1
- package/bin/mock.js +1 -1
- package/bin/repl.js +212 -39
- package/bin/test.js +0 -2
- package/bin/up.js +27 -3
- package/bin/util/containerize.js +1 -3
- package/bin/version.js +27 -7
- package/bin/watch.js +20 -4
- package/lib/bind/cf.js +2 -2
- package/lib/bind/k8s.js +0 -1
- package/lib/bind/plugin.js +2 -0
- package/lib/bind/shared.js +6 -1
- package/lib/build/constants.js +0 -8
- package/lib/build/index.js +569 -25
- package/lib/build/{provider/edmxBuildPlugin.js → plugins/edmx.js} +6 -15
- package/lib/build/{provider/featureToggleBuildPlugin.js → plugins/featureToggles.js} +3 -23
- package/lib/build/{provider → plugins}/fiori/index.js +27 -38
- package/lib/build/{provider → plugins}/hana/index.js +61 -83
- package/lib/build/{provider → plugins}/hana/migrationtable.js +4 -3
- package/lib/build/plugins/helm/index.js +6 -6
- package/lib/build/{provider/internalBuildPlugin.js → plugins/internal.js} +7 -31
- package/lib/build/{provider → plugins}/java/index.js +18 -26
- package/lib/build/plugins/mtx/index.js +41 -0
- package/lib/build/plugins/mtx/resourcesTarBuilder.js +41 -0
- package/lib/build/{provider → plugins}/mtx-extension/extensionCompilation.js +1 -1
- package/lib/build/{provider → plugins}/mtx-extension/index.js +35 -44
- package/lib/build/{provider → plugins}/mtx-sidecar/index.js +18 -4
- package/lib/build/{provider → plugins}/nodejs/index.js +29 -28
- package/lib/build/{plugin.js → plugins/plugin.js} +45 -59
- package/lib/build/plugins.js +11 -8
- package/lib/build/util.js +18 -16
- package/lib/compile/to-xsuaa.js +2 -2
- package/lib/deploy/to-hana/hana.js +64 -56
- package/lib/import/common.js +1 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -3
- package/lib/import/odata/v2parser.js +28 -28
- package/lib/import/odata/v4parser.js +37 -2
- package/lib/import/openapi/index.js +1 -1
- package/lib/init/constants.js +0 -1
- package/lib/init/template/app-frontend/index.js +1 -1
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/files/values.yaml.hbs +1 -0
- package/lib/init/template/completion/completionSetup.js +1 -1
- package/lib/init/template/data/as-csv.js +1 -1
- package/lib/init/template/github-actions/index.js +1 -1
- package/lib/init/template/handler/index.js +1 -1
- package/lib/init/template/helm/index.js +3 -3
- package/lib/init/template/initial/files/readme.md +2 -4
- package/lib/init/template/kyma/index.js +9 -5
- package/lib/init/template/lint/index.js +7 -21
- package/lib/init/template/multitenancy/files/package.json.hbs +0 -5
- package/lib/init/template/postgres/files/containerize.yaml.hbs +15 -0
- package/lib/init/template/postgres/files/package.json.hbs +35 -0
- package/lib/init/template/postgres/files/values.yaml.hbs +23 -0
- package/lib/init/template/postgres/index.js +34 -9
- package/lib/init/template/test/files/package.json +1 -1
- package/lib/init/template/typescript/files/package.json +1 -1
- package/lib/init/template/workzone-standard/files/mta.yaml.hbs +1 -0
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/lint/io.js +9 -13
- package/lib/mtx/pull.js +1 -1
- package/lib/mtx/settings_manager.js +11 -5
- package/lib/mtx/tenant_action.js +1 -1
- package/lib/mtx/util/fs.js +2 -2
- package/lib/util/cf.js +1 -1
- package/lib/util/fs.js +3 -3
- package/lib/util/git.js +1 -1
- package/lib/util/glob.js +1 -1
- package/lib/watch/hot-reload.js +202 -0
- package/lib/watch/livereload-server.js +6 -4
- package/lib/watch/node-watch.js +5 -1
- package/lib/watch/watched.js +7 -3
- package/lib/watch/watcher.js +41 -3
- package/npm-shrinkwrap.json +35 -26
- package/package.json +1 -1
- package/lib/build/buildTaskEngine.js +0 -377
- package/lib/build/buildTaskFactory.js +0 -198
- package/lib/build/buildTaskProvider.js +0 -38
- package/lib/build/buildTaskProviderFactory.js +0 -233
- package/lib/build/provider/internalBuildTaskProvider.js +0 -227
- package/lib/build/provider/java-cf/index.js +0 -1
- package/lib/build/provider/mtx/index.js +0 -36
- package/lib/build/provider/mtx/resourcesTarBuilder.js +0 -102
- package/lib/build/provider/node-cf/index.js +0 -1
- package/lib/init/template/lint/files/.eslint/rules/no-entity-moo.js +0 -40
- package/lib/init/template/lint/files/.eslint/tests/no-entity-moo/fixed/schema.cds +0 -4
- package/lib/init/template/lint/files/.eslint/tests/no-entity-moo/invalid/schema.cds +0 -4
- package/lib/init/template/lint/files/.eslint/tests/no-entity-moo/rule.test.js +0 -15
- package/lib/init/template/lint/files/.eslint/tests/no-entity-moo/valid/schema.cds +0 -6
- package/lib/init/types.d.ts +0 -23
- /package/lib/build/{provider → plugins}/hana/2migration.js +0 -0
- /package/lib/build/{provider → plugins}/hana/template/.hdiconfig-all +0 -0
- /package/lib/build/{provider → plugins}/hana/template/.hdiconfig-cloud +0 -0
- /package/lib/build/{provider → plugins}/hana/template/.hdinamespace +0 -0
- /package/lib/build/{provider → plugins}/hana/template/package.json +0 -0
- /package/lib/build/{provider → plugins}/hana/template/undeploy.json +0 -0
package/bin/version.js
CHANGED
|
@@ -7,13 +7,15 @@ module.exports = exports = async function cds_version (pattern, options) {
|
|
|
7
7
|
java_versions(o),
|
|
8
8
|
])
|
|
9
9
|
print_versions (all.flat(),o)
|
|
10
|
-
if (o.
|
|
11
|
-
|
|
10
|
+
if (!o.json) {
|
|
11
|
+
if (o.info) console.log ('\n','> Project:', project_info (o))
|
|
12
|
+
if (o._elsp) console.log ('\n', `${RED}ELSPROBLEMS${RESET} reported by ${BOLD}npm ls${RESET}. Run ${BOLD}npm install${RESET} to fix dependency problems, then rerun ${BOLD}cds version${RESET}.`)
|
|
13
|
+
}
|
|
12
14
|
console.log()
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
exports.options = [ '--depth', '--omit' ]
|
|
16
|
-
exports.flags = [ '--info', '--markdown', '--abs', '--all' ]
|
|
18
|
+
exports.flags = [ '--info', '--markdown', '--abs', '--all', '--json' ]
|
|
17
19
|
exports.shortcuts = [ '-d', '-o', '-i', '-m', '-a' ]
|
|
18
20
|
exports.help = `
|
|
19
21
|
# SYNOPSIS
|
|
@@ -89,7 +91,7 @@ const $npm_ls = (cmd,..._) => {
|
|
|
89
91
|
|
|
90
92
|
const cds = require('../lib')
|
|
91
93
|
const home = require('os').homedir()
|
|
92
|
-
const cap_packages = /@sap\/
|
|
94
|
+
const cap_packages = /@sap\/[\w-]*\bcds\b|@cap-js\//
|
|
93
95
|
const { GREEN, YELLOW, RED, DIMMED, BOLD, RESET } = cds.utils.colors
|
|
94
96
|
const { join, dirname } = require ('node:path')
|
|
95
97
|
|
|
@@ -174,7 +176,7 @@ async function node_versions(o) {
|
|
|
174
176
|
function java_versions (o) {
|
|
175
177
|
const javaInfo = !cds.env.cli?.version?.skipjava && cds.env['project-nature'] === 'java'
|
|
176
178
|
if (!javaInfo) return []
|
|
177
|
-
else if (process.stderr.isTTY) console.warn (DIMMED, 'This takes a while. Collecting Java versions...', RESET)
|
|
179
|
+
else if (process.stderr.isTTY && !o.json) console.warn (DIMMED, 'This takes a while. Collecting Java versions...', RESET)
|
|
178
180
|
const { MAVEN_ARCHETYPE_VERSION:mav } = require ('../lib/init/constants')
|
|
179
181
|
const cmd = `mvn com.sap.cds:cds-maven-plugin:${mav}:version -B -ntp -Dcds.version.excludeCds -Dcds.version.json`
|
|
180
182
|
try {
|
|
@@ -199,17 +201,26 @@ function project_info (o) {
|
|
|
199
201
|
|
|
200
202
|
|
|
201
203
|
function print_versions (rows, o, cwd = o.root+'/') {
|
|
204
|
+
if (o.json) {
|
|
205
|
+
const json = rows?.reduce((acc, [name, version, location]) => {
|
|
206
|
+
acc[name] = {}
|
|
207
|
+
if (version) acc[name].version = version
|
|
208
|
+
if (location) acc[name].location = location
|
|
209
|
+
return acc
|
|
210
|
+
}, {})
|
|
211
|
+
return console.log(JSON.stringify(json||{}, null, 2))
|
|
212
|
+
}
|
|
202
213
|
|
|
203
214
|
if (!rows || rows.length === 0) return console.error (YELLOW, ' No CAP packages found.', RESET)
|
|
204
|
-
const local = o.abs ? p => p : p => !p ? '' : p.startsWith(cwd) ? p.replace(cwd,'./') : p.replace(home,'~')
|
|
205
215
|
|
|
206
216
|
// cds10: remove and offer --json option instead
|
|
207
|
-
if (cds.env['project-nature'] === 'java' ||
|
|
217
|
+
if (process.env.WS_BASE_URL || cds.env['project-nature'] === 'java' || findPom(cwd)) {
|
|
208
218
|
console.log(rows.map(([name,version,location]) => `${GREEN}${name === 'cds.home'?'home':name}:${RESET} ${version??location}`).join('\n'))
|
|
209
219
|
return
|
|
210
220
|
}
|
|
211
221
|
|
|
212
222
|
// compute column widths for tabular printing
|
|
223
|
+
const local = o.abs ? p => p : p => !p ? '' : p.startsWith(cwd) ? p.replace(cwd,'./') : p.replace(home,'~')
|
|
213
224
|
const header = o.markdown && [ 'Package', 'Version', 'Location' ]
|
|
214
225
|
const all = Object.values(rows); if (header) all.push (header)
|
|
215
226
|
const w1 = Math.max (...all.map(s => s[0]?.length || 0))
|
|
@@ -236,3 +247,12 @@ function print_versions (rows, o, cwd = o.root+'/') {
|
|
|
236
247
|
const colored = [ GREEN, YELLOW, DIMMED ]
|
|
237
248
|
for (let each of rows) print (each, colored)
|
|
238
249
|
}
|
|
250
|
+
|
|
251
|
+
const { existsSync } = require('fs')
|
|
252
|
+
function findPom (dir) {
|
|
253
|
+
if (!dir || dir === '/' || dir === '.') return false
|
|
254
|
+
if (existsSync(join(dir,'pom.xml'))) return true
|
|
255
|
+
const parent = dirname(dir)
|
|
256
|
+
if (parent === dir) return false // reached filesystem root
|
|
257
|
+
return findPom(parent)
|
|
258
|
+
}
|
package/bin/watch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const watchOnlyOptions = ['--ext', '--livereload', '--open', '--debug', '--inspect', '--inspect-brk', '--include', '--exclude']
|
|
1
|
+
const watchOnlyOptions = ['--ext', '--livereload', '--experimental-hot-reload', '--open', '--debug', '--inspect', '--inspect-brk', '--include', '--exclude']
|
|
2
2
|
|
|
3
3
|
module.exports = Object.assign ( watch, {
|
|
4
4
|
flags: [ '--in-memory', '--in-memory?', '--with-mocks', '--with-mtx' ],
|
|
@@ -41,6 +41,11 @@ module.exports = Object.assign ( watch, {
|
|
|
41
41
|
Specify the port for the livereload server. Defaults to '35729'.
|
|
42
42
|
Disable it with value _false_.
|
|
43
43
|
|
|
44
|
+
*--experimental-hot-reload* <true | false>
|
|
45
|
+
|
|
46
|
+
Specify if the experimental hot reload should be used. Changes to the CDS model
|
|
47
|
+
in most scenarios no longer restart the server
|
|
48
|
+
|
|
44
49
|
*--open* <url>
|
|
45
50
|
|
|
46
51
|
Open the given URL (suffix) in the browser after starting.
|
|
@@ -85,7 +90,8 @@ const ignoreDefaults = [
|
|
|
85
90
|
/_out/,
|
|
86
91
|
/@types/,
|
|
87
92
|
/@cds-models/,
|
|
88
|
-
new RegExp(`app${escapedSep}.+?${escapedSep}webapp
|
|
93
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}webapp`),
|
|
94
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}.*\\.json`),
|
|
89
95
|
new RegExp(`app${escapedSep}.+?${escapedSep}dist${escapedSep}`),
|
|
90
96
|
new RegExp(`app${escapedSep}.+?${escapedSep}target${escapedSep}`),
|
|
91
97
|
new RegExp(`app${escapedSep}.+?${escapedSep}tsconfig\\.json$`),
|
|
@@ -119,12 +125,15 @@ async function watch ([cwd], {
|
|
|
119
125
|
if (fs.existsSync(cwd)) cwd = resolve (cwd)
|
|
120
126
|
else try { // try module name like `@capire/bookshop`
|
|
121
127
|
cwd = require.resolve (cwd+'/package.json', {paths:[ ocwd ]}).slice(0,-13)
|
|
122
|
-
} catch
|
|
128
|
+
} catch { throw `Error: No such folder or package: '${cwd}'` }
|
|
123
129
|
log (`cd ${relative(ocwd,cwd)}`)
|
|
124
130
|
}
|
|
125
131
|
else cwd = cds.root
|
|
126
132
|
|
|
127
|
-
if (isJava)
|
|
133
|
+
if (isJava) {
|
|
134
|
+
options.livereload = false
|
|
135
|
+
options['experimental-hot-reload'] = false
|
|
136
|
+
}
|
|
128
137
|
if (!isJava) log (`\n${t.bold}cds ${args.join(' ')}`)
|
|
129
138
|
|
|
130
139
|
const env = Object.assign (process.env, {
|
|
@@ -198,6 +207,13 @@ async function watch ([cwd], {
|
|
|
198
207
|
delete options.open
|
|
199
208
|
break
|
|
200
209
|
case 'EADDRINUSE': env.PORT = 0; _addr_in_use(msg); break
|
|
210
|
+
case 'model-refreshed':
|
|
211
|
+
case 'refreshModel':
|
|
212
|
+
liveReload?.reload()
|
|
213
|
+
break;
|
|
214
|
+
case 'restart':
|
|
215
|
+
watcher.restart()
|
|
216
|
+
break;
|
|
201
217
|
default: console.error (msg)
|
|
202
218
|
}})
|
|
203
219
|
|
package/lib/bind/cf.js
CHANGED
|
@@ -74,8 +74,8 @@ module.exports = new class CFBind extends require('./plugin') {
|
|
|
74
74
|
orgGuid = sharedFromOrgObj.guid;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
} catch
|
|
78
|
-
throw `service instance ${bold(instance)} not found
|
|
77
|
+
} catch {
|
|
78
|
+
throw `service instance ${bold(instance)} not found in the currently targeted Cloud Foundry space`
|
|
79
79
|
}
|
|
80
80
|
switch (instanceObj.type) {
|
|
81
81
|
case 'managed':
|
package/lib/bind/k8s.js
CHANGED
|
@@ -81,7 +81,6 @@ module.exports = new class K8SBind extends require('./plugin') {
|
|
|
81
81
|
)
|
|
82
82
|
|
|
83
83
|
// REVISIT: Proper API
|
|
84
|
-
// eslint-disable-next-line cds-dk/use-relative-require, cds-dk/use-api-require
|
|
85
84
|
const serviceBinding = require('@sap/cds/lib/env/serviceBindings').parseBinding('/', name, properties)
|
|
86
85
|
const { credentials } = serviceBinding
|
|
87
86
|
const vcap = { ...serviceBinding, credentials: undefined }
|
package/lib/bind/plugin.js
CHANGED
package/lib/bind/shared.js
CHANGED
|
@@ -3,6 +3,7 @@ const cds = require('../cds')
|
|
|
3
3
|
const { exists, read, fs, path } = cds.utils
|
|
4
4
|
const git = require('../util/git')
|
|
5
5
|
const { bold } = require('../util/term')
|
|
6
|
+
const { readProject } = require('../init/projectReader')
|
|
6
7
|
|
|
7
8
|
// REVISIT: We should get rid of this...
|
|
8
9
|
const KindToRequiresNameMap = {
|
|
@@ -36,7 +37,11 @@ const PreferredKinds = {
|
|
|
36
37
|
'saas-registry': 1
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
async function bind(options = {
|
|
40
|
+
async function bind(options = {}) {
|
|
41
|
+
const { hasKyma, hasMta } = readProject()
|
|
42
|
+
const onKyma = cds.cli.options.on === 'k8s' || (hasKyma && !hasMta && cds.cli.options.on !== 'cf')
|
|
43
|
+
options.on = onKyma ? 'k8s' : 'cf'
|
|
44
|
+
|
|
40
45
|
let on
|
|
41
46
|
switch (options.on) {
|
|
42
47
|
case 'k8s':
|
package/lib/build/constants.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
exports.OUTPUT_MODE = "outputMode"
|
|
2
|
-
exports.OUTPUT_MODE_NONE = 0x0
|
|
3
|
-
exports.OUTPUT_MODE_FILESYSTEM = 0x1
|
|
4
|
-
exports.OUTPUT_MODE_RESULT = 0x2
|
|
5
|
-
|
|
6
1
|
exports.DEFAULT_SRC_FOLDER = '.'
|
|
7
2
|
exports.BUILD_TASK_JAVA = "java"
|
|
8
3
|
exports.BUILD_TASK_JAVA_CF = "java-cf"
|
|
@@ -13,9 +8,6 @@ exports.BUILD_TASK_FIORI = "fiori"
|
|
|
13
8
|
exports.BUILD_TASK_MTX = "mtx"
|
|
14
9
|
exports.BUILD_TASK_MTX_SIDECAR = "mtx-sidecar"
|
|
15
10
|
exports.BUILD_TASK_MTX_EXTENSION = "mtx-extension"
|
|
16
|
-
exports.BUILD_TASKS = [this.BUILD_TASK_JAVA, this.BUILD_TASK_JAVA_CF, this.BUILD_TASK_NODEJS, this.BUILD_TASK_NODE_CF, this.BUILD_TASK_HANA, this.BUILD_TASK_FIORI, this.BUILD_TASK_MTX, this.BUILD_TASK_MTX_SIDECAR, this.BUILD_TASK_MTX_EXTENSION]
|
|
17
|
-
exports.DEFAULT_BUILTIN_PRIORITY_MIN = 0
|
|
18
|
-
exports.DEFAULT_BUILTIN_PRIORITY_MAX = 524
|
|
19
11
|
|
|
20
12
|
exports.ODATA_VERSION_V2 = "v2"
|
|
21
13
|
exports.ODATA_VERSION_V4 = "v4"
|