@cap-js/cds-types 0.13.0 → 0.15.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 +144 -42
- package/package.json +2 -1
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
|
|
|
@@ -66,9 +66,9 @@ export type __Vector = classes.Vector
|
|
|
66
66
|
|
|
67
67
|
class action extends any_<'action' | 'function'> {}
|
|
68
68
|
|
|
69
|
-
export interface ActionEventHandler<P, R> {
|
|
69
|
+
export interface ActionEventHandler<S, P, R> {
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
71
|
-
(req: Omit<Request_2, 'data'> & { data: P }, next: Function): Promise<R> | R
|
|
71
|
+
(req: Omit<Request_2, 'data'> & { data: P, subject: S }, next: Function): Promise<R> | R
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
interface And {
|
|
@@ -254,6 +254,7 @@ namespace cds {
|
|
|
254
254
|
on,
|
|
255
255
|
once,
|
|
256
256
|
exit,
|
|
257
|
+
error,
|
|
257
258
|
_cds,
|
|
258
259
|
cds_services,
|
|
259
260
|
connect,
|
|
@@ -323,6 +324,8 @@ namespace cds {
|
|
|
323
324
|
Key,
|
|
324
325
|
QueryAPI,
|
|
325
326
|
PropertiesOf,
|
|
327
|
+
Send,
|
|
328
|
+
FluentScheduling,
|
|
326
329
|
Service,
|
|
327
330
|
ApplicationService,
|
|
328
331
|
MessagingService,
|
|
@@ -358,11 +361,15 @@ namespace cds {
|
|
|
358
361
|
update,
|
|
359
362
|
transaction,
|
|
360
363
|
db,
|
|
364
|
+
queued,
|
|
365
|
+
unqueued,
|
|
361
366
|
outboxed,
|
|
362
367
|
unboxed,
|
|
363
368
|
EventContext,
|
|
364
369
|
Event_2 as Event,
|
|
365
370
|
Request_2 as Request,
|
|
371
|
+
GetRequest,
|
|
372
|
+
PostRequest,
|
|
366
373
|
User,
|
|
367
374
|
Anonymous,
|
|
368
375
|
Privileged,
|
|
@@ -387,6 +394,7 @@ namespace cds {
|
|
|
387
394
|
_segment,
|
|
388
395
|
_named,
|
|
389
396
|
val,
|
|
397
|
+
list,
|
|
390
398
|
xpr,
|
|
391
399
|
_xpr,
|
|
392
400
|
operator,
|
|
@@ -434,6 +442,7 @@ namespace cds_2 {
|
|
|
434
442
|
on,
|
|
435
443
|
once,
|
|
436
444
|
exit,
|
|
445
|
+
error,
|
|
437
446
|
_cds,
|
|
438
447
|
cds_services,
|
|
439
448
|
connect,
|
|
@@ -503,6 +512,8 @@ namespace cds_2 {
|
|
|
503
512
|
Key,
|
|
504
513
|
QueryAPI,
|
|
505
514
|
PropertiesOf,
|
|
515
|
+
Send,
|
|
516
|
+
FluentScheduling,
|
|
506
517
|
Service,
|
|
507
518
|
ApplicationService,
|
|
508
519
|
MessagingService,
|
|
@@ -538,11 +549,15 @@ namespace cds_2 {
|
|
|
538
549
|
update,
|
|
539
550
|
transaction,
|
|
540
551
|
db,
|
|
552
|
+
queued,
|
|
553
|
+
unqueued,
|
|
541
554
|
outboxed,
|
|
542
555
|
unboxed,
|
|
543
556
|
EventContext,
|
|
544
557
|
Event_2 as Event,
|
|
545
558
|
Request_2 as Request,
|
|
559
|
+
GetRequest,
|
|
560
|
+
PostRequest,
|
|
546
561
|
User,
|
|
547
562
|
Anonymous,
|
|
548
563
|
Privileged,
|
|
@@ -567,6 +582,7 @@ namespace cds_2 {
|
|
|
567
582
|
_segment,
|
|
568
583
|
_named,
|
|
569
584
|
val,
|
|
585
|
+
list,
|
|
570
586
|
xpr,
|
|
571
587
|
_xpr,
|
|
572
588
|
operator,
|
|
@@ -612,6 +628,7 @@ export type CdsFunction = {
|
|
|
612
628
|
(...args: any[]): any,
|
|
613
629
|
__parameters: object,
|
|
614
630
|
__returns: any,
|
|
631
|
+
__self?: any, // the entity the function is bound to, in case of bound functions
|
|
615
632
|
}
|
|
616
633
|
|
|
617
634
|
/**
|
|
@@ -879,6 +896,7 @@ namespace CQN {
|
|
|
879
896
|
_segment,
|
|
880
897
|
_named,
|
|
881
898
|
val,
|
|
899
|
+
list,
|
|
882
900
|
xpr,
|
|
883
901
|
_xpr,
|
|
884
902
|
operator,
|
|
@@ -1017,6 +1035,18 @@ class Decimal extends Float {
|
|
|
1017
1035
|
scale?: number
|
|
1018
1036
|
}
|
|
1019
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* @beta helper
|
|
1040
|
+
*/
|
|
1041
|
+
type DeepPartial<T> = T extends object
|
|
1042
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1043
|
+
? T extends Function
|
|
1044
|
+
? T
|
|
1045
|
+
: T extends Array<infer U>
|
|
1046
|
+
? Array<DeepPartial<U>>
|
|
1047
|
+
: { [K in keyof T]?: DeepPartial<T[K]> }
|
|
1048
|
+
: T
|
|
1049
|
+
|
|
1020
1050
|
/**
|
|
1021
1051
|
* Definitions are the central elements of a CDS model.
|
|
1022
1052
|
*/
|
|
@@ -1272,6 +1302,17 @@ export namespace env {
|
|
|
1272
1302
|
}
|
|
1273
1303
|
}
|
|
1274
1304
|
|
|
1305
|
+
/**
|
|
1306
|
+
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-facade#cds-error)
|
|
1307
|
+
*/
|
|
1308
|
+
export function error (code: number, message: string, details?: {stack?: unknown}, caller?: (...args: any[]) => unknown): Error
|
|
1309
|
+
|
|
1310
|
+
export function error (message: string, details?: {code: number, stack?: unknown}, caller?: (...args: any[]) => unknown): Error
|
|
1311
|
+
|
|
1312
|
+
export function error (details: {code: number, message: string}, caller?: (...args: any[]) => unknown): Error
|
|
1313
|
+
|
|
1314
|
+
export function error (string: TemplateStringsArray, ...args: any[]): Error
|
|
1315
|
+
|
|
1275
1316
|
export class event extends aspect<'event'> {}
|
|
1276
1317
|
|
|
1277
1318
|
/**
|
|
@@ -1328,7 +1369,7 @@ export interface EventHandler {
|
|
|
1328
1369
|
*/
|
|
1329
1370
|
export function exit (): void
|
|
1330
1371
|
|
|
1331
|
-
export type expr = ref | val | xpr | function_call | SELECT_2
|
|
1372
|
+
export type expr = ref | val | list | xpr | function_call | SELECT_2
|
|
1332
1373
|
|
|
1333
1374
|
export type expr_literal = { '=': string }
|
|
1334
1375
|
|
|
@@ -1373,6 +1414,11 @@ export type _flavor = 'parsed' | 'xtended' | 'inferred'
|
|
|
1373
1414
|
|
|
1374
1415
|
class Float extends number { }
|
|
1375
1416
|
|
|
1417
|
+
export type FluentScheduling<O extends keyof FluentScheduling = never> = {
|
|
1418
|
+
after: <T = any>(t: number | string, u?: string) => Promise<T> & Omit<FluentScheduling<O | 'after'>, O | 'after'>,
|
|
1419
|
+
every: <T = any>(t: number | string, u?: string) => Promise<T> & Omit<FluentScheduling<O | 'every'>, O | 'every'>,
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1376
1422
|
export const foreach: Service['foreach'];
|
|
1377
1423
|
|
|
1378
1424
|
type Formatter = {
|
|
@@ -1404,6 +1450,10 @@ export type function_call = { func: string, args: { [key: string]: any }[] }
|
|
|
1404
1450
|
*/
|
|
1405
1451
|
export function get (files: '*' | filename | filename[], o?: _options): Promise<csn.CSN>
|
|
1406
1452
|
|
|
1453
|
+
export type GetRequest<
|
|
1454
|
+
P extends Record<string, any>[]
|
|
1455
|
+
> = Request_2<Record<never, never>, P>;
|
|
1456
|
+
|
|
1407
1457
|
interface GroupBy {
|
|
1408
1458
|
groupBy: TaggedTemplateQueryPart<this>
|
|
1409
1459
|
& ((columns: Partial<{[column in KeyOfTarget<this extends ConstructedQuery<infer E> ? E : never, never>]: any}>) => this)
|
|
@@ -1417,11 +1467,11 @@ interface GroupBy {
|
|
|
1417
1467
|
* @example
|
|
1418
1468
|
* ```ts
|
|
1419
1469
|
* import { myAction } from '#cds-models/myService'
|
|
1420
|
-
*
|
|
1470
|
+
*
|
|
1421
1471
|
* function onMyFunction (req: HandlerFunction<typeof myAction>['parameters']['req']): HandlerFunction<typeof myAction>['returns'] {
|
|
1422
1472
|
* ...
|
|
1423
1473
|
* }
|
|
1424
|
-
*
|
|
1474
|
+
*
|
|
1425
1475
|
* srv.on(myAction, onMyFunction)
|
|
1426
1476
|
* ```
|
|
1427
1477
|
*/
|
|
@@ -1528,13 +1578,13 @@ interface INSERT_3<T> extends Columns<T>, InUpsert<T> {}
|
|
|
1528
1578
|
class INSERT_3<T> extends ConstructedQuery<T> {
|
|
1529
1579
|
private constructor();
|
|
1530
1580
|
|
|
1531
|
-
static into: (<T extends ArrayConstructable> (entity: T, ...entries: SingularInstanceType<T
|
|
1532
|
-
& (<T extends ArrayConstructable> (entity: T, entries?: SingularInstanceType<T
|
|
1581
|
+
static into: (<T extends ArrayConstructable> (entity: T, ...entries: DeepPartial<SingularInstanceType<T>>[]) => INSERT_3<SingularInstanceType<T>>)
|
|
1582
|
+
& (<T extends ArrayConstructable> (entity: T, entries?: DeepPartial<SingularInstanceType<T>>[]) => INSERT_3<SingularInstanceType<T>>)
|
|
1533
1583
|
& (TaggedTemplateQueryPart<INSERT_3<unknown>>)
|
|
1534
1584
|
& ((entity: EntityDescription, ...entries: Entries[]) => INSERT_3<StaticAny>)
|
|
1535
1585
|
& ((entity: EntityDescription, entries?: Entries) => INSERT_3<StaticAny>)
|
|
1536
|
-
& (<T> (entity: Constructable<T>, ...entries: T[]) => INSERT_3<T>)
|
|
1537
|
-
& (<T> (entity: Constructable<T>, entries?: T[]) => INSERT_3<T>)
|
|
1586
|
+
& (<T> (entity: Constructable<T>, ...entries: DeepPartial<T>[]) => INSERT_3<T>)
|
|
1587
|
+
& (<T> (entity: Constructable<T>, entries?: DeepPartial<T>[]) => INSERT_3<T>)
|
|
1538
1588
|
|
|
1539
1589
|
from (select: SELECT_3<T>): this
|
|
1540
1590
|
INSERT: CQN.INSERT['INSERT']
|
|
@@ -1556,8 +1606,8 @@ type Intersect<T extends readonly unknown[]> = T extends [infer Head, ...infer T
|
|
|
1556
1606
|
interface InUpsert<T> {
|
|
1557
1607
|
data (block: (e: T) => void): this
|
|
1558
1608
|
|
|
1559
|
-
entries (...entries: T[]): this
|
|
1560
|
-
entries (entries: T[]): this
|
|
1609
|
+
entries (...entries: DeepPartial<T>[]): this
|
|
1610
|
+
entries (entries: DeepPartial<T>[]): this
|
|
1561
1611
|
|
|
1562
1612
|
values (...val: (null | Primitive)[]): this
|
|
1563
1613
|
values (val: (null | Primitive)[]): this
|
|
@@ -1799,6 +1849,9 @@ interface LinkedCSN extends Omit<csn.CSN, 'definitions'> {
|
|
|
1799
1849
|
|
|
1800
1850
|
}
|
|
1801
1851
|
|
|
1852
|
+
/** @private */
|
|
1853
|
+
export type list = { list: any[] }
|
|
1854
|
+
|
|
1802
1855
|
/**
|
|
1803
1856
|
* Shortcut for `cds.get(files, 'inferred')`
|
|
1804
1857
|
* @param files - filenames of models or if folder containing models
|
|
@@ -2220,7 +2273,12 @@ type PK = number | string | object
|
|
|
2220
2273
|
|
|
2221
2274
|
type PluralInstanceType<T extends Constructable> = Array<InstanceType<T>>
|
|
2222
2275
|
|
|
2223
|
-
export type
|
|
2276
|
+
export type PostRequest<
|
|
2277
|
+
D = any,
|
|
2278
|
+
P extends Record<string, any>[] = Record<string, any>[]
|
|
2279
|
+
> = Request_2<D, P>;
|
|
2280
|
+
|
|
2281
|
+
export type predicate = _xpr
|
|
2224
2282
|
|
|
2225
2283
|
type Primitive = string | number | boolean | Date
|
|
2226
2284
|
|
|
@@ -2416,6 +2474,8 @@ type QueryArtefact = {
|
|
|
2416
2474
|
|
|
2417
2475
|
}
|
|
2418
2476
|
|
|
2477
|
+
export const queued: (service: Service) => Service;
|
|
2478
|
+
|
|
2419
2479
|
export const read: Service['read'];
|
|
2420
2480
|
|
|
2421
2481
|
/** @private */
|
|
@@ -2432,9 +2492,12 @@ export class RemoteService extends Service {}
|
|
|
2432
2492
|
/**
|
|
2433
2493
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/events)
|
|
2434
2494
|
*/
|
|
2435
|
-
class Request_2<
|
|
2495
|
+
class Request_2<
|
|
2496
|
+
D = any,
|
|
2497
|
+
P extends Record<string, any>[] = Record<string, any>[]
|
|
2498
|
+
> extends Event_2<D> {
|
|
2436
2499
|
|
|
2437
|
-
params:
|
|
2500
|
+
params: P
|
|
2438
2501
|
|
|
2439
2502
|
method: string
|
|
2440
2503
|
|
|
@@ -2524,8 +2587,6 @@ export const run: Service['run'];
|
|
|
2524
2587
|
|
|
2525
2588
|
class scalar extends type { }
|
|
2526
2589
|
|
|
2527
|
-
type Scalarise<A> = A extends Array<infer N> ? N : A
|
|
2528
|
-
|
|
2529
2590
|
/** @private */
|
|
2530
2591
|
export type _segment = name | {
|
|
2531
2592
|
id?: string,
|
|
@@ -2563,6 +2624,7 @@ interface SELECT_3<T> extends Where<T>, And, Having<T>, GroupBy, OrderBy<T>, Lim
|
|
|
2563
2624
|
|
|
2564
2625
|
class SELECT_3<T, Q = SELECT_from> extends ConstructedQuery<T> {
|
|
2565
2626
|
private constructor();
|
|
2627
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Unwrap<T>>
|
|
2566
2628
|
|
|
2567
2629
|
static one: SELECT_one & { from: SELECT_one } & { localized: SELECT_one }
|
|
2568
2630
|
|
|
@@ -2590,6 +2652,32 @@ class SELECT_3<T, Q = SELECT_from> extends ConstructedQuery<T> {
|
|
|
2590
2652
|
count?: boolean,
|
|
2591
2653
|
}
|
|
2592
2654
|
|
|
2655
|
+
/**
|
|
2656
|
+
* If a parameter is given, the raw data stream is piped into it.
|
|
2657
|
+
*
|
|
2658
|
+
* If no parameter is given, the raw data stream is returned.
|
|
2659
|
+
* @param stream the writable stream to pipe the raw data into
|
|
2660
|
+
* @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-ql#pipeline)
|
|
2661
|
+
* @since 9.3.0
|
|
2662
|
+
*/
|
|
2663
|
+
pipeline(stream: import('node:stream').Writable): Promise<void>
|
|
2664
|
+
/**
|
|
2665
|
+
* If a parameter is given, the raw data stream is piped into it.
|
|
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
|
|
2671
|
+
*/
|
|
2672
|
+
pipeline(): Promise<import('node:stream').Readable>
|
|
2673
|
+
|
|
2674
|
+
/**
|
|
2675
|
+
* Calls the given callback function for each row in the result set.
|
|
2676
|
+
* @param cb the callback function to call for each row
|
|
2677
|
+
* @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-ql#foreach)
|
|
2678
|
+
* @since 9.3.0
|
|
2679
|
+
*/
|
|
2680
|
+
foreach: (cb: (element: Unwrap<T>) => void) => Promise<void>
|
|
2593
2681
|
}
|
|
2594
2682
|
|
|
2595
2683
|
type SELECT_from =
|
|
@@ -2650,6 +2738,15 @@ TaggedTemplateQueryPart<Awaitable<SELECT_3<_TODO_2, SELECT_one>, InstanceType<_T
|
|
|
2650
2738
|
& (<T> (entity: { new(): T }, primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T, SELECT_one>, T | null>)
|
|
2651
2739
|
& ((subject: ref) => SELECT_3<_TODO_2>)
|
|
2652
2740
|
|
|
2741
|
+
export type Send<AddOn = {}> = {
|
|
2742
|
+
<T = any>(event: types.event, path: string, data?: object, headers?: object): Promise<T> & AddOn,
|
|
2743
|
+
<T = any>(event: types.event, data?: object, headers?: object): Promise<T> & AddOn,
|
|
2744
|
+
<T = any>(details: { event: types.event, data?: object, headers?: object }): Promise<T> & AddOn,
|
|
2745
|
+
<T = any>(details: { query: ConstructedQuery<T>, data?: object, headers?: object }): Promise<T> & AddOn,
|
|
2746
|
+
<T = any>(details: { method: types.eventName, path: string, data?: object, headers?: object }): Promise<T> & AddOn,
|
|
2747
|
+
<T = any>(details: { event: types.eventName, entity: linked_2.Definition | string, data?: object, params?: object, headers?: object }): Promise<T> & AddOn,
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2653
2750
|
/**
|
|
2654
2751
|
* Constructs service providers from respective service definitions
|
|
2655
2752
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-serve)
|
|
@@ -2741,21 +2838,27 @@ export class Service extends QueryAPI {
|
|
|
2741
2838
|
<P extends ArrayConstructable, R>(event: P, data: PropertiesOf<SingularInstanceType<P>>, headers?: object): Promise<R>,
|
|
2742
2839
|
<T = any>(event: types.event, data?: object, headers?: object): Promise<T>,
|
|
2743
2840
|
<T = any>(details: { event: types.event, data?: object, headers?: object }): Promise<T>,
|
|
2744
|
-
<T = any>(event: types.event, data?: object, headers?: object): Promise<T>,
|
|
2745
2841
|
}
|
|
2746
2842
|
|
|
2747
2843
|
/**
|
|
2748
2844
|
* Constructs and sends a synchronous request.
|
|
2749
2845
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services#srv-send-request)
|
|
2750
2846
|
*/
|
|
2751
|
-
send:
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2847
|
+
send: Send
|
|
2848
|
+
|
|
2849
|
+
/**
|
|
2850
|
+
* @alpha
|
|
2851
|
+
* Constructs and schedules a request for asynchronous processing.
|
|
2852
|
+
* @see [capire docs](https://cap.cloud.sap/docs/node.js/queue#task-scheduling)
|
|
2853
|
+
*/
|
|
2854
|
+
schedule: Send<FluentScheduling>
|
|
2855
|
+
|
|
2856
|
+
/**
|
|
2857
|
+
* @alpha
|
|
2858
|
+
* Triggers task processing.
|
|
2859
|
+
* @see [capire docs](https://cap.cloud.sap/docs/node.js/queue#task-processing)
|
|
2860
|
+
*/
|
|
2861
|
+
flush(): Promise<void>
|
|
2759
2862
|
|
|
2760
2863
|
/**
|
|
2761
2864
|
* Constructs and sends a GET request.
|
|
@@ -2791,7 +2894,7 @@ export class Service extends QueryAPI {
|
|
|
2791
2894
|
}
|
|
2792
2895
|
|
|
2793
2896
|
// The central method to dispatch events
|
|
2794
|
-
dispatch (msg: types.event): Promise<any>
|
|
2897
|
+
dispatch (msg: types.event | Request_2 | types.event[] | Request_2[]): Promise<any>
|
|
2795
2898
|
|
|
2796
2899
|
// FIXME: not yet documented, will come in future version
|
|
2797
2900
|
// disconnect (tenant?: string): Promise<void>
|
|
@@ -2801,8 +2904,8 @@ export class Service extends QueryAPI {
|
|
|
2801
2904
|
|
|
2802
2905
|
on<T extends ArrayConstructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.On<Unwrap<T>>): this
|
|
2803
2906
|
on<T extends Constructable>(eve: types.event, entity: T | T[], handler: CRUDEventHandler.On<InstanceType<T>>): this
|
|
2804
|
-
on<F extends CdsFunction>(boundAction: F, service: string, handler: ActionEventHandler<F['__parameters'], void | Error | F['__returns']>): this
|
|
2805
|
-
on<F extends CdsFunction>(unboundAction: F, handler: ActionEventHandler<F['__parameters'], void | Error | F['__returns']>): this
|
|
2907
|
+
on<F extends CdsFunction>(boundAction: F, service: string, handler: ActionEventHandler<F['__self'], F['__parameters'], void | Error | F['__returns']>): this
|
|
2908
|
+
on<F extends CdsFunction>(unboundAction: F, handler: ActionEventHandler<F['__self'], F['__parameters'], void | Error | F['__returns']>): this
|
|
2806
2909
|
on (eve: types.event, entity: types.target, handler: OnEventHandler): this
|
|
2807
2910
|
on (eve: types.event, handler: OnEventHandler): this
|
|
2808
2911
|
on (eve: 'error', handler: OnErrorHandler): this
|
|
@@ -3147,10 +3250,10 @@ class UInt8 extends Integer { }
|
|
|
3147
3250
|
|
|
3148
3251
|
export const unboxed: (service: Service) => Service;
|
|
3149
3252
|
|
|
3150
|
-
type UnionsToIntersections<U> = Array<UnionToIntersection<Scalarise<U>>>
|
|
3151
|
-
|
|
3152
3253
|
type UnionToIntersection<U> = Partial<(U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never>
|
|
3153
3254
|
|
|
3255
|
+
export const unqueued: (service: Service) => Service;
|
|
3256
|
+
|
|
3154
3257
|
type Unwrap<T> = T extends ArrayConstructable
|
|
3155
3258
|
? SingularInstanceType<T>
|
|
3156
3259
|
: T extends Array<infer U>
|
|
@@ -3168,7 +3271,10 @@ type UPDATE_2 = { UPDATE: {
|
|
|
3168
3271
|
}, }
|
|
3169
3272
|
export { UPDATE_2 as UPDATE }
|
|
3170
3273
|
|
|
3171
|
-
interface UPDATE_3<T> extends Where<T>, And, ByKey {
|
|
3274
|
+
interface UPDATE_3<T> extends Where<T>, And, ByKey {
|
|
3275
|
+
set: UpdateSet<this, T>
|
|
3276
|
+
with: UpdateSet<this, T>
|
|
3277
|
+
}
|
|
3172
3278
|
|
|
3173
3279
|
class UPDATE_3<T> extends ConstructedQuery<T> {
|
|
3174
3280
|
private constructor();
|
|
@@ -3180,11 +3286,7 @@ class UPDATE_3<T> extends ConstructedQuery<T> {
|
|
|
3180
3286
|
& ((entity: EntityDescription | ref | Definition_2, primaryKey?: PK) => UPDATE_3<StaticAny>)
|
|
3181
3287
|
& (<T> (entity: T, primaryKey?: PK) => UPDATE_3<T>)
|
|
3182
3288
|
|
|
3183
|
-
set: UpdateSet<this, T>
|
|
3184
|
-
with: UpdateSet<this, T>
|
|
3185
|
-
|
|
3186
3289
|
UPDATE: CQN.UPDATE['UPDATE']
|
|
3187
|
-
|
|
3188
3290
|
}
|
|
3189
3291
|
|
|
3190
3292
|
/**
|
|
@@ -3193,9 +3295,9 @@ class UPDATE_3<T> extends ConstructedQuery<T> {
|
|
|
3193
3295
|
*/
|
|
3194
3296
|
type UpdateSet<This, T> = TaggedTemplateQueryPart<This>
|
|
3195
3297
|
// simple value > title: 'Some Title'
|
|
3196
|
-
// qbe expression > stock: { '-=': quantity }
|
|
3298
|
+
// qbe expression > stock: { '-=': quantity }
|
|
3197
3299
|
// cqn expression > descr: {xpr: [{ref:[descr]}, '||', 'Some addition to descr.']}
|
|
3198
|
-
& ((data: {[P in keyof T]?: T[P] | {[op in QbeOp]?: T[P]} | CQN.xpr}) => This)
|
|
3300
|
+
& ((data: {[P in keyof T]?: T[P] | DeepPartial<T[P]> | {[op in QbeOp]?: DeepPartial<T[P]>} | CQN.xpr}) => This)
|
|
3199
3301
|
|
|
3200
3302
|
type UPSERT_2 = { UPSERT: {
|
|
3201
3303
|
into: ref | name,
|
|
@@ -3211,13 +3313,13 @@ interface UPSERT_3<T> extends Columns<T>, InUpsert<T> {}
|
|
|
3211
3313
|
class UPSERT_3<T> extends ConstructedQuery<T> {
|
|
3212
3314
|
private constructor();
|
|
3213
3315
|
|
|
3214
|
-
static into: (<T extends ArrayConstructable> (entity: T, ...entries: SingularInstanceType<T
|
|
3215
|
-
& (<T extends ArrayConstructable> (entity: T, entries?: SingularInstanceType<T
|
|
3316
|
+
static into: (<T extends ArrayConstructable> (entity: T, ...entries: DeepPartial<SingularInstanceType<T>>[]) => UPSERT_3<SingularInstanceType<T>>)
|
|
3317
|
+
& (<T extends ArrayConstructable> (entity: T, entries?: DeepPartial<SingularInstanceType<T>>[]) => UPSERT_3<SingularInstanceType<T>>)
|
|
3216
3318
|
& (TaggedTemplateQueryPart<UPSERT_3<StaticAny>>)
|
|
3217
3319
|
& ((entity: EntityDescription, ...entries: Entries[]) => UPSERT_3<StaticAny>)
|
|
3218
3320
|
& ((entity: EntityDescription, entries?: Entries) => UPSERT_3<StaticAny>)
|
|
3219
|
-
& (<T> (entity: Constructable<T>, ...entries: T[]) => UPSERT_3<T>)
|
|
3220
|
-
& (<T> (entity: Constructable<T>, entries?: T[]) => UPSERT_3<T>)
|
|
3321
|
+
& (<T> (entity: Constructable<T>, ...entries: DeepPartial<T>[]) => UPSERT_3<T>)
|
|
3322
|
+
& (<T> (entity: Constructable<T>, entries?: DeepPartial<T>[]) => UPSERT_3<T>)
|
|
3221
3323
|
|
|
3222
3324
|
UPSERT: CQN.UPSERT['UPSERT']
|
|
3223
3325
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/cds-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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/",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@cap-js/cds-test": "^0",
|
|
54
|
+
"@cap-js/db-service": "^2.3.0",
|
|
54
55
|
"@microsoft/api-extractor": "^7.52.8",
|
|
55
56
|
"@sap/cds-dk": "^9",
|
|
56
57
|
"@stylistic/eslint-plugin-js": "^4.0.1",
|