@cap-js/cds-types 0.15.0 → 0.17.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 +185 -92
- package/package.json +5 -3
package/dist/cds-types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare module '@sap/cds' {
|
|
2
2
|
export * from "@sap/cds-dk";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
|
|
5
5
|
export type __any_ = classes.any_
|
|
6
6
|
|
|
@@ -64,13 +64,15 @@ export type __UUID = classes.UUID
|
|
|
64
64
|
|
|
65
65
|
export type __Vector = classes.Vector
|
|
66
66
|
|
|
67
|
-
class action extends
|
|
67
|
+
class action extends any__2<'action' | 'function'> {}
|
|
68
68
|
|
|
69
69
|
export interface ActionEventHandler<S, P, R> {
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
71
|
-
(req:
|
|
71
|
+
(req: ActionRequest<P, S>, next: Function): Promise<R> | R
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
export type ActionRequest<P, S> = Omit<Request_2, 'data'> & { data: P, subject: S }
|
|
75
|
+
|
|
74
76
|
interface And {
|
|
75
77
|
and: TaggedTemplateQueryPart<this>
|
|
76
78
|
& ((predicate: object) => this)
|
|
@@ -88,11 +90,20 @@ export class Anonymous extends User {
|
|
|
88
90
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
const any: typeof
|
|
93
|
+
const any: typeof any__2;
|
|
94
|
+
|
|
95
|
+
interface any_ {
|
|
96
|
+
kind?: kinds
|
|
97
|
+
/**
|
|
98
|
+
* only available when compiled with docs:true
|
|
99
|
+
* @see [capire docs](https://cap.cloud.sap/docs/cds/cdl#comments)
|
|
100
|
+
*/
|
|
101
|
+
doc?: string
|
|
102
|
+
}
|
|
92
103
|
|
|
93
|
-
interface
|
|
104
|
+
interface any__2 extends csn.any_ {}
|
|
94
105
|
|
|
95
|
-
class
|
|
106
|
+
class any__2<K extends kinds = kinds> {
|
|
96
107
|
private _: K // break covariance
|
|
97
108
|
constructor (...aspects: any[])
|
|
98
109
|
|
|
@@ -101,15 +112,6 @@ class any_<K extends kinds = kinds> {
|
|
|
101
112
|
// is (kind: kinds | 'Association' | 'Composition'): boolean
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
interface any__2 {
|
|
105
|
-
kind?: kinds
|
|
106
|
-
/**
|
|
107
|
-
* only available when compiled with docs:true
|
|
108
|
-
* @see [capire docs](https://cap.cloud.sap/docs/cds/cdl#comments)
|
|
109
|
-
*/
|
|
110
|
-
doc?: string
|
|
111
|
-
}
|
|
112
|
-
|
|
113
115
|
/**
|
|
114
116
|
* The {@link https://expressjs.com/en/4x/api.html#app| express.js application} constructed by the server implementation.
|
|
115
117
|
*
|
|
@@ -176,7 +178,27 @@ type Awaitable<T, I> = T & Promise<I>
|
|
|
176
178
|
|
|
177
179
|
class Axios {
|
|
178
180
|
|
|
181
|
+
/**
|
|
182
|
+
* @deprecated Used to provide access to an `axios` instance used as HTTP client. From `@cap-js/cds-test` >=1 onwards, it no longer points to
|
|
183
|
+
* the real `axios` library, but to an emulated lookalike, mostly for backward compatibility.
|
|
184
|
+
* Install `axios` explicitly as a project dependency if you need the full feature set of it. In that case, the HTTP shortcuts will automatically
|
|
185
|
+
* use the installed `axios` instead of the emulated version.
|
|
186
|
+
*/
|
|
179
187
|
get axios (): import('axios').AxiosInstance
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Provides default values for HTTP requests. To stay portable across different HTTP clients, it's recommended to only use these options,
|
|
191
|
+
* which cds.test supports across all clients:
|
|
192
|
+
* - `baseURL` as defined in Axios
|
|
193
|
+
* - `auth` as defined in Axios
|
|
194
|
+
* - `headers` as defined in Fetch API and Axios
|
|
195
|
+
* - `validateStatus` as defined in Axios (default: status >= 200 && status < 300)
|
|
196
|
+
*
|
|
197
|
+
* In addition, you can use all of the config options understood by the underlying HTTP client, that is, for Fetch API,
|
|
198
|
+
* its RequestInit options, and for Axios, its request config options.
|
|
199
|
+
*/
|
|
200
|
+
get defaults (): import('axios').AxiosRequestConfig & RequestInit
|
|
201
|
+
|
|
180
202
|
get: import('axios').AxiosInstance['get'] & TaggedTemplateRequest
|
|
181
203
|
|
|
182
204
|
put: import('axios').AxiosInstance['put'] & TaggedTemplateRequest
|
|
@@ -343,6 +365,7 @@ namespace cds {
|
|
|
343
365
|
CdsFunctions,
|
|
344
366
|
HandlerFunction,
|
|
345
367
|
CRUDEventHandler,
|
|
368
|
+
ActionRequest,
|
|
346
369
|
ActionEventHandler,
|
|
347
370
|
ResultsHandler,
|
|
348
371
|
SpawnEvents,
|
|
@@ -351,7 +374,6 @@ namespace cds {
|
|
|
351
374
|
SpawnOptions,
|
|
352
375
|
context,
|
|
353
376
|
tx,
|
|
354
|
-
entities,
|
|
355
377
|
run,
|
|
356
378
|
foreach,
|
|
357
379
|
stream,
|
|
@@ -361,6 +383,7 @@ namespace cds {
|
|
|
361
383
|
update,
|
|
362
384
|
transaction,
|
|
363
385
|
db,
|
|
386
|
+
entities,
|
|
364
387
|
queued,
|
|
365
388
|
unqueued,
|
|
366
389
|
outboxed,
|
|
@@ -531,6 +554,7 @@ namespace cds_2 {
|
|
|
531
554
|
CdsFunctions,
|
|
532
555
|
HandlerFunction,
|
|
533
556
|
CRUDEventHandler,
|
|
557
|
+
ActionRequest,
|
|
534
558
|
ActionEventHandler,
|
|
535
559
|
ResultsHandler,
|
|
536
560
|
SpawnEvents,
|
|
@@ -539,7 +563,6 @@ namespace cds_2 {
|
|
|
539
563
|
SpawnOptions,
|
|
540
564
|
context,
|
|
541
565
|
tx,
|
|
542
|
-
entities,
|
|
543
566
|
run,
|
|
544
567
|
foreach,
|
|
545
568
|
stream,
|
|
@@ -549,6 +572,7 @@ namespace cds_2 {
|
|
|
549
572
|
update,
|
|
550
573
|
transaction,
|
|
551
574
|
db,
|
|
575
|
+
entities,
|
|
552
576
|
queued,
|
|
553
577
|
unqueued,
|
|
554
578
|
outboxed,
|
|
@@ -643,7 +667,7 @@ namespace classes {
|
|
|
643
667
|
Column,
|
|
644
668
|
Definitions,
|
|
645
669
|
WithElements,
|
|
646
|
-
any_,
|
|
670
|
+
any__2 as any_,
|
|
647
671
|
any,
|
|
648
672
|
aspect,
|
|
649
673
|
type,
|
|
@@ -870,9 +894,9 @@ export let context: EventContext | undefined;
|
|
|
870
894
|
|
|
871
895
|
interface context_ extends csn.context {}
|
|
872
896
|
|
|
873
|
-
class context_ extends
|
|
897
|
+
class context_ extends any__2 { }
|
|
874
898
|
|
|
875
|
-
interface context_2 extends
|
|
899
|
+
interface context_2 extends any_ { }
|
|
876
900
|
|
|
877
901
|
namespace CQN {
|
|
878
902
|
export {
|
|
@@ -972,7 +996,7 @@ namespace csn {
|
|
|
972
996
|
Extension,
|
|
973
997
|
Element,
|
|
974
998
|
kinds,
|
|
975
|
-
|
|
999
|
+
any_,
|
|
976
1000
|
context_2 as context,
|
|
977
1001
|
service_2 as service,
|
|
978
1002
|
type_2 as type,
|
|
@@ -1036,7 +1060,7 @@ class Decimal extends Float {
|
|
|
1036
1060
|
}
|
|
1037
1061
|
|
|
1038
1062
|
/**
|
|
1039
|
-
* @beta helper
|
|
1063
|
+
* @beta helper
|
|
1040
1064
|
*/
|
|
1041
1065
|
type DeepPartial<T> = T extends object
|
|
1042
1066
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
@@ -1052,12 +1076,12 @@ type DeepPartial<T> = T extends object
|
|
|
1052
1076
|
*/
|
|
1053
1077
|
type Definition = context_2 & service_2 & type_2 & struct_2 & entity_2 & Association_2
|
|
1054
1078
|
|
|
1055
|
-
type Definition_2 =
|
|
1079
|
+
type Definition_2 = any__2
|
|
1056
1080
|
|
|
1057
1081
|
/**
|
|
1058
1082
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#iterable)
|
|
1059
1083
|
*/
|
|
1060
|
-
type Definitions<T extends
|
|
1084
|
+
type Definitions<T extends any__2 = any__2> = IterableMap<T>
|
|
1061
1085
|
|
|
1062
1086
|
const delete_: Service['delete'];
|
|
1063
1087
|
export { delete_ as delete };
|
|
@@ -1106,7 +1130,7 @@ export type EDMX = XML
|
|
|
1106
1130
|
|
|
1107
1131
|
type Element = type_2 & struct_2 & Association_2
|
|
1108
1132
|
|
|
1109
|
-
export const entities:
|
|
1133
|
+
export const entities: linked_2.LinkedCSN['entities'];
|
|
1110
1134
|
|
|
1111
1135
|
/**
|
|
1112
1136
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-entity)
|
|
@@ -1305,11 +1329,11 @@ export namespace env {
|
|
|
1305
1329
|
/**
|
|
1306
1330
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-facade#cds-error)
|
|
1307
1331
|
*/
|
|
1308
|
-
export function error (
|
|
1332
|
+
export function error (status: number, message: string, details?: {stack?: unknown}, caller?: (...args: any[]) => unknown): Error
|
|
1309
1333
|
|
|
1310
|
-
export function error (message: string, details?: {
|
|
1334
|
+
export function error (message: string, details?: {status: number, stack?: unknown}, caller?: (...args: any[]) => unknown): Error
|
|
1311
1335
|
|
|
1312
|
-
export function error (details: {
|
|
1336
|
+
export function error (details: {status: number, message: string}, caller?: (...args: any[]) => unknown): Error
|
|
1313
1337
|
|
|
1314
1338
|
export function error (string: TemplateStringsArray, ...args: any[]): Error
|
|
1315
1339
|
|
|
@@ -1348,7 +1372,11 @@ export class EventContext {
|
|
|
1348
1372
|
|
|
1349
1373
|
id: string
|
|
1350
1374
|
|
|
1351
|
-
|
|
1375
|
+
/**
|
|
1376
|
+
* ISO 639-1 language code, optionally followed by an underscore and ISO 3166-1 alpha-2 country code, e.g. "en" or "en_US".
|
|
1377
|
+
* May be `undefined` if the `AcceptLanguage` header is not set in the incoming request.
|
|
1378
|
+
*/
|
|
1379
|
+
locale?: string
|
|
1352
1380
|
|
|
1353
1381
|
timestamp: Date
|
|
1354
1382
|
|
|
@@ -1358,9 +1386,9 @@ export class EventContext {
|
|
|
1358
1386
|
|
|
1359
1387
|
}
|
|
1360
1388
|
|
|
1361
|
-
export interface EventHandler {
|
|
1389
|
+
export interface EventHandler<E = any> {
|
|
1362
1390
|
// (msg : types.EventMessage) : Promise<any> | any | void
|
|
1363
|
-
(req: Request_2): Promise<any> | any | void
|
|
1391
|
+
(req: Request_2<E>): Promise<any> | any | void
|
|
1364
1392
|
}
|
|
1365
1393
|
|
|
1366
1394
|
/**
|
|
@@ -1375,8 +1403,8 @@ export type expr_literal = { '=': string }
|
|
|
1375
1403
|
|
|
1376
1404
|
type Expression<E extends string | number | bigint | boolean> = `${E}${WS}${Op}${WS}`
|
|
1377
1405
|
|
|
1378
|
-
type Expressions<L,E> = KVPairs<L, Expression<Exclude<keyof E, symbol>>, ColumnValue> extends true
|
|
1379
|
-
? L
|
|
1406
|
+
type Expressions<L,E> = KVPairs<L, Expression<Exclude<keyof E, symbol>>, ColumnValue> extends true
|
|
1407
|
+
? L
|
|
1380
1408
|
// fallback: allow for any string. Important for when user renamed properties
|
|
1381
1409
|
: KVPairs<L, Expression<string>, ColumnValue> extends true
|
|
1382
1410
|
? L
|
|
@@ -1408,7 +1436,7 @@ type Extension = {
|
|
|
1408
1436
|
|
|
1409
1437
|
export type filename = string
|
|
1410
1438
|
|
|
1411
|
-
type Filter = string | (<T extends
|
|
1439
|
+
type Filter = string | (<T extends any__2 = any__2>(def: T) => boolean)
|
|
1412
1440
|
|
|
1413
1441
|
export type _flavor = 'parsed' | 'xtended' | 'inferred'
|
|
1414
1442
|
|
|
@@ -1488,7 +1516,7 @@ interface Having<T> {
|
|
|
1488
1516
|
having: HavingWhere<this, T>
|
|
1489
1517
|
}
|
|
1490
1518
|
|
|
1491
|
-
type HavingWhere<This, E> =
|
|
1519
|
+
type HavingWhere<This, E> =
|
|
1492
1520
|
/**
|
|
1493
1521
|
* @param predicate - An object with keys that are valid fields of the target entity and values that are compared to the respective fields.
|
|
1494
1522
|
* @example
|
|
@@ -1498,6 +1526,7 @@ type HavingWhere<This, E> =
|
|
|
1498
1526
|
* ```
|
|
1499
1527
|
*/
|
|
1500
1528
|
((predicate: Partial<{[column in KeyOfTarget<This extends ConstructedQuery<infer E> ? E : never, never>]: any}>) => This)
|
|
1529
|
+
|
|
1501
1530
|
/**
|
|
1502
1531
|
* @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.
|
|
1503
1532
|
* @example
|
|
@@ -1763,6 +1792,7 @@ export namespace linked {
|
|
|
1763
1792
|
namespace linked_2 {
|
|
1764
1793
|
export {
|
|
1765
1794
|
ModelPart,
|
|
1795
|
+
ModelPartFn,
|
|
1766
1796
|
Definition_2 as Definition,
|
|
1767
1797
|
LinkedCSN,
|
|
1768
1798
|
classes
|
|
@@ -1781,13 +1811,13 @@ interface LinkedCSN extends Omit<csn.CSN, 'definitions'> {
|
|
|
1781
1811
|
* let entities = m.all('entity') //> equivalent shortcut
|
|
1782
1812
|
* ```
|
|
1783
1813
|
*/
|
|
1784
|
-
each<T extends
|
|
1814
|
+
each<T extends any__2>(x: Filter, defs?: Definitions<T>): IterableIterator<T>
|
|
1785
1815
|
|
|
1786
1816
|
/**
|
|
1787
1817
|
* Fetches definitions matching the given filter, returning them in an array.
|
|
1788
1818
|
* Convenience shortcut for `[...reflect.each('entity')]`
|
|
1789
1819
|
*/
|
|
1790
|
-
all<T extends
|
|
1820
|
+
all<T extends any__2>(x: Filter, defs?: Definitions<T>): T[]
|
|
1791
1821
|
|
|
1792
1822
|
/**
|
|
1793
1823
|
* Fetches definitions matching the given filter, returning the first match, if any.
|
|
@@ -1796,7 +1826,7 @@ interface LinkedCSN extends Omit<csn.CSN, 'definitions'> {
|
|
|
1796
1826
|
* @param x - the filter
|
|
1797
1827
|
* @param defs - the definitions to fetch in, default: `this.definitions`
|
|
1798
1828
|
*/
|
|
1799
|
-
find<T extends
|
|
1829
|
+
find<T extends any__2>(x: Filter, defs?: Definitions<T>): T | undefined
|
|
1800
1830
|
|
|
1801
1831
|
/**
|
|
1802
1832
|
* Calls the visitor for each definition matching the given filter.
|
|
@@ -1824,7 +1854,7 @@ interface LinkedCSN extends Omit<csn.CSN, 'definitions'> {
|
|
|
1824
1854
|
* @param parent - either the parent itself or its fully-qualified name
|
|
1825
1855
|
* @param filter - an optional filter to apply before picking a child
|
|
1826
1856
|
*/
|
|
1827
|
-
childrenOf(parent: any | string, filter?: ((def:
|
|
1857
|
+
childrenOf(parent: any | string, filter?: ((def: any__2) => boolean)): Definitions
|
|
1828
1858
|
|
|
1829
1859
|
/**
|
|
1830
1860
|
* Provides convenient access to the model's top-level definitions.
|
|
@@ -1842,9 +1872,9 @@ interface LinkedCSN extends Omit<csn.CSN, 'definitions'> {
|
|
|
1842
1872
|
* SELECT.from (Books) .where ({ID:11})
|
|
1843
1873
|
* ```
|
|
1844
1874
|
*/
|
|
1845
|
-
exports: IterableMap<
|
|
1846
|
-
definitions: IterableMap<
|
|
1847
|
-
entities:
|
|
1875
|
+
exports: IterableMap<any__2>
|
|
1876
|
+
definitions: IterableMap<any__2>
|
|
1877
|
+
entities: ModelPartFn<entity>
|
|
1848
1878
|
services: ModelPart<service_>
|
|
1849
1879
|
|
|
1850
1880
|
}
|
|
@@ -2022,6 +2052,7 @@ export type Middlewares = 'context' | 'trace' | 'auth' | 'ctx_model' | string
|
|
|
2022
2052
|
|
|
2023
2053
|
export const middlewares: {
|
|
2024
2054
|
add: (middleware: import('express').RequestHandler, pos?: XOR<XOR<{ at: number }, { after: Middlewares }>, { before: Middlewares }>) => void,
|
|
2055
|
+
before: import('express').RequestHandler[],
|
|
2025
2056
|
};
|
|
2026
2057
|
|
|
2027
2058
|
/**
|
|
@@ -2067,7 +2098,12 @@ function mixin (...classes: (new () => any)[]): void
|
|
|
2067
2098
|
*/
|
|
2068
2099
|
export let model: linked_2.LinkedCSN | undefined;
|
|
2069
2100
|
|
|
2070
|
-
type ModelPart<T extends
|
|
2101
|
+
type ModelPart<T extends any__2> = IterableMap<T> & {
|
|
2102
|
+
/** @deprecated undocumented variant that will be removed in cds^10 */
|
|
2103
|
+
(namespace: string): IterableMap<T>,
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
type ModelPartFn<T extends any__2> = IterableMap<T> & ((namespace: string) => IterableMap<T>)
|
|
2071
2107
|
|
|
2072
2108
|
namespace models {
|
|
2073
2109
|
export {
|
|
@@ -2162,7 +2198,7 @@ export function on (event: 'connect', listener: (srv: Service) => void): _cds
|
|
|
2162
2198
|
export function on (event: 'bootstrap', listener: (app: import('express').Application) => void): _cds
|
|
2163
2199
|
|
|
2164
2200
|
/**
|
|
2165
|
-
* Emitted
|
|
2201
|
+
* Emitted the model is compiled for usage in Node.js or Java runtime.
|
|
2166
2202
|
* @beta
|
|
2167
2203
|
*/
|
|
2168
2204
|
export function on (event: 'compile.for.runtime', listener: (model: CSN) => void): _cds
|
|
@@ -2202,6 +2238,10 @@ export function on (event: 'listening', listener: (args: { server: import('http'
|
|
|
2202
2238
|
*/
|
|
2203
2239
|
export function on (event: 'shutdown', listener: () => void): _cds
|
|
2204
2240
|
|
|
2241
|
+
export function once (event: 'loaded', listener: (model: CSN) => void): _cds
|
|
2242
|
+
|
|
2243
|
+
export function once (event: 'connect', listener: (srv: Service) => void): _cds
|
|
2244
|
+
|
|
2205
2245
|
export function once (event: 'bootstrap', listener: (app: import('express').Application) => void): _cds
|
|
2206
2246
|
|
|
2207
2247
|
export function once (event: 'compile.for.runtime', listener: (model: CSN) => void): _cds
|
|
@@ -2210,6 +2250,8 @@ export function once (event: 'compile.to.dbx', listener: (model: CSN) => void):
|
|
|
2210
2250
|
|
|
2211
2251
|
export function once (event: 'compile.to.edmx', listener: (model: CSN) => void): _cds
|
|
2212
2252
|
|
|
2253
|
+
export function once (event: 'serving', listener: (srv: Service) => void): _cds
|
|
2254
|
+
|
|
2213
2255
|
export function once (event: 'served', listener: (all: cds_services) => void): _cds
|
|
2214
2256
|
|
|
2215
2257
|
export function once (event: 'listening', listener: (args: { server: import('http').Server, url: string }) => void): _cds
|
|
@@ -2280,6 +2322,31 @@ P extends Record<string, any>[] = Record<string, any>[]
|
|
|
2280
2322
|
|
|
2281
2323
|
export type predicate = _xpr
|
|
2282
2324
|
|
|
2325
|
+
/**
|
|
2326
|
+
* @beta helper
|
|
2327
|
+
* @example
|
|
2328
|
+
* ```js
|
|
2329
|
+
* const predicate: PredicateMap<Books> = {
|
|
2330
|
+
* title: 'foo',
|
|
2331
|
+
* or: {
|
|
2332
|
+
* price: { '>': 42 }
|
|
2333
|
+
* }
|
|
2334
|
+
* }
|
|
2335
|
+
* const result = await SELECT.from(Books).where(predicate)
|
|
2336
|
+
* ```
|
|
2337
|
+
* Note that you _have to_ explicitly type the predicate variable with `PredicateMap<T>`,
|
|
2338
|
+
* as we can not offer this type as overload to `.where()` or `.having()`.
|
|
2339
|
+
*/
|
|
2340
|
+
type PredicateMap<T> = _PredicateMap<UnwrappedInstanceType<T>>
|
|
2341
|
+
|
|
2342
|
+
/** @internal */
|
|
2343
|
+
type _PredicateMap<T> = {
|
|
2344
|
+
[k in keyof Partial<T>]: (T[k] | Partial<{ [op in Op]: T[k] }>)
|
|
2345
|
+
}
|
|
2346
|
+
& { or?: _PredicateMap<T>, and?: _PredicateMap<T> }
|
|
2347
|
+
// disallow non-existing properties
|
|
2348
|
+
& { [key: string]: never }
|
|
2349
|
+
|
|
2283
2350
|
type Primitive = string | number | boolean | Date
|
|
2284
2351
|
|
|
2285
2352
|
/** @private */
|
|
@@ -2336,6 +2403,7 @@ namespace ql {
|
|
|
2336
2403
|
export {
|
|
2337
2404
|
Query_2 as Query,
|
|
2338
2405
|
QLExtensions,
|
|
2406
|
+
PredicateMap,
|
|
2339
2407
|
ConstructedQuery,
|
|
2340
2408
|
StaticSELECT,
|
|
2341
2409
|
QL,
|
|
@@ -2369,8 +2437,6 @@ type Query_2 = CQN.Query
|
|
|
2369
2437
|
|
|
2370
2438
|
export class QueryAPI {
|
|
2371
2439
|
|
|
2372
|
-
entities: linked_2.LinkedCSN['entities']
|
|
2373
|
-
|
|
2374
2440
|
/**
|
|
2375
2441
|
* @see [docs](https://cap.cloud.sap/docs/node.js/core-services#crud-style-api)
|
|
2376
2442
|
*/
|
|
@@ -2449,9 +2515,9 @@ export class QueryAPI {
|
|
|
2449
2515
|
transaction: QueryAPI['tx']
|
|
2450
2516
|
|
|
2451
2517
|
tx: {
|
|
2452
|
-
(fn: (tx: Transaction) =>
|
|
2518
|
+
<T>(fn: (tx: Transaction) => T): Promise<Awaited<T>>,
|
|
2453
2519
|
(context?: object): Transaction,
|
|
2454
|
-
(context: object, fn: (tx: Transaction) =>
|
|
2520
|
+
<T>(context: object, fn: (tx: Transaction) => T): Promise<Awaited<T>>,
|
|
2455
2521
|
}
|
|
2456
2522
|
|
|
2457
2523
|
}
|
|
@@ -2497,6 +2563,18 @@ D = any,
|
|
|
2497
2563
|
P extends Record<string, any>[] = Record<string, any>[]
|
|
2498
2564
|
> extends Event_2<D> {
|
|
2499
2565
|
|
|
2566
|
+
messages: {message: string, numericSeverity: levels}[]
|
|
2567
|
+
|
|
2568
|
+
errors: {
|
|
2569
|
+
code?: number,
|
|
2570
|
+
message: string,
|
|
2571
|
+
stack: string,
|
|
2572
|
+
target?: string,
|
|
2573
|
+
args?: unknown[],
|
|
2574
|
+
}[]
|
|
2575
|
+
|
|
2576
|
+
results: D[]
|
|
2577
|
+
|
|
2500
2578
|
params: P
|
|
2501
2579
|
|
|
2502
2580
|
method: string
|
|
@@ -2519,45 +2597,38 @@ P extends Record<string, any>[] = Record<string, any>[]
|
|
|
2519
2597
|
/** @beta */
|
|
2520
2598
|
reply (results: any, options: { mimetype?: string, filename?: string, [key: string]: any }): void
|
|
2521
2599
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
info (code: number, message: string, target?: string, args?: any[]): Error
|
|
2525
|
-
|
|
2526
|
-
warn (code: number, message: string, target?: string, args?: any[]): Error
|
|
2527
|
-
|
|
2528
|
-
error (code: number, message: string, target?: string, args?: any[]): Error
|
|
2529
|
-
|
|
2530
|
-
reject (code: number, message: string, target?: string, args?: any[]): never
|
|
2531
|
-
|
|
2532
|
-
notify (code: number, message: string, args?: any[]): Error
|
|
2533
|
-
|
|
2534
|
-
info (code: number, message: string, args?: any[]): Error
|
|
2535
|
-
|
|
2536
|
-
warn (code: number, message: string, args?: any[]): Error
|
|
2537
|
-
|
|
2538
|
-
error (code: number, message: string, args?: any[]): Error
|
|
2539
|
-
|
|
2540
|
-
reject (code: number, message: string, args?: any[]): never
|
|
2541
|
-
|
|
2600
|
+
// positional args
|
|
2542
2601
|
notify (message: string, target?: string, args?: any[]): Error
|
|
2602
|
+
notify (status: number, message?: string, target?: string, args?: any[]): Error
|
|
2543
2603
|
|
|
2544
2604
|
info (message: string, target?: string, args?: any[]): Error
|
|
2605
|
+
info (status: number, message?: string, target?: string, args?: any[]): Error
|
|
2545
2606
|
|
|
2546
2607
|
warn (message: string, target?: string, args?: any[]): Error
|
|
2608
|
+
warn (status: number, message?: string, target?: string, args?: any[]): Error
|
|
2547
2609
|
|
|
2548
2610
|
error (message: string, target?: string, args?: any[]): Error
|
|
2611
|
+
error (status: number, message?: string, target?: string, args?: any[]): Error
|
|
2612
|
+
error (status: number, target?: string, args?: any[]): Error
|
|
2549
2613
|
|
|
2550
2614
|
reject (message: string, target?: string, args?: any[]): never
|
|
2615
|
+
reject (status: number, message?: string, target?: string, args?: any[]): never
|
|
2551
2616
|
|
|
2552
|
-
|
|
2617
|
+
// single object arg
|
|
2618
|
+
notify (message: { status?: number, code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2619
|
+
notify (message: { status?: number, code: number | string, message?: string, target?: string, args?: any[] }): Error
|
|
2553
2620
|
|
|
2554
|
-
info (message: { code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2621
|
+
info (message: { status?: number, code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2622
|
+
info (message: { status?: number, code: number | string, message?: string, target?: string, args?: any[] }): Error
|
|
2555
2623
|
|
|
2556
|
-
warn (message: { code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2624
|
+
warn (message: { status?: number, code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2625
|
+
warn (message: { status?: number, code: number | string, message?: string, target?: string, args?: any[] }): Error
|
|
2557
2626
|
|
|
2558
|
-
error (message: { code?: number | string, message: string, target?: string, args?: any[]
|
|
2627
|
+
error (message: { status?: number, code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2628
|
+
error (message: { status?: number, code: number | string, message?: string, target?: string, args?: any[] }): Error
|
|
2559
2629
|
|
|
2560
|
-
reject (message: { code?: number | string, message: string, target?: string, args?: any[]
|
|
2630
|
+
reject (message: { status?: number, code?: number | string, message: string, target?: string, args?: any[] }): never
|
|
2631
|
+
reject (message: { status?: number, code: number | string, message?: string, target?: string, args?: any[] }): never
|
|
2561
2632
|
|
|
2562
2633
|
}
|
|
2563
2634
|
export { Request_2 as Request }
|
|
@@ -2577,8 +2648,8 @@ export function resolve (files: '*' | filename | filename[]): filename[] | undef
|
|
|
2577
2648
|
export interface ResultSet extends Array<object> {}
|
|
2578
2649
|
|
|
2579
2650
|
export interface ResultsHandler {
|
|
2580
|
-
(results: any[], req: Request_2):
|
|
2581
|
-
(each: any, req: Request_2):
|
|
2651
|
+
(results: any[], req: Request_2): unknown
|
|
2652
|
+
(each: any, req: Request_2): unknown
|
|
2582
2653
|
}
|
|
2583
2654
|
|
|
2584
2655
|
export const root: string;
|
|
@@ -2653,24 +2724,25 @@ class SELECT_3<T, Q = SELECT_from> extends ConstructedQuery<T> {
|
|
|
2653
2724
|
}
|
|
2654
2725
|
|
|
2655
2726
|
/**
|
|
2656
|
-
*
|
|
2657
|
-
*
|
|
2658
|
-
* If no parameter is given, the raw data stream is returned.
|
|
2727
|
+
* Pipes the raw data stream into the given writable stream.
|
|
2659
2728
|
* @param stream the writable stream to pipe the raw data into
|
|
2660
2729
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-ql#pipeline)
|
|
2661
2730
|
* @since 9.3.0
|
|
2662
2731
|
*/
|
|
2663
2732
|
pipeline(stream: import('node:stream').Writable): Promise<void>
|
|
2664
2733
|
/**
|
|
2665
|
-
*
|
|
2666
|
-
*
|
|
2667
|
-
* If no parameter is given, the raw data stream is returned.
|
|
2668
|
-
* @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-ql#pipeline)
|
|
2669
|
-
* @since 9.3.0
|
|
2670
|
-
* @returns Readable
|
|
2734
|
+
* @deprecated use `.stream()` instead
|
|
2671
2735
|
*/
|
|
2672
2736
|
pipeline(): Promise<import('node:stream').Readable>
|
|
2673
2737
|
|
|
2738
|
+
/**
|
|
2739
|
+
* Returns the raw data stream.
|
|
2740
|
+
* @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-ql#stream)
|
|
2741
|
+
* @since 9.4.0
|
|
2742
|
+
* @returns Readable
|
|
2743
|
+
*/
|
|
2744
|
+
stream(): Promise<import('node:stream').Readable>
|
|
2745
|
+
|
|
2674
2746
|
/**
|
|
2675
2747
|
* Calls the given callback function for each row in the result set.
|
|
2676
2748
|
* @param cb the callback function to call for each row
|
|
@@ -2812,11 +2884,18 @@ export class Service extends QueryAPI {
|
|
|
2812
2884
|
types: linked_2.ModelPart<linked_2.classes.type>
|
|
2813
2885
|
|
|
2814
2886
|
/**
|
|
2887
|
+
* @deprecated use {@link actions} instead
|
|
2815
2888
|
* Provides access to the operations, i.e. actions and functions, exposed by a service
|
|
2816
2889
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2817
2890
|
*/
|
|
2818
2891
|
operations: linked_2.ModelPart<linked_2.classes.action>
|
|
2819
2892
|
|
|
2893
|
+
/**
|
|
2894
|
+
* Provides access to the actions and functions, exposed by a service
|
|
2895
|
+
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services)
|
|
2896
|
+
*/
|
|
2897
|
+
actions: linked_2.ModelPart<linked_2.classes.action>
|
|
2898
|
+
|
|
2820
2899
|
/**
|
|
2821
2900
|
* Acts like a parameter-less constructor. Ensure to call `await super.init()` to have the base class’s handlers added.
|
|
2822
2901
|
* You may register own handlers before the base class’s ones, to intercept requests before the default handlers snap in.
|
|
@@ -2906,6 +2985,8 @@ export class Service extends QueryAPI {
|
|
|
2906
2985
|
on<T extends Constructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.On<InstanceType<T>>): this
|
|
2907
2986
|
on<F extends CdsFunction>(boundAction: F, service: string, handler: ActionEventHandler<F['__self'], F['__parameters'], void | Error | F['__returns']>): this
|
|
2908
2987
|
on<F extends CdsFunction>(unboundAction: F, handler: ActionEventHandler<F['__self'], F['__parameters'], void | Error | F['__returns']>): this
|
|
2988
|
+
// event classes, generated by cds-typer
|
|
2989
|
+
on<E extends {new (...args: any): any, kind: 'event'}>(eve: E, handler: EventHandler<InstanceType<E>>): this
|
|
2909
2990
|
on (eve: types.event, entity: types.target, handler: OnEventHandler): this
|
|
2910
2991
|
on (eve: types.event, handler: OnEventHandler): this
|
|
2911
2992
|
on (eve: 'error', handler: OnErrorHandler): this
|
|
@@ -2985,7 +3066,7 @@ class service_ extends context_ {
|
|
|
2985
3066
|
get protocols (): { [protocol in Protocol]?: boolean | undefined }
|
|
2986
3067
|
}
|
|
2987
3068
|
|
|
2988
|
-
interface service_2 extends
|
|
3069
|
+
interface service_2 extends any_ { }
|
|
2989
3070
|
|
|
2990
3071
|
export interface ServiceImpl {
|
|
2991
3072
|
(this: Service, srv: Service): any
|
|
@@ -3142,12 +3223,24 @@ class Test extends Axios {
|
|
|
3142
3223
|
*/
|
|
3143
3224
|
verbose (v: boolean): this
|
|
3144
3225
|
|
|
3226
|
+
/**
|
|
3227
|
+
* @deprecated Either use the {@link expect} property here or import `chai` in your test file.
|
|
3228
|
+
*/
|
|
3145
3229
|
get chai (): typeof import('chai')
|
|
3146
3230
|
|
|
3147
|
-
|
|
3148
|
-
|
|
3231
|
+
/**
|
|
3232
|
+
* @deprecated Either use the {@link expect} property here or import `chai.assert` in your test file.
|
|
3233
|
+
*/
|
|
3149
3234
|
get assert (): typeof import('chai').assert
|
|
3150
3235
|
|
|
3236
|
+
/**
|
|
3237
|
+
* The `expect` assertion from the `chai` assertion library.
|
|
3238
|
+
*
|
|
3239
|
+
* For Jest, this returns a built-in implementation that covers the most common matchers with the standard `chai` API.
|
|
3240
|
+
* If your tests need more matchers, move to a different test runner such as Vitest, which supports ESM-only modules like `chai`.
|
|
3241
|
+
*/
|
|
3242
|
+
get expect (): typeof import('chai').expect
|
|
3243
|
+
|
|
3151
3244
|
get data (): DataUtil
|
|
3152
3245
|
|
|
3153
3246
|
get cds (): _cds_2
|
|
@@ -3212,9 +3305,9 @@ export const transaction: Service['transaction'];
|
|
|
3212
3305
|
* @see [docs](https://cap.cloud.sap/docs/node.js/cds-tx)
|
|
3213
3306
|
*/
|
|
3214
3307
|
export const tx: {
|
|
3215
|
-
(fn: (tx: Transaction) =>
|
|
3308
|
+
<T>(fn: (tx: Transaction) => T): Promise<T>,
|
|
3216
3309
|
(context?: object): Transaction,
|
|
3217
|
-
(context: object, fn: (tx: Transaction) =>
|
|
3310
|
+
<T>(context: object, fn: (tx: Transaction) => T): Promise<T>,
|
|
3218
3311
|
};
|
|
3219
3312
|
|
|
3220
3313
|
export interface type extends Omit<csn.type, 'items'> {
|
|
@@ -3224,9 +3317,9 @@ export interface type extends Omit<csn.type, 'items'> {
|
|
|
3224
3317
|
virtual?: boolean
|
|
3225
3318
|
}
|
|
3226
3319
|
|
|
3227
|
-
export class type<K extends kinds = 'type'> extends
|
|
3320
|
+
export class type<K extends kinds = 'type'> extends any__2<K> { }
|
|
3228
3321
|
|
|
3229
|
-
interface type_2 extends
|
|
3322
|
+
interface type_2 extends any_ {
|
|
3230
3323
|
type?: 'cds.Boolean' |
|
|
3231
3324
|
'cds.UUID' | 'cds.String' | 'cds.LargeString' | 'cds.Binary' | 'cds.LargeBinary' | 'cds.Vector' |
|
|
3232
3325
|
'cds.Integer' | 'cds.UInt8' | 'cds.Int16' | 'cds.Int32' | 'cds.Int64' | 'cds.Double' | 'cds.Decimal' |
|
|
@@ -3528,7 +3621,7 @@ class Vector extends Binary { }
|
|
|
3528
3621
|
|
|
3529
3622
|
export const version: string;
|
|
3530
3623
|
|
|
3531
|
-
type Visitor = (def:
|
|
3624
|
+
type Visitor = (def: any__2, name: string, parent: any__2, defs: Definitions) => void
|
|
3532
3625
|
|
|
3533
3626
|
interface Where<T> {
|
|
3534
3627
|
where: HavingWhere<this, T>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/cds-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.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/",
|
|
@@ -50,14 +50,16 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@cap-js/cds-test": "^0",
|
|
53
|
+
"@cap-js/cds-test": "^0 || ^1",
|
|
54
54
|
"@cap-js/db-service": "^2.3.0",
|
|
55
55
|
"@microsoft/api-extractor": "^7.52.8",
|
|
56
56
|
"@sap/cds-dk": "^9",
|
|
57
57
|
"@stylistic/eslint-plugin-js": "^4.0.1",
|
|
58
58
|
"@stylistic/eslint-plugin-ts": "^4.0.1",
|
|
59
|
+
"@types/chai": "^5.2.3",
|
|
59
60
|
"axios": "^1.6.2",
|
|
60
|
-
"eslint": "^
|
|
61
|
+
"eslint": "^10",
|
|
62
|
+
"globals": "^17.5.0",
|
|
61
63
|
"typescript": "^5.4.5",
|
|
62
64
|
"typescript-eslint": "^8.0.0-alpha.51"
|
|
63
65
|
}
|