@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.
Files changed (101) hide show
  1. package/CHANGELOG.md +79 -21
  2. package/app/index.js +6 -17
  3. package/lib/auth/index.js +3 -0
  4. package/lib/compile/extend.js +9 -4
  5. package/lib/compile/for/lean_drafts.js +3 -4
  6. package/lib/compile/load.js +11 -15
  7. package/lib/compile/minify.js +2 -4
  8. package/lib/compile/to/sql.js +6 -4
  9. package/lib/compile/to/yaml.js +1 -1
  10. package/lib/dbs/cds-deploy.js +7 -13
  11. package/lib/env/defaults.js +1 -10
  12. package/lib/env/schemas/cds-package.js +27 -0
  13. package/lib/env/schemas/cds-rc.js +693 -0
  14. package/lib/env/schemas/index.js +6 -4
  15. package/lib/index.js +40 -47
  16. package/lib/log/cds-error.js +6 -0
  17. package/lib/log/format/aspects/als.js +1 -0
  18. package/lib/log/format/json.js +5 -1
  19. package/lib/ql/Query.js +2 -1
  20. package/lib/ql/cds-ql.js +1 -2
  21. package/lib/ql/infer.js +0 -2
  22. package/lib/req/cds-context.js +1 -1
  23. package/lib/req/request.js +3 -6
  24. package/lib/srv/middlewares/trace.js +2 -2
  25. package/lib/srv/protocols/hcql.js +44 -30
  26. package/lib/srv/protocols/http.js +60 -0
  27. package/lib/srv/protocols/index.js +0 -7
  28. package/lib/srv/protocols/odata-v4.js +8 -2
  29. package/lib/srv/srv-api.js +129 -62
  30. package/lib/srv/srv-handlers.js +0 -1
  31. package/lib/srv/srv-models.js +1 -0
  32. package/lib/utils/cds-utils.js +26 -0
  33. package/lib/utils/check-version.js +10 -13
  34. package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +22 -6
  35. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +3 -4
  36. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +89 -21
  37. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/boundToCQN.js +4 -2
  38. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +1 -24
  39. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/updateToCQN.js +1 -7
  40. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ApplyParser.js +3 -3
  41. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchProcessor.js +1 -1
  42. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpHeaderReader.js +1 -1
  43. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +6 -0
  44. package/libx/_runtime/cds-services/adapter/odata-v4/to.js +0 -5
  45. package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +2 -0
  46. package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +17 -1
  47. package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +22 -2
  48. package/libx/_runtime/cds-services/services/utils/columns.js +1 -2
  49. package/libx/_runtime/common/aspects/Association.js +17 -9
  50. package/libx/_runtime/common/generic/crud.js +13 -22
  51. package/libx/_runtime/common/generic/etag.js +1 -1
  52. package/libx/_runtime/common/generic/input.js +9 -1
  53. package/libx/_runtime/common/generic/paging.js +3 -3
  54. package/libx/_runtime/common/generic/sorting.js +25 -15
  55. package/libx/_runtime/common/generic/stream.js +2 -16
  56. package/libx/_runtime/common/i18n/messages.properties +3 -0
  57. package/libx/_runtime/common/utils/copy.js +5 -0
  58. package/libx/_runtime/common/utils/cqn.js +1 -1
  59. package/libx/_runtime/common/utils/cqn2cqn4sql.js +4 -3
  60. package/libx/_runtime/common/utils/csn.js +0 -49
  61. package/libx/_runtime/common/utils/foreignKeyPropagations.js +5 -5
  62. package/libx/_runtime/common/utils/generateOnCond.js +50 -25
  63. package/libx/_runtime/common/utils/resolveView.js +5 -35
  64. package/libx/_runtime/common/utils/rewriteAsterisks.js +17 -4
  65. package/libx/_runtime/common/utils/stream.js +16 -15
  66. package/libx/_runtime/common/utils/streamProp.js +25 -22
  67. package/libx/_runtime/db/Service.js +27 -8
  68. package/libx/_runtime/db/generic/input.js +6 -1
  69. package/libx/_runtime/db/generic/rewrite.js +3 -2
  70. package/libx/_runtime/db/query/read.js +15 -5
  71. package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +0 -11
  72. package/libx/_runtime/db/utils/columns.js +1 -0
  73. package/libx/_runtime/db/utils/stream.js +41 -0
  74. package/libx/_runtime/fiori/generic/read.js +2 -1
  75. package/libx/_runtime/fiori/generic/readOverDraft.js +1 -1
  76. package/libx/_runtime/fiori/lean-draft.js +209 -55
  77. package/libx/_runtime/hana/Service.js +1 -1
  78. package/libx/_runtime/hana/execute.js +53 -14
  79. package/libx/_runtime/messaging/AMQPWebhookMessaging.js +2 -1
  80. package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +34 -15
  81. package/libx/_runtime/messaging/file-based.js +4 -3
  82. package/libx/_runtime/messaging/redis-messaging.js +2 -1
  83. package/libx/_runtime/remote/Service.js +2 -1
  84. package/libx/_runtime/remote/utils/client.js +1 -1
  85. package/libx/_runtime/sqlite/Service.js +1 -1
  86. package/libx/_runtime/sqlite/execute.js +17 -5
  87. package/libx/odata/afterburner.js +58 -19
  88. package/libx/odata/cqn2odata.js +6 -8
  89. package/libx/odata/create.js +44 -0
  90. package/libx/odata/delete.js +25 -0
  91. package/libx/odata/error.js +8 -3
  92. package/libx/odata/metadata.js +6 -8
  93. package/libx/odata/service-document.js +1 -1
  94. package/libx/odata/update.js +110 -0
  95. package/libx/odata/utils.js +9 -6
  96. package/libx/outbox/index.js +74 -89
  97. package/libx/rest/RestAdapter.js +0 -3
  98. package/package.json +1 -1
  99. package/lib/env/schemas/cds-package.json +0 -17
  100. package/lib/env/schemas/cds-rc.json +0 -740
  101. 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
- }