@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/ql.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as CQN from
|
|
3
|
-
import { Constructable, ArrayConstructable, SingularType } from
|
|
4
|
-
import { LinkedEntity } from
|
|
1
|
+
import { Definition, EntityElements } from './csn'
|
|
2
|
+
import * as CQN from './cqn'
|
|
3
|
+
import { Constructable, ArrayConstructable, SingularType } from './internal/inference'
|
|
4
|
+
import { LinkedEntity } from './linked'
|
|
5
5
|
import { ref, column_expr } from './cqn'
|
|
6
6
|
|
|
7
7
|
export type Query = CQN.Query
|
|
8
8
|
|
|
9
9
|
export class ConstructedQuery {
|
|
10
|
-
then(_resolved:(x:any)=>any, _rejected:(e:Error)=>any) : any
|
|
11
|
-
}
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
then (_resolved: (x: any) => any, _rejected: (e: Error) => any): any
|
|
12
|
+
|
|
15
13
|
}
|
|
16
14
|
|
|
15
|
+
|
|
17
16
|
export type PK = number | string | object
|
|
18
17
|
|
|
19
18
|
|
|
@@ -27,24 +26,25 @@ type QLExtensions<T> = T extends QLExtensions_<any> ? T : QLExtensions_<T>
|
|
|
27
26
|
* They are passed down to all properties recursively.
|
|
28
27
|
*/
|
|
29
28
|
type QLExtensions_<T> = {
|
|
30
|
-
|
|
29
|
+
[Key in keyof T]: QLExtensions<T[Key]>
|
|
31
30
|
} & {
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
33
|
* Alias for this attribute.
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
as: (alias: string) => void,
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
38
|
* Accesses any nested attribute based on a [path](https://cap.cloud.sap/cap/docs/java/query-api#path-expressions):
|
|
39
39
|
* `X.get('a.b.c.d')`. Note that you will not receive
|
|
40
40
|
* proper typing after this call.
|
|
41
41
|
* To still have access to typed results, use
|
|
42
42
|
* `X.a().b().c().d()` instead.
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
get: (path: string) => any,
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
// have to exclude undefined from the type, or we'd end up with a distribution of Subqueryable
|
|
47
|
+
// over T and undefined, which gives us zero code completion within the callable.
|
|
48
48
|
} & Subqueryable<Exclude<T, undefined>>
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -52,11 +52,11 @@ type QLExtensions_<T> = {
|
|
|
52
52
|
* The final result of each subquery will be the property itself:
|
|
53
53
|
* `Book.title` == `Subqueryable<Book>.title()`
|
|
54
54
|
*/
|
|
55
|
-
type Subqueryable<T> =
|
|
56
|
-
T extends Primitive ? {}
|
|
55
|
+
type Subqueryable<T> = T extends Primitive ? unknown
|
|
57
56
|
// composition of many/ association to many
|
|
58
|
-
: T extends readonly unknown[] ? {
|
|
59
|
-
|
|
57
|
+
: T extends readonly unknown[] ? {
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
60
|
* @example
|
|
61
61
|
* ```js
|
|
62
62
|
* SELECT.from(Books, b => b.author)
|
|
@@ -71,11 +71,12 @@ T extends Primitive ? {}
|
|
|
71
71
|
*
|
|
72
72
|
* Note that you do not need to return anything from these subqueries.
|
|
73
73
|
*/
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
// composition of one/ association to one
|
|
77
|
-
: {
|
|
78
|
-
|
|
74
|
+
(fn: ((a: QLExtensions<T[number]>) => any) | '*'): T[number],
|
|
75
|
+
}
|
|
76
|
+
// composition of one/ association to one
|
|
77
|
+
: {
|
|
78
|
+
|
|
79
|
+
/**
|
|
79
80
|
* @example
|
|
80
81
|
* ```js
|
|
81
82
|
* SELECT.from(Books, b => b.author)
|
|
@@ -90,15 +91,14 @@ T extends Primitive ? {}
|
|
|
90
91
|
*
|
|
91
92
|
* Note that you do not need to return anything from these subqueries.
|
|
92
93
|
*/
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
;
|
|
94
|
+
(fn: ((a: QLExtensions<T>) => any) | '*'): T,
|
|
95
|
+
}
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
// Alias for projections
|
|
99
99
|
// https://cap.cloud.sap/docs/node.js/cds-ql?q=projection#projection-functions
|
|
100
|
-
//export type Projection<T> = (e:T)=>void
|
|
101
|
-
export type Projection<T> = (e:QLExtensions<T extends ArrayConstructable ?
|
|
100
|
+
// export type Projection<T> = (e:T)=>void
|
|
101
|
+
export type Projection<T> = (e: QLExtensions<T extends ArrayConstructable ? SingularType<T> : T>) => void
|
|
102
102
|
// Type for query pieces that can either be chained to build more complex queries or
|
|
103
103
|
// awaited to materialise the result:
|
|
104
104
|
// `Awaitable<SELECT<Book>, Book> = SELECT<Book> & Promise<Book>`
|
|
@@ -116,25 +116,33 @@ export type Awaitable<T, I> = T & Promise<I>
|
|
|
116
116
|
// all the functionality of an instance of SELECT, but directly callable:
|
|
117
117
|
// new SELECT(...).(...) == SELECT(...)
|
|
118
118
|
export type StaticSELECT<T> = typeof SELECT
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
& ((...columns: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) => SELECT<T>)
|
|
120
|
+
& ((...columns: string[]) => SELECT<T>)
|
|
121
|
+
& ((columns: string[]) => SELECT<T>)
|
|
122
|
+
& (TaggedTemplateQueryPart<SELECT<T>>)
|
|
123
|
+
& SELECT_one // as it is not directly quantified, ...
|
|
124
|
+
& SELECT_from // ...we should expect both a scalar and a list
|
|
125
125
|
|
|
126
126
|
declare class QL<T> {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
127
|
+
|
|
128
|
+
SELECT: StaticSELECT<T>
|
|
129
|
+
|
|
130
|
+
INSERT: typeof INSERT
|
|
131
|
+
& ((...entries: object[]) => INSERT<any>) & ((entries: object[]) => INSERT<any>)
|
|
132
|
+
|
|
133
|
+
UPSERT: typeof UPSERT
|
|
134
|
+
& ((...entries: object[]) => UPSERT<any>) & ((entries: object[]) => UPSERT<any>)
|
|
135
|
+
|
|
136
|
+
UPDATE: typeof UPDATE
|
|
137
|
+
& typeof UPDATE.entity
|
|
138
|
+
|
|
139
|
+
DELETE: typeof DELETE
|
|
140
|
+
& ((...entries: object[]) => DELETE<any>) & ((entries: object[]) => DELETE<any>)
|
|
141
|
+
|
|
142
|
+
CREATE: typeof CREATE
|
|
143
|
+
|
|
144
|
+
DROP: typeof DROP
|
|
145
|
+
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
// used as a catch-all type for using tagged template strings: SELECT `foo`. from `bar` etc.
|
|
@@ -145,186 +153,243 @@ declare class QL<T> {
|
|
|
145
153
|
type TaggedTemplateQueryPart<T> = (strings: TemplateStringsArray, ...params: unknown[]) => T
|
|
146
154
|
|
|
147
155
|
export class SELECT<T> extends ConstructedQuery {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
156
|
+
|
|
157
|
+
static one: SELECT_one & { from: SELECT_one }
|
|
158
|
+
|
|
159
|
+
static distinct: typeof SELECT
|
|
160
|
+
|
|
161
|
+
static from: SELECT_from
|
|
162
|
+
|
|
163
|
+
from: SELECT_from & TaggedTemplateQueryPart<this>
|
|
164
|
+
& ((entity: Definition | string, primaryKey?: PK, projection?: Projection<unknown>) => this)
|
|
165
|
+
|
|
166
|
+
byKey (primaryKey?: PK): this
|
|
167
|
+
columns: TaggedTemplateQueryPart<this>
|
|
168
|
+
& ((projection: Projection<T>) => this)
|
|
169
|
+
& ((...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) => this)
|
|
170
|
+
& ((...col: (string | column_expr)[]) => this)
|
|
171
|
+
& ((col: (string | column_expr)[]) => this)
|
|
172
|
+
|
|
173
|
+
where: TaggedTemplateQueryPart<this>
|
|
174
|
+
& ((predicate: object) => this)
|
|
175
|
+
& ((...expr: any[]) => this)
|
|
176
|
+
|
|
177
|
+
and: TaggedTemplateQueryPart<this>
|
|
178
|
+
& ((predicate: object) => this)
|
|
179
|
+
& ((...expr: any[]) => this)
|
|
180
|
+
|
|
181
|
+
having: TaggedTemplateQueryPart<this>
|
|
182
|
+
& ((...expr: string[]) => this)
|
|
183
|
+
& ((predicate: object) => this)
|
|
184
|
+
|
|
185
|
+
groupBy: TaggedTemplateQueryPart<this>
|
|
186
|
+
& ((...expr: string[]) => this)
|
|
187
|
+
|
|
188
|
+
orderBy: TaggedTemplateQueryPart<this>
|
|
189
|
+
& ((...expr: string[]) => this)
|
|
190
|
+
|
|
191
|
+
limit: TaggedTemplateQueryPart<this>
|
|
192
|
+
& ((rows: number, offset?: number) => this)
|
|
193
|
+
|
|
194
|
+
forShareLock (): this
|
|
195
|
+
|
|
196
|
+
forUpdate ({ wait }?: { wait?: number }): this
|
|
197
|
+
|
|
198
|
+
alias (as: string): this
|
|
199
|
+
elements: EntityElements
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
// Not yet public
|
|
203
|
+
// fullJoin (other: string, as: string) : this
|
|
204
|
+
// leftJoin (other: string, as: string) : this
|
|
184
205
|
// rightJoin (other: string, as: string) : this
|
|
185
206
|
// innerJoin (other: string, as: string) : this
|
|
186
207
|
// join (other: string, as: string, kind?: string) : this
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
208
|
+
// on : TaggedTemplateQueryPart<this>
|
|
209
|
+
// & ((...expr : string[]) => this)
|
|
210
|
+
// & ((predicate:object) => this)
|
|
211
|
+
|
|
212
|
+
SELECT: CQN.SELECT['SELECT'] & {
|
|
213
|
+
forUpdate?: { wait: number },
|
|
214
|
+
forShareLock?: { wait: number },
|
|
215
|
+
search?: CQN.predicate,
|
|
216
|
+
count?: boolean,
|
|
217
|
+
}
|
|
218
|
+
|
|
197
219
|
}
|
|
198
220
|
|
|
199
221
|
|
|
200
222
|
type SELECT_one =
|
|
201
|
-
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
223
|
+
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
202
224
|
&
|
|
203
225
|
// calling with class
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
226
|
+
(<T extends ArrayConstructable<any>>
|
|
227
|
+
(entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
|
|
228
|
+
=> Awaitable<SELECT<SingularType<T>>, SingularType<T>>)
|
|
207
229
|
&
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
& ((entity: Definition | string, primaryKey
|
|
213
|
-
& ((entity: LinkedEntity | string, primaryKey
|
|
214
|
-
& (<T> (entity: T[], projection
|
|
215
|
-
& (<T> (entity: T[], primaryKey
|
|
216
|
-
& (<T> (entity: {new():T}, projection
|
|
217
|
-
& (<T> (entity: {new():T}, primaryKey
|
|
218
|
-
& ((subject: ref) => SELECT<any>)
|
|
230
|
+
(<T extends ArrayConstructable<any>>
|
|
231
|
+
(entityType: T, primaryKey: PK, projection?: Projection<QLExtensions<SingularType<T>>>)
|
|
232
|
+
=> Awaitable<SELECT<SingularType<T>>, SingularType<T>>)
|
|
233
|
+
|
|
234
|
+
& ((entity: Definition | string, primaryKey?: PK, projection?: Projection<unknown>) => SELECT<any>)
|
|
235
|
+
& ((entity: LinkedEntity | string, primaryKey?: PK, projection?: Projection<unknown>) => SELECT<any>)
|
|
236
|
+
& (<T> (entity: T[], projection?: Projection<T>) => Awaitable<SELECT<T>, T>)
|
|
237
|
+
& (<T> (entity: T[], primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT<T>, T>)
|
|
238
|
+
& (<T> (entity: { new(): T }, projection?: Projection<T>) => Awaitable<SELECT<T>, T>)
|
|
239
|
+
& (<T> (entity: { new(): T }, primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT<T>, T>)
|
|
240
|
+
& ((subject: ref) => SELECT<any>)
|
|
219
241
|
|
|
220
242
|
type SELECT_from =
|
|
221
243
|
// tagged template
|
|
222
|
-
|
|
244
|
+
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
223
245
|
&
|
|
224
246
|
// calling with class
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
247
|
+
(<T extends ArrayConstructable<any>>
|
|
248
|
+
(entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
|
|
249
|
+
=> Awaitable<SELECT<T>, InstanceType<T>>)
|
|
228
250
|
&
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
251
|
+
(<T extends ArrayConstructable<any>>
|
|
252
|
+
(entityType: T, primaryKey: PK, projection?: Projection<SingularType<T>>)
|
|
253
|
+
=> Awaitable<SELECT<SingularType<T>>, InstanceType<SingularType<T>>>) // when specifying a key, we expect a single element as result
|
|
232
254
|
// calling with definition
|
|
233
|
-
& ((entity: Definition | string, primaryKey
|
|
234
|
-
& ((entity: LinkedEntity | string, primaryKey
|
|
255
|
+
& ((entity: Definition | string, primaryKey?: PK, projection?: Projection<unknown>) => SELECT<any>)
|
|
256
|
+
& ((entity: LinkedEntity | string, primaryKey?: PK, projection?: Projection<unknown>) => SELECT<any>)
|
|
235
257
|
// calling with concrete list
|
|
236
|
-
& (<T> (entity: T[], projection
|
|
237
|
-
& (<T> (entity: T[], primaryKey
|
|
238
|
-
& ((subject: ref) => SELECT<any>)
|
|
258
|
+
& (<T> (entity: T[], projection?: Projection<T>) => SELECT<T> & Promise<T[]>)
|
|
259
|
+
& (<T> (entity: T[], primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT<T>, T>)
|
|
260
|
+
& ((subject: ref) => SELECT<any>)
|
|
239
261
|
|
|
240
262
|
export class INSERT<T> extends ConstructedQuery {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
263
|
+
|
|
264
|
+
static into: (<T extends ArrayConstructable<any>> (entity: T, entries?: object | object[]) => INSERT<SingularType<T>>)
|
|
265
|
+
& (TaggedTemplateQueryPart<INSERT<unknown>>)
|
|
266
|
+
& ((entity: Definition | string, entries?: object | object[]) => INSERT<any>)
|
|
267
|
+
& ((entity: LinkedEntity | string, entries?: object | object[]) => INSERT<any>)
|
|
268
|
+
& (<T> (entity: Constructable<T>, entries?: object | object[]) => INSERT<T>)
|
|
269
|
+
& (<T> (entity: T, entries?: T | object | object[]) => INSERT<T>)
|
|
270
|
+
|
|
271
|
+
into: (<T extends ArrayConstructable> (entity: T) => this)
|
|
272
|
+
& TaggedTemplateQueryPart<this>
|
|
273
|
+
& ((entity: Definition | string) => this)
|
|
274
|
+
|
|
275
|
+
data (block: (e: T) => void): this
|
|
276
|
+
|
|
277
|
+
entries (...entries: object[]): this
|
|
278
|
+
|
|
279
|
+
columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]): this
|
|
280
|
+
|
|
281
|
+
columns (...col: string[]): this
|
|
282
|
+
|
|
283
|
+
values (...val: any[]): this
|
|
284
|
+
|
|
285
|
+
rows (...row: any[]): this
|
|
286
|
+
|
|
287
|
+
as (select: SELECT<T>): this
|
|
288
|
+
INSERT: CQN.INSERT['INSERT']
|
|
289
|
+
|
|
259
290
|
}
|
|
260
291
|
|
|
261
292
|
|
|
262
293
|
export class UPSERT<T> extends ConstructedQuery {
|
|
263
|
-
static into : (<T extends ArrayConstructable<any>> (entity:T, entries? : object | object[]) => UPSERT<SingularType<T>>)
|
|
264
|
-
& (TaggedTemplateQueryPart<UPSERT<unknown>>)
|
|
265
|
-
& ((entity : Definition | string, entries? : object | object[]) => UPSERT<any>)
|
|
266
|
-
& ((entity : LinkedEntity | string, entries? : object | object[]) => UPSERT<any>)
|
|
267
|
-
& (<T> (entity:Constructable<T>, entries? : object | object[]) => UPSERT<T>)
|
|
268
|
-
& (<T> (entity:T, entries? : T | object | object[]) => UPSERT<T>)
|
|
269
|
-
|
|
270
|
-
into: (<T extends ArrayConstructable> (entity:T) => this)
|
|
271
|
-
& TaggedTemplateQueryPart<this>
|
|
272
|
-
& ((entity : Definition | string) => this)
|
|
273
|
-
data (block : (e:T)=>void) : this
|
|
274
|
-
entries (...entries : object[]) : this
|
|
275
|
-
columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) : this
|
|
276
|
-
columns (...col: string[]) : this
|
|
277
|
-
values (... val: any[]) : this
|
|
278
|
-
rows (... row: any[]) : this
|
|
279
|
-
UPSERT : CQN.UPSERT["UPSERT"]
|
|
280
|
-
}
|
|
281
294
|
|
|
295
|
+
static into: (<T extends ArrayConstructable<any>> (entity: T, entries?: object | object[]) => UPSERT<SingularType<T>>)
|
|
296
|
+
& (TaggedTemplateQueryPart<UPSERT<unknown>>)
|
|
297
|
+
& ((entity: Definition | string, entries?: object | object[]) => UPSERT<any>)
|
|
298
|
+
& ((entity: LinkedEntity | string, entries?: object | object[]) => UPSERT<any>)
|
|
299
|
+
& (<T> (entity: Constructable<T>, entries?: object | object[]) => UPSERT<T>)
|
|
300
|
+
& (<T> (entity: T, entries?: T | object | object[]) => UPSERT<T>)
|
|
301
|
+
|
|
302
|
+
into: (<T extends ArrayConstructable> (entity: T) => this)
|
|
303
|
+
& TaggedTemplateQueryPart<this>
|
|
304
|
+
& ((entity: Definition | string) => this)
|
|
305
|
+
|
|
306
|
+
data (block: (e: T) => void): this
|
|
307
|
+
|
|
308
|
+
entries (...entries: object[]): this
|
|
309
|
+
|
|
310
|
+
columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]): this
|
|
282
311
|
|
|
312
|
+
columns (...col: string[]): this
|
|
283
313
|
|
|
314
|
+
values (...val: any[]): this
|
|
315
|
+
|
|
316
|
+
rows (...row: any[]): this
|
|
317
|
+
UPSERT: CQN.UPSERT['UPSERT']
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
284
322
|
export class DELETE<T> extends ConstructedQuery {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
323
|
+
|
|
324
|
+
static from:
|
|
325
|
+
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
326
|
+
& ((entity: Definition | string | ArrayConstructable, primaryKey?: PK) => DELETE<any>)
|
|
327
|
+
& ((entity: LinkedEntity | string | ArrayConstructable, primaryKey?: PK) => DELETE<any>)
|
|
328
|
+
& ((subject: ref) => DELETE<any>)
|
|
329
|
+
|
|
330
|
+
byKey (primaryKey?: PK): this
|
|
331
|
+
|
|
332
|
+
where (predicate: object): this
|
|
333
|
+
|
|
334
|
+
where (...expr: any[]): this
|
|
335
|
+
|
|
336
|
+
and (predicate: object): this
|
|
337
|
+
|
|
338
|
+
and (...expr: any[]): this
|
|
339
|
+
DELETE: CQN.DELETE['DELETE']
|
|
340
|
+
|
|
296
341
|
}
|
|
297
342
|
|
|
343
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
298
344
|
export class UPDATE<T> extends ConstructedQuery {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
345
|
+
|
|
346
|
+
// cds-typer plural
|
|
347
|
+
static entity<T extends ArrayConstructable<any>> (entity: T, primaryKey?: PK): UPDATE<SingularType<T>>
|
|
348
|
+
|
|
349
|
+
static entity (entity: Definition | string, primaryKey?: PK): UPDATE<any>
|
|
350
|
+
|
|
351
|
+
static entity (entity: LinkedEntity | string, primaryKey?: PK): UPDATE<any>
|
|
352
|
+
|
|
353
|
+
static entity<T> (entity: Constructable<T>, primaryKey?: PK): UPDATE<T>
|
|
354
|
+
|
|
355
|
+
static entity<T> (entity: T, primaryKey?: PK): UPDATE<T>
|
|
356
|
+
|
|
357
|
+
byKey (primaryKey?: PK): this
|
|
358
|
+
// with (block: (e:T)=>void) : this
|
|
359
|
+
// set (block: (e:T)=>void) : this
|
|
360
|
+
set: TaggedTemplateQueryPart<this>
|
|
361
|
+
& ((data: object) => this);
|
|
362
|
+
|
|
363
|
+
with: TaggedTemplateQueryPart<this>
|
|
364
|
+
& ((data: object) => this)
|
|
365
|
+
|
|
366
|
+
where (predicate: object): this
|
|
367
|
+
|
|
368
|
+
where (...expr: any[]): this
|
|
369
|
+
|
|
370
|
+
and (predicate: object): this
|
|
371
|
+
|
|
372
|
+
and (...expr: any[]): this
|
|
373
|
+
UPDATE: CQN.UPDATE['UPDATE']
|
|
374
|
+
|
|
318
375
|
}
|
|
319
376
|
|
|
377
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
320
378
|
export class CREATE<T> extends ConstructedQuery {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
379
|
+
|
|
380
|
+
static entity (entity: Definition | string): CREATE<any>
|
|
381
|
+
|
|
382
|
+
static entity (entity: LinkedEntity | string): CREATE<any>
|
|
383
|
+
CREATE: CQN.CREATE['CREATE']
|
|
384
|
+
|
|
324
385
|
}
|
|
325
386
|
|
|
387
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
326
388
|
export class DROP<T> extends ConstructedQuery {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
389
|
+
|
|
390
|
+
static entity (entity: Definition | string): DROP<any>
|
|
391
|
+
|
|
392
|
+
static entity (entity: LinkedEntity | string): DROP<any>
|
|
393
|
+
DROP: CQN.DROP['DROP']
|
|
394
|
+
|
|
330
395
|
}
|