@sap/cds 7.5.3 → 7.6.2
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 +79 -21
- package/app/index.js +6 -17
- package/lib/auth/index.js +3 -0
- package/lib/compile/extend.js +9 -4
- package/lib/compile/for/lean_drafts.js +3 -4
- package/lib/compile/load.js +11 -15
- package/lib/compile/minify.js +2 -4
- package/lib/compile/to/sql.js +6 -4
- package/lib/compile/to/yaml.js +1 -1
- package/lib/dbs/cds-deploy.js +7 -13
- package/lib/env/defaults.js +1 -10
- package/lib/env/schemas/cds-package.js +27 -0
- package/lib/env/schemas/cds-rc.js +693 -0
- package/lib/env/schemas/index.js +6 -4
- package/lib/index.js +40 -47
- package/lib/log/cds-error.js +6 -0
- package/lib/log/format/aspects/als.js +1 -0
- package/lib/log/format/json.js +5 -1
- package/lib/ql/Query.js +2 -1
- package/lib/ql/cds-ql.js +1 -2
- package/lib/ql/infer.js +0 -2
- package/lib/req/cds-context.js +1 -1
- package/lib/req/request.js +3 -6
- package/lib/srv/middlewares/trace.js +2 -2
- package/lib/srv/protocols/hcql.js +44 -30
- package/lib/srv/protocols/http.js +60 -0
- package/lib/srv/protocols/index.js +0 -7
- package/lib/srv/protocols/odata-v4.js +8 -2
- package/lib/srv/srv-api.js +129 -62
- package/lib/srv/srv-handlers.js +0 -1
- package/lib/srv/srv-models.js +1 -0
- package/lib/utils/cds-utils.js +26 -0
- package/lib/utils/check-version.js +10 -13
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +22 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +3 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +89 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/boundToCQN.js +4 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +1 -24
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/updateToCQN.js +1 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ApplyParser.js +3 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchProcessor.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpHeaderReader.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +6 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +0 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +2 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +17 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +22 -2
- package/libx/_runtime/cds-services/services/utils/columns.js +1 -2
- package/libx/_runtime/common/aspects/Association.js +17 -9
- package/libx/_runtime/common/generic/crud.js +13 -22
- package/libx/_runtime/common/generic/etag.js +1 -1
- package/libx/_runtime/common/generic/input.js +9 -1
- package/libx/_runtime/common/generic/paging.js +3 -3
- package/libx/_runtime/common/generic/sorting.js +25 -15
- package/libx/_runtime/common/generic/stream.js +2 -16
- package/libx/_runtime/common/i18n/messages.properties +3 -0
- package/libx/_runtime/common/utils/copy.js +5 -0
- package/libx/_runtime/common/utils/cqn.js +1 -1
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +4 -3
- package/libx/_runtime/common/utils/csn.js +0 -49
- package/libx/_runtime/common/utils/foreignKeyPropagations.js +5 -5
- package/libx/_runtime/common/utils/generateOnCond.js +50 -25
- package/libx/_runtime/common/utils/resolveView.js +5 -35
- package/libx/_runtime/common/utils/rewriteAsterisks.js +17 -4
- package/libx/_runtime/common/utils/stream.js +16 -15
- package/libx/_runtime/common/utils/streamProp.js +25 -22
- package/libx/_runtime/db/Service.js +27 -8
- package/libx/_runtime/db/generic/input.js +6 -1
- package/libx/_runtime/db/generic/rewrite.js +3 -2
- package/libx/_runtime/db/query/read.js +15 -5
- package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +0 -11
- package/libx/_runtime/db/utils/columns.js +1 -0
- package/libx/_runtime/db/utils/stream.js +41 -0
- package/libx/_runtime/fiori/generic/read.js +2 -1
- package/libx/_runtime/fiori/generic/readOverDraft.js +1 -1
- package/libx/_runtime/fiori/lean-draft.js +209 -55
- package/libx/_runtime/hana/Service.js +1 -1
- package/libx/_runtime/hana/execute.js +53 -14
- package/libx/_runtime/messaging/AMQPWebhookMessaging.js +2 -1
- package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +34 -15
- package/libx/_runtime/messaging/file-based.js +4 -3
- package/libx/_runtime/messaging/redis-messaging.js +2 -1
- package/libx/_runtime/remote/Service.js +2 -1
- package/libx/_runtime/remote/utils/client.js +1 -1
- package/libx/_runtime/sqlite/Service.js +1 -1
- package/libx/_runtime/sqlite/execute.js +17 -5
- package/libx/odata/afterburner.js +58 -19
- package/libx/odata/cqn2odata.js +6 -8
- package/libx/odata/create.js +44 -0
- package/libx/odata/delete.js +25 -0
- package/libx/odata/error.js +8 -3
- package/libx/odata/metadata.js +6 -8
- package/libx/odata/service-document.js +1 -1
- package/libx/odata/update.js +110 -0
- package/libx/odata/utils.js +9 -6
- package/libx/outbox/index.js +74 -89
- package/libx/rest/RestAdapter.js +0 -3
- package/package.json +1 -1
- package/lib/env/schemas/cds-package.json +0 -17
- package/lib/env/schemas/cds-rc.json +0 -740
- package/lib/ql/STREAM.js +0 -90
package/lib/ql/STREAM.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
const Whereable = require('./Whereable'), { parse } = Whereable
|
|
2
|
-
|
|
3
|
-
module.exports = class Query extends Whereable {
|
|
4
|
-
|
|
5
|
-
static _api() {
|
|
6
|
-
const $ = Object.assign
|
|
7
|
-
return $((..._) => new this()._column_or_data_or_from(..._), {
|
|
8
|
-
into: (..._) => new this().into(..._),
|
|
9
|
-
from: (..._) => new this().from(..._),
|
|
10
|
-
column: (..._) => new this().column(..._),
|
|
11
|
-
columns: (..._) => new this().columns(..._),
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
_column_or_data_or_from (col, ...more) { // srv.read`title`.from`Books` or srv.read`Books` ?
|
|
16
|
-
if (!col) return this
|
|
17
|
-
else if (col.name) return this.from (...arguments) //> clearly a from
|
|
18
|
-
else if (col.raw) { // tagged template string
|
|
19
|
-
if (col[0].startsWith('from ')) { // STREAM`from ...`, with an arbitrary long CQL tail...
|
|
20
|
-
Object.assign (this.STREAM, STREAM_(' ',arguments))
|
|
21
|
-
return this
|
|
22
|
-
} else if (col[0][0] === '{') { // STREAM`{a,b}`... -> it's column
|
|
23
|
-
let {column:c} = STREAM_('from X', arguments)
|
|
24
|
-
return this._add('column',c)
|
|
25
|
-
} else { // STREAM`Foo` -> ambiguous -> try parsing as column...
|
|
26
|
-
let {column:c} = STREAM_('from X {', arguments, '}')
|
|
27
|
-
if (c.length > 1 || !c[0].ref) return this._add('column',c)
|
|
28
|
-
// else cols = c[0] //> goes on below...
|
|
29
|
-
}
|
|
30
|
-
} else { // STREAM('foo')
|
|
31
|
-
if (Array.isArray(col)) return this.columns(col)
|
|
32
|
-
if (typeof col === 'string') return this.column(col)
|
|
33
|
-
else return this.data(col)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// return a proxy assuming it's a from and switching to
|
|
37
|
-
// column on a subsequent call of .from, if any.
|
|
38
|
-
return Object.defineProperties (this.from (col, ...more), {
|
|
39
|
-
from: { configurable:true, value:(...args) => { delete this.from
|
|
40
|
-
return this.from (...args) .column (col, ...more)
|
|
41
|
-
}}
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
column (col) {
|
|
46
|
-
this._add ('column',col)
|
|
47
|
-
return this
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
columns (cols) {
|
|
51
|
-
this._add ('columns',cols)
|
|
52
|
-
return this
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
from (target, key, column) {
|
|
56
|
-
this.STREAM.from = this._target_ref4 (...arguments)
|
|
57
|
-
if (!target.raw && key) {
|
|
58
|
-
this.byKey(key)
|
|
59
|
-
if (typeof column === 'function') {
|
|
60
|
-
const cols=[]; column (new Proxy (column,{ get: (_,p) => cols.push(p) }))
|
|
61
|
-
cols.length === 1 ? this.column(cols[0]) : this.columns(cols)
|
|
62
|
-
}
|
|
63
|
-
else if (column) this.column(column)
|
|
64
|
-
}
|
|
65
|
-
return this
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
into (target, key) {
|
|
69
|
-
this.STREAM.into = this._target_ref4 (...arguments)
|
|
70
|
-
if (!target.raw && key) {
|
|
71
|
-
this.byKey(key)
|
|
72
|
-
}
|
|
73
|
-
return this
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
data (x) {
|
|
77
|
-
this.STREAM.data = x
|
|
78
|
-
return this
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
get _target_ref(){ return this.STREAM.into || this.STREAM.from }
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const {CQL} = parse, STREAM_ = (prefix, [ strings, ...more ], suffix) => {
|
|
86
|
-
const tts = [...strings]; tts.raw = true
|
|
87
|
-
if (prefix) tts[0] = `STREAM ${prefix} ${tts[0]}`
|
|
88
|
-
if (suffix) tts[tts.length-1] += ` ${suffix}`
|
|
89
|
-
return CQL(tts,...more).STREAM
|
|
90
|
-
}
|