@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/apis/ql.d.ts CHANGED
@@ -1,19 +1,18 @@
1
- import { CSN, Definition, EntityElements } from "./csn"
2
- import * as CQN from "./cqn"
3
- import { Constructable, ArrayConstructable, SingularType } from "./internal/inference"
4
- import { LinkedEntity } from "./linked"
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
- export class cds_ql {
14
- ql:QL<any> & ((context:object) => QL<any>)
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
- [Key in keyof T]: QLExtensions<T[Key]>
29
+ [Key in keyof T]: QLExtensions<T[Key]>
31
30
  } & {
32
- /**
31
+
32
+ /**
33
33
  * Alias for this attribute.
34
34
  */
35
- as: (alias: string) => void
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
- get: (path: string) => any
44
+ get: (path: string) => any,
45
45
 
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.
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
- (fn: ((a:QLExtensions<T[number]>) => any) | '*'): T[number]
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
- (fn: ((a:QLExtensions<T>) => any) | '*'): T
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 ? SingularType<T> : T>)=>void
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
- & ((...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
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
- SELECT : StaticSELECT<T>
128
- INSERT : typeof INSERT
129
- & ((...entries:object[]) => INSERT<any>) & ((entries:object[]) => INSERT<any>)
130
- UPSERT: typeof UPSERT
131
- & ((...entries:object[]) => UPSERT<any>) & ((entries:object[]) => UPSERT<any>)
132
- UPDATE : typeof UPDATE
133
- & typeof UPDATE.entity
134
- DELETE : typeof DELETE
135
- & ((...entries:object[]) => DELETE<any>) & ((entries:object[]) => DELETE<any>)
136
- CREATE : typeof CREATE
137
- DROP : typeof DROP
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
- static one : SELECT_one & { from: SELECT_one }
149
- static distinct : typeof SELECT
150
- static from : SELECT_from
151
- from: SELECT_from & TaggedTemplateQueryPart<this>
152
- & ((entity: Definition | string, primaryKey? : PK, projection? : Projection<unknown>) => this)
153
- byKey (primaryKey? : PK) : this
154
- columns: TaggedTemplateQueryPart<this>
155
- & ((projection: Projection<T>) => this)
156
- & ((...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) => this)
157
- & ((...col:(string | column_expr)[]) => this)
158
- & ((col:(string | column_expr)[]) => this)
159
- where: TaggedTemplateQueryPart<this>
160
- & ((predicate:object) => this)
161
- & ((...expr : any[]) => this)
162
- and: TaggedTemplateQueryPart<this>
163
- & ((predicate:object) => this)
164
- & ((...expr : any[]) => this)
165
- having: TaggedTemplateQueryPart<this>
166
- & ((...expr : string[]) => this)
167
- & ((predicate:object) => this)
168
- groupBy: TaggedTemplateQueryPart<this>
169
- & ((...expr : string[]) => this)
170
- orderBy: TaggedTemplateQueryPart<this>
171
- & ((...expr : string[]) => this)
172
- limit: TaggedTemplateQueryPart<this>
173
- & ((rows : number, offset? : number) => this)
174
- forShareLock () : this
175
- forUpdate ({wait}? : {wait?: number}) : this
176
- alias (as: string) : this
177
-
178
- elements: EntityElements
179
-
180
-
181
- // Not yet public
182
- // fullJoin (other: string, as: string) : this
183
- // leftJoin (other: string, as: string) : this
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
- // on : TaggedTemplateQueryPart<this>
188
- // & ((...expr : string[]) => this)
189
- // & ((predicate:object) => this)
190
-
191
- SELECT : CQN.SELECT["SELECT"] & {
192
- forUpdate?: { wait: number }
193
- forShareLock?: { wait: number }
194
- search?: CQN.predicate
195
- count?: boolean
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
- (<T extends ArrayConstructable<any>>
205
- (entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
206
- => Awaitable<SELECT<SingularType<T>>, SingularType<T>>)
226
+ (<T extends ArrayConstructable<any>>
227
+ (entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
228
+ => Awaitable<SELECT<SingularType<T>>, SingularType<T>>)
207
229
  &
208
- (<T extends ArrayConstructable<any>>
209
- (entityType: T, primaryKey : PK, projection?: Projection<QLExtensions<SingularType<T>>>)
210
- => Awaitable<SELECT<SingularType<T>>, SingularType<T>>)
211
-
212
- & ((entity: Definition | string, primaryKey? : PK, projection? : Projection<unknown>) => SELECT<any>)
213
- & ((entity: LinkedEntity | string, primaryKey? : PK, projection? : Projection<unknown>) => SELECT<any>)
214
- & (<T> (entity: T[], projection? : Projection<T>) => Awaitable<SELECT<T>, T>)
215
- & (<T> (entity: T[], primaryKey : PK, projection? : Projection<T>) => Awaitable<SELECT<T>, T>)
216
- & (<T> (entity: {new():T}, projection? : Projection<T>) => Awaitable<SELECT<T>, T>)
217
- & (<T> (entity: {new():T}, primaryKey : PK, projection? : Projection<T>) => Awaitable<SELECT<T>, T>)
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
- TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
244
+ TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
223
245
  &
224
246
  // calling with class
225
- (<T extends ArrayConstructable<any>>
226
- (entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
227
- => Awaitable<SELECT<T>, InstanceType<T>>)
247
+ (<T extends ArrayConstructable<any>>
248
+ (entityType: T, projection?: Projection<QLExtensions<SingularType<T>>>)
249
+ => Awaitable<SELECT<T>, InstanceType<T>>)
228
250
  &
229
- (<T extends ArrayConstructable<any>>
230
- (entityType: T, primaryKey : PK, projection?: Projection<SingularType<T>>)
231
- => Awaitable<SELECT<SingularType<T>>, InstanceType<SingularType<T>>>) // when specifying a key, we expect a single element as result
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? : PK, projection? : Projection<unknown>) => SELECT<any>)
234
- & ((entity: LinkedEntity | string, primaryKey? : PK, projection? : Projection<unknown>) => SELECT<any>)
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? : Projection<T>) => SELECT<T> & Promise<T[]>)
237
- & (<T> (entity: T[], primaryKey : PK, projection? : Projection<T>) => Awaitable<SELECT<T>, T>)
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
- static into : (<T extends ArrayConstructable<any>> (entity:T, entries? : object | object[]) => INSERT<SingularType<T>>)
242
- & (TaggedTemplateQueryPart<INSERT<unknown>>)
243
- & ((entity : Definition | string, entries? : object | object[]) => INSERT<any>)
244
- & ((entity : LinkedEntity | string, entries? : object | object[]) => INSERT<any>)
245
- & (<T> (entity:Constructable<T>, entries? : object | object[]) => INSERT<T>)
246
- & (<T> (entity:T, entries? : T | object | object[]) => INSERT<T>)
247
-
248
- into: (<T extends ArrayConstructable> (entity:T) => this)
249
- & TaggedTemplateQueryPart<this>
250
- & ((entity : Definition | string) => this)
251
- data (block : (e:T)=>void) : this
252
- entries (...entries : object[]) : this
253
- columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) : this
254
- columns (...col: string[]) : this
255
- values (... val: any[]) : this
256
- rows (... row: any[]) : this
257
- as (select: SELECT<T>): this
258
- INSERT : CQN.INSERT["INSERT"]
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
- static from:
286
- TaggedTemplateQueryPart<Awaitable<SELECT<unknown>, InstanceType<any>>>
287
- & ((entity : Definition | string | ArrayConstructable, primaryKey? : PK) => DELETE<any>)
288
- & ((entity : LinkedEntity | string | ArrayConstructable, primaryKey? : PK) => DELETE<any>)
289
- & ((subject: ref) => DELETE<any>)
290
- byKey (primaryKey? : PK) : this
291
- where (predicate:object) : this
292
- where (...expr : any[]) : this
293
- and (predicate:object) : this
294
- and (...expr : any[]) : this
295
- DELETE : CQN.DELETE["DELETE"]
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
- // cds-typer plural
300
- static entity <T extends ArrayConstructable<any>> (entity:T, primaryKey? : PK) : UPDATE<SingularType<T>>
301
-
302
- static entity (entity : Definition | string, primaryKey? : PK) : UPDATE<any>
303
- static entity (entity : LinkedEntity | string, primaryKey? : PK) : UPDATE<any>
304
- static entity <T> (entity:Constructable<T>, primaryKey? : PK) : UPDATE<T>
305
- static entity <T> (entity:T, primaryKey? : PK) : UPDATE<T>
306
- byKey (primaryKey? : PK) : this
307
- // with (block: (e:T)=>void) : this
308
- // set (block: (e:T)=>void) : this
309
- set: TaggedTemplateQueryPart<this>
310
- & ((data:object) => this)
311
- with: TaggedTemplateQueryPart<this>
312
- & ((data:object) => this)
313
- where (predicate:object) : this
314
- where (...expr : any[]) : this
315
- and (predicate:object) : this
316
- and (...expr : any[]) : this
317
- UPDATE : CQN.UPDATE["UPDATE"]
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
- static entity (entity : Definition | string) : CREATE<any>
322
- static entity (entity : LinkedEntity | string) : CREATE<any>
323
- CREATE : CQN.CREATE["CREATE"]
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
- static entity (entity : Definition | string) : DROP<any>
328
- static entity (entity : LinkedEntity | string) : DROP<any>
329
- DROP : CQN.DROP["DROP"]
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
  }