@cap-js/cds-types 0.4.0 → 0.6.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/dist/cds-types.d.ts +612 -518
- package/package.json +6 -3
- package/scripts/postinstall.js +14 -0
package/dist/cds-types.d.ts
CHANGED
|
@@ -1,23 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
export
|
|
1
|
+
declare module '@sap/cds' {
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export type __any_ = classes.any_
|
|
5
|
+
|
|
6
|
+
export type __array = classes.array
|
|
7
|
+
|
|
8
|
+
export type __aspect = classes.aspect
|
|
9
|
+
|
|
10
|
+
export type __Association = classes.Association
|
|
11
|
+
|
|
12
|
+
export type __Binary = classes.Binary
|
|
13
|
+
|
|
14
|
+
export type __Boolean = classes.Boolean
|
|
15
|
+
|
|
16
|
+
export type __Composition = classes.Composition
|
|
17
|
+
|
|
18
|
+
export type __context_ = classes.context_
|
|
19
|
+
|
|
20
|
+
export type __Date = classes.Date
|
|
21
|
+
|
|
22
|
+
export type __date = classes.date
|
|
23
|
+
|
|
24
|
+
export type __DateTime = classes.DateTime
|
|
25
|
+
|
|
26
|
+
export type __Decimal = classes.Decimal
|
|
27
|
+
|
|
28
|
+
export type __Double = classes.Double
|
|
29
|
+
|
|
30
|
+
export type __entity = classes.entity
|
|
31
|
+
|
|
32
|
+
export type __Float = classes.Float
|
|
33
|
+
|
|
34
|
+
export type __Int16 = classes.Int16
|
|
35
|
+
|
|
36
|
+
export type __Int32 = classes.Int32
|
|
37
|
+
|
|
38
|
+
export type __Int64 = classes.Int64
|
|
39
|
+
|
|
40
|
+
export type __Integer = classes.Integer
|
|
41
|
+
|
|
42
|
+
export type __LargeBinary = classes.LargeBinary
|
|
43
|
+
|
|
44
|
+
export type __LargeString = classes.LargeString
|
|
45
|
+
|
|
46
|
+
export type __scalar = classes.scalar
|
|
47
|
+
|
|
48
|
+
export type __service = classes.service_
|
|
49
|
+
|
|
50
|
+
export type __String = classes.String
|
|
51
|
+
|
|
52
|
+
export type __struct = classes.struct
|
|
53
|
+
|
|
54
|
+
export type __Time = classes.Time
|
|
55
|
+
|
|
56
|
+
export type __TimeStamp = classes.TimeStamp
|
|
57
|
+
|
|
58
|
+
export type __type = classes.type
|
|
59
|
+
|
|
60
|
+
export type __UInt8 = classes.UInt8
|
|
61
|
+
|
|
62
|
+
export type __UUID = classes.UUID
|
|
63
|
+
|
|
64
|
+
export type __Vector = classes.Vector
|
|
65
|
+
|
|
66
|
+
class action extends any_<'action' | 'function'> {}
|
|
67
|
+
|
|
68
|
+
export interface ActionEventHandler<P, R> {
|
|
13
69
|
(req: Omit<Request_2, 'data'> & { data: P }, next: Function): Promise<R> | R
|
|
14
70
|
}
|
|
15
71
|
|
|
16
|
-
|
|
72
|
+
const any: typeof any_;
|
|
17
73
|
|
|
18
|
-
|
|
74
|
+
interface any_ extends csn.any_ {}
|
|
19
75
|
|
|
20
|
-
|
|
76
|
+
class any_<K extends kinds = kinds> {
|
|
21
77
|
private _: K // break covariance
|
|
22
78
|
constructor (...aspects: any[])
|
|
23
79
|
|
|
@@ -26,15 +82,15 @@ export declare class any_<K extends kinds = kinds> {
|
|
|
26
82
|
// is (kind: kinds | 'Association' | 'Composition'): boolean
|
|
27
83
|
}
|
|
28
84
|
|
|
29
|
-
|
|
85
|
+
interface any__2 {
|
|
30
86
|
kind?: kinds
|
|
31
87
|
}
|
|
32
88
|
|
|
33
|
-
export
|
|
89
|
+
export class ApplicationService extends Service {}
|
|
34
90
|
|
|
35
|
-
export
|
|
91
|
+
export class array extends type<'type' | 'elements'> { }
|
|
36
92
|
|
|
37
|
-
|
|
93
|
+
interface ArrayConstructable<T = any> {
|
|
38
94
|
new(...args: any[]): T[]
|
|
39
95
|
}
|
|
40
96
|
|
|
@@ -44,7 +100,7 @@ declare interface ArrayConstructable<T = any> {
|
|
|
44
100
|
* @internal
|
|
45
101
|
* @since cds 7.9
|
|
46
102
|
*/
|
|
47
|
-
|
|
103
|
+
type _ArrayLike<T> = Iterable<T> & {
|
|
48
104
|
forEach: (handler: (element: T) => any) => void,
|
|
49
105
|
filter: (predicate: (element: T) => boolean) => Array<T>,
|
|
50
106
|
map: <R>(converter: (element: T) => R) => Array<R>,
|
|
@@ -52,16 +108,16 @@ declare type _ArrayLike<T> = Iterable<T> & {
|
|
|
52
108
|
find: (predicate: (element: T) => boolean) => T | undefined,
|
|
53
109
|
}
|
|
54
110
|
|
|
55
|
-
|
|
111
|
+
class aspect<K extends kinds = 'aspect'> extends type<K> implements WithElements {
|
|
56
112
|
elements: Definitions<type<'type'>>
|
|
57
113
|
}
|
|
58
114
|
|
|
59
115
|
/**
|
|
60
116
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-association)
|
|
61
117
|
*/
|
|
62
|
-
export
|
|
118
|
+
export interface Association extends Omit<csn.Association, 'type' | 'items'> {}
|
|
63
119
|
|
|
64
|
-
export
|
|
120
|
+
export class Association extends type {
|
|
65
121
|
_target: entity
|
|
66
122
|
|
|
67
123
|
isAssociation: true
|
|
@@ -72,7 +128,7 @@ export declare class Association extends type {
|
|
|
72
128
|
|
|
73
129
|
}
|
|
74
130
|
|
|
75
|
-
|
|
131
|
+
interface Association_2 extends type_2 {
|
|
76
132
|
type: 'cds.Association' | 'cds.Composition'
|
|
77
133
|
target: FQN
|
|
78
134
|
|
|
@@ -92,22 +148,22 @@ declare interface Association_2 extends type_2 {
|
|
|
92
148
|
keys?: (ref & { as: string })[]
|
|
93
149
|
}
|
|
94
150
|
|
|
95
|
-
|
|
151
|
+
type Awaitable<T, I> = T & Promise<I>
|
|
96
152
|
|
|
97
|
-
|
|
153
|
+
class Axios {
|
|
98
154
|
|
|
99
|
-
get axios (): AxiosInstance
|
|
100
|
-
get: AxiosInstance['get'];
|
|
155
|
+
get axios (): import('axios').AxiosInstance
|
|
156
|
+
get: import('axios').AxiosInstance['get'];
|
|
101
157
|
|
|
102
|
-
put: AxiosInstance['put']
|
|
158
|
+
put: import('axios').AxiosInstance['put']
|
|
103
159
|
|
|
104
|
-
post: AxiosInstance['post']
|
|
160
|
+
post: import('axios').AxiosInstance['post']
|
|
105
161
|
|
|
106
|
-
patch: AxiosInstance['patch']
|
|
162
|
+
patch: import('axios').AxiosInstance['patch']
|
|
107
163
|
|
|
108
|
-
delete: AxiosInstance['delete']
|
|
164
|
+
delete: import('axios').AxiosInstance['delete']
|
|
109
165
|
|
|
110
|
-
options: AxiosInstance['options']
|
|
166
|
+
options: import('axios').AxiosInstance['options']
|
|
111
167
|
|
|
112
168
|
get GET (): Axios['get']
|
|
113
169
|
|
|
@@ -123,16 +179,15 @@ declare class Axios {
|
|
|
123
179
|
|
|
124
180
|
}
|
|
125
181
|
|
|
126
|
-
|
|
182
|
+
class Binary extends string { }
|
|
127
183
|
|
|
128
|
-
|
|
184
|
+
const boolean: typeof boolean_;
|
|
129
185
|
|
|
130
|
-
|
|
186
|
+
class boolean_ extends scalar { }
|
|
131
187
|
|
|
132
|
-
|
|
133
|
-
export { Boolean_2 as Boolean }
|
|
188
|
+
class Boolean_2 extends boolean { }
|
|
134
189
|
|
|
135
|
-
export
|
|
190
|
+
export const builtin: {
|
|
136
191
|
|
|
137
192
|
/**
|
|
138
193
|
* @see {@link models.linked.classes}
|
|
@@ -141,9 +196,9 @@ export declare const builtin: {
|
|
|
141
196
|
types: Record<string, object>, // FIXME: value should be any class part of linked.classes
|
|
142
197
|
};
|
|
143
198
|
|
|
144
|
-
export
|
|
199
|
+
export type CDL = string
|
|
145
200
|
|
|
146
|
-
|
|
201
|
+
namespace cds {
|
|
147
202
|
export {
|
|
148
203
|
log,
|
|
149
204
|
debug,
|
|
@@ -201,6 +256,37 @@ declare namespace cds {
|
|
|
201
256
|
model,
|
|
202
257
|
parse,
|
|
203
258
|
linked,
|
|
259
|
+
__type,
|
|
260
|
+
__aspect,
|
|
261
|
+
__any_,
|
|
262
|
+
__scalar,
|
|
263
|
+
__Boolean,
|
|
264
|
+
__UUID,
|
|
265
|
+
__String,
|
|
266
|
+
__LargeString,
|
|
267
|
+
__Binary,
|
|
268
|
+
__LargeBinary,
|
|
269
|
+
__Vector,
|
|
270
|
+
__Integer,
|
|
271
|
+
__UInt8,
|
|
272
|
+
__Int16,
|
|
273
|
+
__Int32,
|
|
274
|
+
__Int64,
|
|
275
|
+
__Float,
|
|
276
|
+
__Double,
|
|
277
|
+
__Decimal,
|
|
278
|
+
__date,
|
|
279
|
+
__Date,
|
|
280
|
+
__Time,
|
|
281
|
+
__DateTime,
|
|
282
|
+
__TimeStamp,
|
|
283
|
+
__array,
|
|
284
|
+
__struct,
|
|
285
|
+
__context_,
|
|
286
|
+
__service,
|
|
287
|
+
__entity,
|
|
288
|
+
__Association,
|
|
289
|
+
__Composition,
|
|
204
290
|
compile,
|
|
205
291
|
spawn,
|
|
206
292
|
Key,
|
|
@@ -270,10 +356,41 @@ declare namespace cds {
|
|
|
270
356
|
operator,
|
|
271
357
|
function_call,
|
|
272
358
|
enum_literal,
|
|
273
|
-
expr_literal
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
359
|
+
expr_literal
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export type _cds = typeof cds
|
|
364
|
+
|
|
365
|
+
type _cds_2 = typeof cds
|
|
366
|
+
|
|
367
|
+
export interface cds_connect_options {
|
|
368
|
+
impl?: string
|
|
369
|
+
service?: string
|
|
370
|
+
kind?: string
|
|
371
|
+
model?: string
|
|
372
|
+
credentials?: object
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export interface cds_serve_fluent {
|
|
376
|
+
from (model: string | CSN): cds_serve_fluent
|
|
377
|
+
to (protocol: string): cds_serve_fluent
|
|
378
|
+
at (path: string): cds_serve_fluent
|
|
379
|
+
in (app: import('express').Application): cds_serve_fluent
|
|
380
|
+
with (impl: ServiceImpl | string): cds_serve_fluent
|
|
381
|
+
// (req,res) : void
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export type cds_services = { [name: string]: Service }
|
|
385
|
+
|
|
386
|
+
export type CdsFunction = {
|
|
387
|
+
(...args: any[]): any,
|
|
388
|
+
__parameters: object,
|
|
389
|
+
__returns: any,
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
namespace classes {
|
|
393
|
+
export {
|
|
277
394
|
mixin,
|
|
278
395
|
Protocol,
|
|
279
396
|
Column,
|
|
@@ -282,6 +399,7 @@ declare namespace cds {
|
|
|
282
399
|
any_,
|
|
283
400
|
any,
|
|
284
401
|
aspect,
|
|
402
|
+
type,
|
|
285
403
|
scalar,
|
|
286
404
|
boolean,
|
|
287
405
|
Boolean_2 as Boolean,
|
|
@@ -306,52 +424,29 @@ declare namespace cds {
|
|
|
306
424
|
Time,
|
|
307
425
|
DateTime,
|
|
308
426
|
TimeStamp,
|
|
427
|
+
array,
|
|
428
|
+
struct,
|
|
309
429
|
context_,
|
|
310
430
|
service_,
|
|
311
431
|
action,
|
|
432
|
+
event,
|
|
433
|
+
entity,
|
|
434
|
+
Association,
|
|
435
|
+
Composition,
|
|
312
436
|
ManagedAssociation,
|
|
313
437
|
MixedIn
|
|
314
438
|
}
|
|
315
439
|
}
|
|
316
440
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
declare type _cds_2 = typeof cds
|
|
320
|
-
|
|
321
|
-
export declare interface cds_connect_options {
|
|
322
|
-
impl?: string
|
|
323
|
-
service?: string
|
|
324
|
-
kind?: string
|
|
325
|
-
model?: string
|
|
326
|
-
credentials?: object
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export declare interface cds_serve_fluent {
|
|
330
|
-
from (model: string | CSN_2): cds_serve_fluent
|
|
331
|
-
to (protocol: string): cds_serve_fluent
|
|
332
|
-
at (path: string): cds_serve_fluent
|
|
333
|
-
in (app: Application): cds_serve_fluent
|
|
334
|
-
with (impl: ServiceImpl | string): cds_serve_fluent
|
|
335
|
-
// (req,res) : void
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export declare type cds_services = { [name: string]: Service }
|
|
339
|
-
|
|
340
|
-
export declare type CdsFunction = {
|
|
341
|
-
(...args: any[]): any,
|
|
342
|
-
__parameters: object,
|
|
343
|
-
__returns: any,
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
export declare type Column = { ref: [string], as?: string }
|
|
441
|
+
type Column = { ref: [string], as?: string }
|
|
347
442
|
|
|
348
|
-
export
|
|
443
|
+
export type column_expr = UnionToIntersection<expr> & { as?: name, cast?: any, expand?: column_expr[], inline?: column_expr[] }
|
|
349
444
|
|
|
350
445
|
/**
|
|
351
446
|
* Provides a set of methods to parse a given model, query or expression.
|
|
352
447
|
* You can also use `cds.compile(csn).to('<output>')` as a fluent variant.
|
|
353
448
|
*/
|
|
354
|
-
export
|
|
449
|
+
export const compile: {
|
|
355
450
|
|
|
356
451
|
/** Shortcut for `cds.compile.to.csn()` */
|
|
357
452
|
cdl (model: CDL, o?: _options): csn.CSN,
|
|
@@ -433,11 +528,11 @@ export declare const compile: {
|
|
|
433
528
|
},
|
|
434
529
|
};
|
|
435
530
|
|
|
436
|
-
export
|
|
531
|
+
export class Composition extends Association {
|
|
437
532
|
isComposition: true
|
|
438
533
|
}
|
|
439
534
|
|
|
440
|
-
export
|
|
535
|
+
export const connect: {
|
|
441
536
|
|
|
442
537
|
/**
|
|
443
538
|
* Connects to a specific datasource.
|
|
@@ -459,11 +554,11 @@ export declare const connect: {
|
|
|
459
554
|
(options?: string | cds_connect_options): Promise<_cds>, // > cds.connect(<options>)
|
|
460
555
|
};
|
|
461
556
|
|
|
462
|
-
|
|
557
|
+
interface Constructable<T = any> {
|
|
463
558
|
new(...args: any[]): T
|
|
464
559
|
}
|
|
465
560
|
|
|
466
|
-
|
|
561
|
+
class ConstructedQuery {
|
|
467
562
|
|
|
468
563
|
then (_resolved: (x: any) => any, _rejected: (e: Error) => any): any
|
|
469
564
|
|
|
@@ -472,15 +567,15 @@ declare class ConstructedQuery {
|
|
|
472
567
|
/**
|
|
473
568
|
* @see [docs](https://cap.cloud.sap/docs/node.js/cds-tx#event-contexts
|
|
474
569
|
*/
|
|
475
|
-
export
|
|
570
|
+
export let context: EventContext | undefined;
|
|
476
571
|
|
|
477
|
-
|
|
572
|
+
interface context_ extends csn.context {}
|
|
478
573
|
|
|
479
|
-
|
|
574
|
+
class context_ extends any_ { }
|
|
480
575
|
|
|
481
|
-
|
|
576
|
+
interface context_2 extends any__2 { }
|
|
482
577
|
|
|
483
|
-
|
|
578
|
+
namespace CQN {
|
|
484
579
|
export {
|
|
485
580
|
Query,
|
|
486
581
|
SELECT_2 as SELECT,
|
|
@@ -509,15 +604,15 @@ declare namespace CQN {
|
|
|
509
604
|
}
|
|
510
605
|
}
|
|
511
606
|
|
|
512
|
-
export
|
|
607
|
+
export const create: Service['create'];
|
|
513
608
|
|
|
514
|
-
|
|
609
|
+
type CREATE_2 = { CREATE: {
|
|
515
610
|
entity: entity_2 | name,
|
|
516
611
|
as: SELECT_2,
|
|
517
612
|
}, }
|
|
518
613
|
export { CREATE_2 as CREATE }
|
|
519
614
|
|
|
520
|
-
|
|
615
|
+
class CREATE_3<T> extends ConstructedQuery {
|
|
521
616
|
|
|
522
617
|
static entity (entity: Target): CREATE_3<any>
|
|
523
618
|
|
|
@@ -525,116 +620,16 @@ declare class CREATE_3<T> extends ConstructedQuery {
|
|
|
525
620
|
|
|
526
621
|
}
|
|
527
622
|
|
|
528
|
-
export
|
|
623
|
+
export namespace CRUDEventHandler {
|
|
529
624
|
export type Before<P, R = P | void | Error> = (req: TypedRequest<P>) => Promise<R> | R
|
|
530
625
|
export type On<P, R = P | void | Error> = (req: TypedRequest<P>, next: (...args: any[]) => Promise<R> | R) => Promise<R> | R
|
|
531
626
|
export type After<P, R = P | void | Error> = (data: undefined | P, req: TypedRequest<P>) => Promise<R> | R
|
|
532
627
|
}
|
|
533
628
|
|
|
534
|
-
export declare interface CSN extends Omit<csn.CSN, 'definitions'> {
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Fetches definitions matching the given filter, returning an iterator on them.
|
|
538
|
-
* @example
|
|
539
|
-
* ```js
|
|
540
|
-
* let m = cds.reflect (aParsedModel)
|
|
541
|
-
* for (let d of m.each('entity')) console.log (d.kind, d.name)
|
|
542
|
-
* let entities = [...m.each('entity')] //> capture all
|
|
543
|
-
* let entities = m.all('entity') //> equivalent shortcut
|
|
544
|
-
* ```
|
|
545
|
-
*/
|
|
546
|
-
each<T extends any_>(x: Filter, defs?: Definitions<T>): IterableIterator<T>
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* Fetches definitions matching the given filter, returning them in an array.
|
|
550
|
-
* Convenience shortcut for `[...reflect.each('entity')]`
|
|
551
|
-
*/
|
|
552
|
-
all<T extends any_>(x: Filter, defs?: Definitions<T>): T[]
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Fetches definitions matching the given filter, returning the first match, if any.
|
|
556
|
-
* @example
|
|
557
|
-
* let service = model.find('service')
|
|
558
|
-
* @param x - the filter
|
|
559
|
-
* @param defs - the definitions to fetch in, default: `this.definitions`
|
|
560
|
-
*/
|
|
561
|
-
find<T extends any_>(x: Filter, defs?: Definitions<T>): T | undefined
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Calls the visitor for each definition matching the given filter.
|
|
565
|
-
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#foreach)
|
|
566
|
-
*/
|
|
567
|
-
foreach(x: Filter, visitor: Visitor, defs?: Definitions): this
|
|
568
|
-
foreach(visitor: Visitor, defs?: Definitions): this
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
* Same as foreach but recursively visits each element definition
|
|
572
|
-
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#foreach)
|
|
573
|
-
*/
|
|
574
|
-
forall(x: Filter, visitor: Visitor, defs?: Definitions): this
|
|
575
|
-
forall(visitor: Visitor, defs?: Definitions): this
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Fetches definitions declared as children of a given parent context or service.
|
|
579
|
-
* It fetches all definitions whose fully-qualified names start with the parent's name.
|
|
580
|
-
* Returns the found definitions as an object with the local names as keys.
|
|
581
|
-
* @example
|
|
582
|
-
* ```js
|
|
583
|
-
* let service = model.find ('service')
|
|
584
|
-
* let entities = m.childrenOf (service)
|
|
585
|
-
* ```
|
|
586
|
-
* @param parent - either the parent itself or its fully-qualified name
|
|
587
|
-
* @param filter - an optional filter to apply before picking a child
|
|
588
|
-
*/
|
|
589
|
-
childrenOf(parent: any | string, filter?: ((def: any_) => boolean)): Definitions
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Provides convenient access to the model's top-level definitions.
|
|
593
|
-
* For example, you can use it in an es6-import-like fashion to avoid
|
|
594
|
-
* working with fully-qualified names as follows:
|
|
595
|
-
*
|
|
596
|
-
* @example
|
|
597
|
-
* ```js
|
|
598
|
-
* let model = cds.reflect (cds.parse(`
|
|
599
|
-
* namespace our.lovely.bookshop;
|
|
600
|
-
* entity Books {...}
|
|
601
|
-
* entity Authors {...}
|
|
602
|
-
* `))
|
|
603
|
-
* const {Books,Authors} = model.exports
|
|
604
|
-
* SELECT.from (Books) .where ({ID:11})
|
|
605
|
-
* ```
|
|
606
|
-
*/
|
|
607
|
-
exports: IterableMap<any_>
|
|
608
|
-
definitions: IterableMap<any_>
|
|
609
|
-
entities: ModelPart<entity>
|
|
610
|
-
services: ModelPart<service_>
|
|
611
|
-
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
declare namespace csn {
|
|
615
|
-
export {
|
|
616
|
-
CSN_2 as CSN,
|
|
617
|
-
FQN,
|
|
618
|
-
Definition_2 as Definition,
|
|
619
|
-
Extension,
|
|
620
|
-
Element,
|
|
621
|
-
kinds,
|
|
622
|
-
any__2 as any_,
|
|
623
|
-
context_2 as context,
|
|
624
|
-
service_2 as service,
|
|
625
|
-
type_2 as type,
|
|
626
|
-
struct_2 as struct,
|
|
627
|
-
entity_2 as entity,
|
|
628
|
-
EntityElements,
|
|
629
|
-
Association_2 as Association
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
export { csn }
|
|
633
|
-
|
|
634
629
|
/**
|
|
635
630
|
* A parsed CDS model in CSN object notation.
|
|
636
631
|
*/
|
|
637
|
-
|
|
632
|
+
interface CSN {
|
|
638
633
|
|
|
639
634
|
/**
|
|
640
635
|
* The assigned namespace. If parsed from multiple sources,
|
|
@@ -652,7 +647,7 @@ declare interface CSN_2 {
|
|
|
652
647
|
/**
|
|
653
648
|
* All definitions in the model including those from imported models.
|
|
654
649
|
*/
|
|
655
|
-
definitions?: Record<FQN,
|
|
650
|
+
definitions?: Record<FQN, Definition>
|
|
656
651
|
|
|
657
652
|
/**
|
|
658
653
|
* All extensions in the model including those from imported models.
|
|
@@ -666,17 +661,37 @@ declare interface CSN_2 {
|
|
|
666
661
|
$sources?: string[]
|
|
667
662
|
}
|
|
668
663
|
|
|
664
|
+
namespace csn {
|
|
665
|
+
export {
|
|
666
|
+
CSN,
|
|
667
|
+
FQN,
|
|
668
|
+
Definition,
|
|
669
|
+
Extension,
|
|
670
|
+
Element,
|
|
671
|
+
kinds,
|
|
672
|
+
any__2 as any_,
|
|
673
|
+
context_2 as context,
|
|
674
|
+
service_2 as service,
|
|
675
|
+
type_2 as type,
|
|
676
|
+
struct_2 as struct,
|
|
677
|
+
entity_2 as entity,
|
|
678
|
+
EntityElements,
|
|
679
|
+
Association_2 as Association
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
export { csn }
|
|
683
|
+
|
|
669
684
|
/** @private */
|
|
670
|
-
export
|
|
685
|
+
export type data = Record<string, any>
|
|
671
686
|
|
|
672
|
-
export
|
|
687
|
+
export class DatabaseService extends Service {
|
|
673
688
|
deploy (model?: csn.CSN | string): Promise<csn.CSN>
|
|
674
689
|
begin (): Promise<void>
|
|
675
690
|
commit (): Promise<void>
|
|
676
691
|
rollback (): Promise<void>
|
|
677
692
|
}
|
|
678
693
|
|
|
679
|
-
|
|
694
|
+
class DataUtil {
|
|
680
695
|
|
|
681
696
|
delete (db?: Service): Promise<void>
|
|
682
697
|
|
|
@@ -689,14 +704,13 @@ declare class DataUtil {
|
|
|
689
704
|
|
|
690
705
|
}
|
|
691
706
|
|
|
692
|
-
|
|
707
|
+
class date extends scalar { }
|
|
693
708
|
|
|
694
|
-
|
|
695
|
-
export { Date_2 as Date }
|
|
709
|
+
class Date_2 extends date { }
|
|
696
710
|
|
|
697
|
-
|
|
711
|
+
class DateTime extends date { }
|
|
698
712
|
|
|
699
|
-
export
|
|
713
|
+
export const db: DatabaseService;
|
|
700
714
|
|
|
701
715
|
/**
|
|
702
716
|
* Shortcut to `cds.log(...).debug`, returning `undefined` if `cds.log(...)._debug` is `false`.
|
|
@@ -710,32 +724,32 @@ export declare const db: DatabaseService;
|
|
|
710
724
|
*
|
|
711
725
|
* @param name - logger name
|
|
712
726
|
*/
|
|
713
|
-
export
|
|
714
|
-
|
|
715
|
-
export declare class Decimal extends Float { }
|
|
727
|
+
export function debug (name: string): undefined | Log
|
|
716
728
|
|
|
717
|
-
|
|
729
|
+
class Decimal extends Float { }
|
|
718
730
|
|
|
719
731
|
/**
|
|
720
732
|
* Definitions are the central elements of a CDS model.
|
|
721
733
|
*/
|
|
722
|
-
|
|
734
|
+
type Definition = context_2 & service_2 & type_2 & struct_2 & entity_2 & Association_2
|
|
735
|
+
|
|
736
|
+
type Definition_2 = any_
|
|
723
737
|
|
|
724
738
|
/**
|
|
725
739
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#iterable)
|
|
726
740
|
*/
|
|
727
|
-
|
|
741
|
+
type Definitions<T extends any_ = any_> = IterableMap<T>
|
|
728
742
|
|
|
729
|
-
|
|
743
|
+
const delete_: Service['delete'];
|
|
730
744
|
export { delete_ as delete };
|
|
731
745
|
|
|
732
|
-
|
|
746
|
+
type DELETE_2 = { DELETE: {
|
|
733
747
|
from: ref | name,
|
|
734
748
|
where?: predicate,
|
|
735
749
|
}, }
|
|
736
750
|
export { DELETE_2 as DELETE }
|
|
737
751
|
|
|
738
|
-
|
|
752
|
+
class DELETE_3<T> extends ConstructedQuery {
|
|
739
753
|
|
|
740
754
|
static from:
|
|
741
755
|
TaggedTemplateQueryPart<Awaitable<SELECT_3<unknown>, InstanceType<any>>>
|
|
@@ -755,16 +769,16 @@ declare class DELETE_3<T> extends ConstructedQuery {
|
|
|
755
769
|
|
|
756
770
|
}
|
|
757
771
|
|
|
758
|
-
|
|
772
|
+
class Double extends Float { }
|
|
759
773
|
|
|
760
|
-
|
|
774
|
+
type DROP_2 = { DROP: {
|
|
761
775
|
entity: name,
|
|
762
776
|
table: ref,
|
|
763
777
|
view: ref,
|
|
764
778
|
}, }
|
|
765
779
|
export { DROP_2 as DROP }
|
|
766
780
|
|
|
767
|
-
|
|
781
|
+
class DROP_3<T> extends ConstructedQuery {
|
|
768
782
|
|
|
769
783
|
static entity (entity: Target): DROP_3<any>
|
|
770
784
|
|
|
@@ -772,20 +786,20 @@ declare class DROP_3<T> extends ConstructedQuery {
|
|
|
772
786
|
|
|
773
787
|
}
|
|
774
788
|
|
|
775
|
-
export
|
|
789
|
+
export type EDM = { $version: string }
|
|
776
790
|
|
|
777
|
-
export
|
|
791
|
+
export type EDMX = XML
|
|
778
792
|
|
|
779
|
-
|
|
793
|
+
type Element = type_2 & struct_2 & Association_2
|
|
780
794
|
|
|
781
|
-
export
|
|
795
|
+
export const entities: Service['entities'];
|
|
782
796
|
|
|
783
797
|
/**
|
|
784
798
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-entity)
|
|
785
799
|
*/
|
|
786
|
-
export
|
|
800
|
+
export interface entity extends Omit<csn.entity, 'elements' | 'items' | 'keys' | 'drafts'> {}
|
|
787
801
|
|
|
788
|
-
export
|
|
802
|
+
export class entity extends struct<'entity'> {
|
|
789
803
|
is_entity: true
|
|
790
804
|
|
|
791
805
|
keys: Definitions<type>
|
|
@@ -801,7 +815,7 @@ export declare class entity extends struct<'entity'> {
|
|
|
801
815
|
drafts?: entity
|
|
802
816
|
}
|
|
803
817
|
|
|
804
|
-
|
|
818
|
+
interface entity_2 extends Omit<struct_2, 'elements'> {
|
|
805
819
|
|
|
806
820
|
/**
|
|
807
821
|
* Entities with a query signify a view
|
|
@@ -813,11 +827,11 @@ declare interface entity_2 extends Omit<struct_2, 'elements'> {
|
|
|
813
827
|
*/
|
|
814
828
|
elements: EntityElements
|
|
815
829
|
// REVISIT: following should move to LinkedCSN
|
|
816
|
-
keys: { [name: string]:
|
|
830
|
+
keys: { [name: string]: Definition }
|
|
817
831
|
drafts?: entity_2
|
|
818
832
|
}
|
|
819
833
|
|
|
820
|
-
|
|
834
|
+
type EntityElements = {
|
|
821
835
|
[name: string]: Element & {
|
|
822
836
|
key?: boolean,
|
|
823
837
|
virtual?: boolean,
|
|
@@ -826,7 +840,7 @@ declare type EntityElements = {
|
|
|
826
840
|
},
|
|
827
841
|
}
|
|
828
842
|
|
|
829
|
-
export
|
|
843
|
+
export type enum_literal = { '#': string }
|
|
830
844
|
|
|
831
845
|
/**
|
|
832
846
|
* Access to the configuration for Node.js runtime and tools.
|
|
@@ -834,7 +848,7 @@ export declare type enum_literal = { '#': string }
|
|
|
834
848
|
* filtered through the currently active profiles, thus highly dependent on the current working
|
|
835
849
|
* directory and process environment.
|
|
836
850
|
*/
|
|
837
|
-
export
|
|
851
|
+
export const env: {
|
|
838
852
|
build: _TODO,
|
|
839
853
|
hana: _TODO,
|
|
840
854
|
i18n: {
|
|
@@ -856,7 +870,7 @@ export declare const env: {
|
|
|
856
870
|
sql: _TODO,
|
|
857
871
|
} & { [key: string]: any };
|
|
858
872
|
|
|
859
|
-
export
|
|
873
|
+
export namespace env {
|
|
860
874
|
|
|
861
875
|
export interface MockUser {
|
|
862
876
|
tenant?: string
|
|
@@ -934,12 +948,12 @@ export declare namespace env {
|
|
|
934
948
|
}
|
|
935
949
|
}
|
|
936
950
|
|
|
937
|
-
export
|
|
951
|
+
export class event extends aspect<'event'> {}
|
|
938
952
|
|
|
939
953
|
/**
|
|
940
954
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/events)
|
|
941
955
|
*/
|
|
942
|
-
|
|
956
|
+
class Event_2 extends EventContext {
|
|
943
957
|
|
|
944
958
|
event: string
|
|
945
959
|
|
|
@@ -954,10 +968,10 @@ export { Event_2 as Event }
|
|
|
954
968
|
* Represents the invocation context of incoming request and event messages.
|
|
955
969
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/events)
|
|
956
970
|
*/
|
|
957
|
-
export
|
|
971
|
+
export class EventContext {
|
|
958
972
|
|
|
959
973
|
constructor (properties: { event: string, data?: object, query?: object, headers?: object })
|
|
960
|
-
http?: { req: express.Request, res: express.Response }
|
|
974
|
+
http?: { req: import('express').Request, res: import('express').Response }
|
|
961
975
|
|
|
962
976
|
tenant: string
|
|
963
977
|
|
|
@@ -973,7 +987,7 @@ export declare class EventContext {
|
|
|
973
987
|
|
|
974
988
|
}
|
|
975
989
|
|
|
976
|
-
export
|
|
990
|
+
export interface EventHandler {
|
|
977
991
|
// (msg : types.EventMessage) : Promise<any> | any | void
|
|
978
992
|
(req: Request_2): Promise<any> | any | void
|
|
979
993
|
}
|
|
@@ -982,11 +996,11 @@ export declare interface EventHandler {
|
|
|
982
996
|
* Provides a graceful shutdown for running servers, by first emitting `cds.emit('shutdown')`.
|
|
983
997
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-facade#cds-exit)
|
|
984
998
|
*/
|
|
985
|
-
export
|
|
999
|
+
export function exit (): void
|
|
986
1000
|
|
|
987
|
-
export
|
|
1001
|
+
export type expr = ref | val | xpr | function_call | SELECT_2
|
|
988
1002
|
|
|
989
|
-
export
|
|
1003
|
+
export type expr_literal = { '=': string }
|
|
990
1004
|
|
|
991
1005
|
/**
|
|
992
1006
|
* Add aspects to a given object, for example:
|
|
@@ -999,30 +1013,30 @@ export declare type expr_literal = { '=': string }
|
|
|
999
1013
|
* }.prototype)
|
|
1000
1014
|
* ```
|
|
1001
1015
|
*/
|
|
1002
|
-
export
|
|
1016
|
+
export function extend<T> (target: T): {
|
|
1003
1017
|
with<E extends readonly any[]>(...ext: E): T & Intersect<E>,
|
|
1004
1018
|
}
|
|
1005
1019
|
|
|
1006
1020
|
/**
|
|
1007
1021
|
* Extensions capture `extend Foo with { ... }` directives.
|
|
1008
1022
|
*/
|
|
1009
|
-
|
|
1023
|
+
type Extension = {
|
|
1010
1024
|
extend: FQN,
|
|
1011
1025
|
elements?: { [name: string]: Element },
|
|
1012
1026
|
includes?: FQN[],
|
|
1013
1027
|
}
|
|
1014
1028
|
|
|
1015
|
-
export
|
|
1029
|
+
export type filename = string
|
|
1016
1030
|
|
|
1017
|
-
|
|
1031
|
+
type Filter = string | (<T extends any_ = any_>(def: T) => boolean)
|
|
1018
1032
|
|
|
1019
|
-
export
|
|
1033
|
+
export type _flavor = 'parsed' | 'xtended' | 'inferred'
|
|
1020
1034
|
|
|
1021
|
-
|
|
1035
|
+
class Float extends number { }
|
|
1022
1036
|
|
|
1023
|
-
export
|
|
1037
|
+
export const foreach: Service['foreach'];
|
|
1024
1038
|
|
|
1025
|
-
|
|
1039
|
+
type Formatter = {
|
|
1026
1040
|
|
|
1027
1041
|
/**
|
|
1028
1042
|
* Custom format function
|
|
@@ -1038,10 +1052,10 @@ declare type Formatter = {
|
|
|
1038
1052
|
/**
|
|
1039
1053
|
* The fully-quality name of a definition.
|
|
1040
1054
|
*/
|
|
1041
|
-
|
|
1055
|
+
type FQN = string
|
|
1042
1056
|
|
|
1043
1057
|
/** @private */
|
|
1044
|
-
export
|
|
1058
|
+
export type function_call = { func: string, args: { [key: string]: any }[] }
|
|
1045
1059
|
|
|
1046
1060
|
/**
|
|
1047
1061
|
* Loads and parses models from the specified files.
|
|
@@ -1049,13 +1063,13 @@ export declare type function_call = { func: string, args: { [key: string]: any }
|
|
|
1049
1063
|
* Essentially a shortcut for `cds.compile.to.csn(files)`
|
|
1050
1064
|
* @param files - filenames of models or if folder containing models
|
|
1051
1065
|
*/
|
|
1052
|
-
export
|
|
1066
|
+
export function get (files: '*' | filename | filename[], o?: _options): Promise<csn.CSN>
|
|
1053
1067
|
|
|
1054
|
-
export
|
|
1068
|
+
export const home: string;
|
|
1055
1069
|
|
|
1056
|
-
export
|
|
1070
|
+
export const insert: Service['insert'];
|
|
1057
1071
|
|
|
1058
|
-
|
|
1072
|
+
type INSERT_2 = { INSERT: {
|
|
1059
1073
|
into: ref | name,
|
|
1060
1074
|
entries: data[],
|
|
1061
1075
|
columns: string[],
|
|
@@ -1065,7 +1079,7 @@ declare type INSERT_2 = { INSERT: {
|
|
|
1065
1079
|
}, }
|
|
1066
1080
|
export { INSERT_2 as INSERT }
|
|
1067
1081
|
|
|
1068
|
-
|
|
1082
|
+
class INSERT_3<T> extends ConstructedQuery {
|
|
1069
1083
|
|
|
1070
1084
|
static into: (<T extends ArrayConstructable<any>> (entity: T, entries?: object | object[]) => INSERT_3<SingularType<T>>)
|
|
1071
1085
|
& (TaggedTemplateQueryPart<INSERT_3<unknown>>)
|
|
@@ -1094,15 +1108,15 @@ declare class INSERT_3<T> extends ConstructedQuery {
|
|
|
1094
1108
|
|
|
1095
1109
|
}
|
|
1096
1110
|
|
|
1097
|
-
|
|
1111
|
+
class Int16 extends Integer { }
|
|
1098
1112
|
|
|
1099
|
-
|
|
1113
|
+
class Int32 extends Integer { }
|
|
1100
1114
|
|
|
1101
|
-
|
|
1115
|
+
class Int64 extends Integer { }
|
|
1102
1116
|
|
|
1103
|
-
|
|
1117
|
+
class Integer extends number { }
|
|
1104
1118
|
|
|
1105
|
-
|
|
1119
|
+
type Intersect<T extends readonly unknown[]> = T extends [infer Head, ...infer Tail]
|
|
1106
1120
|
? Head & Intersect<Tail>
|
|
1107
1121
|
: unknown
|
|
1108
1122
|
|
|
@@ -1110,18 +1124,18 @@ declare type Intersect<T extends readonly unknown[]> = T extends [infer Head, ..
|
|
|
1110
1124
|
* Object structure that exposes both array-like and object-like behaviour.
|
|
1111
1125
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#iterable)
|
|
1112
1126
|
*/
|
|
1113
|
-
|
|
1127
|
+
type IterableMap<T> = { [name: string]: T } & _ArrayLike<T>
|
|
1114
1128
|
|
|
1115
|
-
|
|
1129
|
+
type JSON_2 = string
|
|
1116
1130
|
export { JSON_2 as JSON }
|
|
1117
1131
|
|
|
1118
|
-
export
|
|
1132
|
+
export type Key = number | string | any
|
|
1119
1133
|
|
|
1120
|
-
|
|
1134
|
+
type kinds = 'aspect' | 'entity' | 'type' | 'event' | 'action' | 'function' | 'service' | 'context' | 'elements'
|
|
1121
1135
|
|
|
1122
|
-
|
|
1136
|
+
class LargeBinary extends Binary { }
|
|
1123
1137
|
|
|
1124
|
-
|
|
1138
|
+
class LargeString extends String_2 { }
|
|
1125
1139
|
|
|
1126
1140
|
/**
|
|
1127
1141
|
* Prepare a node module for lazy-loading submodules instead
|
|
@@ -1138,7 +1152,7 @@ export declare class LargeString extends String_2 { }
|
|
|
1138
1152
|
* The first usage of `facade.sub` will load the sub module
|
|
1139
1153
|
* using standard Node.js's `module.require` functions.
|
|
1140
1154
|
*/
|
|
1141
|
-
export
|
|
1155
|
+
export function lazified<T> (target: T): T
|
|
1142
1156
|
|
|
1143
1157
|
/**
|
|
1144
1158
|
* Equip a given facade object with getters for lazy-loading modules instead
|
|
@@ -1154,137 +1168,185 @@ export declare function lazified<T> (target: T): T
|
|
|
1154
1168
|
* The first usage of `facade.sub` will load the sub module
|
|
1155
1169
|
* using standard Node.js's `module.require` functions.
|
|
1156
1170
|
*/
|
|
1157
|
-
export
|
|
1171
|
+
export function lazify<T> (target: T): T
|
|
1158
1172
|
|
|
1159
|
-
|
|
1173
|
+
enum levels {
|
|
1160
1174
|
// SILLY and VERBOSE are aliases for TRACE
|
|
1161
1175
|
/* eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values */
|
|
1162
1176
|
SILENT = 0, ERROR = 1, WARN = 2, INFO = 3, DEBUG = 4, TRACE = 5, SILLY = 5, VERBOSE = 5
|
|
1163
1177
|
}
|
|
1164
1178
|
|
|
1165
|
-
export
|
|
1179
|
+
export const linked: {
|
|
1166
1180
|
|
|
1167
1181
|
/**
|
|
1168
1182
|
* Turns the given plain CSN model into a linked model
|
|
1169
1183
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect)
|
|
1170
1184
|
*/
|
|
1171
|
-
(model: csn.CSN): linked_2.
|
|
1185
|
+
(model: csn.CSN): linked_2.LinkedCSN,
|
|
1172
1186
|
|
|
1173
1187
|
/**
|
|
1174
1188
|
* Base classes of linked definitions from reflected models.
|
|
1175
1189
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-builtin-classes)
|
|
1176
1190
|
*/
|
|
1177
|
-
classes: typeof
|
|
1191
|
+
classes: typeof classes,
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#linked-csn)
|
|
1195
|
+
*/
|
|
1196
|
+
LinkedCSN: linked_2.LinkedCSN,
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#iterable)
|
|
1200
|
+
*/
|
|
1201
|
+
LinkedDefinitions: IterableMap<linked_2.classes.any_>,
|
|
1178
1202
|
};
|
|
1179
1203
|
|
|
1180
|
-
|
|
1181
|
-
export
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
type
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
date
|
|
1214
|
-
|
|
1215
|
-
Time
|
|
1216
|
-
DateTime
|
|
1217
|
-
TimeStamp
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
entity
|
|
1225
|
-
Association
|
|
1226
|
-
Composition
|
|
1227
|
-
ManagedAssociation,
|
|
1228
|
-
MixedIn
|
|
1204
|
+
export namespace linked {
|
|
1205
|
+
export type LinkedDefinitions = IterableMap<linked_2.classes.any_>
|
|
1206
|
+
export type LinkedCSN = linked_2.LinkedCSN
|
|
1207
|
+
|
|
1208
|
+
export namespace classes {
|
|
1209
|
+
export type type = __type
|
|
1210
|
+
export type aspect = __aspect
|
|
1211
|
+
|
|
1212
|
+
export type any_ = __any_
|
|
1213
|
+
|
|
1214
|
+
export type scalar = __scalar
|
|
1215
|
+
// can not shadow builtins. Same for string and number...
|
|
1216
|
+
//export type boolean = LinkedClasses.Boolean // on purpose
|
|
1217
|
+
export type Boolean = __Boolean
|
|
1218
|
+
|
|
1219
|
+
export type UUID = __UUID
|
|
1220
|
+
//export type string = LinkedClasses.String // on purpose
|
|
1221
|
+
export type String = __String
|
|
1222
|
+
export type LargeString = __LargeString
|
|
1223
|
+
export type Binary = __Binary
|
|
1224
|
+
export type LargeBinary = __LargeBinary
|
|
1225
|
+
export type Vector = __Vector
|
|
1226
|
+
|
|
1227
|
+
//export type number = LinkedClasses.scalar // currently no better way to do this
|
|
1228
|
+
export type Integer = __Integer
|
|
1229
|
+
export type UInt8 = __UInt8
|
|
1230
|
+
export type Int16 = __Int16
|
|
1231
|
+
export type Int32 = __Int32
|
|
1232
|
+
export type Int64 = __Int64
|
|
1233
|
+
export type Float = __Float
|
|
1234
|
+
export type Double = __Double
|
|
1235
|
+
export type Decimal = __Decimal
|
|
1236
|
+
|
|
1237
|
+
export type date = __date
|
|
1238
|
+
export type Date = __Date
|
|
1239
|
+
export type Time = __Time
|
|
1240
|
+
export type DateTime = __DateTime
|
|
1241
|
+
export type TimeStamp = __TimeStamp
|
|
1242
|
+
|
|
1243
|
+
export type array = __array
|
|
1244
|
+
|
|
1245
|
+
export type struct = __struct
|
|
1246
|
+
export type context_ = __context_
|
|
1247
|
+
export type service = __service
|
|
1248
|
+
export type entity = __entity
|
|
1249
|
+
export type Association = __Association
|
|
1250
|
+
export type Composition = __Composition
|
|
1229
1251
|
}
|
|
1230
1252
|
}
|
|
1231
1253
|
|
|
1232
|
-
|
|
1254
|
+
namespace linked_2 {
|
|
1233
1255
|
export {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
WithElements,
|
|
1239
|
-
any_,
|
|
1240
|
-
any,
|
|
1241
|
-
aspect,
|
|
1242
|
-
type,
|
|
1243
|
-
scalar,
|
|
1244
|
-
boolean,
|
|
1245
|
-
Boolean_2 as Boolean,
|
|
1246
|
-
string,
|
|
1247
|
-
UUID,
|
|
1248
|
-
String_2 as String,
|
|
1249
|
-
LargeString,
|
|
1250
|
-
Binary,
|
|
1251
|
-
LargeBinary,
|
|
1252
|
-
Vector,
|
|
1253
|
-
number,
|
|
1254
|
-
Integer,
|
|
1255
|
-
UInt8,
|
|
1256
|
-
Int16,
|
|
1257
|
-
Int32,
|
|
1258
|
-
Int64,
|
|
1259
|
-
Float,
|
|
1260
|
-
Double,
|
|
1261
|
-
Decimal,
|
|
1262
|
-
date,
|
|
1263
|
-
Date_2 as Date,
|
|
1264
|
-
Time,
|
|
1265
|
-
DateTime,
|
|
1266
|
-
TimeStamp,
|
|
1267
|
-
array,
|
|
1268
|
-
struct,
|
|
1269
|
-
context_,
|
|
1270
|
-
service_,
|
|
1271
|
-
action,
|
|
1272
|
-
event,
|
|
1273
|
-
entity,
|
|
1274
|
-
Association,
|
|
1275
|
-
Composition,
|
|
1276
|
-
ManagedAssociation,
|
|
1277
|
-
MixedIn
|
|
1256
|
+
ModelPart,
|
|
1257
|
+
Definition_2 as Definition,
|
|
1258
|
+
LinkedCSN,
|
|
1259
|
+
classes
|
|
1278
1260
|
}
|
|
1279
1261
|
}
|
|
1280
1262
|
|
|
1263
|
+
interface LinkedCSN extends Omit<csn.CSN, 'definitions'> {
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Fetches definitions matching the given filter, returning an iterator on them.
|
|
1267
|
+
* @example
|
|
1268
|
+
* ```js
|
|
1269
|
+
* let m = cds.reflect (aParsedModel)
|
|
1270
|
+
* for (let d of m.each('entity')) console.log (d.kind, d.name)
|
|
1271
|
+
* let entities = [...m.each('entity')] //> capture all
|
|
1272
|
+
* let entities = m.all('entity') //> equivalent shortcut
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
each<T extends any_>(x: Filter, defs?: Definitions<T>): IterableIterator<T>
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Fetches definitions matching the given filter, returning them in an array.
|
|
1279
|
+
* Convenience shortcut for `[...reflect.each('entity')]`
|
|
1280
|
+
*/
|
|
1281
|
+
all<T extends any_>(x: Filter, defs?: Definitions<T>): T[]
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Fetches definitions matching the given filter, returning the first match, if any.
|
|
1285
|
+
* @example
|
|
1286
|
+
* let service = model.find('service')
|
|
1287
|
+
* @param x - the filter
|
|
1288
|
+
* @param defs - the definitions to fetch in, default: `this.definitions`
|
|
1289
|
+
*/
|
|
1290
|
+
find<T extends any_>(x: Filter, defs?: Definitions<T>): T | undefined
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Calls the visitor for each definition matching the given filter.
|
|
1294
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#foreach)
|
|
1295
|
+
*/
|
|
1296
|
+
foreach(x: Filter, visitor: Visitor, defs?: Definitions): this
|
|
1297
|
+
foreach(visitor: Visitor, defs?: Definitions): this
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Same as foreach but recursively visits each element definition
|
|
1301
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#foreach)
|
|
1302
|
+
*/
|
|
1303
|
+
forall(x: Filter, visitor: Visitor, defs?: Definitions): this
|
|
1304
|
+
forall(visitor: Visitor, defs?: Definitions): this
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Fetches definitions declared as children of a given parent context or service.
|
|
1308
|
+
* It fetches all definitions whose fully-qualified names start with the parent's name.
|
|
1309
|
+
* Returns the found definitions as an object with the local names as keys.
|
|
1310
|
+
* @example
|
|
1311
|
+
* ```js
|
|
1312
|
+
* let service = model.find ('service')
|
|
1313
|
+
* let entities = m.childrenOf (service)
|
|
1314
|
+
* ```
|
|
1315
|
+
* @param parent - either the parent itself or its fully-qualified name
|
|
1316
|
+
* @param filter - an optional filter to apply before picking a child
|
|
1317
|
+
*/
|
|
1318
|
+
childrenOf(parent: any | string, filter?: ((def: any_) => boolean)): Definitions
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* Provides convenient access to the model's top-level definitions.
|
|
1322
|
+
* For example, you can use it in an es6-import-like fashion to avoid
|
|
1323
|
+
* working with fully-qualified names as follows:
|
|
1324
|
+
*
|
|
1325
|
+
* @example
|
|
1326
|
+
* ```js
|
|
1327
|
+
* let model = cds.reflect (cds.parse(`
|
|
1328
|
+
* namespace our.lovely.bookshop;
|
|
1329
|
+
* entity Books {...}
|
|
1330
|
+
* entity Authors {...}
|
|
1331
|
+
* `))
|
|
1332
|
+
* const {Books,Authors} = model.exports
|
|
1333
|
+
* SELECT.from (Books) .where ({ID:11})
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
1336
|
+
exports: IterableMap<any_>
|
|
1337
|
+
definitions: IterableMap<any_>
|
|
1338
|
+
entities: ModelPart<entity>
|
|
1339
|
+
services: ModelPart<service_>
|
|
1340
|
+
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1281
1343
|
/**
|
|
1282
1344
|
* Shortcut for `cds.get(files, 'inferred')`
|
|
1283
1345
|
* @param files - filenames of models or if folder containing models
|
|
1284
1346
|
*/
|
|
1285
|
-
export
|
|
1347
|
+
export function load (files: '*' | filename | filename[], o?: _options): Promise<csn.CSN>
|
|
1286
1348
|
|
|
1287
|
-
|
|
1349
|
+
type Log = {
|
|
1288
1350
|
|
|
1289
1351
|
/**
|
|
1290
1352
|
* Logs a message
|
|
@@ -1298,9 +1360,9 @@ declare type Log = {
|
|
|
1298
1360
|
/**
|
|
1299
1361
|
* Create a new logger, or install a custom log formatter
|
|
1300
1362
|
*/
|
|
1301
|
-
export
|
|
1363
|
+
export const log: LogFactory;
|
|
1302
1364
|
|
|
1303
|
-
|
|
1365
|
+
type LogFactory = {
|
|
1304
1366
|
|
|
1305
1367
|
/**
|
|
1306
1368
|
* Returns a trace logger for the given module if trace is switched on for it,
|
|
@@ -1354,7 +1416,7 @@ declare type LogFactory = {
|
|
|
1354
1416
|
winstonLogger (LoggerOptions?: { level?: string, levels?: any, format?: any, transports?: any, exitOnError?: boolean | Function, silent?: boolean }),
|
|
1355
1417
|
}
|
|
1356
1418
|
|
|
1357
|
-
|
|
1419
|
+
class Logger {
|
|
1358
1420
|
|
|
1359
1421
|
|
|
1360
1422
|
/**
|
|
@@ -1424,19 +1486,19 @@ declare class Logger {
|
|
|
1424
1486
|
|
|
1425
1487
|
}
|
|
1426
1488
|
|
|
1427
|
-
|
|
1489
|
+
type LogLevel = keyof typeof levels | Lowercase<keyof typeof levels> | levels
|
|
1428
1490
|
|
|
1429
|
-
|
|
1491
|
+
type ManagedAssociation = Association & {
|
|
1430
1492
|
foreignKeys: Definitions<type>,
|
|
1431
1493
|
keys: Column[],
|
|
1432
1494
|
}
|
|
1433
1495
|
|
|
1434
|
-
export
|
|
1496
|
+
export class MessagingService extends Service {}
|
|
1435
1497
|
|
|
1436
|
-
export
|
|
1498
|
+
export type Middleswares = 'context' | 'trace' | 'auth' | 'ctx_model' | string
|
|
1437
1499
|
|
|
1438
|
-
export
|
|
1439
|
-
add: (middleware: RequestHandler, pos?: XOR<XOR<{ at: number }, { after: Middleswares }>, { before: Middleswares }>) => void,
|
|
1500
|
+
export const middlewares: {
|
|
1501
|
+
add: (middleware: import('express').RequestHandler, pos?: XOR<XOR<{ at: number }, { after: Middleswares }>, { before: Middleswares }>) => void,
|
|
1440
1502
|
};
|
|
1441
1503
|
|
|
1442
1504
|
/**
|
|
@@ -1459,7 +1521,7 @@ export declare const middlewares: {
|
|
|
1459
1521
|
* s2.bar // error :)
|
|
1460
1522
|
* ```
|
|
1461
1523
|
*/
|
|
1462
|
-
|
|
1524
|
+
type MixedIn<T> = T & { [key: string | number | symbol]: unknown }
|
|
1463
1525
|
|
|
1464
1526
|
/**
|
|
1465
1527
|
* Using this will require you to explicitly cast all classes you added mixins to
|
|
@@ -1467,18 +1529,18 @@ export declare type MixedIn<T> = T & { [key: string | number | symbol]: unknown
|
|
|
1467
1529
|
* properties, you can use the {@link MixedIn} type.
|
|
1468
1530
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#mixin)
|
|
1469
1531
|
*/
|
|
1470
|
-
|
|
1532
|
+
function mixin (...classes: (new () => any)[]): void
|
|
1471
1533
|
|
|
1472
1534
|
/**
|
|
1473
1535
|
* The effective CDS model loaded during bootstrapping, which contains all service and entity definitions,
|
|
1474
1536
|
* including required services.
|
|
1475
1537
|
* Should only be ever set explictly in test scenarios!
|
|
1476
1538
|
*/
|
|
1477
|
-
export
|
|
1539
|
+
export let model: linked_2.LinkedCSN | undefined;
|
|
1478
1540
|
|
|
1479
|
-
|
|
1541
|
+
type ModelPart<T extends any_> = IterableMap<T> & ((namespace: string) => IterableMap<T>)
|
|
1480
1542
|
|
|
1481
|
-
|
|
1543
|
+
namespace models {
|
|
1482
1544
|
export {
|
|
1483
1545
|
get,
|
|
1484
1546
|
load,
|
|
@@ -1498,18 +1560,49 @@ declare namespace models {
|
|
|
1498
1560
|
model,
|
|
1499
1561
|
parse,
|
|
1500
1562
|
linked,
|
|
1563
|
+
__type,
|
|
1564
|
+
__aspect,
|
|
1565
|
+
__any_,
|
|
1566
|
+
__scalar,
|
|
1567
|
+
__Boolean,
|
|
1568
|
+
__UUID,
|
|
1569
|
+
__String,
|
|
1570
|
+
__LargeString,
|
|
1571
|
+
__Binary,
|
|
1572
|
+
__LargeBinary,
|
|
1573
|
+
__Vector,
|
|
1574
|
+
__Integer,
|
|
1575
|
+
__UInt8,
|
|
1576
|
+
__Int16,
|
|
1577
|
+
__Int32,
|
|
1578
|
+
__Int64,
|
|
1579
|
+
__Float,
|
|
1580
|
+
__Double,
|
|
1581
|
+
__Decimal,
|
|
1582
|
+
__date,
|
|
1583
|
+
__Date,
|
|
1584
|
+
__Time,
|
|
1585
|
+
__DateTime,
|
|
1586
|
+
__TimeStamp,
|
|
1587
|
+
__array,
|
|
1588
|
+
__struct,
|
|
1589
|
+
__context_,
|
|
1590
|
+
__service,
|
|
1591
|
+
__entity,
|
|
1592
|
+
__Association,
|
|
1593
|
+
__Composition,
|
|
1501
1594
|
compile
|
|
1502
1595
|
}
|
|
1503
1596
|
}
|
|
1504
1597
|
|
|
1505
1598
|
/** @private */
|
|
1506
|
-
export
|
|
1599
|
+
export type name = string
|
|
1507
1600
|
|
|
1508
|
-
|
|
1601
|
+
const number: typeof number_;
|
|
1509
1602
|
|
|
1510
|
-
|
|
1603
|
+
class number_ extends scalar { }
|
|
1511
1604
|
|
|
1512
|
-
export
|
|
1605
|
+
export type _odata_options = {
|
|
1513
1606
|
flavor?: 'v2' | 'v4' | 'w4' | 'x4',
|
|
1514
1607
|
version?: 'v2' | 'v4',
|
|
1515
1608
|
structs?: boolean,
|
|
@@ -1521,65 +1614,65 @@ export declare type _odata_options = {
|
|
|
1521
1614
|
*/
|
|
1522
1615
|
// FIXME: this is actually supposed to be part of models.d.ts
|
|
1523
1616
|
// but had to be moved here so export * would not clash their definitions
|
|
1524
|
-
export
|
|
1617
|
+
export function on (event: 'loaded', listener: (model: CSN) => void): _cds
|
|
1525
1618
|
|
|
1526
1619
|
/**
|
|
1527
1620
|
* Emitted whenever a specific service is connected for the first time.
|
|
1528
1621
|
*/
|
|
1529
|
-
export
|
|
1622
|
+
export function on (event: 'connect', listener: (srv: Service) => void): _cds
|
|
1530
1623
|
|
|
1531
1624
|
/**
|
|
1532
1625
|
* Emitted at the very beginning of the bootsrapping process, when the
|
|
1533
1626
|
* express application has been constructed but no middlewares or routes
|
|
1534
1627
|
* added yet.
|
|
1535
1628
|
*/
|
|
1536
|
-
export
|
|
1629
|
+
export function on (event: 'bootstrap', listener: (app: import('express').Application) => void): _cds
|
|
1537
1630
|
|
|
1538
1631
|
/**
|
|
1539
1632
|
* Emitted for each service served by cds.serve().
|
|
1540
1633
|
*/
|
|
1541
|
-
export
|
|
1634
|
+
export function on (event: 'serving', listener: (srv: Service) => void): _cds
|
|
1542
1635
|
|
|
1543
1636
|
/**
|
|
1544
1637
|
* Emitted by the default, built-in `server.js` when all services are
|
|
1545
1638
|
* constructed and mounted by cds.serve().
|
|
1546
1639
|
*/
|
|
1547
|
-
export
|
|
1640
|
+
export function on (event: 'served', listener: (all: cds_services) => void): _cds
|
|
1548
1641
|
|
|
1549
1642
|
/**
|
|
1550
1643
|
* Emitted by the default, built-in `server.js` when the http server
|
|
1551
1644
|
* is started and listening for incoming requests.
|
|
1552
1645
|
*/
|
|
1553
|
-
export
|
|
1646
|
+
export function on (event: 'listening', listener: (args: { server: import('http').Server, url: string }) => void): _cds
|
|
1554
1647
|
|
|
1555
1648
|
/**
|
|
1556
1649
|
* Emitted by the default, built-in `server.js` when the http server
|
|
1557
1650
|
* is shutdown.
|
|
1558
1651
|
*/
|
|
1559
|
-
export
|
|
1652
|
+
export function on (event: 'shutdown', listener: () => void): _cds
|
|
1560
1653
|
|
|
1561
|
-
export
|
|
1654
|
+
export function once (event: 'bootstrap', listener: (app: import('express').Application) => void): _cds
|
|
1562
1655
|
|
|
1563
|
-
export
|
|
1656
|
+
export function once (event: 'served', listener: (all: cds_services) => void): _cds
|
|
1564
1657
|
|
|
1565
|
-
export
|
|
1658
|
+
export function once (event: 'listening', listener: (args: { server: import('http').Server, url: string }) => void): _cds
|
|
1566
1659
|
|
|
1567
|
-
export
|
|
1660
|
+
export function once (event: 'shutdown', listener: () => void): _cds
|
|
1568
1661
|
|
|
1569
|
-
export
|
|
1662
|
+
export type OneOrMany<T> = T | T[]
|
|
1570
1663
|
|
|
1571
|
-
export
|
|
1664
|
+
export interface OnErrorHandler {
|
|
1572
1665
|
(err: Error, req: Request_2): any | void
|
|
1573
1666
|
}
|
|
1574
1667
|
|
|
1575
|
-
export
|
|
1668
|
+
export interface OnEventHandler {
|
|
1576
1669
|
(req: Request_2, next: Function): Promise<any> | any | void
|
|
1577
1670
|
}
|
|
1578
1671
|
|
|
1579
1672
|
/** @private */
|
|
1580
|
-
export
|
|
1673
|
+
export type operator = string
|
|
1581
1674
|
|
|
1582
|
-
export
|
|
1675
|
+
export type _options = {
|
|
1583
1676
|
flavor?: _flavor,
|
|
1584
1677
|
plain?: boolean,
|
|
1585
1678
|
docs?: boolean,
|
|
@@ -1588,15 +1681,15 @@ export declare type _options = {
|
|
|
1588
1681
|
} | _flavor
|
|
1589
1682
|
|
|
1590
1683
|
/** @private */
|
|
1591
|
-
export
|
|
1684
|
+
export type ordering_term = expr & { sort?: 'asc' | 'desc', nulls?: 'first' | 'last' }
|
|
1592
1685
|
|
|
1593
|
-
export
|
|
1686
|
+
export const outboxed: (service: Service) => Service;
|
|
1594
1687
|
|
|
1595
1688
|
/**
|
|
1596
1689
|
* Provides a set of methods to parse a given model, query or expression.
|
|
1597
1690
|
* You can also use `cds.parse()` as a shortcut to `cds.parse.cdl()`.
|
|
1598
1691
|
*/
|
|
1599
|
-
export
|
|
1692
|
+
export const parse: {
|
|
1600
1693
|
|
|
1601
1694
|
/** Shortcut to `cds.parse.cdl()` */
|
|
1602
1695
|
(cdl: CDL): csn.CSN,
|
|
@@ -1607,24 +1700,24 @@ export declare const parse: {
|
|
|
1607
1700
|
ref (src: string): string[],
|
|
1608
1701
|
};
|
|
1609
1702
|
|
|
1610
|
-
|
|
1703
|
+
type Partial_2<T> = { [Key in keyof T]: undefined | T[Key] }
|
|
1611
1704
|
export { Partial_2 as Partial }
|
|
1612
1705
|
|
|
1613
|
-
|
|
1706
|
+
type PK = number | string | object
|
|
1614
1707
|
|
|
1615
|
-
|
|
1708
|
+
type PluralType<T extends Constructable> = Array<InstanceType<T>>
|
|
1616
1709
|
|
|
1617
|
-
export
|
|
1710
|
+
export type predicate = UnionsToIntersections<_xpr>
|
|
1618
1711
|
|
|
1619
|
-
|
|
1712
|
+
type Primitive = string | number | boolean | Date
|
|
1620
1713
|
|
|
1621
1714
|
/** @private */
|
|
1622
|
-
export
|
|
1715
|
+
export type primitive = number | string | boolean | null
|
|
1623
1716
|
|
|
1624
1717
|
/**
|
|
1625
1718
|
* Subclass for executing code with superuser privileges.
|
|
1626
1719
|
*/
|
|
1627
|
-
export
|
|
1720
|
+
export class Privileged extends User {
|
|
1628
1721
|
|
|
1629
1722
|
constructor ()
|
|
1630
1723
|
|
|
@@ -1632,15 +1725,15 @@ export declare class Privileged extends User {
|
|
|
1632
1725
|
|
|
1633
1726
|
}
|
|
1634
1727
|
|
|
1635
|
-
|
|
1728
|
+
type Projection<T> = (e: QLExtensions<T extends ArrayConstructable ? SingularType<T> : T>) => void
|
|
1636
1729
|
|
|
1637
1730
|
/**
|
|
1638
1731
|
* @alpha
|
|
1639
1732
|
* related to .protocols getters
|
|
1640
1733
|
*/
|
|
1641
|
-
|
|
1734
|
+
type Protocol = 'odata' | 'rest'
|
|
1642
1735
|
|
|
1643
|
-
|
|
1736
|
+
class QL<T> {
|
|
1644
1737
|
|
|
1645
1738
|
SELECT: StaticSELECT<T>
|
|
1646
1739
|
|
|
@@ -1662,7 +1755,7 @@ declare class QL<T> {
|
|
|
1662
1755
|
|
|
1663
1756
|
}
|
|
1664
1757
|
|
|
1665
|
-
|
|
1758
|
+
namespace ql {
|
|
1666
1759
|
export {
|
|
1667
1760
|
Query_2 as Query,
|
|
1668
1761
|
ConstructedQuery,
|
|
@@ -1690,13 +1783,13 @@ declare namespace ql {
|
|
|
1690
1783
|
}
|
|
1691
1784
|
export { ql }
|
|
1692
1785
|
|
|
1693
|
-
export
|
|
1786
|
+
export type QLExtensions<T> = T extends QLExtensions_<any> ? T : QLExtensions_<T>
|
|
1694
1787
|
|
|
1695
1788
|
/**
|
|
1696
1789
|
* QLExtensions are properties that are attached to entities in CQL contexts.
|
|
1697
1790
|
* They are passed down to all properties recursively.
|
|
1698
1791
|
*/
|
|
1699
|
-
|
|
1792
|
+
type QLExtensions_<T> = {
|
|
1700
1793
|
[Key in keyof T]: QLExtensions<T[Key]>
|
|
1701
1794
|
} & {
|
|
1702
1795
|
|
|
@@ -1718,13 +1811,13 @@ declare type QLExtensions_<T> = {
|
|
|
1718
1811
|
// over T and undefined, which gives us zero code completion within the callable.
|
|
1719
1812
|
} & Subqueryable<Exclude<T, undefined>>
|
|
1720
1813
|
|
|
1721
|
-
export
|
|
1814
|
+
export type Query = Partial<SELECT_2 & INSERT_2 & UPDATE_2 & DELETE_2 & CREATE_2 & DROP_2 & UPSERT_2>
|
|
1722
1815
|
|
|
1723
|
-
|
|
1816
|
+
type Query_2 = CQN.Query
|
|
1724
1817
|
|
|
1725
|
-
export
|
|
1818
|
+
export class QueryAPI {
|
|
1726
1819
|
|
|
1727
|
-
entities: linked_2.
|
|
1820
|
+
entities: linked_2.LinkedCSN['entities']
|
|
1728
1821
|
|
|
1729
1822
|
/**
|
|
1730
1823
|
* @see [docs](https://cap.cloud.sap/docs/node.js/core-services#crud-style-api)
|
|
@@ -1781,10 +1874,10 @@ export declare class QueryAPI {
|
|
|
1781
1874
|
stream: {
|
|
1782
1875
|
(column: string): {
|
|
1783
1876
|
from(entity: linked_2.Definition | string): {
|
|
1784
|
-
where(filter: any): ReadableStream,
|
|
1877
|
+
where(filter: any): import('node:stream/web').ReadableStream,
|
|
1785
1878
|
},
|
|
1786
1879
|
},
|
|
1787
|
-
(query: Query_2): Promise<ReadableStream>,
|
|
1880
|
+
(query: Query_2): Promise<import('node:stream/web').ReadableStream>,
|
|
1788
1881
|
}
|
|
1789
1882
|
|
|
1790
1883
|
/**
|
|
@@ -1810,23 +1903,23 @@ export declare class QueryAPI {
|
|
|
1810
1903
|
|
|
1811
1904
|
}
|
|
1812
1905
|
|
|
1813
|
-
export
|
|
1906
|
+
export const read: Service['read'];
|
|
1814
1907
|
|
|
1815
1908
|
/** @private */
|
|
1816
|
-
export
|
|
1909
|
+
export type ref = { ref: (name & { id?: string, where?: expr, args?: expr[] })[] }
|
|
1817
1910
|
|
|
1818
1911
|
/**
|
|
1819
1912
|
* Turns the given plain CSN model into a reflected model
|
|
1820
1913
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect)
|
|
1821
1914
|
*/
|
|
1822
|
-
export
|
|
1915
|
+
export function reflect (model: csn.CSN): linked_2.LinkedCSN
|
|
1823
1916
|
|
|
1824
|
-
export
|
|
1917
|
+
export class RemoteService extends Service {}
|
|
1825
1918
|
|
|
1826
1919
|
/**
|
|
1827
1920
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/events)
|
|
1828
1921
|
*/
|
|
1829
|
-
|
|
1922
|
+
class Request_2 extends Event_2 {
|
|
1830
1923
|
|
|
1831
1924
|
params: (string | object)[]
|
|
1832
1925
|
|
|
@@ -1834,7 +1927,7 @@ declare class Request_2 extends Event_2 {
|
|
|
1834
1927
|
|
|
1835
1928
|
path: string
|
|
1836
1929
|
|
|
1837
|
-
target:
|
|
1930
|
+
target: Definition_2
|
|
1838
1931
|
|
|
1839
1932
|
/**
|
|
1840
1933
|
* Shortcut to {@link Request.target | target (entity) name}
|
|
@@ -1891,7 +1984,7 @@ declare class Request_2 extends Event_2 {
|
|
|
1891
1984
|
}
|
|
1892
1985
|
export { Request_2 as Request }
|
|
1893
1986
|
|
|
1894
|
-
export
|
|
1987
|
+
export const requires: env.Requires;
|
|
1895
1988
|
|
|
1896
1989
|
/**
|
|
1897
1990
|
* Resolves given file or module name(s) to an array of absolute file names.
|
|
@@ -1901,24 +1994,24 @@ export declare const requires: env.Requires;
|
|
|
1901
1994
|
* @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/' ]`
|
|
1902
1995
|
* @returns An array of absolute file names or `undefined` if none could be resolved.
|
|
1903
1996
|
*/
|
|
1904
|
-
export
|
|
1997
|
+
export function resolve (files: '*' | filename | filename[]): filename[] | undefined
|
|
1905
1998
|
|
|
1906
|
-
export
|
|
1999
|
+
export interface ResultSet extends Array<object> {}
|
|
1907
2000
|
|
|
1908
|
-
export
|
|
2001
|
+
export interface ResultsHandler {
|
|
1909
2002
|
(results: any[], req: Request_2): void
|
|
1910
2003
|
(each: any, req: Request_2): void
|
|
1911
2004
|
}
|
|
1912
2005
|
|
|
1913
|
-
export
|
|
2006
|
+
export const root: string;
|
|
1914
2007
|
|
|
1915
|
-
export
|
|
2008
|
+
export const run: Service['run'];
|
|
1916
2009
|
|
|
1917
|
-
|
|
2010
|
+
class scalar extends type { }
|
|
1918
2011
|
|
|
1919
|
-
|
|
2012
|
+
type Scalarise<A> = A extends Array<infer N> ? N : A
|
|
1920
2013
|
|
|
1921
|
-
|
|
2014
|
+
type SELECT_2 = { SELECT: {
|
|
1922
2015
|
distinct?: true,
|
|
1923
2016
|
one?: boolean,
|
|
1924
2017
|
from: source,
|
|
@@ -1933,7 +2026,7 @@ declare type SELECT_2 = { SELECT: {
|
|
|
1933
2026
|
}, }
|
|
1934
2027
|
export { SELECT_2 as SELECT }
|
|
1935
2028
|
|
|
1936
|
-
|
|
2029
|
+
class SELECT_3<T> extends ConstructedQuery {
|
|
1937
2030
|
|
|
1938
2031
|
static one: SELECT_one & { from: SELECT_one }
|
|
1939
2032
|
|
|
@@ -1999,7 +2092,7 @@ declare class SELECT_3<T> extends ConstructedQuery {
|
|
|
1999
2092
|
|
|
2000
2093
|
}
|
|
2001
2094
|
|
|
2002
|
-
|
|
2095
|
+
type SELECT_from =
|
|
2003
2096
|
// tagged template
|
|
2004
2097
|
TaggedTemplateQueryPart<Awaitable<SELECT_3<unknown>, InstanceType<any>>>
|
|
2005
2098
|
&
|
|
@@ -2029,7 +2122,7 @@ primaryKey: PK,
|
|
|
2029
2122
|
projection?: Projection<InstanceType<T>>
|
|
2030
2123
|
) => Awaitable<SELECT_3<PluralType<T>>, PluralType<T>>)
|
|
2031
2124
|
|
|
2032
|
-
|
|
2125
|
+
type SELECT_one =
|
|
2033
2126
|
TaggedTemplateQueryPart<Awaitable<SELECT_3<unknown>, InstanceType<any>>>
|
|
2034
2127
|
&
|
|
2035
2128
|
// calling with class
|
|
@@ -2052,7 +2145,7 @@ TaggedTemplateQueryPart<Awaitable<SELECT_3<unknown>, InstanceType<any>>>
|
|
|
2052
2145
|
* Constructs service providers from respective service definitions
|
|
2053
2146
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-serve)
|
|
2054
2147
|
*/
|
|
2055
|
-
export
|
|
2148
|
+
export const serve: (service: string, options?: {
|
|
2056
2149
|
service?: string,
|
|
2057
2150
|
from?: '*' | 'all' | string,
|
|
2058
2151
|
[key: string]: any,
|
|
@@ -2061,13 +2154,13 @@ export declare const serve: (service: string, options?: {
|
|
|
2061
2154
|
/**
|
|
2062
2155
|
* The default bootstrap function as loaded from server.js
|
|
2063
2156
|
*/
|
|
2064
|
-
export
|
|
2157
|
+
export const server: Function;
|
|
2065
2158
|
|
|
2066
2159
|
/**
|
|
2067
2160
|
* Class cds.Service
|
|
2068
2161
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2069
2162
|
*/
|
|
2070
|
-
export
|
|
2163
|
+
export class Service extends QueryAPI {
|
|
2071
2164
|
|
|
2072
2165
|
constructor (
|
|
2073
2166
|
name?: string,
|
|
@@ -2092,31 +2185,31 @@ export declare class Service extends QueryAPI {
|
|
|
2092
2185
|
* The model from which the service's definition was loaded
|
|
2093
2186
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2094
2187
|
*/
|
|
2095
|
-
model: linked_2.
|
|
2188
|
+
model: linked_2.LinkedCSN
|
|
2096
2189
|
|
|
2097
2190
|
/**
|
|
2098
2191
|
* Provides access to the entities exposed by a service
|
|
2099
2192
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2100
2193
|
*/
|
|
2101
|
-
entities: linked_2.ModelPart<linked_2.entity>
|
|
2194
|
+
entities: linked_2.ModelPart<linked_2.classes.entity>
|
|
2102
2195
|
|
|
2103
2196
|
/**
|
|
2104
2197
|
* Provides access to the events declared by a service
|
|
2105
2198
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2106
2199
|
*/
|
|
2107
|
-
events: linked_2.ModelPart<linked_2.event>
|
|
2200
|
+
events: linked_2.ModelPart<linked_2.classes.event>
|
|
2108
2201
|
|
|
2109
2202
|
/**
|
|
2110
2203
|
* Provides access to the types exposed by a service
|
|
2111
2204
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2112
2205
|
*/
|
|
2113
|
-
types: linked_2.ModelPart<linked_2.type>
|
|
2206
|
+
types: linked_2.ModelPart<linked_2.classes.type>
|
|
2114
2207
|
|
|
2115
2208
|
/**
|
|
2116
2209
|
* Provides access to the operations, i.e. actions and functions, exposed by a service
|
|
2117
2210
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2118
2211
|
*/
|
|
2119
|
-
operations: linked_2.ModelPart<linked_2.action>
|
|
2212
|
+
operations: linked_2.ModelPart<linked_2.classes.action>
|
|
2120
2213
|
|
|
2121
2214
|
/**
|
|
2122
2215
|
* Acts like a parameter-less constructor. Ensure to call `await super.init()` to have the base class’s handlers added.
|
|
@@ -2226,9 +2319,9 @@ export declare class Service extends QueryAPI {
|
|
|
2226
2319
|
* Shortcut to base class for all service definitions from linked models.
|
|
2227
2320
|
* Plus accessors to impl functions and constructed providers.
|
|
2228
2321
|
*/
|
|
2229
|
-
export
|
|
2322
|
+
export const service: service;
|
|
2230
2323
|
|
|
2231
|
-
export
|
|
2324
|
+
export type service = {
|
|
2232
2325
|
|
|
2233
2326
|
/**
|
|
2234
2327
|
* Dummy wrapper for service implementation functions.
|
|
@@ -2246,9 +2339,9 @@ export declare type service = {
|
|
|
2246
2339
|
/**
|
|
2247
2340
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-service)
|
|
2248
2341
|
*/
|
|
2249
|
-
|
|
2342
|
+
interface service_ extends csn.service {}
|
|
2250
2343
|
|
|
2251
|
-
|
|
2344
|
+
class service_ extends context_ {
|
|
2252
2345
|
is_service: true
|
|
2253
2346
|
get entities (): Definitions<entity>
|
|
2254
2347
|
get types (): Definitions<type>
|
|
@@ -2267,28 +2360,28 @@ export declare class service_ extends context_ {
|
|
|
2267
2360
|
get protocols (): { [protocol in Protocol]?: boolean | undefined }
|
|
2268
2361
|
}
|
|
2269
2362
|
|
|
2270
|
-
|
|
2363
|
+
interface service_2 extends any__2 { }
|
|
2271
2364
|
|
|
2272
|
-
export
|
|
2365
|
+
export interface ServiceImpl {
|
|
2273
2366
|
(this: Service, srv: Service): any
|
|
2274
2367
|
}
|
|
2275
2368
|
|
|
2276
2369
|
/**
|
|
2277
2370
|
* Dictionary of all services constructed and/or connected.
|
|
2278
2371
|
*/
|
|
2279
|
-
export
|
|
2372
|
+
export const services: cds_services;
|
|
2280
2373
|
|
|
2281
|
-
|
|
2374
|
+
type SingularType<T extends ArrayConstructable<T>> = InstanceType<T>[number]
|
|
2282
2375
|
|
|
2283
2376
|
/** @private */
|
|
2284
|
-
export
|
|
2377
|
+
export type source = UnionToIntersection<ref | SELECT_2> & { as?: name, join?: name, on?: xpr }
|
|
2285
2378
|
|
|
2286
2379
|
/**
|
|
2287
2380
|
* @see [docs](https://cap.cloud.sap/docs/node.js/cds-tx#cds-spawn)
|
|
2288
2381
|
*/
|
|
2289
|
-
export
|
|
2382
|
+
export function spawn (options: SpawnOptions, fn: (tx: Transaction) => object): SpawnEventEmitter
|
|
2290
2383
|
|
|
2291
|
-
export
|
|
2384
|
+
export class SpawnEventEmitter {
|
|
2292
2385
|
|
|
2293
2386
|
on<U extends keyof SpawnEvents>(
|
|
2294
2387
|
event: U, listener: SpawnEvents[U]
|
|
@@ -2301,21 +2394,21 @@ export declare class SpawnEventEmitter {
|
|
|
2301
2394
|
|
|
2302
2395
|
}
|
|
2303
2396
|
|
|
2304
|
-
export
|
|
2397
|
+
export interface SpawnEvents {
|
|
2305
2398
|
succeeded: (res: any) => void
|
|
2306
2399
|
failed: (error: any) => void
|
|
2307
2400
|
done: () => void
|
|
2308
2401
|
}
|
|
2309
2402
|
|
|
2310
|
-
export
|
|
2403
|
+
export type SpawnOptions = {
|
|
2311
2404
|
[key: string]: any,
|
|
2312
2405
|
every?: number,
|
|
2313
2406
|
after?: number,
|
|
2314
2407
|
}
|
|
2315
2408
|
|
|
2316
|
-
export
|
|
2409
|
+
export type SQL = string
|
|
2317
2410
|
|
|
2318
|
-
|
|
2411
|
+
type StaticSELECT<T> = typeof SELECT_3
|
|
2319
2412
|
& ((...columns: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) => SELECT_3<T>)
|
|
2320
2413
|
& ((...columns: string[]) => SELECT_3<T>)
|
|
2321
2414
|
& ((columns: string[]) => SELECT_3<T>)
|
|
@@ -2323,27 +2416,26 @@ declare type StaticSELECT<T> = typeof SELECT_3
|
|
|
2323
2416
|
& SELECT_from // as it is not directly quantified, ...
|
|
2324
2417
|
& SELECT_one
|
|
2325
2418
|
|
|
2326
|
-
export
|
|
2419
|
+
export const stream: Service['stream'];
|
|
2327
2420
|
|
|
2328
|
-
|
|
2421
|
+
const string: typeof string_;
|
|
2329
2422
|
|
|
2330
|
-
|
|
2423
|
+
class string_ extends scalar { }
|
|
2331
2424
|
|
|
2332
|
-
|
|
2333
|
-
export { String_2 as String }
|
|
2425
|
+
class String_2 extends string { }
|
|
2334
2426
|
|
|
2335
2427
|
/**
|
|
2336
2428
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-struct)
|
|
2337
2429
|
*/
|
|
2338
|
-
export
|
|
2430
|
+
export interface struct extends Omit<csn.struct, 'items' | 'elements'> {}
|
|
2339
2431
|
|
|
2340
|
-
export
|
|
2432
|
+
export class struct<K extends kinds = 'elements' | 'type'> extends type<K> implements WithElements {
|
|
2341
2433
|
is_struct: true
|
|
2342
2434
|
|
|
2343
2435
|
elements: Definitions<type<'type'>>
|
|
2344
2436
|
}
|
|
2345
2437
|
|
|
2346
|
-
|
|
2438
|
+
interface struct_2 extends type_2 {
|
|
2347
2439
|
|
|
2348
2440
|
/**
|
|
2349
2441
|
* References to definitions to be included.
|
|
@@ -2358,7 +2450,7 @@ declare interface struct_2 extends type_2 {
|
|
|
2358
2450
|
* The final result of each subquery will be the property itself:
|
|
2359
2451
|
* `Book.title` == `Subqueryable<Book>.title()`
|
|
2360
2452
|
*/
|
|
2361
|
-
|
|
2453
|
+
type Subqueryable<T> = T extends Primitive ? unknown
|
|
2362
2454
|
// composition of many/ association to many
|
|
2363
2455
|
: T extends readonly unknown[] ? {
|
|
2364
2456
|
|
|
@@ -2400,14 +2492,14 @@ declare type Subqueryable<T> = T extends Primitive ? unknown
|
|
|
2400
2492
|
(fn: ((a: QLExtensions<T>) => any) | '*'): T,
|
|
2401
2493
|
}
|
|
2402
2494
|
|
|
2403
|
-
|
|
2495
|
+
type TaggedTemplateQueryPart<T> = (strings: TemplateStringsArray, ...params: unknown[]) => T
|
|
2404
2496
|
|
|
2405
2497
|
/**
|
|
2406
2498
|
* Target for any QL operation
|
|
2407
2499
|
*/
|
|
2408
|
-
|
|
2500
|
+
type Target = linked_2.classes.entity | Definition | string
|
|
2409
2501
|
|
|
2410
|
-
|
|
2502
|
+
class Test extends Axios {
|
|
2411
2503
|
|
|
2412
2504
|
test: Test
|
|
2413
2505
|
|
|
@@ -2422,11 +2514,11 @@ declare class Test extends Axios {
|
|
|
2422
2514
|
*/
|
|
2423
2515
|
verbose (v: boolean): this
|
|
2424
2516
|
|
|
2425
|
-
get chai (): typeof chai
|
|
2517
|
+
get chai (): typeof import('chai')
|
|
2426
2518
|
|
|
2427
|
-
get expect (): typeof chai.expect
|
|
2519
|
+
get expect (): typeof import('chai').expect
|
|
2428
2520
|
|
|
2429
|
-
get assert (): typeof chai.assert
|
|
2521
|
+
get assert (): typeof import('chai').assert
|
|
2430
2522
|
|
|
2431
2523
|
get data (): DataUtil
|
|
2432
2524
|
|
|
@@ -2438,7 +2530,7 @@ declare class Test extends Axios {
|
|
|
2438
2530
|
release(): void,
|
|
2439
2531
|
}
|
|
2440
2532
|
|
|
2441
|
-
then (r: (args: { server: http.Server, url: string }) => void): void
|
|
2533
|
+
then (r: (args: { server: import('http').Server, url: string }) => void): void
|
|
2442
2534
|
|
|
2443
2535
|
// get sleep(): (ms: number) => Promise<void>;
|
|
2444
2536
|
// get spy(): <T, K extends keyof T>(o: T, f: K) => T[K] extends (...args: infer TArgs) => infer TReturnValue
|
|
@@ -2447,7 +2539,7 @@ declare class Test extends Axios {
|
|
|
2447
2539
|
|
|
2448
2540
|
}
|
|
2449
2541
|
|
|
2450
|
-
export
|
|
2542
|
+
export const test: {
|
|
2451
2543
|
Test: typeof Test,
|
|
2452
2544
|
|
|
2453
2545
|
/**
|
|
@@ -2463,80 +2555,80 @@ export declare const test: {
|
|
|
2463
2555
|
in (dirname: string): Test,
|
|
2464
2556
|
};
|
|
2465
2557
|
|
|
2466
|
-
|
|
2558
|
+
class Time extends date { }
|
|
2467
2559
|
|
|
2468
|
-
|
|
2560
|
+
class TimeStamp extends DateTime { }
|
|
2469
2561
|
|
|
2470
2562
|
/**
|
|
2471
2563
|
* DO NOT USE
|
|
2472
2564
|
* @internal
|
|
2473
2565
|
*/
|
|
2474
|
-
export
|
|
2566
|
+
export type _TODO = any
|
|
2475
2567
|
|
|
2476
|
-
export
|
|
2568
|
+
export interface Transaction extends Service {
|
|
2477
2569
|
commit(): Promise<void>
|
|
2478
2570
|
rollback(): Promise<void>
|
|
2479
2571
|
}
|
|
2480
2572
|
|
|
2481
|
-
export
|
|
2573
|
+
export const transaction: Service['transaction'];
|
|
2482
2574
|
|
|
2483
2575
|
/**
|
|
2484
2576
|
* Starts or joins a transaction
|
|
2485
2577
|
* @see [docs](https://cap.cloud.sap/docs/node.js/cds-tx)
|
|
2486
2578
|
*/
|
|
2487
|
-
export
|
|
2579
|
+
export const tx: {
|
|
2488
2580
|
(fn: (tx: Transaction) => object): Promise<any>,
|
|
2489
2581
|
(context?: object): Transaction,
|
|
2490
2582
|
(context: object, fn: (tx: Transaction) => object): Promise<any>,
|
|
2491
2583
|
};
|
|
2492
2584
|
|
|
2493
|
-
export
|
|
2585
|
+
export interface type extends Omit<csn.type, 'items'> {
|
|
2494
2586
|
items: type
|
|
2495
2587
|
}
|
|
2496
2588
|
|
|
2497
|
-
export
|
|
2589
|
+
export class type<K extends kinds = 'type'> extends any_<K> { }
|
|
2498
2590
|
|
|
2499
|
-
|
|
2591
|
+
interface type_2 extends any__2 {
|
|
2500
2592
|
type?: FQN
|
|
2501
2593
|
items?: type_2
|
|
2502
2594
|
}
|
|
2503
2595
|
|
|
2504
|
-
export
|
|
2596
|
+
export type TypedRequest<T> = Omit<Request_2, 'data'> & { data: T }
|
|
2505
2597
|
|
|
2506
|
-
export
|
|
2598
|
+
export namespace types {
|
|
2507
2599
|
export type event = eventName | eventName[]
|
|
2508
2600
|
export type eventName = string
|
|
2509
2601
|
| 'CREATE' | 'READ' | 'UPDATE' | 'DELETE'
|
|
2510
2602
|
| 'NEW' | 'EDIT' | 'PATCH' | 'SAVE'
|
|
2511
2603
|
| 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE'
|
|
2512
2604
|
| 'COMMIT' | 'ROLLBACK'
|
|
2513
|
-
export type target = string | linked_2.Definition | linked_2.entity | (string | linked_2.Definition | linked_2.entity)[] | ArrayConstructable
|
|
2605
|
+
export type target = string | linked_2.Definition | linked_2.classes.entity | (string | linked_2.Definition | linked_2.classes.entity)[] | ArrayConstructable
|
|
2514
2606
|
}
|
|
2515
2607
|
|
|
2516
|
-
|
|
2608
|
+
class UInt8 extends Integer { }
|
|
2517
2609
|
|
|
2518
|
-
export
|
|
2610
|
+
export const unboxed: (service: Service) => Service;
|
|
2519
2611
|
|
|
2520
|
-
|
|
2612
|
+
type UnionsToIntersections<U> = Array<UnionToIntersection<Scalarise<U>>>
|
|
2521
2613
|
|
|
2522
|
-
|
|
2614
|
+
type UnionToIntersection<U> = Partial<(U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never>
|
|
2523
2615
|
|
|
2524
|
-
|
|
2616
|
+
type Unwrap<T> = T extends ArrayConstructable
|
|
2525
2617
|
? SingularType<T>
|
|
2526
2618
|
: T extends Array<infer U>
|
|
2527
2619
|
? U
|
|
2528
2620
|
: T
|
|
2529
2621
|
|
|
2530
|
-
export
|
|
2622
|
+
export const update: Service['update'];
|
|
2531
2623
|
|
|
2532
|
-
|
|
2624
|
+
type UPDATE_2 = { UPDATE: {
|
|
2533
2625
|
entity: ref | name,
|
|
2534
2626
|
data: { [key: string]: expr },
|
|
2535
2627
|
where?: predicate,
|
|
2536
2628
|
}, }
|
|
2537
2629
|
export { UPDATE_2 as UPDATE }
|
|
2538
2630
|
|
|
2539
|
-
|
|
2631
|
+
class UPDATE_3<T> extends ConstructedQuery {
|
|
2540
2632
|
|
|
2541
2633
|
// cds-typer plural
|
|
2542
2634
|
static entity<T extends ArrayConstructable<any>> (entity: T, primaryKey?: PK): UPDATE_3<SingularType<T>>
|
|
@@ -2567,7 +2659,7 @@ declare class UPDATE_3<T> extends ConstructedQuery {
|
|
|
2567
2659
|
|
|
2568
2660
|
}
|
|
2569
2661
|
|
|
2570
|
-
|
|
2662
|
+
type UPSERT_2 = { UPSERT: {
|
|
2571
2663
|
into: ref | name,
|
|
2572
2664
|
columns: string[],
|
|
2573
2665
|
entries: data[],
|
|
@@ -2576,7 +2668,7 @@ declare type UPSERT_2 = { UPSERT: {
|
|
|
2576
2668
|
}, }
|
|
2577
2669
|
export { UPSERT_2 as UPSERT }
|
|
2578
2670
|
|
|
2579
|
-
|
|
2671
|
+
class UPSERT_3<T> extends ConstructedQuery {
|
|
2580
2672
|
|
|
2581
2673
|
static into: (<T extends ArrayConstructable<any>> (entity: T, entries?: object | object[]) => UPSERT_3<SingularType<T>>)
|
|
2582
2674
|
& (TaggedTemplateQueryPart<UPSERT_3<unknown>>)
|
|
@@ -2607,7 +2699,7 @@ declare class UPSERT_3<T> extends ConstructedQuery {
|
|
|
2607
2699
|
* Represents the user in a given context.
|
|
2608
2700
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/authentication#cds-user)
|
|
2609
2701
|
*/
|
|
2610
|
-
export
|
|
2702
|
+
export class User {
|
|
2611
2703
|
|
|
2612
2704
|
constructor (obj?: string | { id: string, attr: Record<string, string>, roles: Array<string> | Record<string, string> } | User)
|
|
2613
2705
|
id: string
|
|
@@ -2635,7 +2727,7 @@ export declare class User {
|
|
|
2635
2727
|
/**
|
|
2636
2728
|
* Provides a set of utility functionss
|
|
2637
2729
|
*/
|
|
2638
|
-
export
|
|
2730
|
+
export const utils: {
|
|
2639
2731
|
|
|
2640
2732
|
/**
|
|
2641
2733
|
* Generates a new v4 UUID
|
|
@@ -2683,9 +2775,9 @@ export declare const utils: {
|
|
|
2683
2775
|
*/
|
|
2684
2776
|
write: {
|
|
2685
2777
|
(data: object): {
|
|
2686
|
-
to(...file: string[]): Promise<ReturnType<typeof fs.promises.writeFile>>,
|
|
2778
|
+
to(...file: string[]): Promise<ReturnType<typeof import('node:fs').promises.writeFile>>,
|
|
2687
2779
|
},
|
|
2688
|
-
(file: string, data: object): Promise<ReturnType<typeof fs.promises.writeFile>>,
|
|
2780
|
+
(file: string, data: object): Promise<ReturnType<typeof import('node:fs').promises.writeFile>>,
|
|
2689
2781
|
},
|
|
2690
2782
|
|
|
2691
2783
|
/**
|
|
@@ -2693,9 +2785,9 @@ export declare const utils: {
|
|
|
2693
2785
|
*/
|
|
2694
2786
|
copy: {
|
|
2695
2787
|
(src: string): {
|
|
2696
|
-
to(...dst: string[]): Promise<ReturnType<typeof fs.promises.copyFile>>,
|
|
2788
|
+
to(...dst: string[]): Promise<ReturnType<typeof import('node:fs').promises.copyFile>>,
|
|
2697
2789
|
},
|
|
2698
|
-
(dst: string, src: string): Promise<ReturnType<typeof fs.promises.copyFile>>,
|
|
2790
|
+
(dst: string, src: string): Promise<ReturnType<typeof import('node:fs').promises.copyFile>>,
|
|
2699
2791
|
},
|
|
2700
2792
|
|
|
2701
2793
|
/**
|
|
@@ -2706,33 +2798,33 @@ export declare const utils: {
|
|
|
2706
2798
|
/**
|
|
2707
2799
|
* @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rmdir-path
|
|
2708
2800
|
*/
|
|
2709
|
-
rmdir: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>,
|
|
2801
|
+
rmdir: (...path: string[]) => Promise<ReturnType<typeof import('node:fs').promises.rm>>,
|
|
2710
2802
|
|
|
2711
2803
|
|
|
2712
2804
|
/**
|
|
2713
2805
|
* @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rimraf-path
|
|
2714
2806
|
*/
|
|
2715
|
-
rimraf: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>,
|
|
2807
|
+
rimraf: (...path: string[]) => Promise<ReturnType<typeof import('node:fs').promises.rm>>,
|
|
2716
2808
|
|
|
2717
2809
|
|
|
2718
2810
|
/**
|
|
2719
2811
|
* @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rm-path
|
|
2720
2812
|
*/
|
|
2721
|
-
rm: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>,
|
|
2813
|
+
rm: (...path: string[]) => Promise<ReturnType<typeof import('node:fs').promises.rm>>,
|
|
2722
2814
|
};
|
|
2723
2815
|
|
|
2724
|
-
|
|
2816
|
+
class UUID extends string { }
|
|
2725
2817
|
|
|
2726
2818
|
/** @private */
|
|
2727
|
-
export
|
|
2819
|
+
export type val = { val: any }
|
|
2728
2820
|
|
|
2729
|
-
|
|
2821
|
+
class Vector extends Binary { }
|
|
2730
2822
|
|
|
2731
|
-
export
|
|
2823
|
+
export const version: string;
|
|
2732
2824
|
|
|
2733
|
-
|
|
2825
|
+
type Visitor = (def: any_, name: string, parent: any_, defs: Definitions) => void
|
|
2734
2826
|
|
|
2735
|
-
|
|
2827
|
+
interface WithElements {
|
|
2736
2828
|
elements: Definitions<type>
|
|
2737
2829
|
}
|
|
2738
2830
|
|
|
@@ -2740,24 +2832,24 @@ export declare interface WithElements {
|
|
|
2740
2832
|
* https://stackoverflow.com/a/53229567
|
|
2741
2833
|
* @internal
|
|
2742
2834
|
*/
|
|
2743
|
-
|
|
2835
|
+
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }
|
|
2744
2836
|
|
|
2745
|
-
export
|
|
2837
|
+
export type XML = string
|
|
2746
2838
|
|
|
2747
2839
|
/** @internal */
|
|
2748
|
-
|
|
2840
|
+
type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U
|
|
2749
2841
|
|
|
2750
2842
|
/** @private */
|
|
2751
|
-
export
|
|
2843
|
+
export type xpr = { xpr: _xpr }
|
|
2752
2844
|
|
|
2753
2845
|
/** @private */
|
|
2754
|
-
export
|
|
2846
|
+
export type _xpr = (expr | operator) []
|
|
2755
2847
|
|
|
2756
|
-
export
|
|
2848
|
+
export type YAML = string
|
|
2757
2849
|
|
|
2758
2850
|
export { }
|
|
2759
2851
|
|
|
2760
|
-
|
|
2852
|
+
global {
|
|
2761
2853
|
// these provide the functionality from SELECT, INSERT, etc in the global facade
|
|
2762
2854
|
const SELECT: ql.QL<any>['SELECT']
|
|
2763
2855
|
const INSERT: ql.QL<any>['INSERT']
|
|
@@ -2776,3 +2868,5 @@ declare global {
|
|
|
2776
2868
|
type CREATE<T> = ql.CREATE<T>
|
|
2777
2869
|
type DROP<T> = ql.DROP<T>
|
|
2778
2870
|
}
|
|
2871
|
+
|
|
2872
|
+
}
|