@cap-js/cds-types 0.0.1 → 0.2.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/README.md +13 -2
- package/apis/cds.d.ts +30 -26
- package/apis/core.d.ts +90 -83
- package/apis/cqn.d.ts +87 -65
- package/apis/csn.d.ts +25 -16
- package/apis/env.d.ts +21 -24
- package/apis/events.d.ts +82 -59
- package/apis/internal/inference.d.ts +39 -5
- package/apis/linked.d.ts +45 -38
- package/apis/log.d.ts +79 -71
- package/apis/models.d.ts +155 -162
- package/apis/ql.d.ts +256 -191
- package/apis/server.d.ts +72 -62
- package/apis/services.d.ts +164 -106
- package/apis/test.d.ts +80 -49
- package/apis/utils.d.ts +85 -90
- package/package.json +13 -3
package/apis/models.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Query as CQN, expr, _xpr } from
|
|
2
|
-
import { LinkedCSN } from
|
|
3
|
-
import { CSN } from
|
|
1
|
+
import { Query as CQN, expr, _xpr } from './cqn'
|
|
2
|
+
import { LinkedCSN } from './linked'
|
|
3
|
+
import { CSN } from './csn'
|
|
4
4
|
|
|
5
5
|
type _flavor = 'parsed' | 'xtended' | 'inferred'
|
|
6
6
|
type _odata_options = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
flavor?: 'v2' | 'v4' | 'w4' | 'x4',
|
|
8
|
+
version?: 'v2' | 'v4',
|
|
9
|
+
structs?: boolean,
|
|
10
|
+
refs?: boolean,
|
|
11
11
|
}
|
|
12
12
|
type _options = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
flavor?: _flavor,
|
|
14
|
+
plain?: boolean,
|
|
15
|
+
docs?: boolean,
|
|
16
|
+
names?: string,
|
|
17
|
+
odata?: _odata_options,
|
|
18
18
|
} | _flavor
|
|
19
19
|
|
|
20
20
|
type JSON = string
|
|
@@ -22,159 +22,152 @@ type YAML = string
|
|
|
22
22
|
type CDL = string
|
|
23
23
|
type SQL = string
|
|
24
24
|
type XML = string
|
|
25
|
-
type EDM = { $version:string }
|
|
25
|
+
type EDM = { $version: string }
|
|
26
26
|
type EDMX = XML
|
|
27
27
|
type filename = string
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
30
|
+
/**
|
|
31
|
+
* The effective CDS model loaded during bootstrapping, which contains all service and entity definitions,
|
|
32
|
+
* including required services.
|
|
33
|
+
* Should only be ever set explictly in test scenarios!
|
|
34
|
+
*/
|
|
35
|
+
export let model: LinkedCSN | undefined
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Provides a set of methods to parse a given model, query or expression.
|
|
39
|
+
* You can also use `cds.parse()` as a shortcut to `cds.parse.cdl()`.
|
|
40
|
+
*/
|
|
41
|
+
export const parse: {
|
|
42
|
+
|
|
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
|
+
}
|
|
179
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Loads and parses models from the specified files.
|
|
54
|
+
* Uses `cds.resolve` to fetch the respective models.
|
|
55
|
+
* Essentially a shortcut for `cds.compile.to.csn(files)`
|
|
56
|
+
* @param files - filenames of models or if folder containing models
|
|
57
|
+
*/
|
|
58
|
+
export function get (files: '*' | filename | filename[], o?: _options): Promise<CSN>
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Shortcut for `cds.get(files, 'inferred')`
|
|
62
|
+
* @param files - filenames of models or if folder containing models
|
|
63
|
+
*/
|
|
64
|
+
export function load (files: '*' | filename | filename[], o?: _options): Promise<CSN>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Resolves given file or module name(s) to an array of absolute file names.
|
|
69
|
+
* Uses Node's `require.resolve` internally with the following additions:
|
|
70
|
+
* - 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.
|
|
71
|
+
* - if no file extension is given, `.csn` and `.cds` will be appended in that order.
|
|
72
|
+
* @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/' ]`
|
|
73
|
+
* @returns An array of absolute file names or `undefined` if none could be resolved.
|
|
74
|
+
*/
|
|
75
|
+
export function resolve (files: '*' | filename | filename[]): filename[] | undefined
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Turns the given plain CSN model into a linked model
|
|
79
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect)
|
|
80
|
+
*/
|
|
81
|
+
declare const linked: (model: CSN) => LinkedCSN
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Turns the given plain CSN model into a reflected model
|
|
85
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect)
|
|
86
|
+
*/
|
|
87
|
+
export const reflect: (model: CSN) => LinkedCSN
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Provides a set of methods to parse a given model, query or expression.
|
|
91
|
+
* You can also use `cds.compile(csn).to('<output>')` as a fluent variant.
|
|
92
|
+
*/
|
|
93
|
+
export const compile: {
|
|
94
|
+
|
|
95
|
+
/** Shortcut for `cds.compile.to.csn()` */
|
|
96
|
+
cdl (model: CDL, o?: _options): CSN,
|
|
97
|
+
|
|
98
|
+
for: {
|
|
99
|
+
odata (model: CSN, o?: _options): CSN,
|
|
100
|
+
sql (model: CSN, o?: _options): CSN,
|
|
101
|
+
},
|
|
102
|
+
to: {
|
|
103
|
+
parsed: {
|
|
104
|
+
csn (files: filename[], o?: _options): Promise<CSN>,
|
|
105
|
+
csn (model: CDL, o?: _options): CSN,
|
|
106
|
+
},
|
|
107
|
+
xtended: {
|
|
108
|
+
csn (files: filename[], o?: _options): Promise<CSN>,
|
|
109
|
+
csn (model: CDL, o?: _options): CSN,
|
|
110
|
+
},
|
|
111
|
+
inferred: {
|
|
112
|
+
csn (files: filename[], o?: _options): Promise<CSN>,
|
|
113
|
+
csn (model: CDL, o?: _options): CSN,
|
|
114
|
+
},
|
|
115
|
+
csn (files: filename[], o?: _options): Promise<CSN>,
|
|
116
|
+
csn (model: CDL, o?: _options): CSN,
|
|
117
|
+
yml (model: CSN, o?: _options): YAML,
|
|
118
|
+
yaml (model: CSN, o?: _options): YAML,
|
|
119
|
+
json (model: CSN, o?: _options): JSON,
|
|
120
|
+
sql (model: CSN, o?: _options): SQL[],
|
|
121
|
+
cdl (model: CSN, o?: _options): CDL | Iterable<[CDL, { file: filename }]>,
|
|
122
|
+
edm (model: CSN, o?: _options | _odata_options): EDM | string,
|
|
123
|
+
edmx (model: CSN, o?: _options | _odata_options): EDMX | Iterable<[EDMX, { file: filename }]>,
|
|
124
|
+
hdbcds (model: CSN, o?: _options): SQL | Iterable<[SQL, { file: filename }]>,
|
|
125
|
+
hdbtable (model: CSN, o?: _options): SQL | Iterable<[SQL, { file: filename }]>,
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/** Fluent API variant */
|
|
129
|
+
(model: CSN | CDL): {
|
|
130
|
+
for: {
|
|
131
|
+
odata (o?: _options): CSN,
|
|
132
|
+
sql (o?: _options): CSN,
|
|
133
|
+
},
|
|
134
|
+
to: {
|
|
135
|
+
parsed: { csn (o?: _options): CSN },
|
|
136
|
+
xtended: { csn (o?: _options): CSN },
|
|
137
|
+
inferred: { csn (o?: _options): CSN },
|
|
138
|
+
csn (o?: _options): CSN,
|
|
139
|
+
yml (o?: _options): YAML,
|
|
140
|
+
yaml (o?: _options): YAML,
|
|
141
|
+
json (o?: _options): JSON,
|
|
142
|
+
sql (o?: _options): SQL[],
|
|
143
|
+
cdl (o?: _options): CDL | Iterable<[CDL, { file: filename }]>,
|
|
144
|
+
edm (o?: _options | _odata_options): EDM | string,
|
|
145
|
+
edmx (o?: _options | _odata_options): EDMX | Iterable<[EDMX, { file: filename }]>,
|
|
146
|
+
hdbcds (o?: _options): SQL | Iterable<[SQL, { file: filename }]>,
|
|
147
|
+
hdbtable (o?: _options): SQL | Iterable<[SQL, { file: filename }]>,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
/** Async fluent variant reading from files */
|
|
152
|
+
(files: filename[]): {
|
|
153
|
+
for: {
|
|
154
|
+
odata (o?: _options): Promise<CSN>,
|
|
155
|
+
sql (o?: _options): Promise<CSN>,
|
|
156
|
+
},
|
|
157
|
+
to: {
|
|
158
|
+
parsed: { csn (o?: _options): Promise <CSN> },
|
|
159
|
+
xtended: { csn (o?: _options): Promise <CSN> },
|
|
160
|
+
inferred: { csn (o?: _options): Promise <CSN> },
|
|
161
|
+
csn (o?: _options): Promise <CSN>,
|
|
162
|
+
yml (o?: _options): Promise <YAML>,
|
|
163
|
+
yaml (o?: _options): Promise <YAML>,
|
|
164
|
+
json (o?: _options): Promise <JSON>,
|
|
165
|
+
sql (o?: _options): Promise <SQL[]>,
|
|
166
|
+
cdl (o?: _options): Promise <CDL | Iterable<[CDL, { file: filename }]>>,
|
|
167
|
+
edm (o?: _options | _odata_options): Promise <EDM | string>,
|
|
168
|
+
edmx (o?: _options | _odata_options): Promise <EDMX | Iterable<[EDMX, { file: filename }]>>,
|
|
169
|
+
hdbcds (o?: _options): Promise <SQL | Iterable<[SQL, { file: filename }]>>,
|
|
170
|
+
hdbtable (o?: _options): Promise <SQL | Iterable<[SQL, { file: filename }]>>,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
180
173
|
}
|