@cap-js/cds-types 0.1.0 → 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 +11 -0
- package/apis/cds.d.ts +11 -11
- package/apis/core.d.ts +36 -23
- package/apis/cqn.d.ts +76 -65
- package/apis/csn.d.ts +23 -14
- package/apis/env.d.ts +11 -11
- package/apis/events.d.ts +76 -32
- package/apis/internal/inference.d.ts +39 -5
- package/apis/linked.d.ts +26 -27
- package/apis/log.d.ts +48 -39
- package/apis/models.d.ts +105 -103
- package/apis/ql.d.ts +256 -188
- package/apis/server.d.ts +67 -65
- package/apis/services.d.ts +111 -76
- package/apis/test.d.ts +70 -45
- package/apis/utils.d.ts +45 -44
- package/package.json +11 -3
package/apis/ql.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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
|
-
|
|
10
|
+
|
|
11
|
+
then (_resolved: (x: any) => any, _rejected: (e: Error) => any): any
|
|
12
|
+
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
|
|
@@ -24,24 +26,25 @@ type QLExtensions<T> = T extends QLExtensions_<any> ? T : QLExtensions_<T>
|
|
|
24
26
|
* They are passed down to all properties recursively.
|
|
25
27
|
*/
|
|
26
28
|
type QLExtensions_<T> = {
|
|
27
|
-
|
|
29
|
+
[Key in keyof T]: QLExtensions<T[Key]>
|
|
28
30
|
} & {
|
|
29
|
-
|
|
31
|
+
|
|
32
|
+
/**
|
|
30
33
|
* Alias for this attribute.
|
|
31
34
|
*/
|
|
32
|
-
|
|
35
|
+
as: (alias: string) => void,
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
/**
|
|
35
38
|
* Accesses any nested attribute based on a [path](https://cap.cloud.sap/cap/docs/java/query-api#path-expressions):
|
|
36
39
|
* `X.get('a.b.c.d')`. Note that you will not receive
|
|
37
40
|
* proper typing after this call.
|
|
38
41
|
* To still have access to typed results, use
|
|
39
42
|
* `X.a().b().c().d()` instead.
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
get: (path: string) => any,
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
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.
|
|
45
48
|
} & Subqueryable<Exclude<T, undefined>>
|
|
46
49
|
|
|
47
50
|
/**
|
|
@@ -49,11 +52,11 @@ type QLExtensions_<T> = {
|
|
|
49
52
|
* The final result of each subquery will be the property itself:
|
|
50
53
|
* `Book.title` == `Subqueryable<Book>.title()`
|
|
51
54
|
*/
|
|
52
|
-
type Subqueryable<T> =
|
|
53
|
-
T extends Primitive ? {}
|
|
55
|
+
type Subqueryable<T> = T extends Primitive ? unknown
|
|
54
56
|
// composition of many/ association to many
|
|
55
|
-
: T extends readonly unknown[] ? {
|
|
56
|
-
|
|
57
|
+
: T extends readonly unknown[] ? {
|
|
58
|
+
|
|
59
|
+
/**
|
|
57
60
|
* @example
|
|
58
61
|
* ```js
|
|
59
62
|
* SELECT.from(Books, b => b.author)
|
|
@@ -68,11 +71,12 @@ T extends Primitive ? {}
|
|
|
68
71
|
*
|
|
69
72
|
* Note that you do not need to return anything from these subqueries.
|
|
70
73
|
*/
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
// composition of one/ association to one
|
|
74
|
-
: {
|
|
75
|
-
|
|
74
|
+
(fn: ((a: QLExtensions<T[number]>) => any) | '*'): T[number],
|
|
75
|
+
}
|
|
76
|
+
// composition of one/ association to one
|
|
77
|
+
: {
|
|
78
|
+
|
|
79
|
+
/**
|
|
76
80
|
* @example
|
|
77
81
|
* ```js
|
|
78
82
|
* SELECT.from(Books, b => b.author)
|
|
@@ -87,15 +91,14 @@ T extends Primitive ? {}
|
|
|
87
91
|
*
|
|
88
92
|
* Note that you do not need to return anything from these subqueries.
|
|
89
93
|
*/
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
;
|
|
94
|
+
(fn: ((a: QLExtensions<T>) => any) | '*'): T,
|
|
95
|
+
}
|
|
93
96
|
|
|
94
97
|
|
|
95
98
|
// Alias for projections
|
|
96
99
|
// https://cap.cloud.sap/docs/node.js/cds-ql?q=projection#projection-functions
|
|
97
|
-
//export type Projection<T> = (e:T)=>void
|
|
98
|
-
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
|
|
99
102
|
// Type for query pieces that can either be chained to build more complex queries or
|
|
100
103
|
// awaited to materialise the result:
|
|
101
104
|
// `Awaitable<SELECT<Book>, Book> = SELECT<Book> & Promise<Book>`
|
|
@@ -113,25 +116,33 @@ export type Awaitable<T, I> = T & Promise<I>
|
|
|
113
116
|
// all the functionality of an instance of SELECT, but directly callable:
|
|
114
117
|
// new SELECT(...).(...) == SELECT(...)
|
|
115
118
|
export type StaticSELECT<T> = typeof SELECT
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
|
122
125
|
|
|
123
126
|
declare class QL<T> {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
+
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
// used as a catch-all type for using tagged template strings: SELECT `foo`. from `bar` etc.
|
|
@@ -142,186 +153,243 @@ declare class QL<T> {
|
|
|
142
153
|
type TaggedTemplateQueryPart<T> = (strings: TemplateStringsArray, ...params: unknown[]) => T
|
|
143
154
|
|
|
144
155
|
export class SELECT<T> extends ConstructedQuery {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
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
|
|
181
205
|
// rightJoin (other: string, as: string) : this
|
|
182
206
|
// innerJoin (other: string, as: string) : this
|
|
183
207
|
// join (other: string, as: string, kind?: string) : this
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
+
|
|
194
219
|
}
|
|
195
220
|
|
|
196
221
|
|
|
197
222
|
type SELECT_one =
|
|
198
|
-
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
223
|
+
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
199
224
|
&
|
|
200
225
|
// calling with class
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
226
|
+
(<T extends ArrayConstructable<any>>
|
|
227
|
+
(entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
|
|
228
|
+
=> Awaitable<SELECT<SingularType<T>>, SingularType<T>>)
|
|
204
229
|
&
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
& ((entity: Definition | string, primaryKey
|
|
210
|
-
& ((entity: LinkedEntity | string, primaryKey
|
|
211
|
-
& (<T> (entity: T[], projection
|
|
212
|
-
& (<T> (entity: T[], primaryKey
|
|
213
|
-
& (<T> (entity: {new():T}, projection
|
|
214
|
-
& (<T> (entity: {new():T}, primaryKey
|
|
215
|
-
& ((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>)
|
|
216
241
|
|
|
217
242
|
type SELECT_from =
|
|
218
243
|
// tagged template
|
|
219
|
-
|
|
244
|
+
TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
|
|
220
245
|
&
|
|
221
246
|
// calling with class
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
247
|
+
(<T extends ArrayConstructable<any>>
|
|
248
|
+
(entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
|
|
249
|
+
=> Awaitable<SELECT<T>, InstanceType<T>>)
|
|
225
250
|
&
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
|
229
254
|
// calling with definition
|
|
230
|
-
& ((entity: Definition | string, primaryKey
|
|
231
|
-
& ((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>)
|
|
232
257
|
// calling with concrete list
|
|
233
|
-
& (<T> (entity: T[], projection
|
|
234
|
-
& (<T> (entity: T[], primaryKey
|
|
235
|
-
& ((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>)
|
|
236
261
|
|
|
237
262
|
export class INSERT<T> extends ConstructedQuery {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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
|
+
|
|
256
290
|
}
|
|
257
291
|
|
|
258
292
|
|
|
259
293
|
export class UPSERT<T> extends ConstructedQuery {
|
|
260
|
-
static into : (<T extends ArrayConstructable<any>> (entity:T, entries? : object | object[]) => UPSERT<SingularType<T>>)
|
|
261
|
-
& (TaggedTemplateQueryPart<UPSERT<unknown>>)
|
|
262
|
-
& ((entity : Definition | string, entries? : object | object[]) => UPSERT<any>)
|
|
263
|
-
& ((entity : LinkedEntity | string, entries? : object | object[]) => UPSERT<any>)
|
|
264
|
-
& (<T> (entity:Constructable<T>, entries? : object | object[]) => UPSERT<T>)
|
|
265
|
-
& (<T> (entity:T, entries? : T | object | object[]) => UPSERT<T>)
|
|
266
|
-
|
|
267
|
-
into: (<T extends ArrayConstructable> (entity:T) => this)
|
|
268
|
-
& TaggedTemplateQueryPart<this>
|
|
269
|
-
& ((entity : Definition | string) => this)
|
|
270
|
-
data (block : (e:T)=>void) : this
|
|
271
|
-
entries (...entries : object[]) : this
|
|
272
|
-
columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) : this
|
|
273
|
-
columns (...col: string[]) : this
|
|
274
|
-
values (... val: any[]) : this
|
|
275
|
-
rows (... row: any[]) : this
|
|
276
|
-
UPSERT : CQN.UPSERT["UPSERT"]
|
|
277
|
-
}
|
|
278
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
|
|
311
|
+
|
|
312
|
+
columns (...col: string[]): this
|
|
279
313
|
|
|
314
|
+
values (...val: any[]): this
|
|
280
315
|
|
|
316
|
+
rows (...row: any[]): this
|
|
317
|
+
UPSERT: CQN.UPSERT['UPSERT']
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
281
322
|
export class DELETE<T> extends ConstructedQuery {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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
|
+
|
|
293
341
|
}
|
|
294
342
|
|
|
343
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
295
344
|
export class UPDATE<T> extends ConstructedQuery {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
+
|
|
315
375
|
}
|
|
316
376
|
|
|
377
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
317
378
|
export class CREATE<T> extends ConstructedQuery {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
379
|
+
|
|
380
|
+
static entity (entity: Definition | string): CREATE<any>
|
|
381
|
+
|
|
382
|
+
static entity (entity: LinkedEntity | string): CREATE<any>
|
|
383
|
+
CREATE: CQN.CREATE['CREATE']
|
|
384
|
+
|
|
321
385
|
}
|
|
322
386
|
|
|
387
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
323
388
|
export class DROP<T> extends ConstructedQuery {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
389
|
+
|
|
390
|
+
static entity (entity: Definition | string): DROP<any>
|
|
391
|
+
|
|
392
|
+
static entity (entity: LinkedEntity | string): DROP<any>
|
|
393
|
+
DROP: CQN.DROP['DROP']
|
|
394
|
+
|
|
327
395
|
}
|