@sap/cds 7.4.1 → 7.5.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 +101 -0
- package/apis/cds.d.ts +1 -38
- package/apis/core.d.ts +21 -101
- package/apis/cqn.d.ts +18 -76
- package/apis/csn.d.ts +18 -114
- package/apis/events.d.ts +16 -123
- package/apis/internal/inference.d.ts +18 -32
- package/apis/linked.d.ts +18 -97
- package/apis/log.d.ts +19 -164
- package/apis/models.d.ts +18 -180
- package/apis/ql.d.ts +16 -322
- package/apis/reflect.d.ts +32 -0
- package/apis/server.d.ts +18 -135
- package/apis/services.d.ts +18 -380
- package/bin/cds-serve.js +5 -2
- package/bin/serve.js +7 -16
- package/lib/auth/basic-auth.js +3 -1
- package/lib/auth/ias-auth.js +62 -48
- package/lib/auth/ias-claims.js +34 -0
- package/lib/auth/index.js +54 -33
- package/lib/auth/jwt-auth.js +55 -52
- package/lib/compile/cdsc.js +2 -2
- package/lib/compile/to/edm.js +4 -4
- package/lib/compile/to/hdbtabledata.js +5 -8
- package/lib/compile/to/srvinfo.js +2 -2
- package/lib/env/cds-env.js +3 -9
- package/lib/env/cds-requires.js +16 -17
- package/lib/env/compat.js +0 -9
- package/lib/env/defaults.js +17 -6
- package/lib/i18n/localize.js +46 -42
- package/lib/index.js +6 -8
- package/lib/linked/classes.js +7 -118
- package/lib/linked/entities.js +1 -1
- package/lib/log/cds-log.js +15 -10
- package/lib/log/format/aspects/als.js +41 -0
- package/lib/log/format/aspects/cf.js +36 -0
- package/lib/log/format/json.js +96 -0
- package/lib/plugins.js +7 -3
- package/lib/req/context.js +4 -2
- package/lib/srv/cds-connect.js +3 -5
- package/lib/srv/cds-serve.js +13 -26
- package/lib/srv/factory.js +3 -3
- package/lib/srv/middlewares/index.js +0 -2
- package/lib/srv/middlewares/trace.js +2 -3
- package/lib/srv/protocols/_legacy.js +27 -30
- package/lib/srv/protocols/index.js +173 -58
- package/lib/srv/protocols/odata-v4.js +29 -16
- package/lib/srv/srv-api.js +8 -13
- package/lib/srv/srv-handlers.js +14 -14
- package/lib/utils/cds-utils.js +15 -0
- package/libx/_runtime/auth/index.js +4 -5
- package/libx/_runtime/auth/strategies/basic.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +23 -13
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +6 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +10 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +5 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +2 -1
- package/libx/_runtime/cds-services/services/utils/columns.js +3 -9
- package/libx/_runtime/cds.js +13 -0
- package/libx/_runtime/common/composition/data.js +3 -0
- package/libx/_runtime/common/composition/delete.js +1 -1
- package/libx/_runtime/common/error/frontend.js +2 -2
- package/libx/_runtime/common/generic/auth/readOnly.js +1 -1
- package/libx/_runtime/common/generic/auth/restrictions.js +1 -1
- package/libx/_runtime/common/generic/sorting.js +4 -5
- package/libx/_runtime/common/utils/csn.js +23 -18
- package/libx/_runtime/common/utils/propagateForeignKeys.js +2 -1
- package/libx/_runtime/common/utils/restrictions.js +6 -15
- package/libx/_runtime/db/generic/input.js +3 -2
- package/libx/_runtime/fiori/generic/readOverDraft.js +2 -5
- package/libx/_runtime/fiori/lean-draft.js +69 -5
- package/libx/_runtime/hana/Service.js +1 -1
- package/libx/_runtime/messaging/AMQPWebhookMessaging.js +1 -1
- package/libx/_runtime/messaging/Outbox.js +3 -8
- package/libx/_runtime/messaging/enterprise-messaging.js +1 -1
- package/libx/_runtime/messaging/file-based.js +1 -1
- package/libx/_runtime/messaging/service.js +7 -10
- package/libx/_runtime/remote/Service.js +15 -45
- package/libx/_runtime/remote/utils/client.js +20 -33
- package/libx/_runtime/remote/utils/cloudSdkProvider.js +30 -0
- package/libx/_runtime/sqlite/Service.js +2 -2
- package/libx/odata/afterburner.js +29 -21
- package/libx/odata/cqn2odata.js +1 -1
- package/libx/odata/error.js +7 -0
- package/libx/odata/grammar.peggy +16 -20
- package/libx/odata/metadata.js +73 -78
- package/libx/odata/parser.js +1 -1
- package/libx/odata/read.js +94 -0
- package/libx/odata/result.js +91 -0
- package/libx/odata/service-document.js +31 -37
- package/libx/odata/utils.js +2 -1
- package/libx/outbox/index.js +9 -4
- package/libx/rest/RestAdapter.js +68 -67
- package/libx/rest/middleware/create.js +20 -26
- package/libx/rest/middleware/delete.js +5 -3
- package/libx/rest/middleware/error.js +2 -3
- package/libx/rest/middleware/input.js +5 -5
- package/libx/rest/middleware/operation.js +96 -41
- package/libx/rest/middleware/parse.js +4 -6
- package/libx/rest/middleware/payload.js +5 -5
- package/libx/rest/middleware/read.js +11 -17
- package/libx/rest/middleware/update.js +20 -25
- package/package.json +2 -1
- package/server.js +7 -4
- package/srv/outbox.cds +9 -10
- package/apis/env.d.ts +0 -25
- package/apis/test.d.ts +0 -81
- package/apis/utils.d.ts +0 -15
- package/lib/auth/passport-basic.js +0 -14
- package/lib/auth/passport-digest.js +0 -16
- package/lib/env/presets.js +0 -35
- package/lib/log/format/cf.js +0 -16
- package/lib/log/format/kibana.js +0 -92
- package/lib/srv/middlewares/ctx-auth.js +0 -11
- package/libx/_runtime/cds-services/adapter/rest/utils/validation-checks.js +0 -119
|
@@ -1,32 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type SingularType<T extends ArrayConstructable<T>> = InstanceType<T>[number]
|
|
20
|
-
|
|
21
|
-
// Convenient way of unwrapping the inner type from array-typed values, as well as the value type itself
|
|
22
|
-
// `class MyArray<T> extends Array<T>``
|
|
23
|
-
// The latter is used heavily in the CDS typer, but its behaviour depends based on how the types are imported:
|
|
24
|
-
// If they are imported on a value based (`require('path/to/type')`) they will be considered `ArrayConstructable`.
|
|
25
|
-
// But if they are being used on type level (JSDOC: `/* @type {import('path/to/type')} */`) they are considered an `Array` .
|
|
26
|
-
// This type introduces an indirection that streamlines their behaviour for both cases.
|
|
27
|
-
// For any scalar type `Unwrap` behaves idempotent.
|
|
28
|
-
export type Unwrap<T> = T extends ArrayConstructable
|
|
29
|
-
? SingularType<T>
|
|
30
|
-
: T extends Array<infer U>
|
|
31
|
-
? U
|
|
32
|
-
: T
|
|
1
|
+
/**
|
|
2
|
+
* DO NO LONGER IMPORT THIS FILE
|
|
3
|
+
*
|
|
4
|
+
* Instead use:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* import * as cds from '@sap/cds'
|
|
9
|
+
* cds.Request
|
|
10
|
+
* or
|
|
11
|
+
* import { Request } from '@sap/cds'
|
|
12
|
+
* or
|
|
13
|
+
* @type { import('@sap/cds').Request }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
export * from '@cap-js/cds-types/apis/internal/inference'
|
package/apis/linked.d.ts
CHANGED
|
@@ -1,97 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
is2many: boolean
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface LinkedCSN extends CSN {
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Fetches definitions matching the given filter, returning an iterator on them.
|
|
26
|
-
* @example
|
|
27
|
-
* let m = cds.reflect (aParsedModel)
|
|
28
|
-
* for (let d of m.each('entity')) console.log (d.kind, d.name)
|
|
29
|
-
* let entities = [...m.each('entity')] //> capture all
|
|
30
|
-
* let entities = m.all('entity') //> equivalent shortcut
|
|
31
|
-
*/
|
|
32
|
-
each(x: Filter, defs?: Definitions): IterableIterator<any>
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Fetches definitions matching the given filter, returning them in an array.
|
|
36
|
-
* Convenience shortcut for `[...reflect.each('entity')]`
|
|
37
|
-
*/
|
|
38
|
-
all(x: Filter, defs?: Definitions): any[]
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Fetches definitions matching the given filter, returning the first match, if any.
|
|
42
|
-
* @example
|
|
43
|
-
* let service = model.find('service')
|
|
44
|
-
* @param {Filter} [x] the filter
|
|
45
|
-
* @param {Definitions} [defs] the definitions to fetch in, default: `this.definitions`
|
|
46
|
-
*/
|
|
47
|
-
find(x: Filter, defs?: Definitions): any
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Calls the visitor for each definition matching the given filter.
|
|
51
|
-
* @see [capire](https://github.wdf.sap.corp/pages/cap/node.js/api#cds-reflect-foreach)
|
|
52
|
-
*/
|
|
53
|
-
foreach(x: Filter, visitor: Visitor, defs?: Definitions): this
|
|
54
|
-
foreach(visitor: Visitor, defs?: Definitions): this
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Same as foreach but recursively visits each element definition
|
|
58
|
-
* @see [capire](https://github.wdf.sap.corp/pages/cap/node.js/api#cds-reflect-foreach)
|
|
59
|
-
*/
|
|
60
|
-
forall(x: Filter, visitor: Visitor, defs?: Definitions): this
|
|
61
|
-
forall(visitor: Visitor, defs?: Definitions): this
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Fetches definitions declared as children of a given parent context or service.
|
|
65
|
-
* It fetches all definitions whose fully-qualified names start with the parent's name.
|
|
66
|
-
* Returns the found definitions as an object with the local names as keys.
|
|
67
|
-
* @example
|
|
68
|
-
* let service = model.find ('service')
|
|
69
|
-
* let entities = m.childrenOf (service)
|
|
70
|
-
* @param parent either the parent itself or its fully-qualified name
|
|
71
|
-
* @param filter an optional filter to apply before picking a child
|
|
72
|
-
*/
|
|
73
|
-
childrenOf(parent: any | string, filter?: ((def: LinkedDefinition) => boolean)): Definitions
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Provides convenient access to the model's top-level definitions.
|
|
77
|
-
* For example, you can use it in an es6-import-like fashion to avoid
|
|
78
|
-
* working with fully-qualified names as follows:
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* let model = cds.reflect (cds.parse(`
|
|
82
|
-
* namespace our.lovely.bookshop;
|
|
83
|
-
* entity Books {...}
|
|
84
|
-
* entity Authors {...}
|
|
85
|
-
* `))
|
|
86
|
-
* const {Books,Authors} = model.exports
|
|
87
|
-
* SELECT.from (Books) .where ({ID:11})
|
|
88
|
-
*/
|
|
89
|
-
exports: Definitions & ((namespace: string) => Definitions)
|
|
90
|
-
entities: Definitions & ((namespace: string) => Definitions)
|
|
91
|
-
services: Definitions & ((namespace: string) => Definitions)
|
|
92
|
-
definitions: Definitions
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
type Visitor = (def: LinkedDefinition, name: string, parent: LinkedDefinition, defs: Definitions) => void
|
|
97
|
-
type Filter = string | ((def: LinkedDefinition) => boolean)
|
|
1
|
+
/**
|
|
2
|
+
* DO NO LONGER IMPORT THIS FILE
|
|
3
|
+
*
|
|
4
|
+
* Instead use:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* import * as cds from '@sap/cds'
|
|
9
|
+
* cds.Request
|
|
10
|
+
* or
|
|
11
|
+
* import { Request } from '@sap/cds'
|
|
12
|
+
* or
|
|
13
|
+
* @type { import('@sap/cds').Request }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
export * from '@cap-js/cds-types/apis/linked'
|
package/apis/log.d.ts
CHANGED
|
@@ -1,165 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* DO NO LONGER IMPORT THIS FILE
|
|
3
|
+
*
|
|
4
|
+
* Instead use:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* import * as cds from '@sap/cds'
|
|
9
|
+
* cds.Request
|
|
10
|
+
* or
|
|
11
|
+
* import { Request } from '@sap/cds'
|
|
12
|
+
* or
|
|
13
|
+
* @type { import('@sap/cds').Request }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { Logger } from '@cap-js/cds-types/apis/log'
|
|
7
20
|
|
|
8
|
-
/**
|
|
9
|
-
* Shortcut to `cds.log(...).debug`, returning `undefined` if `cds.log(...)._debug` is `false`.
|
|
10
|
-
* Use like this:
|
|
11
|
-
* ```
|
|
12
|
-
* const dbg = cds.debug('foo')
|
|
13
|
-
* ...
|
|
14
|
-
* dbg && dbg('message')
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @param name logger name
|
|
18
|
-
*/
|
|
19
|
-
debug(name: string): undefined | Log
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare type LogFactory = {
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns a trace logger for the given module if trace is switched on for it,
|
|
26
|
-
* otherwise returns null. All cds runtime packages use this method for their
|
|
27
|
-
* trace and debug output.
|
|
28
|
-
*
|
|
29
|
-
* By default this logger would prefix all output with `[sql] - `
|
|
30
|
-
* You can change this by specifying another prefix in the options:
|
|
31
|
-
*
|
|
32
|
-
* ```
|
|
33
|
-
* const LOG = cds.log('sql|db', { prefix: 'cds.ql' })
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* Call `cds.log()` for a given module again to dynamically change the log level
|
|
37
|
-
* of all formerly created loggers, for example:
|
|
38
|
-
*
|
|
39
|
-
* ```
|
|
40
|
-
* const LOG = cds.log('sql')
|
|
41
|
-
* LOG.info ('this will show, as default level is info')
|
|
42
|
-
* cds.log('sql', 'warn')
|
|
43
|
-
* LOG.info('this will be suppressed now')
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @param name logger name
|
|
47
|
-
* @param options level, label and prefix
|
|
48
|
-
* @returns the logger
|
|
49
|
-
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-log)
|
|
50
|
-
*/
|
|
51
|
-
(name: string, options?: string | number | { level?: number, label?: string, prefix?: string }): Logger
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Set a custom formatter function like that:
|
|
55
|
-
* ```
|
|
56
|
-
* cds.log.format = (module, level, ...args) => [ '[', module, ']', ...args ]
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* The formatter shall return an array of arguments, which are passed to the logger (for example, `console.log()`)
|
|
60
|
-
*/
|
|
61
|
-
format: Formatter
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Set a custom logger.
|
|
65
|
-
* ```
|
|
66
|
-
* cds.log.Logger = ...
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
Logger: Logger
|
|
70
|
-
|
|
71
|
-
winstonLogger (LoggerOptions?: {level?: string, levels?: any, format?: any, transports?: any, exitOnError?: boolean | Function, silent?: boolean})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
declare class Logger {
|
|
75
|
-
/**
|
|
76
|
-
* Logs with 'trace' level
|
|
77
|
-
*/
|
|
78
|
-
trace: Log
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Logs with 'debug' level
|
|
82
|
-
*/
|
|
83
|
-
debug: Log
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Logs with 'info' level
|
|
87
|
-
*/
|
|
88
|
-
info: Log
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Logs with 'warn' level
|
|
92
|
-
*/
|
|
93
|
-
warn: Log
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Logs with 'error' level
|
|
97
|
-
*/
|
|
98
|
-
error: Log
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Logs with default level
|
|
102
|
-
*/
|
|
103
|
-
log: Log
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @returns whether 'trace' level is active
|
|
107
|
-
*/
|
|
108
|
-
_trace: boolean
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @returns whether 'debug' level is active
|
|
112
|
-
*/
|
|
113
|
-
_debug: boolean
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @returns whether 'info' level is active
|
|
117
|
-
*/
|
|
118
|
-
_info: boolean
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @returns whether 'warn' level is active
|
|
122
|
-
*/
|
|
123
|
-
_warn: boolean
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @returns whether 'error' level is active
|
|
127
|
-
*/
|
|
128
|
-
_error: boolean
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Change the format for this logger instance:
|
|
132
|
-
* ```
|
|
133
|
-
* cds.log('foo').setFormat((module, level, ...args) => [ '[', module, ']', ...args ])
|
|
134
|
-
* ```
|
|
135
|
-
*
|
|
136
|
-
* The formatter shall return an array of arguments, which are passed to the logger (for example, `console.log()`)
|
|
137
|
-
*/
|
|
138
|
-
setFormat(formatter: Formatter)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
declare type Formatter = {
|
|
142
|
-
/**
|
|
143
|
-
* Custom format function
|
|
144
|
-
*
|
|
145
|
-
* @param module logger name
|
|
146
|
-
* @param level log level
|
|
147
|
-
* @param args additional arguments
|
|
148
|
-
* @returns an array of arguments, which are passed to the logger (for example, `console.log()`)
|
|
149
|
-
*/
|
|
150
|
-
(module: string, level: number, args: any[]): any[]
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
declare type Log = {
|
|
154
|
-
/**
|
|
155
|
-
* Logs a message
|
|
156
|
-
*
|
|
157
|
-
* @param message text to log
|
|
158
|
-
* @param optionalParams additional parameters, same as in `console.log(text, param1, ...)`
|
|
159
|
-
*/
|
|
160
|
-
(message?: any, ...optionalParams: any[]): void
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
declare enum levels {
|
|
164
|
-
SILENT = 0, ERROR = 1, WARN = 2, INFO = 3, DEBUG = 4, TRACE = 5, SILLY = 5, VERBOSE = 5
|
|
165
|
-
}
|
package/apis/models.d.ts
CHANGED
|
@@ -1,180 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type JSON = string
|
|
21
|
-
type YAML = string
|
|
22
|
-
type CDL = string
|
|
23
|
-
type SQL = string
|
|
24
|
-
type XML = string
|
|
25
|
-
type EDM = { $version:string }
|
|
26
|
-
type EDMX = XML
|
|
27
|
-
type filename = string
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export default class cds {
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The effective CDS model loaded during bootstrapping, which contains all service and entity definitions,
|
|
34
|
-
* including required services.
|
|
35
|
-
*/
|
|
36
|
-
model?: LinkedCSN
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Provides a set of methods to parse a given model, query or expression.
|
|
40
|
-
* You can also use `cds.parse()` as a shortcut to `cds.parse.cdl()`.
|
|
41
|
-
*/
|
|
42
|
-
parse : {
|
|
43
|
-
/** Shortcut to `cds.parse.cdl()` */
|
|
44
|
-
(cdl:CDL) : CSN
|
|
45
|
-
cdl (cdl:CDL) : CSN
|
|
46
|
-
cql (src:string) : CQN
|
|
47
|
-
expr (src:string) : expr
|
|
48
|
-
xpr (src:string) : _xpr
|
|
49
|
-
ref (src:string) : string[]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Provides a set of methods to parse a given model, query or expression.
|
|
55
|
-
* You can also use `cds.compile(csn).to('<output>')` as a fluent variant.
|
|
56
|
-
*/
|
|
57
|
-
compile : {
|
|
58
|
-
/** Shortcut for `cds.compile.to.csn()` */
|
|
59
|
-
cdl (model:CDL, o?:_options) : CSN,
|
|
60
|
-
|
|
61
|
-
for: {
|
|
62
|
-
odata (model:CSN, o?:_options) : CSN
|
|
63
|
-
sql (model:CSN, o?:_options) : CSN
|
|
64
|
-
},
|
|
65
|
-
to: {
|
|
66
|
-
parsed:{
|
|
67
|
-
csn (files:filename[], o?:_options) : Promise<CSN>
|
|
68
|
-
csn (model:CDL, o?:_options) : CSN
|
|
69
|
-
}
|
|
70
|
-
xtended:{
|
|
71
|
-
csn (files:filename[], o?:_options) : Promise<CSN>
|
|
72
|
-
csn (model:CDL, o?:_options) : CSN
|
|
73
|
-
}
|
|
74
|
-
inferred:{
|
|
75
|
-
csn (files:filename[], o?:_options) : Promise<CSN>
|
|
76
|
-
csn (model:CDL, o?:_options) : CSN
|
|
77
|
-
}
|
|
78
|
-
csn (files:filename[], o?:_options) : Promise<CSN>
|
|
79
|
-
csn (model:CDL, o?:_options) : CSN
|
|
80
|
-
yml (model:CSN, o?:_options) : YAML
|
|
81
|
-
yaml (model:CSN, o?:_options) : YAML
|
|
82
|
-
json (model:CSN, o?:_options) : JSON
|
|
83
|
-
sql (model:CSN, o?:_options) : SQL[]
|
|
84
|
-
cdl (model:CSN, o?:_options) : CDL | Iterable<[CDL,{file:filename}]>
|
|
85
|
-
edm (model:CSN, o?:_options|_odata_options) : EDM | string
|
|
86
|
-
edmx (model:CSN, o?:_options|_odata_options) : EDMX | Iterable<[EDMX,{file:filename}]>
|
|
87
|
-
hdbcds (model:CSN, o?:_options) : SQL | Iterable<[SQL,{file:filename}]>
|
|
88
|
-
hdbtable (model:CSN, o?:_options) : SQL | Iterable<[SQL,{file:filename}]>
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** Fluent API variant */
|
|
92
|
-
(model: CSN | CDL) : {
|
|
93
|
-
for: {
|
|
94
|
-
odata (o?:_options) : CSN
|
|
95
|
-
sql (o?:_options) : CSN
|
|
96
|
-
},
|
|
97
|
-
to: {
|
|
98
|
-
parsed:{ csn (o?:_options) : CSN }
|
|
99
|
-
xtended:{ csn (o?:_options) : CSN }
|
|
100
|
-
inferred:{ csn (o?:_options) : CSN }
|
|
101
|
-
csn (o?:_options) : CSN
|
|
102
|
-
yml (o?:_options) : YAML
|
|
103
|
-
yaml (o?:_options) : YAML
|
|
104
|
-
json (o?:_options) : JSON
|
|
105
|
-
sql (o?:_options) : SQL[]
|
|
106
|
-
cdl (o?:_options) : CDL | Iterable<[CDL,{file:filename}]>
|
|
107
|
-
edm (o?:_options|_odata_options) : EDM | string
|
|
108
|
-
edmx (o?:_options|_odata_options) : EDMX | Iterable<[EDMX,{file:filename}]>
|
|
109
|
-
hdbcds (o?:_options) : SQL | Iterable<[SQL,{file:filename}]>
|
|
110
|
-
hdbtable (o?:_options) : SQL | Iterable<[SQL,{file:filename}]>
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** Async fluent variant reading from files */
|
|
115
|
-
(files: filename[]) : {
|
|
116
|
-
for: {
|
|
117
|
-
odata (o?:_options) : Promise<CSN>
|
|
118
|
-
sql (o?:_options) : Promise<CSN>
|
|
119
|
-
},
|
|
120
|
-
to: {
|
|
121
|
-
parsed:{ csn (o?:_options) : Promise <CSN> }
|
|
122
|
-
xtended:{ csn (o?:_options) : Promise <CSN> }
|
|
123
|
-
inferred:{ csn (o?:_options) : Promise <CSN> }
|
|
124
|
-
csn (o?:_options) : Promise <CSN>
|
|
125
|
-
yml (o?:_options) : Promise <YAML>
|
|
126
|
-
yaml (o?:_options) : Promise <YAML>
|
|
127
|
-
json (o?:_options) : Promise <JSON>
|
|
128
|
-
sql (o?:_options) : Promise <SQL[]>
|
|
129
|
-
cdl (o?:_options) : Promise <CDL | Iterable<[CDL,{file:filename}]>>
|
|
130
|
-
edm (o?:_options|_odata_options) : Promise <EDM | string>
|
|
131
|
-
edmx (o?:_options|_odata_options) : Promise <EDMX | Iterable<[EDMX,{file:filename}]>>
|
|
132
|
-
hdbcds (o?:_options) : Promise <SQL | Iterable<[SQL,{file:filename}]>>
|
|
133
|
-
hdbtable (o?:_options) : Promise <SQL | Iterable<[SQL,{file:filename}]>>
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Loads and parses models from the specified files.
|
|
140
|
-
* Uses `cds.resolve` to fetch the respective models.
|
|
141
|
-
* Essentially a shortcut for `cds.compile.to.csn(files)`
|
|
142
|
-
* @param {string} files - filenames of models or if folder containing models
|
|
143
|
-
*/
|
|
144
|
-
get(files: '*' | filename | filename[], o?:_options) : Promise<CSN>
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Shortcut for `cds.get(files, 'inferred')`
|
|
148
|
-
* @param {string} files - filenames of models or if folder containing models
|
|
149
|
-
*/
|
|
150
|
-
load(files: '*' | filename | filename[], o?:_options) : Promise<CSN>
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Emitted whenever a model is loaded using cds.load().
|
|
154
|
-
*/
|
|
155
|
-
on (event : 'loaded', listener : (model : CSN) => void) : this
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Resolves given file or module name(s) to an array of absolute file names.
|
|
160
|
-
* Uses Node's `require.resolve` internally with the following additions:
|
|
161
|
-
* - relative names are resolved relative to the current working directory instead of the current JavaScript module; hence, use __dirname if you want to find or load models relative to the current module.
|
|
162
|
-
* - if no file extension is given, `.csn` and `.cds` will be appended in that order.
|
|
163
|
-
* @param files - The file or module name(s) of a model or a folder containing models. Specify `'*'` to fetch moels from default locations, i.e. `[ 'db/', 'srv/', 'app/' ]`
|
|
164
|
-
* @returns An array of absolute file names or `undefined` if none could be resolved.
|
|
165
|
-
*/
|
|
166
|
-
resolve (files: '*' | filename | filename[]) : filename[] | undefined
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Turns the given plain CSN model into a linked model
|
|
170
|
-
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect)
|
|
171
|
-
*/
|
|
172
|
-
linked(model: CSN): LinkedCSN
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Turns the given plain CSN model into a reflected model
|
|
176
|
-
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect)
|
|
177
|
-
*/
|
|
178
|
-
reflect(model: CSN): LinkedCSN
|
|
179
|
-
|
|
180
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* DO NO LONGER IMPORT THIS FILE
|
|
3
|
+
*
|
|
4
|
+
* Instead use:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* import * as cds from '@sap/cds'
|
|
9
|
+
* cds.Request
|
|
10
|
+
* or
|
|
11
|
+
* import { Request } from '@sap/cds'
|
|
12
|
+
* or
|
|
13
|
+
* @type { import('@sap/cds').Request }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
export * from '@cap-js/cds-types/apis/models'
|