@sap/cds 7.0.0 → 7.0.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 +9 -0
- package/lib/compile/load.js +2 -2
- package/lib/srv/middlewares/ctx-model.js +1 -1
- package/lib/srv/protocols/odata-v4.js +9 -4
- package/lib/srv/srv-tx.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriTokenizer.js +5 -8
- package/package.json +1 -1
- package/server.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
- The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
5
5
|
- This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## Version 7.0.1 - 2023-07-03
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Feature toggle detection in single tenant mode
|
|
12
|
+
- Log output for OData $batch requests
|
|
13
|
+
- Avoid "catastrophic backtracking" issue in okra's tokenizer
|
|
14
|
+
- Transaction marked as committed too early
|
|
15
|
+
|
|
7
16
|
## Version 7.0.0 - 2023-06-21
|
|
8
17
|
|
|
9
18
|
### Added
|
package/lib/compile/load.js
CHANGED
|
@@ -13,8 +13,8 @@ module.exports = exports = function load (files, options) {
|
|
|
13
13
|
|
|
14
14
|
exports.parsed = function cds_get (files, options, _flavor) { // NOSONAR
|
|
15
15
|
|
|
16
|
-
TRACE?.time('cds.load model ')
|
|
17
16
|
const o = typeof options === 'string' ? { flavor:options } : options || {}
|
|
17
|
+
if (!o.silent) TRACE?.time('cds.load model ')
|
|
18
18
|
if (!files) files = ['*']; else if (!Array.isArray(files)) files = [files]
|
|
19
19
|
if (o.files || o.flavor === 'files') return cds.resolve(files,o)
|
|
20
20
|
if (o.sources || o.flavor === 'sources') return _sources4 (cds.resolve(files,o))
|
|
@@ -32,7 +32,7 @@ exports.parsed = function cds_get (files, options, _flavor) { // NOSONAR
|
|
|
32
32
|
|
|
33
33
|
const _finalize = (csn,o) => {
|
|
34
34
|
if (!o.silent) cds.emit ('loaded', csn)
|
|
35
|
-
TRACE?.timeEnd('cds.load model ')
|
|
35
|
+
if (!o.silent) TRACE?.timeEnd('cds.load model ')
|
|
36
36
|
return csn
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -8,7 +8,7 @@ module.exports = ()=> {
|
|
|
8
8
|
return async function cds_context_model (req,res, next) {
|
|
9
9
|
if (req.baseUrl.startsWith('/-/')) return next() //> our own tech services cannot be extended
|
|
10
10
|
const ctx = cds.context
|
|
11
|
-
if (ctx.tenant) try {
|
|
11
|
+
if (ctx.tenant || ctx.features) try {
|
|
12
12
|
// if (req.headers.features) ctx.user.features = req.headers.features //> currently done in basic-auth only
|
|
13
13
|
ctx.model = req.__model = await model4 (ctx.tenant, ctx.features) // REVISIT: req.__model is because of Okra
|
|
14
14
|
} catch (e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const cds = require('../../index'), { User } = cds, {
|
|
1
|
+
const cds = require('../../index'), { User } = cds, { decodeURI } = cds.utils
|
|
2
2
|
const libx = require('../../../libx/_runtime')
|
|
3
3
|
const LOG = cds.log('odata')
|
|
4
4
|
|
|
@@ -6,10 +6,15 @@ module.exports = function ODataAdapter (srv) { return [
|
|
|
6
6
|
(req, _, next) => {
|
|
7
7
|
let u = req.user
|
|
8
8
|
req.user = u instanceof User ? u : new User(u)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
let url = decodeURI(req.originalUrl)
|
|
11
|
+
LOG && LOG (req.method, url, req.body||'')
|
|
12
|
+
if (/\$batch/.test(req.url)) req.on ('dispatch', (req) => {
|
|
13
|
+
let path = decodeURI(req._path)
|
|
14
|
+
LOG && LOG ('>', req.event, path, req._query||'')
|
|
15
|
+
if (LOG._debug && req.query) LOG.debug (req.query)
|
|
12
16
|
})
|
|
17
|
+
|
|
13
18
|
next()
|
|
14
19
|
},
|
|
15
20
|
libx.to.odata_v4 (srv)
|
package/lib/srv/srv-tx.js
CHANGED
|
@@ -132,10 +132,10 @@ class RootTransaction extends Transaction {
|
|
|
132
132
|
* are informed by emitting 'succeeded' event to them all.
|
|
133
133
|
*/
|
|
134
134
|
async commit (res) {
|
|
135
|
-
this._done = 'committed'
|
|
136
135
|
try {
|
|
137
136
|
await this.context.emit ('commit',res) //> allow custom handlers req.before('commit')
|
|
138
137
|
await super.commit (res)
|
|
138
|
+
this._done = 'committed'
|
|
139
139
|
await this.context.emit ('succeeded',res)
|
|
140
140
|
await this.context.emit ('done')
|
|
141
141
|
} catch (err) {
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const UriSyntaxError = require('../errors/UriSyntaxError')
|
|
4
4
|
|
|
5
|
-
const IDENTIFIER =
|
|
6
|
-
'(?:(?:_|\\p{Letter}|\\p{Letter_Number})' +
|
|
7
|
-
'(?:_|\\p{Letter}|\\p{Letter_Number}|\\p{Decimal_Number}' +
|
|
8
|
-
'|\\p{Nonspacing_Mark}|\\p{Spacing_Mark}|\\p{Connector_Punctuation}|\\p{Format}){0,127})'
|
|
5
|
+
const IDENTIFIER = '([_\\p{L}\\p{Nl}][_\\p{L}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Pc}\\p{Cf}]{0,127})'
|
|
9
6
|
const IDENTIFIER_REGEXP = new RegExp('^' + IDENTIFIER, 'u')
|
|
10
|
-
const QUALIFIED_NAME_REGEXP = new RegExp('^' + IDENTIFIER + '(
|
|
7
|
+
const QUALIFIED_NAME_REGEXP = new RegExp('^' + IDENTIFIER + '(\\.' + IDENTIFIER + ')+', 'u')
|
|
11
8
|
const PARAMETER_ALIAS_NAME_REGEXP = new RegExp('^@' + IDENTIFIER, 'u')
|
|
12
9
|
|
|
13
10
|
const BOOLEAN_VALUE_REGEXP = new RegExp('^(?:true|false)', 'i')
|
|
@@ -696,9 +693,9 @@ class UriTokenizer {
|
|
|
696
693
|
* @private
|
|
697
694
|
*/
|
|
698
695
|
_nextWithRegularExpression (regexp) {
|
|
699
|
-
const
|
|
700
|
-
if (!
|
|
701
|
-
this._index +=
|
|
696
|
+
const matched = this._parseString.substring(this._index).match(regexp)
|
|
697
|
+
if (!matched) return false
|
|
698
|
+
this._index += matched[0].length
|
|
702
699
|
return true
|
|
703
700
|
}
|
|
704
701
|
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -92,7 +92,7 @@ const defaults = {
|
|
|
92
92
|
const path = require('path')
|
|
93
93
|
const _app_serve = function (endpoint) { return {
|
|
94
94
|
from: (pkg,folder) => {
|
|
95
|
-
folder = !folder ? pkg : path.resolve(require.resolve(pkg+'/package.json'),'../'+folder)
|
|
95
|
+
folder = !folder ? pkg : path.resolve(require.resolve(pkg+'/package.json',{paths:[cds.root]}),'../'+folder)
|
|
96
96
|
this.use (endpoint, express.static(folder))
|
|
97
97
|
if (!endpoint.endsWith('/webapp')) (this._app_links || (this._app_links = [])) .push (endpoint)
|
|
98
98
|
}
|