@sap/cds-dk 7.2.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/activate.js +2 -2
- package/bin/add.js +1 -1
- package/bin/build.js +6 -3
- package/bin/compile/index.js +9 -5
- package/bin/env.js +0 -3
- package/bin/extend.js +29 -3
- package/bin/import.js +7 -3
- package/bin/init.js +31 -37
- package/bin/push.js +10 -6
- 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/{buildTaskHandler.js → buildPlugin.js} +40 -27
- package/lib/build/buildTaskEngine.js +75 -74
- package/lib/build/buildTaskFactory.js +39 -32
- package/lib/build/buildTaskProvider.js +24 -19
- package/lib/build/buildTaskProviderFactory.js +125 -58
- package/lib/build/constants.js +6 -4
- package/lib/build/index.js +7 -3
- package/lib/build/plugins.js +35 -0
- package/lib/build/provider/{buildTaskHandlerEdmx.js → edmxBuildPlugin.js} +11 -7
- package/lib/build/provider/{buildTaskHandlerFeatureToggles.js → featureToggleBuildPlugin.js} +5 -5
- package/lib/build/provider/fiori/index.js +5 -6
- package/lib/build/provider/hana/index.js +54 -30
- package/lib/build/provider/{buildTaskHandlerInternal.js → internalBuildPlugin.js} +14 -10
- package/lib/build/provider/{buildTaskProviderInternal.js → internalBuildTaskProvider.js} +27 -28
- package/lib/build/provider/java/index.js +30 -24
- package/lib/build/provider/mtx/index.js +4 -4
- package/lib/build/provider/mtx/resourcesTarBuilder.js +8 -8
- package/lib/build/provider/mtx-extension/index.js +17 -9
- package/lib/build/provider/mtx-sidecar/index.js +17 -11
- package/lib/build/provider/nodejs/index.js +14 -13
- package/lib/build/util.js +5 -0
- package/lib/client/auth_manager.js +6 -12
- package/lib/client/base_command.js +1 -1
- package/lib/client/download_legacy.js +43 -0
- package/lib/client/params.js +6 -0
- package/lib/client/push.js +41 -1
- package/lib/client/settings_manager.js +28 -17
- package/lib/compile/openapi/csdl2openapi.js +1 -1
- package/lib/env/schema.js +36 -0
- package/lib/env/schemas/cds-rc.json +101 -0
- package/lib/import/common.js +23 -10
- package/lib/import/importapi.js +2 -2
- package/lib/import/message.js +3 -1
- package/lib/import/odata/v4parser.js +23 -7
- package/lib/index.js +11 -0
- package/lib/init/constants.js +5 -2
- package/lib/init/index.js +2 -3
- package/lib/init/template/_merging/registry-mta.js +33 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +1 -1
- package/lib/init/template/approuter/index.js +9 -9
- package/lib/init/template/connectivity/index.js +5 -4
- package/lib/init/template/destination/index.js +2 -5
- 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/html5-repo/index.js +27 -3
- package/lib/init/template/mta/index.js +9 -3
- 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/init/template/postgres/files/mta.yaml.hbs +27 -0
- package/lib/init/template/postgres/files/package.json.hbs +5 -0
- package/lib/init/template/postgres/index.js +52 -0
- package/lib/init/util/projectReader.js +0 -1
- package/lib/util/pruneAxiosErrors.js +25 -8
- 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 +334 -335
- 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
|
@@ -5,9 +5,14 @@ const axios = require('axios')
|
|
|
5
5
|
const ws = require('ws')
|
|
6
6
|
const express = require('express')
|
|
7
7
|
const { URL } = require('url')
|
|
8
|
+
const { relative, sep } = require ('path')
|
|
9
|
+
|
|
10
|
+
const ext = 'css,gif,html,jpg,png,svg,ts,mjs,cjs,js,json,properties,change,variant,ctrl_variant,ctrl_variant_change,ctrl_variant_management_change'
|
|
11
|
+
const watchIncludes = RegExp(`\\.(${ext.replace(/,/g,'|')})$|\\${sep}(webapp|appconfig)`)
|
|
12
|
+
const watchExcludes = RegExp(`@cds-models\\${sep}|@types\\${sep}`)
|
|
8
13
|
|
|
9
14
|
module.exports = class LiveReload {
|
|
10
|
-
async start(port) {
|
|
15
|
+
async start(port, cwd, delay=0) {
|
|
11
16
|
if (!parseInt(port)) port = 35729
|
|
12
17
|
this.files = []
|
|
13
18
|
|
|
@@ -43,7 +48,7 @@ module.exports = class LiveReload {
|
|
|
43
48
|
this.wsServer.on('connection', (socket) => {
|
|
44
49
|
DEBUG?.('Client connected')
|
|
45
50
|
socket.on('message', (msg) => {
|
|
46
|
-
DEBUG?.('Client message', msg)
|
|
51
|
+
DEBUG?.('Client message', msg.toString())
|
|
47
52
|
const request = JSON.parse(msg)
|
|
48
53
|
|
|
49
54
|
if (request.command === 'hello') {
|
|
@@ -77,6 +82,24 @@ module.exports = class LiveReload {
|
|
|
77
82
|
this.wsServer.close()
|
|
78
83
|
server.close()
|
|
79
84
|
})
|
|
85
|
+
|
|
86
|
+
// Watching for touched files...
|
|
87
|
+
const watch = require('node-watch')
|
|
88
|
+
const filter = f => {
|
|
89
|
+
const isIn = !watchExcludes.test(f) && watchIncludes.test(f)
|
|
90
|
+
if (!isIn) DEBUG?. (`livereload ignored: ${relative(cwd||process.cwd(), f)}`)
|
|
91
|
+
// else DEBUG?. (`livereload NOT ignored: ${relative(cwd||process.cwd(), f)}`, watchIncludes)
|
|
92
|
+
return isIn
|
|
93
|
+
}
|
|
94
|
+
const watcher = watch (cwd||process.cwd(),{ recursive:true, filter, delay:0 })
|
|
95
|
+
if (DEBUG) watcher.on('close', ()=> DEBUG('⚡️', 'cds watch - livereload file watcher closed'))
|
|
96
|
+
watcher.on('change', _coalesceEvents(delay, (files) => {
|
|
97
|
+
DEBUG?. (`livereload for: ${files.map(f => f.name)}`)
|
|
98
|
+
this.markPending(files.map(f => f.name))
|
|
99
|
+
this.reload()
|
|
100
|
+
}))
|
|
101
|
+
process.once('shutdown', ()=> watcher.close())
|
|
102
|
+
|
|
80
103
|
})
|
|
81
104
|
}
|
|
82
105
|
|
|
@@ -99,6 +122,19 @@ module.exports = class LiveReload {
|
|
|
99
122
|
}
|
|
100
123
|
}
|
|
101
124
|
|
|
125
|
+
// reduces mutiple node-watch events in a time frame into a bulk
|
|
126
|
+
function _coalesceEvents(delay, fn) {
|
|
127
|
+
let timer, cache = []
|
|
128
|
+
return function(type, name) { // node-watch callback signature
|
|
129
|
+
if (type) cache.push({type, name})
|
|
130
|
+
if (!timer) timer = setTimeout(() => {
|
|
131
|
+
fn(cache)
|
|
132
|
+
timer = null
|
|
133
|
+
cache = []
|
|
134
|
+
}, delay).unref();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
102
138
|
function broadcast(data, sockets) {
|
|
103
139
|
sockets.forEach(socket => {
|
|
104
140
|
DEBUG?.(`Sending ${data}`)
|
package/lib/watch/node-watch.js
CHANGED
|
@@ -2,7 +2,7 @@ const cds = require ('../cds')
|
|
|
2
2
|
const DEBUG = cds.debug('cli|watch')
|
|
3
3
|
const { relative } = require('path')
|
|
4
4
|
|
|
5
|
-
module.exports = ({ cwd, script, ext,
|
|
5
|
+
module.exports = ({ cwd, script, ext, ignore=RegExp(), env={}, delay=200, options={} })=>{
|
|
6
6
|
|
|
7
7
|
let child
|
|
8
8
|
|
|
@@ -52,10 +52,11 @@ module.exports = ({ cwd, script, ext, includes=RegExp(), ignore=RegExp(), env={}
|
|
|
52
52
|
|
|
53
53
|
// Watching for touched files...
|
|
54
54
|
const watch = require('node-watch')
|
|
55
|
-
const include = RegExp(`\\.(${ext.replace(/,/g,'|')})
|
|
55
|
+
const include = RegExp(`\\.(${ext.replace(/,/g,'|')})$`)
|
|
56
56
|
const filter = f => {
|
|
57
57
|
const isIn = !ignore.test(f) && include.test(f)
|
|
58
58
|
if (!isIn) DEBUG?. (`ignored: ${relative(cwd||process.cwd(), f)}`)
|
|
59
|
+
// else DEBUG?. (`NOT ignored: ${relative(cwd||process.cwd(), f)}`, include.test(f), include)
|
|
59
60
|
return isIn
|
|
60
61
|
}
|
|
61
62
|
const watcher = watch (cwd||process.cwd(),{ recursive:true, filter, delay:0 })
|