@cap-js/cds-types 0.6.5 → 0.7.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 +464 -255
- package/package.json +3 -2
package/dist/cds-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module '@sap/cds' {
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
|
|
4
4
|
export type __any_ = classes.any_
|
|
5
5
|
|
|
@@ -70,6 +70,12 @@ export interface ActionEventHandler<P, R> {
|
|
|
70
70
|
(req: Omit<Request_2, 'data'> & { data: P }, next: Function): Promise<R> | R
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
interface And {
|
|
74
|
+
and: TaggedTemplateQueryPart<this>
|
|
75
|
+
& ((predicate: object) => this)
|
|
76
|
+
& ((...expr: any[]) => this)
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
const any: typeof any_;
|
|
74
80
|
|
|
75
81
|
interface any_ extends csn.any_ {}
|
|
@@ -87,6 +93,13 @@ interface any__2 {
|
|
|
87
93
|
kind?: kinds
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
/**
|
|
97
|
+
* The {@link https://expressjs.com/en/4x/api.html#app| express.js application} constructed by the server implementation.
|
|
98
|
+
*
|
|
99
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-server#cds-app)
|
|
100
|
+
*/
|
|
101
|
+
export const app: import('express').Application;
|
|
102
|
+
|
|
90
103
|
export class ApplicationService extends Service {}
|
|
91
104
|
|
|
92
105
|
export class array extends type<'type' | 'elements'> { }
|
|
@@ -95,20 +108,6 @@ interface ArrayConstructable<T = any> {
|
|
|
95
108
|
new(...args: any[]): T[]
|
|
96
109
|
}
|
|
97
110
|
|
|
98
|
-
/**
|
|
99
|
-
* A subset of array-like methods, but not `ArrayLike`, as it does not expose `.length`.
|
|
100
|
-
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#iterable)
|
|
101
|
-
* @internal
|
|
102
|
-
* @since cds 7.9
|
|
103
|
-
*/
|
|
104
|
-
type _ArrayLike<T> = Iterable<T> & {
|
|
105
|
-
forEach: (handler: (element: T) => any) => void,
|
|
106
|
-
filter: (predicate: (element: T) => boolean) => Array<T>,
|
|
107
|
-
map: <R>(converter: (element: T) => R) => Array<R>,
|
|
108
|
-
some: (predicate: (element: T) => boolean) => boolean,
|
|
109
|
-
find: (predicate: (element: T) => boolean) => T | undefined,
|
|
110
|
-
}
|
|
111
|
-
|
|
112
111
|
class aspect<K extends kinds = 'aspect'> extends type<K> implements WithElements {
|
|
113
112
|
elements: Definitions<type<'type'>>
|
|
114
113
|
}
|
|
@@ -130,7 +129,6 @@ export class Association extends type {
|
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
interface Association_2 extends type_2 {
|
|
133
|
-
type: 'cds.Association' | 'cds.Composition'
|
|
134
132
|
target: FQN
|
|
135
133
|
|
|
136
134
|
/**
|
|
@@ -154,17 +152,17 @@ type Awaitable<T, I> = T & Promise<I>
|
|
|
154
152
|
class Axios {
|
|
155
153
|
|
|
156
154
|
get axios (): import('axios').AxiosInstance
|
|
157
|
-
get: import('axios').AxiosInstance['get']
|
|
155
|
+
get: import('axios').AxiosInstance['get'] & TaggedTemplateRequest
|
|
158
156
|
|
|
159
|
-
put: import('axios').AxiosInstance['put']
|
|
157
|
+
put: import('axios').AxiosInstance['put'] & TaggedTemplateRequest
|
|
160
158
|
|
|
161
|
-
post: import('axios').AxiosInstance['post']
|
|
159
|
+
post: import('axios').AxiosInstance['post'] & TaggedTemplateRequest
|
|
162
160
|
|
|
163
|
-
patch: import('axios').AxiosInstance['patch']
|
|
161
|
+
patch: import('axios').AxiosInstance['patch'] & TaggedTemplateRequest
|
|
164
162
|
|
|
165
|
-
delete: import('axios').AxiosInstance['delete']
|
|
163
|
+
delete: import('axios').AxiosInstance['delete'] & TaggedTemplateRequest
|
|
166
164
|
|
|
167
|
-
options: import('axios').AxiosInstance['options']
|
|
165
|
+
options: import('axios').AxiosInstance['options'] & TaggedTemplateRequest
|
|
168
166
|
|
|
169
167
|
get GET (): Axios['get']
|
|
170
168
|
|
|
@@ -197,6 +195,10 @@ export const builtin: {
|
|
|
197
195
|
types: Record<string, object>, // FIXME: value should be any class part of linked.classes
|
|
198
196
|
};
|
|
199
197
|
|
|
198
|
+
interface ByKey {
|
|
199
|
+
byKey (primaryKey?: PK): this
|
|
200
|
+
}
|
|
201
|
+
|
|
200
202
|
export type CDL = string
|
|
201
203
|
|
|
202
204
|
namespace cds {
|
|
@@ -212,6 +214,7 @@ namespace cds {
|
|
|
212
214
|
version,
|
|
213
215
|
home,
|
|
214
216
|
root,
|
|
217
|
+
cli,
|
|
215
218
|
requires,
|
|
216
219
|
extend,
|
|
217
220
|
lazify,
|
|
@@ -238,6 +241,7 @@ namespace cds {
|
|
|
238
241
|
cds_connect_options,
|
|
239
242
|
Middleswares,
|
|
240
243
|
middlewares,
|
|
244
|
+
app,
|
|
241
245
|
env,
|
|
242
246
|
_TODO,
|
|
243
247
|
get,
|
|
@@ -352,13 +356,16 @@ namespace cds {
|
|
|
352
356
|
ordering_term,
|
|
353
357
|
expr,
|
|
354
358
|
ref,
|
|
359
|
+
_segment,
|
|
360
|
+
_named,
|
|
355
361
|
val,
|
|
356
362
|
xpr,
|
|
357
363
|
_xpr,
|
|
358
364
|
operator,
|
|
359
365
|
function_call,
|
|
360
366
|
enum_literal,
|
|
361
|
-
expr_literal
|
|
367
|
+
expr_literal,
|
|
368
|
+
minify
|
|
362
369
|
}
|
|
363
370
|
}
|
|
364
371
|
|
|
@@ -370,7 +377,7 @@ export interface cds_connect_options {
|
|
|
370
377
|
impl?: string
|
|
371
378
|
service?: string
|
|
372
379
|
kind?: string
|
|
373
|
-
model?: string
|
|
380
|
+
model?: string | CSN
|
|
374
381
|
credentials?: object
|
|
375
382
|
}
|
|
376
383
|
|
|
@@ -440,10 +447,34 @@ namespace classes {
|
|
|
440
447
|
}
|
|
441
448
|
}
|
|
442
449
|
|
|
450
|
+
/**
|
|
451
|
+
* The parsed effective `cds` CLI command and arguments.
|
|
452
|
+
* May be undefined if not started from the `cds` CLI.
|
|
453
|
+
* @see https://cap.cloud.sap/docs/node.js/cds-facade#cds-cli
|
|
454
|
+
*/
|
|
455
|
+
export const cli: {
|
|
456
|
+
/** Basic command like `serve` */ command?: CliCommands,
|
|
457
|
+
/** Positional arguments */ argv?: string[],
|
|
458
|
+
/** Named arguments */ options?: Record<string, any>,
|
|
459
|
+
} | undefined;
|
|
460
|
+
|
|
461
|
+
type CliCommands = 'add' | 'build' | 'compile' | 'deploy' | 'import' | 'init' | 'serve' | (string & {})
|
|
462
|
+
|
|
443
463
|
type Column = { ref: [string], as?: string }
|
|
444
464
|
|
|
445
465
|
export type column_expr = UnionToIntersection<expr> & { as?: name, cast?: any, expand?: column_expr[], inline?: column_expr[] }
|
|
446
466
|
|
|
467
|
+
interface Columns<T, This = undefined> {
|
|
468
|
+
columns:
|
|
469
|
+
((...col: KeyOfSingular<T>[]) => This extends undefined ? this : This)
|
|
470
|
+
& ((col: KeyOfSingular<T>[]) => This extends undefined ? this : This)
|
|
471
|
+
& ((...col: (string | column_expr)[]) => This extends undefined ? this : This)
|
|
472
|
+
& ((col: (string | column_expr)[]) => This extends undefined ? this : This)
|
|
473
|
+
& TaggedTemplateQueryPart<This extends undefined ? this : This>
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
type ColumnValue = Primitive | Readonly<Primitive[]> | SELECT<any>
|
|
477
|
+
|
|
447
478
|
/**
|
|
448
479
|
* Provides a set of methods to parse a given model, query or expression.
|
|
449
480
|
* You can also use `cds.compile(csn).to('<output>')` as a fluent variant.
|
|
@@ -456,6 +487,7 @@ export const compile: {
|
|
|
456
487
|
for: {
|
|
457
488
|
odata (model: csn.CSN, o?: _options): csn.CSN,
|
|
458
489
|
sql (model: csn.CSN, o?: _options): csn.CSN,
|
|
490
|
+
nodejs (model: csn.CSN, o?: _options): linked.LinkedCSN,
|
|
459
491
|
},
|
|
460
492
|
to: {
|
|
461
493
|
parsed: {
|
|
@@ -575,8 +607,10 @@ interface Constructable<T = any> {
|
|
|
575
607
|
new(...args: any[]): T
|
|
576
608
|
}
|
|
577
609
|
|
|
578
|
-
class ConstructedQuery {
|
|
579
|
-
|
|
610
|
+
class ConstructedQuery<T> {
|
|
611
|
+
// branded type to break covariance for the subclasses
|
|
612
|
+
// that don't make explicit use of the generic. So `UPDATE<Books> !<: UPDATE<number>`
|
|
613
|
+
private _: T
|
|
580
614
|
then (_resolved: (x: any) => any, _rejected: (e: Error) => any): any
|
|
581
615
|
|
|
582
616
|
}
|
|
@@ -611,6 +645,8 @@ namespace CQN {
|
|
|
611
645
|
ordering_term,
|
|
612
646
|
expr,
|
|
613
647
|
ref,
|
|
648
|
+
_segment,
|
|
649
|
+
_named,
|
|
614
650
|
val,
|
|
615
651
|
xpr,
|
|
616
652
|
_xpr,
|
|
@@ -629,9 +665,10 @@ type CREATE_2 = { CREATE: {
|
|
|
629
665
|
}, }
|
|
630
666
|
export { CREATE_2 as CREATE }
|
|
631
667
|
|
|
632
|
-
class CREATE_3<T> extends ConstructedQuery {
|
|
668
|
+
class CREATE_3<T> extends ConstructedQuery<T> {
|
|
669
|
+
private constructor();
|
|
633
670
|
|
|
634
|
-
static entity (entity:
|
|
671
|
+
static entity (entity: EntityDescription): CREATE_3<EntityDescription>
|
|
635
672
|
|
|
636
673
|
CREATE: CQN.CREATE['CREATE']
|
|
637
674
|
|
|
@@ -743,7 +780,17 @@ export const db: DatabaseService;
|
|
|
743
780
|
*/
|
|
744
781
|
export function debug (name: string): undefined | Log
|
|
745
782
|
|
|
746
|
-
class Decimal extends Float {
|
|
783
|
+
class Decimal extends Float {
|
|
784
|
+
precision?: number
|
|
785
|
+
scale?: number
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Recursively excludes nullability from all properties of T.
|
|
790
|
+
*/
|
|
791
|
+
type DeepRequired<T> = {
|
|
792
|
+
[K in keyof T]: DeepRequired<T[K]>
|
|
793
|
+
} & Exclude<Required<T>, null>
|
|
747
794
|
|
|
748
795
|
export namespace default_2 {
|
|
749
796
|
export {
|
|
@@ -757,6 +804,7 @@ export namespace default_2 {
|
|
|
757
804
|
version,
|
|
758
805
|
home,
|
|
759
806
|
root,
|
|
807
|
+
cli,
|
|
760
808
|
requires,
|
|
761
809
|
extend,
|
|
762
810
|
lazify,
|
|
@@ -783,6 +831,7 @@ export namespace default_2 {
|
|
|
783
831
|
cds_connect_options,
|
|
784
832
|
Middleswares,
|
|
785
833
|
middlewares,
|
|
834
|
+
app,
|
|
786
835
|
env,
|
|
787
836
|
_TODO,
|
|
788
837
|
get,
|
|
@@ -897,13 +946,16 @@ export namespace default_2 {
|
|
|
897
946
|
ordering_term,
|
|
898
947
|
expr,
|
|
899
948
|
ref,
|
|
949
|
+
_segment,
|
|
950
|
+
_named,
|
|
900
951
|
val,
|
|
901
952
|
xpr,
|
|
902
953
|
_xpr,
|
|
903
954
|
operator,
|
|
904
955
|
function_call,
|
|
905
956
|
enum_literal,
|
|
906
|
-
expr_literal
|
|
957
|
+
expr_literal,
|
|
958
|
+
minify
|
|
907
959
|
}
|
|
908
960
|
}
|
|
909
961
|
|
|
@@ -928,22 +980,16 @@ type DELETE_2 = { DELETE: {
|
|
|
928
980
|
}, }
|
|
929
981
|
export { DELETE_2 as DELETE }
|
|
930
982
|
|
|
931
|
-
|
|
983
|
+
interface DELETE_3<T> extends Where<T>, And, ByKey {}
|
|
932
984
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
& ((entity: Target | ArrayConstructable, primaryKey?: PK) => DELETE_3<any>)
|
|
936
|
-
& ((subject: ref) => DELETE_3<any>)
|
|
937
|
-
|
|
938
|
-
byKey (primaryKey?: PK): this
|
|
985
|
+
class DELETE_3<T> extends ConstructedQuery<T> {
|
|
986
|
+
private constructor();
|
|
939
987
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
and (predicate: object): this
|
|
988
|
+
static from:
|
|
989
|
+
TaggedTemplateQueryPart<Awaitable<SELECT_3<unknown>, InstanceType<StaticAny>>>
|
|
990
|
+
& (<T>(entity: EntityDescription | ArrayConstructable, primaryKey?: PK) => DELETE_3<T>)
|
|
991
|
+
& ((subject: ref) => DELETE_3<_TODO_2>)
|
|
945
992
|
|
|
946
|
-
and (...expr: any[]): this
|
|
947
993
|
DELETE: CQN.DELETE['DELETE']
|
|
948
994
|
|
|
949
995
|
}
|
|
@@ -957,9 +1003,10 @@ type DROP_2 = { DROP: {
|
|
|
957
1003
|
}, }
|
|
958
1004
|
export { DROP_2 as DROP }
|
|
959
1005
|
|
|
960
|
-
class DROP_3<T> extends ConstructedQuery {
|
|
1006
|
+
class DROP_3<T> extends ConstructedQuery<T> {
|
|
1007
|
+
private constructor();
|
|
961
1008
|
|
|
962
|
-
static entity (entity:
|
|
1009
|
+
static entity (entity: EntityDescription): DROP_3<EntityDescription>
|
|
963
1010
|
|
|
964
1011
|
DROP: CQN.DROP['DROP']
|
|
965
1012
|
|
|
@@ -1010,15 +1057,22 @@ interface entity_2 extends Omit<struct_2, 'elements'> {
|
|
|
1010
1057
|
drafts?: entity_2
|
|
1011
1058
|
}
|
|
1012
1059
|
|
|
1060
|
+
type EntityDescription = entity | Definition | string
|
|
1061
|
+
|
|
1013
1062
|
type EntityElements = {
|
|
1014
1063
|
[name: string]: Element & {
|
|
1015
1064
|
key?: boolean,
|
|
1016
1065
|
virtual?: boolean,
|
|
1017
1066
|
unique?: boolean,
|
|
1018
1067
|
notNull?: boolean,
|
|
1068
|
+
precision?: number,
|
|
1069
|
+
scale?: number,
|
|
1070
|
+
length?: number,
|
|
1019
1071
|
},
|
|
1020
1072
|
}
|
|
1021
1073
|
|
|
1074
|
+
type Entries<T = any> = {[key:string]: T} | {[key:string]: T}
|
|
1075
|
+
|
|
1022
1076
|
export type enum_literal = { '#': string }
|
|
1023
1077
|
|
|
1024
1078
|
/**
|
|
@@ -1036,6 +1090,7 @@ export const env: {
|
|
|
1036
1090
|
folders: string[],
|
|
1037
1091
|
[key: string]: any,
|
|
1038
1092
|
},
|
|
1093
|
+
profiles: string[],
|
|
1039
1094
|
requires: env.Requires,
|
|
1040
1095
|
folders: {
|
|
1041
1096
|
app: string,
|
|
@@ -1087,23 +1142,50 @@ export namespace env {
|
|
|
1087
1142
|
binding?: Binding,
|
|
1088
1143
|
[key: string]: any,
|
|
1089
1144
|
},
|
|
1090
|
-
multitenancy
|
|
1145
|
+
multitenancy?: boolean | { kind: string, jobs: {
|
|
1091
1146
|
clusterSize: number,
|
|
1092
1147
|
workerSize: number,
|
|
1093
1148
|
t0: string,
|
|
1094
1149
|
[key: string]: any,
|
|
1095
1150
|
},},
|
|
1096
|
-
toggles
|
|
1097
|
-
extensibility
|
|
1151
|
+
toggles?: boolean,
|
|
1152
|
+
extensibility?: boolean | {
|
|
1098
1153
|
model: string[],
|
|
1099
1154
|
tenantCheckInterval: number,
|
|
1100
1155
|
[key: string]: any,
|
|
1101
1156
|
},
|
|
1102
|
-
messaging
|
|
1157
|
+
messaging?: {
|
|
1103
1158
|
kind: 'file-based-messaging' | 'redis-messaging' | 'local-messaging' | 'enterprise-messaging' | 'enterprise-messaging-shared' | string,
|
|
1104
1159
|
format: 'cloudevents' | string,
|
|
1105
1160
|
[key: string]: any,
|
|
1106
1161
|
},
|
|
1162
|
+
'cds.xt.SaasProvisioningService'?: {
|
|
1163
|
+
model: string,
|
|
1164
|
+
kind: string,
|
|
1165
|
+
alwaysUpgradeModel?: boolean,
|
|
1166
|
+
[key: string]: any,
|
|
1167
|
+
},
|
|
1168
|
+
'cds.xt.SmsProvisioningService'?: {
|
|
1169
|
+
model: string,
|
|
1170
|
+
kind: string,
|
|
1171
|
+
[key: string]: any,
|
|
1172
|
+
},
|
|
1173
|
+
'cds.xt.ExtensibilityService'?: {
|
|
1174
|
+
model: string,
|
|
1175
|
+
kind?: string,
|
|
1176
|
+
[key: string]: any,
|
|
1177
|
+
},
|
|
1178
|
+
'cds.xt.ModelProviderService'?: {
|
|
1179
|
+
model: string,
|
|
1180
|
+
root: string,
|
|
1181
|
+
kind?: string,
|
|
1182
|
+
[key: string]: any,
|
|
1183
|
+
},
|
|
1184
|
+
'cds.xt.DeploymentService'?: {
|
|
1185
|
+
model: string,
|
|
1186
|
+
kind?: string,
|
|
1187
|
+
[key: string]: any,
|
|
1188
|
+
},
|
|
1107
1189
|
[key: string]: any,
|
|
1108
1190
|
}
|
|
1109
1191
|
|
|
@@ -1164,6 +1246,8 @@ export class EventContext {
|
|
|
1164
1246
|
|
|
1165
1247
|
features?: { [key: string]: boolean }
|
|
1166
1248
|
|
|
1249
|
+
model: LinkedCSN
|
|
1250
|
+
|
|
1167
1251
|
}
|
|
1168
1252
|
|
|
1169
1253
|
export interface EventHandler {
|
|
@@ -1181,6 +1265,15 @@ export type expr = ref | val | xpr | function_call | SELECT_2
|
|
|
1181
1265
|
|
|
1182
1266
|
export type expr_literal = { '=': string }
|
|
1183
1267
|
|
|
1268
|
+
type Expression<E extends string | number | bigint | boolean> = `${E}${WS}${Op}${WS}`
|
|
1269
|
+
|
|
1270
|
+
type Expressions<L,E> = KVPairs<L, Expression<Exclude<keyof E, symbol>>, ColumnValue> extends true
|
|
1271
|
+
? L
|
|
1272
|
+
// fallback: allow for any string. Important for when user renamed properties
|
|
1273
|
+
: KVPairs<L, Expression<string>, ColumnValue> extends true
|
|
1274
|
+
? L
|
|
1275
|
+
: never
|
|
1276
|
+
|
|
1184
1277
|
/**
|
|
1185
1278
|
* Add aspects to a given object, for example:
|
|
1186
1279
|
*
|
|
@@ -1244,6 +1337,40 @@ export type function_call = { func: string, args: { [key: string]: any }[] }
|
|
|
1244
1337
|
*/
|
|
1245
1338
|
export function get (files: '*' | filename | filename[], o?: _options): Promise<csn.CSN>
|
|
1246
1339
|
|
|
1340
|
+
interface GroupBy {
|
|
1341
|
+
groupBy: TaggedTemplateQueryPart<this>
|
|
1342
|
+
& ((columns: Partial<{[column in KeyOfTarget<this extends ConstructedQuery<infer E> ? E : never, never>]: any}>) => this)
|
|
1343
|
+
& ((...expr: string[]) => this)
|
|
1344
|
+
& ((ref: ref) => this)
|
|
1345
|
+
// columns currently not being auto-completed due to complexity
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
interface Having<T> {
|
|
1349
|
+
having: HavingWhere<this, T>
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
type HavingWhere<This, E> =
|
|
1353
|
+
/**
|
|
1354
|
+
* @param predicate - An object with keys that are valid fields of the target entity and values that are compared to the respective fields.
|
|
1355
|
+
* @example
|
|
1356
|
+
* ```js
|
|
1357
|
+
* SELECT.from(Books).where({ ID: 42 }) // where ID is a valid field of Book
|
|
1358
|
+
* SELECT.from(Books).having({ ID: 42 }) // where ID is a valid field of Book
|
|
1359
|
+
* ```
|
|
1360
|
+
*/
|
|
1361
|
+
((predicate: Partial<{[column in KeyOfTarget<This extends ConstructedQuery<infer E> ? E : never, never>]: any}>) => This)
|
|
1362
|
+
/**
|
|
1363
|
+
* @param expr - An array of expressions, where every odd element is a valid field of the target entity and every even element is a value that is compared to the respective field.
|
|
1364
|
+
* @example
|
|
1365
|
+
* ```js
|
|
1366
|
+
* SELECT.from(Books).where(['ID =', 42 ]) // where ID is a valid, numerical field of Book
|
|
1367
|
+
* SELECT.from(Books).having(['ID =', 42 ]) // where ID is a valid, numerical field of Book
|
|
1368
|
+
*```
|
|
1369
|
+
*/
|
|
1370
|
+
& (<const L extends unknown[]>(...expr: Expressions<L, UnwrappedInstanceType<E>>) => This)
|
|
1371
|
+
& ((...expr: string[]) => This)
|
|
1372
|
+
& TaggedTemplateQueryPart<This>
|
|
1373
|
+
|
|
1247
1374
|
export const home: string;
|
|
1248
1375
|
|
|
1249
1376
|
export const insert: Service['insert'];
|
|
@@ -1258,31 +1385,22 @@ type INSERT_2 = { INSERT: {
|
|
|
1258
1385
|
}, }
|
|
1259
1386
|
export { INSERT_2 as INSERT }
|
|
1260
1387
|
|
|
1261
|
-
|
|
1388
|
+
interface INSERT_3<T> extends Columns<T>, InUpsert<T> {}
|
|
1262
1389
|
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
& ((entity: Target, entries?: object | object[]) => INSERT_3<any>)
|
|
1266
|
-
& (<T> (entity: Constructable<T>, entries?: object | object[]) => INSERT_3<T>)
|
|
1267
|
-
& (<T> (entity: T, entries?: T | object | object[]) => INSERT_3<T>)
|
|
1390
|
+
class INSERT_3<T> extends ConstructedQuery<T> {
|
|
1391
|
+
private constructor();
|
|
1268
1392
|
|
|
1269
|
-
into: (<T extends ArrayConstructable> (entity: T) =>
|
|
1270
|
-
& TaggedTemplateQueryPart<
|
|
1271
|
-
& ((entity:
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
entries (...entries: object[]): this
|
|
1276
|
-
|
|
1277
|
-
columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]): this
|
|
1278
|
-
|
|
1279
|
-
columns (...col: string[]): this
|
|
1280
|
-
|
|
1281
|
-
values (...val: any[]): this
|
|
1282
|
-
|
|
1283
|
-
rows (...row: any[]): this
|
|
1393
|
+
static into: (<T extends ArrayConstructable> (entity: T, entries?: Entries) => INSERT_3<SingularInstanceType<T>>)
|
|
1394
|
+
& (TaggedTemplateQueryPart<INSERT_3<unknown>>)
|
|
1395
|
+
& ((entity: EntityDescription, entries?: Entries) => INSERT_3<StaticAny>)
|
|
1396
|
+
& (<T> (entity: Constructable<T>, entries?: Entries) => INSERT_3<T>)
|
|
1397
|
+
& (<T> (entity: T, entries?: T | Entries) => INSERT_3<T>)
|
|
1284
1398
|
|
|
1399
|
+
/**
|
|
1400
|
+
* @deprected
|
|
1401
|
+
*/
|
|
1285
1402
|
as (select: SELECT_3<T>): this
|
|
1403
|
+
from (select: SELECT_3<T>): this
|
|
1286
1404
|
INSERT: CQN.INSERT['INSERT']
|
|
1287
1405
|
|
|
1288
1406
|
}
|
|
@@ -1299,53 +1417,70 @@ type Intersect<T extends readonly unknown[]> = T extends [infer Head, ...infer T
|
|
|
1299
1417
|
? Head & Intersect<Tail>
|
|
1300
1418
|
: unknown
|
|
1301
1419
|
|
|
1420
|
+
interface InUpsert<T> {
|
|
1421
|
+
data (block: (e: T) => void): this
|
|
1422
|
+
|
|
1423
|
+
entries (...entries: object[]): this
|
|
1424
|
+
|
|
1425
|
+
values (...val: (null | Primitive)[]): this
|
|
1426
|
+
values (val: (null | Primitive)[]): this
|
|
1427
|
+
|
|
1428
|
+
rows (...row: (null | Primitive)[][]): this
|
|
1429
|
+
rows (row: (null | Primitive)[][]): this
|
|
1430
|
+
|
|
1431
|
+
into: (<T extends ArrayConstructable> (entity: T) => this)
|
|
1432
|
+
& TaggedTemplateQueryPart<this>
|
|
1433
|
+
& ((entity: EntityDescription) => this)
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1302
1436
|
/**
|
|
1303
1437
|
* Object structure that exposes both array-like and object-like behaviour.
|
|
1304
1438
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#iterable)
|
|
1305
1439
|
*/
|
|
1306
|
-
|
|
1440
|
+
|
|
1441
|
+
type IterableMap<T> = { [name: string]: T } & Iterable<T>
|
|
1307
1442
|
|
|
1308
1443
|
type JSON_2 = string
|
|
1309
1444
|
export { JSON_2 as JSON }
|
|
1310
1445
|
|
|
1311
1446
|
export type Key = number | string | any
|
|
1312
1447
|
|
|
1313
|
-
type
|
|
1448
|
+
type KeyOfSingular<T> = Unwrap<T> extends T
|
|
1449
|
+
? keyof T
|
|
1450
|
+
: keyof Unwrap<T>
|
|
1451
|
+
|
|
1452
|
+
type KeyOfTarget<T, F = string | column_expr> = T extends ConstructedQuery<infer U>
|
|
1453
|
+
? (U extends ArrayConstructable // Books
|
|
1454
|
+
? keyof SingularInstanceType<U>
|
|
1455
|
+
: U extends Constructable // Book
|
|
1456
|
+
? keyof InstanceType<U>
|
|
1457
|
+
: F)
|
|
1458
|
+
: F
|
|
1459
|
+
|
|
1460
|
+
type kinds = 'aspect' | 'entity' | 'type' | 'event' | 'action' | 'function' | 'service' | 'context' | 'elements' | 'element'
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* T is a tuple of alternating K, V pairs -> true, else false
|
|
1464
|
+
* Allows for variadic parameter lists with alternating expecing types,
|
|
1465
|
+
* like we have in cql.SELECT.where
|
|
1466
|
+
*/
|
|
1467
|
+
type KVPairs<T,K,V> = T extends []
|
|
1468
|
+
? true
|
|
1469
|
+
: T extends [K, V, ...infer R]
|
|
1470
|
+
? KVPairs<R,K,V>
|
|
1471
|
+
: false
|
|
1314
1472
|
|
|
1315
1473
|
class LargeBinary extends Binary { }
|
|
1316
1474
|
|
|
1317
1475
|
class LargeString extends String_2 { }
|
|
1318
1476
|
|
|
1319
1477
|
/**
|
|
1320
|
-
*
|
|
1321
|
-
* of static requires. Example:
|
|
1322
|
-
*
|
|
1323
|
-
* @example
|
|
1324
|
-
* ```js
|
|
1325
|
-
* require = lazify (module) //> turns require into a lazy one
|
|
1326
|
-
* const facade = module.exports = {
|
|
1327
|
-
* sub: require ('./sub-module')
|
|
1328
|
-
* })
|
|
1329
|
-
* ```
|
|
1330
|
-
*
|
|
1331
|
-
* The first usage of `facade.sub` will load the sub module
|
|
1332
|
-
* using standard Node.js's `module.require` functions.
|
|
1478
|
+
* @deprecated since version 8.1
|
|
1333
1479
|
*/
|
|
1334
1480
|
export function lazified<T> (target: T): T
|
|
1335
1481
|
|
|
1336
1482
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
* of static requires. Example:
|
|
1339
|
-
*
|
|
1340
|
-
* @example
|
|
1341
|
-
* ```js
|
|
1342
|
-
* const facade = lazify ({
|
|
1343
|
-
* sub: lazy => require ('./sub-module')
|
|
1344
|
-
* })
|
|
1345
|
-
* ```
|
|
1346
|
-
*
|
|
1347
|
-
* The first usage of `facade.sub` will load the sub module
|
|
1348
|
-
* using standard Node.js's `module.require` functions.
|
|
1483
|
+
* @deprecated since version 8.1
|
|
1349
1484
|
*/
|
|
1350
1485
|
export function lazify<T> (target: T): T
|
|
1351
1486
|
|
|
@@ -1355,6 +1490,11 @@ enum levels {
|
|
|
1355
1490
|
SILENT = 0, ERROR = 1, WARN = 2, INFO = 3, DEBUG = 4, TRACE = 5, SILLY = 5, VERBOSE = 5
|
|
1356
1491
|
}
|
|
1357
1492
|
|
|
1493
|
+
interface Limit {
|
|
1494
|
+
limit: TaggedTemplateQueryPart<this>
|
|
1495
|
+
& ((rows: number, offset?: number) => this)
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1358
1498
|
export const linked: {
|
|
1359
1499
|
|
|
1360
1500
|
/**
|
|
@@ -1680,6 +1820,12 @@ export const middlewares: {
|
|
|
1680
1820
|
add: (middleware: import('express').RequestHandler, pos?: XOR<XOR<{ at: number }, { after: Middleswares }>, { before: Middleswares }>) => void,
|
|
1681
1821
|
};
|
|
1682
1822
|
|
|
1823
|
+
/**
|
|
1824
|
+
* Minifies a given CSN model by removing all unused1 types and aspects, as well all entities tagged with `@cds.persistence.skip:'if-unused'`
|
|
1825
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-compile#cds-minify)
|
|
1826
|
+
*/
|
|
1827
|
+
export function minify (model: CSN): CSN
|
|
1828
|
+
|
|
1683
1829
|
/**
|
|
1684
1830
|
* Allows arbitrary property access. Can be used for explicitly casting
|
|
1685
1831
|
* classes you have added {@link mixin}s to.
|
|
@@ -1777,6 +1923,9 @@ namespace models {
|
|
|
1777
1923
|
/** @private */
|
|
1778
1924
|
export type name = string
|
|
1779
1925
|
|
|
1926
|
+
/** @private */
|
|
1927
|
+
export type _named = { [key: name]: expr }
|
|
1928
|
+
|
|
1780
1929
|
const number: typeof number_;
|
|
1781
1930
|
|
|
1782
1931
|
class number_ extends scalar { }
|
|
@@ -1849,6 +1998,8 @@ export interface OnEventHandler {
|
|
|
1849
1998
|
(req: Request_2, next: Function): Promise<any> | any | void
|
|
1850
1999
|
}
|
|
1851
2000
|
|
|
2001
|
+
type Op = '=' | '<' | '>' | '<=' | '>=' | '!=' | 'in' | 'like'
|
|
2002
|
+
|
|
1852
2003
|
/** @private */
|
|
1853
2004
|
export type operator = string
|
|
1854
2005
|
|
|
@@ -1860,6 +2011,12 @@ export type _options = {
|
|
|
1860
2011
|
odata?: _odata_options,
|
|
1861
2012
|
} | _flavor
|
|
1862
2013
|
|
|
2014
|
+
interface OrderBy<T> {
|
|
2015
|
+
orderBy: TaggedTemplateQueryPart<this>
|
|
2016
|
+
& ((...col: KeyOfSingular<T>[]) => this)
|
|
2017
|
+
& ((...expr: string[]) => this)
|
|
2018
|
+
}
|
|
2019
|
+
|
|
1863
2020
|
/** @private */
|
|
1864
2021
|
export type ordering_term = expr & { sort?: 'asc' | 'desc', nulls?: 'first' | 'last' }
|
|
1865
2022
|
|
|
@@ -1885,7 +2042,7 @@ export { Partial_2 as Partial }
|
|
|
1885
2042
|
|
|
1886
2043
|
type PK = number | string | object
|
|
1887
2044
|
|
|
1888
|
-
type
|
|
2045
|
+
type PluralInstanceType<T extends Constructable> = Array<InstanceType<T>>
|
|
1889
2046
|
|
|
1890
2047
|
export type predicate = UnionsToIntersections<_xpr>
|
|
1891
2048
|
|
|
@@ -1905,7 +2062,7 @@ export class Privileged extends User {
|
|
|
1905
2062
|
|
|
1906
2063
|
}
|
|
1907
2064
|
|
|
1908
|
-
type Projection<T> = (e: QLExtensions<T extends ArrayConstructable ?
|
|
2065
|
+
type Projection<T> = (e: QLExtensions<T extends ArrayConstructable ? SingularInstanceType<T> : T>) => void
|
|
1909
2066
|
|
|
1910
2067
|
/**
|
|
1911
2068
|
* @alpha
|
|
@@ -1917,42 +2074,32 @@ class QL<T> {
|
|
|
1917
2074
|
|
|
1918
2075
|
SELECT: StaticSELECT<T>
|
|
1919
2076
|
|
|
1920
|
-
INSERT: typeof INSERT_3
|
|
1921
|
-
& ((...entries: object[]) => INSERT_3<
|
|
2077
|
+
INSERT: typeof INSERT_3<T>
|
|
2078
|
+
& ((...entries: object[]) => INSERT_3<T>) & ((entries: object[]) => INSERT_3<T>)
|
|
1922
2079
|
|
|
1923
2080
|
UPSERT: typeof UPSERT_3
|
|
1924
|
-
& ((...entries: object[]) => UPSERT_3<
|
|
2081
|
+
& ((...entries: object[]) => UPSERT_3<T>) & ((entries: object[]) => UPSERT_3<T>)
|
|
1925
2082
|
|
|
1926
|
-
UPDATE: typeof UPDATE_3
|
|
1927
|
-
& typeof UPDATE_3.entity
|
|
2083
|
+
UPDATE: typeof UPDATE_3<T>
|
|
2084
|
+
& typeof UPDATE_3.entity<_TODO_2>
|
|
1928
2085
|
|
|
1929
|
-
DELETE: typeof DELETE_3
|
|
1930
|
-
& ((...entries: object[]) => DELETE_3<
|
|
2086
|
+
DELETE: typeof DELETE_3<T>
|
|
2087
|
+
& ((...entries: object[]) => DELETE_3<T>) & ((entries: object[]) => DELETE_3<T>)
|
|
1931
2088
|
|
|
1932
|
-
CREATE: typeof CREATE_3
|
|
2089
|
+
CREATE: typeof CREATE_3<T>
|
|
1933
2090
|
|
|
1934
|
-
DROP: typeof DROP_3
|
|
2091
|
+
DROP: typeof DROP_3<T>
|
|
1935
2092
|
|
|
1936
2093
|
}
|
|
1937
2094
|
|
|
1938
2095
|
namespace ql {
|
|
1939
2096
|
export {
|
|
1940
2097
|
Query_2 as Query,
|
|
1941
|
-
ConstructedQuery,
|
|
1942
|
-
PK,
|
|
1943
|
-
Primitive,
|
|
1944
2098
|
QLExtensions,
|
|
1945
|
-
|
|
1946
|
-
QLExtensions_,
|
|
1947
|
-
Subqueryable,
|
|
1948
|
-
Projection,
|
|
1949
|
-
Awaitable,
|
|
2099
|
+
ConstructedQuery,
|
|
1950
2100
|
StaticSELECT,
|
|
1951
2101
|
QL,
|
|
1952
|
-
TaggedTemplateQueryPart,
|
|
1953
2102
|
SELECT_3 as SELECT,
|
|
1954
|
-
SELECT_one,
|
|
1955
|
-
SELECT_from,
|
|
1956
2103
|
INSERT_3 as INSERT,
|
|
1957
2104
|
UPSERT_3 as UPSERT,
|
|
1958
2105
|
DELETE_3 as DELETE,
|
|
@@ -1963,35 +2110,20 @@ namespace ql {
|
|
|
1963
2110
|
}
|
|
1964
2111
|
export { ql }
|
|
1965
2112
|
|
|
1966
|
-
export type QLExtensions<T> = T extends QLExtensions_<any> ? T : QLExtensions_<T
|
|
2113
|
+
export type QLExtensions<T> = T extends QLExtensions_<any> ? T : QLExtensions_<DeepRequired<T>>
|
|
1967
2114
|
|
|
1968
2115
|
/**
|
|
1969
2116
|
* QLExtensions are properties that are attached to entities in CQL contexts.
|
|
1970
2117
|
* They are passed down to all properties recursively.
|
|
1971
2118
|
*/
|
|
1972
|
-
type
|
|
1973
|
-
|
|
1974
|
-
} &
|
|
1975
|
-
|
|
1976
|
-
/**
|
|
1977
|
-
* Alias for this attribute.
|
|
1978
|
-
*/
|
|
1979
|
-
as: (alias: string) => void,
|
|
1980
|
-
|
|
1981
|
-
/**
|
|
1982
|
-
* Accesses any nested attribute based on a [path](https://cap.cloud.sap/cap/docs/java/query-api#path-expressions):
|
|
1983
|
-
* `X.get('a.b.c.d')`. Note that you will not receive
|
|
1984
|
-
* proper typing after this call.
|
|
1985
|
-
* To still have access to typed results, use
|
|
1986
|
-
* `X.a().b().c().d()` instead.
|
|
1987
|
-
*/
|
|
1988
|
-
get: (path: string) => any,
|
|
1989
|
-
|
|
1990
|
-
// have to exclude undefined from the type, or we'd end up with a distribution of Subqueryable
|
|
1991
|
-
// over T and undefined, which gives us zero code completion within the callable.
|
|
1992
|
-
} & Subqueryable<Exclude<T, undefined>>
|
|
2119
|
+
// have to exclude undefined from the type, or we'd end up with a distribution of Subqueryable
|
|
2120
|
+
// over T and undefined, which gives us zero code completion within the callable.
|
|
2121
|
+
type QLExtensions_<T> = { [Key in keyof T]: QLExtensions<T[Key]> } & QueryArtefact & Subqueryable<Exclude<T, undefined>>
|
|
1993
2122
|
|
|
1994
|
-
export type Query =
|
|
2123
|
+
export type Query = {
|
|
2124
|
+
/** @since 7.4.0 */
|
|
2125
|
+
elements: { [key: string]: Definition },
|
|
2126
|
+
} & Partial<SELECT_2 & INSERT_2 & UPDATE_2 & DELETE_2 & CREATE_2 & DROP_2 & UPSERT_2>
|
|
1995
2127
|
|
|
1996
2128
|
type Query_2 = CQN.Query
|
|
1997
2129
|
|
|
@@ -2043,7 +2175,7 @@ export class QueryAPI {
|
|
|
2043
2175
|
* @see [docs](https://cap.cloud.sap/docs/node.js/core-services#crud-style-api)
|
|
2044
2176
|
*/
|
|
2045
2177
|
run: {
|
|
2046
|
-
(query: ConstructedQuery | ConstructedQuery[]): Promise<ResultSet | any>,
|
|
2178
|
+
(query: ConstructedQuery<_TODO_2> | ConstructedQuery<_TODO_2>[]): Promise<ResultSet | any>,
|
|
2047
2179
|
(query: Query_2): Promise<ResultSet | any>,
|
|
2048
2180
|
(query: string, args?: any[] | object): Promise<ResultSet | any>,
|
|
2049
2181
|
}
|
|
@@ -2083,10 +2215,28 @@ export class QueryAPI {
|
|
|
2083
2215
|
|
|
2084
2216
|
}
|
|
2085
2217
|
|
|
2218
|
+
type QueryArtefact = {
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
* Alias for this attribute.
|
|
2222
|
+
*/
|
|
2223
|
+
as (alias: string): void,
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* Accesses any nested attribute based on a [path](https://cap.cloud.sap/cap/docs/java/query-api#path-expressions):
|
|
2227
|
+
* `X.get('a.b.c.d')`. Note that you will not receive
|
|
2228
|
+
* proper typing after this call.
|
|
2229
|
+
* To still have access to typed results, use
|
|
2230
|
+
* `X.a().b().c().d()` instead.
|
|
2231
|
+
*/
|
|
2232
|
+
get (path: string): any,
|
|
2233
|
+
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2086
2236
|
export const read: Service['read'];
|
|
2087
2237
|
|
|
2088
2238
|
/** @private */
|
|
2089
|
-
export type ref = { ref:
|
|
2239
|
+
export type ref = { ref: _segment[] }
|
|
2090
2240
|
|
|
2091
2241
|
/**
|
|
2092
2242
|
* Turns the given plain CSN model into a reflected model
|
|
@@ -2191,6 +2341,17 @@ class scalar extends type { }
|
|
|
2191
2341
|
|
|
2192
2342
|
type Scalarise<A> = A extends Array<infer N> ? N : A
|
|
2193
2343
|
|
|
2344
|
+
/** @private */
|
|
2345
|
+
export type _segment = name | {
|
|
2346
|
+
id?: string,
|
|
2347
|
+
where?: _xpr,
|
|
2348
|
+
args?: _named,
|
|
2349
|
+
groupBy: expr[],
|
|
2350
|
+
having: _xpr,
|
|
2351
|
+
orderBy: ordering_term[],
|
|
2352
|
+
limit: { rows: expr, offset: expr },
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2194
2355
|
type SELECT_2 = { SELECT: {
|
|
2195
2356
|
distinct?: true,
|
|
2196
2357
|
one?: boolean,
|
|
@@ -2206,44 +2367,25 @@ type SELECT_2 = { SELECT: {
|
|
|
2206
2367
|
}, }
|
|
2207
2368
|
export { SELECT_2 as SELECT }
|
|
2208
2369
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2370
|
+
interface SELECT_3<T> extends Where<T>, And, Having<T>, GroupBy, OrderBy<T>, Limit {
|
|
2371
|
+
// overload specific to SELECT
|
|
2372
|
+
columns: Columns<T, SELECT_3<T>>['columns'] & ((projection: Projection<T>) => this)
|
|
2373
|
+
}
|
|
2212
2374
|
|
|
2213
|
-
|
|
2375
|
+
class SELECT_3<T> extends ConstructedQuery<T> {
|
|
2376
|
+
private constructor();
|
|
2214
2377
|
|
|
2215
|
-
static from:
|
|
2378
|
+
static one: SELECT_one & { from: SELECT_one } & { localized: SELECT_one }
|
|
2216
2379
|
|
|
2217
|
-
|
|
2218
|
-
& ((entity: Target, primaryKey?: PK, projection?: Projection<unknown>) => this)
|
|
2380
|
+
static distinct: typeof SELECT_3<StaticAny>
|
|
2219
2381
|
|
|
2220
|
-
|
|
2221
|
-
columns: TaggedTemplateQueryPart<this>
|
|
2222
|
-
& ((projection: Projection<T>) => this)
|
|
2223
|
-
& ((...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) => this)
|
|
2224
|
-
& ((...col: (string | column_expr)[]) => this)
|
|
2225
|
-
& ((col: (string | column_expr)[]) => this)
|
|
2382
|
+
static from: SELECT_from & { localized: SELECT_from }
|
|
2226
2383
|
|
|
2227
|
-
|
|
2228
|
-
& ((predicate: object) => this)
|
|
2229
|
-
& ((...expr: any[]) => this)
|
|
2384
|
+
static localized: SELECT_from & { from: SELECT_from }
|
|
2230
2385
|
|
|
2231
|
-
|
|
2232
|
-
&
|
|
2233
|
-
& ((
|
|
2234
|
-
|
|
2235
|
-
having: TaggedTemplateQueryPart<this>
|
|
2236
|
-
& ((...expr: string[]) => this)
|
|
2237
|
-
& ((predicate: object) => this)
|
|
2238
|
-
|
|
2239
|
-
groupBy: TaggedTemplateQueryPart<this>
|
|
2240
|
-
& ((...expr: string[]) => this)
|
|
2241
|
-
|
|
2242
|
-
orderBy: TaggedTemplateQueryPart<this>
|
|
2243
|
-
& ((...expr: string[]) => this)
|
|
2244
|
-
|
|
2245
|
-
limit: TaggedTemplateQueryPart<this>
|
|
2246
|
-
& ((rows: number, offset?: number) => this)
|
|
2386
|
+
from: SELECT_from
|
|
2387
|
+
& TaggedTemplateQueryPart<this>
|
|
2388
|
+
& ((entity: EntityDescription, primaryKey?: PK, projection?: Projection<unknown>) => this)
|
|
2247
2389
|
|
|
2248
2390
|
forShareLock (): this
|
|
2249
2391
|
|
|
@@ -2274,52 +2416,61 @@ class SELECT_3<T> extends ConstructedQuery {
|
|
|
2274
2416
|
|
|
2275
2417
|
type SELECT_from =
|
|
2276
2418
|
// tagged template
|
|
2277
|
-
TaggedTemplateQueryPart<Awaitable<SELECT_3<
|
|
2419
|
+
TaggedTemplateQueryPart<Awaitable<SELECT_3<_TODO_2>, InstanceType<_TODO_2>>>
|
|
2278
2420
|
&
|
|
2279
2421
|
// calling with class
|
|
2280
|
-
(<
|
|
2281
|
-
(entityType:
|
|
2282
|
-
=> Awaitable<SELECT_3<
|
|
2422
|
+
(<E extends ArrayConstructable>
|
|
2423
|
+
(entityType: E, projection?: Projection<QLExtensions<SingularInstanceType<E>>>)
|
|
2424
|
+
=> Awaitable<SELECT_3<E>, InstanceType<E>>)
|
|
2283
2425
|
&
|
|
2284
|
-
(<
|
|
2285
|
-
(entityType:
|
|
2286
|
-
=> Awaitable<SELECT_3<
|
|
2426
|
+
(<E extends ArrayConstructable>
|
|
2427
|
+
(entityType: E, primaryKey: PK, projection?: Projection<SingularInstanceType<E>>)
|
|
2428
|
+
=> Awaitable<SELECT_3<SingularInstanceType<E>>, SingularInstanceType<E>>) // when specifying a key, we expect a single element as result
|
|
2287
2429
|
// calling with definition
|
|
2288
|
-
& ((entity:
|
|
2430
|
+
& (<T>(entity: EntityDescription, primaryKey?: PK, projection?: Projection<T>) => SELECT_3<T>)
|
|
2289
2431
|
// calling with concrete list
|
|
2290
2432
|
& (<T> (entity: T[], projection?: Projection<T>) => SELECT_3<T> & Promise<T[]>)
|
|
2291
2433
|
& (<T> (entity: T[], primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
|
|
2292
|
-
& ((subject: ref) => SELECT_3<
|
|
2434
|
+
& ((subject: ref) => SELECT_3<_TODO_2>)
|
|
2293
2435
|
// put these overloads at the very end, as they would also match the above
|
|
2294
2436
|
// We expect these to be the overloads for scalars since we covered arrays above -> wrap them back in Array
|
|
2295
|
-
& (<T extends Constructable
|
|
2437
|
+
& (<T extends Constructable>(
|
|
2438
|
+
entityType: T,
|
|
2439
|
+
columns: string[] // could be keyof in the future
|
|
2440
|
+
) => Awaitable<SELECT_3<PluralInstanceType<T>>, PluralInstanceType<T>>)
|
|
2441
|
+
& (<T extends Constructable>(
|
|
2442
|
+
entityType: T,
|
|
2443
|
+
primaryKey: PK,
|
|
2444
|
+
columns: string[] // could be keyof in the future
|
|
2445
|
+
) => Awaitable<SELECT_3<InstanceType<T>>, InstanceType<T>>)
|
|
2446
|
+
& (<T extends Constructable>(
|
|
2296
2447
|
entityType: T,
|
|
2297
2448
|
projection?: Projection<InstanceType<T>>
|
|
2298
|
-
) => Awaitable<SELECT_3<
|
|
2299
|
-
& (<T extends Constructable
|
|
2449
|
+
) => Awaitable<SELECT_3<PluralInstanceType<T>>, PluralInstanceType<T>>)
|
|
2450
|
+
& (<T extends Constructable>(
|
|
2300
2451
|
entityType: T,
|
|
2301
2452
|
primaryKey: PK,
|
|
2302
2453
|
projection?: Projection<InstanceType<T>>
|
|
2303
|
-
) => Awaitable<SELECT_3<
|
|
2454
|
+
) => Awaitable<SELECT_3<InstanceType<T>>, InstanceType<T>>)
|
|
2304
2455
|
|
|
2305
2456
|
type SELECT_one =
|
|
2306
|
-
TaggedTemplateQueryPart<Awaitable<SELECT_3<
|
|
2457
|
+
TaggedTemplateQueryPart<Awaitable<SELECT_3<_TODO_2>, InstanceType<_TODO_2>>>
|
|
2307
2458
|
&
|
|
2308
2459
|
// calling with class
|
|
2309
|
-
(<T extends ArrayConstructable
|
|
2310
|
-
(entityType: T, projection?: Projection<QLExtensions<
|
|
2311
|
-
=> Awaitable<SELECT_3<
|
|
2460
|
+
(<T extends ArrayConstructable>
|
|
2461
|
+
(entityType: T, projection?: Projection<QLExtensions<SingularInstanceType<T>>>)
|
|
2462
|
+
=> Awaitable<SELECT_3<SingularInstanceType<T>>, SingularInstanceType<T>>)
|
|
2312
2463
|
&
|
|
2313
|
-
(<T extends ArrayConstructable
|
|
2314
|
-
(entityType: T, primaryKey: PK, projection?: Projection<QLExtensions<
|
|
2315
|
-
=> Awaitable<SELECT_3<
|
|
2464
|
+
(<T extends ArrayConstructable>
|
|
2465
|
+
(entityType: T, primaryKey: PK, projection?: Projection<QLExtensions<SingularInstanceType<T>>>)
|
|
2466
|
+
=> Awaitable<SELECT_3<SingularInstanceType<T>>, SingularInstanceType<T>>)
|
|
2316
2467
|
|
|
2317
|
-
& ((entity:
|
|
2468
|
+
& ((entity: EntityDescription, primaryKey?: PK, projection?: Projection<unknown>) => SELECT_3<_TODO_2>)
|
|
2318
2469
|
& (<T> (entity: T[], projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
|
|
2319
2470
|
& (<T> (entity: T[], primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
|
|
2320
2471
|
& (<T> (entity: { new(): T }, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
|
|
2321
2472
|
& (<T> (entity: { new(): T }, primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
|
|
2322
|
-
& ((subject: ref) => SELECT_3<
|
|
2473
|
+
& ((subject: ref) => SELECT_3<_TODO_2>)
|
|
2323
2474
|
|
|
2324
2475
|
/**
|
|
2325
2476
|
* Constructs service providers from respective service definitions
|
|
@@ -2415,7 +2566,7 @@ export class Service extends QueryAPI {
|
|
|
2415
2566
|
<T = any>(event: types.event, path: string, data?: object, headers?: object): Promise<T>,
|
|
2416
2567
|
<T = any>(event: types.event, data?: object, headers?: object): Promise<T>,
|
|
2417
2568
|
<T = any>(details: { event: types.event, data?: object, headers?: object }): Promise<T>,
|
|
2418
|
-
<T = any>(details: { query: ConstructedQuery
|
|
2569
|
+
<T = any>(details: { query: ConstructedQuery<T>, data?: object, headers?: object }): Promise<T>,
|
|
2419
2570
|
<T = any>(details: { method: types.eventName, path: string, data?: object, headers?: object }): Promise<T>,
|
|
2420
2571
|
<T = any>(details: { event: types.eventName, entity: linked_2.Definition | string, data?: object, params?: object, headers?: object }): Promise<T>,
|
|
2421
2572
|
}
|
|
@@ -2462,8 +2613,8 @@ export class Service extends QueryAPI {
|
|
|
2462
2613
|
// Provider API
|
|
2463
2614
|
prepend (fn: ServiceImpl): this
|
|
2464
2615
|
|
|
2465
|
-
on<T extends ArrayConstructable>(eve: types.event, entity: T, handler: CRUDEventHandler.On<Unwrap<T>>): this
|
|
2466
|
-
on<T extends Constructable>(eve: types.event, entity: T, handler: CRUDEventHandler.On<InstanceType<T>>): this
|
|
2616
|
+
on<T extends ArrayConstructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.On<Unwrap<T>>): this
|
|
2617
|
+
on<T extends Constructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.On<InstanceType<T>>): this
|
|
2467
2618
|
on<F extends CdsFunction>(boundAction: F, service: string, handler: ActionEventHandler<F['__parameters'], void | Error | F['__returns']>): this
|
|
2468
2619
|
on<F extends CdsFunction>(unboundAction: F, handler: ActionEventHandler<F['__parameters'], void | Error | F['__returns']>): this
|
|
2469
2620
|
on (eve: types.event, entity: types.target, handler: OnEventHandler): this
|
|
@@ -2476,8 +2627,8 @@ export class Service extends QueryAPI {
|
|
|
2476
2627
|
// onFailed (eve: types.Events, handler: types.EventHandler): this
|
|
2477
2628
|
before<F extends CdsFunction>(boundAction: F, service: string, handler: CRUDEventHandler.Before<F['__parameters'], void | Error | F['__returns']>): this
|
|
2478
2629
|
before<F extends CdsFunction>(unboundAction: F, handler: CRUDEventHandler.Before<F['__parameters'], void | Error | F['__returns']>): this
|
|
2479
|
-
before<T extends ArrayConstructable>(eve: types.event, entity: T, handler: CRUDEventHandler.Before<Unwrap<T>>): this
|
|
2480
|
-
before<T extends Constructable>(eve: types.event, entity: T, handler: CRUDEventHandler.Before<InstanceType<T>>): this
|
|
2630
|
+
before<T extends ArrayConstructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.Before<Unwrap<T>>): this
|
|
2631
|
+
before<T extends Constructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.Before<InstanceType<T>>): this
|
|
2481
2632
|
before (eve: types.event, entity: types.target, handler: EventHandler): this
|
|
2482
2633
|
before (eve: types.event, handler: EventHandler): this
|
|
2483
2634
|
|
|
@@ -2486,11 +2637,11 @@ export class Service extends QueryAPI {
|
|
|
2486
2637
|
// (3) check if T is scalar -> use T directly
|
|
2487
2638
|
// this streamlines that in _most_ cases, handlers will receive a single object.
|
|
2488
2639
|
// _Except_ for after.read handlers (1), which will change its inflection based on T.
|
|
2489
|
-
after<T extends ArrayConstructable>(event: 'READ', entity: T, handler: CRUDEventHandler.After<InstanceType<T>>): this
|
|
2490
|
-
after<T extends ArrayConstructable>(event: 'each', entity: T, handler: CRUDEventHandler.After<Unwrap<T>>): this
|
|
2491
|
-
after<T extends Constructable>(event: 'READ' | 'each', entity: T, handler: CRUDEventHandler.After<InstanceType<T>>): this
|
|
2492
|
-
after<T extends ArrayConstructable>(eve: types.event, entity: T, handler: CRUDEventHandler.After<Unwrap<T>>): this
|
|
2493
|
-
after<T extends Constructable>(eve: types.event, entity: T, handler: CRUDEventHandler.After<InstanceType<T>>): this
|
|
2640
|
+
after<T extends ArrayConstructable>(event: 'READ', entity: T | T[], handler: CRUDEventHandler.After<InstanceType<T>>): this
|
|
2641
|
+
after<T extends ArrayConstructable>(event: 'each', entity: T | T[], handler: CRUDEventHandler.After<Unwrap<T>>): this
|
|
2642
|
+
after<T extends Constructable>(event: 'READ' | 'each', entity: T | T[], handler: CRUDEventHandler.After<InstanceType<T>>): this
|
|
2643
|
+
after<T extends ArrayConstructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.After<Unwrap<T>>): this
|
|
2644
|
+
after<T extends Constructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.After<InstanceType<T>>): this
|
|
2494
2645
|
after<F extends CdsFunction>(boundAction: F, service: string, handler: CRUDEventHandler.After<F['__parameters'], void | Error | F['__returns']>): this
|
|
2495
2646
|
after<F extends CdsFunction>(unboundAction: F, handler: CRUDEventHandler.After<F['__parameters'], void | Error | F['__returns']>): this
|
|
2496
2647
|
after (eve: types.event, entity: types.target, handler: ResultsHandler): this
|
|
@@ -2556,7 +2707,7 @@ export interface ServiceImpl {
|
|
|
2556
2707
|
*/
|
|
2557
2708
|
export const services: cds_services;
|
|
2558
2709
|
|
|
2559
|
-
type
|
|
2710
|
+
type SingularInstanceType<T extends ArrayConstructable> = InstanceType<T>[number]
|
|
2560
2711
|
|
|
2561
2712
|
/** @private */
|
|
2562
2713
|
export type source = UnionToIntersection<ref | SELECT_2> & { as?: name, join?: name, on?: xpr }
|
|
@@ -2593,11 +2744,11 @@ export type SpawnOptions = {
|
|
|
2593
2744
|
|
|
2594
2745
|
export type SQL = string
|
|
2595
2746
|
|
|
2596
|
-
type
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
&
|
|
2600
|
-
&
|
|
2747
|
+
type StaticAny = any
|
|
2748
|
+
|
|
2749
|
+
type StaticSELECT<T> = { columns: SELECT_3<T>['columns'] }
|
|
2750
|
+
& typeof SELECT_3<T>
|
|
2751
|
+
& SELECT_3<T>['columns']
|
|
2601
2752
|
& SELECT_from // as it is not directly quantified, ...
|
|
2602
2753
|
& SELECT_one
|
|
2603
2754
|
|
|
@@ -2605,7 +2756,9 @@ export const stream: Service['stream'];
|
|
|
2605
2756
|
|
|
2606
2757
|
const string: typeof string_;
|
|
2607
2758
|
|
|
2608
|
-
class string_ extends scalar {
|
|
2759
|
+
class string_ extends scalar {
|
|
2760
|
+
length?: number
|
|
2761
|
+
}
|
|
2609
2762
|
|
|
2610
2763
|
class String_2 extends string { }
|
|
2611
2764
|
|
|
@@ -2635,7 +2788,7 @@ interface struct_2 extends type_2 {
|
|
|
2635
2788
|
* The final result of each subquery will be the property itself:
|
|
2636
2789
|
* `Book.title` == `Subqueryable<Book>.title()`
|
|
2637
2790
|
*/
|
|
2638
|
-
type Subqueryable<T> = T extends Primitive
|
|
2791
|
+
type Subqueryable<T> = T extends Primitive ? unknown
|
|
2639
2792
|
// composition of many/ association to many
|
|
2640
2793
|
: T extends readonly unknown[] ? {
|
|
2641
2794
|
|
|
@@ -2679,10 +2832,7 @@ type Subqueryable<T> = T extends Primitive ? unknown
|
|
|
2679
2832
|
|
|
2680
2833
|
type TaggedTemplateQueryPart<T> = (strings: TemplateStringsArray, ...params: unknown[]) => T
|
|
2681
2834
|
|
|
2682
|
-
|
|
2683
|
-
* Target for any QL operation
|
|
2684
|
-
*/
|
|
2685
|
-
type Target = linked_2.classes.entity | Definition | string
|
|
2835
|
+
type TaggedTemplateRequest = (strings: TemplateStringsArray, ...params: unknown[]) => Promise<import('axios').AxiosResponse>
|
|
2686
2836
|
|
|
2687
2837
|
class Test extends Axios {
|
|
2688
2838
|
|
|
@@ -2750,6 +2900,9 @@ class TimeStamp extends DateTime { }
|
|
|
2750
2900
|
*/
|
|
2751
2901
|
export type _TODO = any
|
|
2752
2902
|
|
|
2903
|
+
/** @internal */
|
|
2904
|
+
type _TODO_2 = any
|
|
2905
|
+
|
|
2753
2906
|
export interface Transaction extends Service {
|
|
2754
2907
|
commit(): Promise<void>
|
|
2755
2908
|
rollback(): Promise<void>
|
|
@@ -2768,13 +2921,21 @@ export const tx: {
|
|
|
2768
2921
|
};
|
|
2769
2922
|
|
|
2770
2923
|
export interface type extends Omit<csn.type, 'items'> {
|
|
2771
|
-
items
|
|
2924
|
+
items?: type
|
|
2925
|
+
key?: boolean
|
|
2926
|
+
notNull?: boolean
|
|
2927
|
+
virtual?: boolean
|
|
2772
2928
|
}
|
|
2773
2929
|
|
|
2774
2930
|
export class type<K extends kinds = 'type'> extends any_<K> { }
|
|
2775
2931
|
|
|
2776
2932
|
interface type_2 extends any__2 {
|
|
2777
|
-
type?:
|
|
2933
|
+
type?: 'cds.Boolean' |
|
|
2934
|
+
'cds.UUID' | 'cds.String' | 'cds.LargeString' | 'cds.Binary' | 'cds.LargeBinary' | 'cds.Vector' |
|
|
2935
|
+
'cds.Integer' | 'cds.UInt8' | 'cds.Int16' | 'cds.Int32' | 'cds.Int64' | 'cds.Float' | 'cds.Double' | 'cds.Decimal' |
|
|
2936
|
+
'cds.Date' | 'cds.Time' | 'cds.DateTime' | 'cds.Timestamp' |
|
|
2937
|
+
'cds.Association' | 'cds.Composition' |
|
|
2938
|
+
FQN & Record<never,never> // allow any other CDS type as well (e.g. 'User')
|
|
2778
2939
|
items?: type_2
|
|
2779
2940
|
}
|
|
2780
2941
|
|
|
@@ -2799,11 +2960,13 @@ type UnionsToIntersections<U> = Array<UnionToIntersection<Scalarise<U>>>
|
|
|
2799
2960
|
type UnionToIntersection<U> = Partial<(U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never>
|
|
2800
2961
|
|
|
2801
2962
|
type Unwrap<T> = T extends ArrayConstructable
|
|
2802
|
-
?
|
|
2963
|
+
? SingularInstanceType<T>
|
|
2803
2964
|
: T extends Array<infer U>
|
|
2804
2965
|
? U
|
|
2805
2966
|
: T
|
|
2806
2967
|
|
|
2968
|
+
type UnwrappedInstanceType<T> = Unwrap<T> extends Constructable ? InstanceType<Unwrap<T>> : Unwrap<T>
|
|
2969
|
+
|
|
2807
2970
|
export const update: Service['update'];
|
|
2808
2971
|
|
|
2809
2972
|
type UPDATE_2 = { UPDATE: {
|
|
@@ -2813,18 +2976,22 @@ type UPDATE_2 = { UPDATE: {
|
|
|
2813
2976
|
}, }
|
|
2814
2977
|
export { UPDATE_2 as UPDATE }
|
|
2815
2978
|
|
|
2816
|
-
|
|
2979
|
+
interface UPDATE_3<T> extends Where<T>, And, ByKey {}
|
|
2980
|
+
|
|
2981
|
+
class UPDATE_3<T> extends ConstructedQuery<T> {
|
|
2982
|
+
private constructor();
|
|
2817
2983
|
|
|
2818
2984
|
// cds-typer plural
|
|
2819
|
-
|
|
2985
|
+
// FIXME: this returned UPDATE<SingularInstanceType<T>> before. should UPDATE<Books>.entity(...) return Book or Books?
|
|
2986
|
+
static entity<T extends ArrayConstructable> (entity: T, primaryKey?: PK): UPDATE_3<InstanceType<T>>
|
|
2820
2987
|
|
|
2821
|
-
static entity (entity:
|
|
2988
|
+
static entity (entity: EntityDescription, primaryKey?: PK): UPDATE_3<StaticAny>
|
|
2822
2989
|
|
|
2823
|
-
static entity<T> (entity:
|
|
2990
|
+
static entity<T extends Constructable> (entity: T, primaryKey?: PK): UPDATE_3<T>
|
|
2824
2991
|
|
|
2992
|
+
// currently no easy way to restrict T from being a primitive type
|
|
2825
2993
|
static entity<T> (entity: T, primaryKey?: PK): UPDATE_3<T>
|
|
2826
2994
|
|
|
2827
|
-
byKey (primaryKey?: PK): this
|
|
2828
2995
|
// with (block: (e:T)=>void) : this
|
|
2829
2996
|
// set (block: (e:T)=>void) : this
|
|
2830
2997
|
set: TaggedTemplateQueryPart<this>
|
|
@@ -2833,13 +3000,6 @@ class UPDATE_3<T> extends ConstructedQuery {
|
|
|
2833
3000
|
with: TaggedTemplateQueryPart<this>
|
|
2834
3001
|
& ((data: object) => this)
|
|
2835
3002
|
|
|
2836
|
-
where (predicate: object): this
|
|
2837
|
-
|
|
2838
|
-
where (...expr: any[]): this
|
|
2839
|
-
|
|
2840
|
-
and (predicate: object): this
|
|
2841
|
-
|
|
2842
|
-
and (...expr: any[]): this
|
|
2843
3003
|
UPDATE: CQN.UPDATE['UPDATE']
|
|
2844
3004
|
|
|
2845
3005
|
}
|
|
@@ -2853,29 +3013,19 @@ type UPSERT_2 = { UPSERT: {
|
|
|
2853
3013
|
}, }
|
|
2854
3014
|
export { UPSERT_2 as UPSERT }
|
|
2855
3015
|
|
|
2856
|
-
|
|
3016
|
+
interface UPSERT_3<T> extends Columns<T>, InUpsert<T> {}
|
|
2857
3017
|
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
& ((entity: Target, entries?: object | object[]) => UPSERT_3<any>)
|
|
2861
|
-
& (<T> (entity: Constructable<T>, entries?: object | object[]) => UPSERT_3<T>)
|
|
2862
|
-
& (<T> (entity: T, entries?: T | object | object[]) => UPSERT_3<T>)
|
|
3018
|
+
class UPSERT_3<T> extends ConstructedQuery<T> {
|
|
3019
|
+
private constructor();
|
|
2863
3020
|
|
|
2864
|
-
into: (<T extends ArrayConstructable> (entity: T) =>
|
|
2865
|
-
& TaggedTemplateQueryPart<
|
|
2866
|
-
& ((entity:
|
|
3021
|
+
static into: (<T extends ArrayConstructable> (entity: T, entries?: Entries) => UPSERT_3<SingularInstanceType<T>>)
|
|
3022
|
+
& (TaggedTemplateQueryPart<UPSERT_3<StaticAny>>)
|
|
3023
|
+
& ((entity: EntityDescription, entries?: Entries) => UPSERT_3<StaticAny>)
|
|
3024
|
+
& (<T> (entity: Constructable<T>, entries?: Entries) => UPSERT_3<T>)
|
|
3025
|
+
// currently no easy way to restrict T to non-primitives
|
|
3026
|
+
& (<T> (entity: T, entries?: T | Entries) => UPSERT_3<T>)
|
|
2867
3027
|
|
|
2868
|
-
data (block: (e: T) => void): this
|
|
2869
3028
|
|
|
2870
|
-
entries (...entries: object[]): this
|
|
2871
|
-
|
|
2872
|
-
columns (...col: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]): this
|
|
2873
|
-
|
|
2874
|
-
columns (...col: string[]): this
|
|
2875
|
-
|
|
2876
|
-
values (...val: any[]): this
|
|
2877
|
-
|
|
2878
|
-
rows (...row: any[]): this
|
|
2879
3029
|
UPSERT: CQN.UPSERT['UPSERT']
|
|
2880
3030
|
|
|
2881
3031
|
}
|
|
@@ -2910,7 +3060,7 @@ export class User {
|
|
|
2910
3060
|
}
|
|
2911
3061
|
|
|
2912
3062
|
/**
|
|
2913
|
-
* Provides a set of utility
|
|
3063
|
+
* Provides a set of utility functions
|
|
2914
3064
|
*/
|
|
2915
3065
|
export const utils: {
|
|
2916
3066
|
|
|
@@ -2996,6 +3146,59 @@ export const utils: {
|
|
|
2996
3146
|
* @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rm-path
|
|
2997
3147
|
*/
|
|
2998
3148
|
rm: (...path: string[]) => Promise<ReturnType<typeof import('node:fs').promises.rm>>,
|
|
3149
|
+
|
|
3150
|
+
/**
|
|
3151
|
+
* @since 8.3.0
|
|
3152
|
+
* @see https://cap.cloud.sap/docs/node.js/cds-utils#colors
|
|
3153
|
+
*/
|
|
3154
|
+
colors: {
|
|
3155
|
+
enabled: boolean,
|
|
3156
|
+
RESET: '\x1b[0m',
|
|
3157
|
+
BOLD: '\x1b[1m' | '',
|
|
3158
|
+
BRIGHT: '\x1b[1m' | '',
|
|
3159
|
+
DIMMED: '\x1b[2m' | '',
|
|
3160
|
+
ITALIC: '\x1b[3m' | '',
|
|
3161
|
+
UNDER: '\x1b[4m' | '',
|
|
3162
|
+
BLINK: '\x1b[5m' | '',
|
|
3163
|
+
FLASH: '\x1b[6m' | '',
|
|
3164
|
+
INVERT: '\x1b[7m' | '',
|
|
3165
|
+
BLACK: '\x1b[30m' | '',
|
|
3166
|
+
RED: '\x1b[31m' | '',
|
|
3167
|
+
GREEN: '\x1b[32m' | '',
|
|
3168
|
+
YELLOW: '\x1b[33m' | '',
|
|
3169
|
+
BLUE: '\x1b[34m' | '',
|
|
3170
|
+
PINK: '\x1b[35m' | '',
|
|
3171
|
+
CYAN: '\x1b[36m' | '',
|
|
3172
|
+
LIGHT_GRAY: '\x1b[37m' | '',
|
|
3173
|
+
DEFAULT: '\x1b[39m' | '',
|
|
3174
|
+
GRAY: '\x1b[90m' | '',
|
|
3175
|
+
LIGHT_RED: '\x1b[91m' | '',
|
|
3176
|
+
LIGHT_GREEN: '\x1b[92m' | '',
|
|
3177
|
+
LIGHT_YELLOW: '\x1b[93m' | '',
|
|
3178
|
+
LIGHT_BLUE: '\x1b[94m' | '',
|
|
3179
|
+
LIGHT_PINK: '\x1b[95m' | '',
|
|
3180
|
+
LIGHT_CYAN: '\x1b[96m' | '',
|
|
3181
|
+
WHITE: '\x1b[97m' | '',
|
|
3182
|
+
bg: {
|
|
3183
|
+
BLACK: '\x1b[40m' | '',
|
|
3184
|
+
RED: '\x1b[41m' | '',
|
|
3185
|
+
GREEN: '\x1b[42m' | '',
|
|
3186
|
+
YELLOW: '\x1b[43m' | '',
|
|
3187
|
+
BLUE: '\x1b[44m' | '',
|
|
3188
|
+
PINK: '\x1b[45m' | '',
|
|
3189
|
+
CYAN: '\x1b[46m' | '',
|
|
3190
|
+
WHITE: '\x1b[47m' | '',
|
|
3191
|
+
DEFAULT: '\x1b[49m' | '',
|
|
3192
|
+
LIGHT_GRAY: '\x1b[100m' | '',
|
|
3193
|
+
LIGHT_RED: '\x1b[101m' | '',
|
|
3194
|
+
LIGHT_GREEN: '\x1b[102m' | '',
|
|
3195
|
+
LIGHT_YELLOW: '\x1b[103m' | '',
|
|
3196
|
+
LIGHT_BLUE: '\x1b[104m' | '',
|
|
3197
|
+
LIGHT_PINK: '\x1b[105m' | '',
|
|
3198
|
+
LIGHT_CYAN: '\x1b[106m' | '',
|
|
3199
|
+
LIGHT_WHITE: '\x1b[107m' | '',
|
|
3200
|
+
},
|
|
3201
|
+
},
|
|
2999
3202
|
};
|
|
3000
3203
|
|
|
3001
3204
|
class UUID extends string { }
|
|
@@ -3009,6 +3212,10 @@ export const version: string;
|
|
|
3009
3212
|
|
|
3010
3213
|
type Visitor = (def: any_, name: string, parent: any_, defs: Definitions) => void
|
|
3011
3214
|
|
|
3215
|
+
interface Where<T> {
|
|
3216
|
+
where: HavingWhere<this, T>
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3012
3219
|
interface WithElements {
|
|
3013
3220
|
elements: Definitions<type>
|
|
3014
3221
|
}
|
|
@@ -3019,6 +3226,8 @@ interface WithElements {
|
|
|
3019
3226
|
*/
|
|
3020
3227
|
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }
|
|
3021
3228
|
|
|
3229
|
+
type WS = '' | ' '
|
|
3230
|
+
|
|
3022
3231
|
export type XML = string
|
|
3023
3232
|
|
|
3024
3233
|
/** @internal */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/cds-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Type definitions for main packages of CAP, like `@sap/cds`",
|
|
5
5
|
"repository": "github:cap-js/cds-types",
|
|
6
6
|
"homepage": "https://cap.cloud.sap/",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"lint:fix": "npx eslint . --fix",
|
|
30
30
|
"setup": "npm i && npm i file:. --no-save --force",
|
|
31
31
|
"prerelease:ci-fix": "node .github/prerelease-fix.js",
|
|
32
|
-
"postinstall": "node ./scripts/postinstall.js"
|
|
32
|
+
"postinstall": "node ./scripts/postinstall.js",
|
|
33
|
+
"dependencies": "node ./scripts/postinstall.js"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"@sap/cds": "^8.0.0"
|