@cap-js/cds-types 0.9.0 → 0.11.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 +310 -195
- package/package.json +18 -23
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
|
|
|
@@ -102,6 +102,11 @@ class any_<K extends kinds = kinds> {
|
|
|
102
102
|
|
|
103
103
|
interface any__2 {
|
|
104
104
|
kind?: kinds
|
|
105
|
+
/**
|
|
106
|
+
* only available when compiled with docs:true
|
|
107
|
+
* @see [capire docs](https://cap.cloud.sap/docs/cds/cdl#comments)
|
|
108
|
+
*/
|
|
109
|
+
doc?: string
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
/**
|
|
@@ -111,7 +116,15 @@ interface any__2 {
|
|
|
111
116
|
*/
|
|
112
117
|
export const app: import('express').Application;
|
|
113
118
|
|
|
114
|
-
export class ApplicationService extends Service {
|
|
119
|
+
export class ApplicationService extends Service {
|
|
120
|
+
new<T extends Constructable>(draft: T, data: {[K in keyof InstanceType<T>]?: InstanceType<T>[K]}): Promise<unknown>
|
|
121
|
+
new<T extends Constructable>(draft: T): {
|
|
122
|
+
for(keys: Key[]): Promise<unknown>,
|
|
123
|
+
}
|
|
124
|
+
discard(draft: Constructable, keys: Key[]): Promise<unknown>
|
|
125
|
+
edit(draft: Constructable, keys: Key[]): Promise<unknown>
|
|
126
|
+
save(draft: Constructable, keys: Key[]): Promise<unknown>
|
|
127
|
+
}
|
|
115
128
|
|
|
116
129
|
export class array extends type<'type' | 'elements'> { }
|
|
117
130
|
|
|
@@ -214,7 +227,6 @@ export type CDL = string
|
|
|
214
227
|
|
|
215
228
|
namespace cds {
|
|
216
229
|
export {
|
|
217
|
-
default_2 as default,
|
|
218
230
|
log,
|
|
219
231
|
debug,
|
|
220
232
|
test,
|
|
@@ -309,6 +321,7 @@ namespace cds {
|
|
|
309
321
|
spawn,
|
|
310
322
|
Key,
|
|
311
323
|
QueryAPI,
|
|
324
|
+
PropertiesOf,
|
|
312
325
|
Service,
|
|
313
326
|
ApplicationService,
|
|
314
327
|
MessagingService,
|
|
@@ -378,13 +391,197 @@ namespace cds {
|
|
|
378
391
|
operator,
|
|
379
392
|
function_call,
|
|
380
393
|
enum_literal,
|
|
381
|
-
expr_literal
|
|
394
|
+
expr_literal,
|
|
395
|
+
Texts,
|
|
396
|
+
I18nBundle,
|
|
397
|
+
I18nFacade,
|
|
398
|
+
I18nFilesOptions,
|
|
399
|
+
I18nFiles,
|
|
400
|
+
i18n
|
|
382
401
|
}
|
|
383
402
|
}
|
|
403
|
+
export default cds;
|
|
384
404
|
|
|
385
|
-
export type _cds = typeof
|
|
405
|
+
export type _cds = typeof cds_2
|
|
386
406
|
|
|
387
|
-
|
|
407
|
+
namespace cds_2 {
|
|
408
|
+
export {
|
|
409
|
+
cds as default,
|
|
410
|
+
log,
|
|
411
|
+
debug,
|
|
412
|
+
test,
|
|
413
|
+
ql,
|
|
414
|
+
QLExtensions,
|
|
415
|
+
csn,
|
|
416
|
+
delete_ as delete,
|
|
417
|
+
version,
|
|
418
|
+
home,
|
|
419
|
+
root,
|
|
420
|
+
cli,
|
|
421
|
+
requires,
|
|
422
|
+
extend,
|
|
423
|
+
lazify,
|
|
424
|
+
lazified,
|
|
425
|
+
entity,
|
|
426
|
+
event,
|
|
427
|
+
type,
|
|
428
|
+
array,
|
|
429
|
+
struct,
|
|
430
|
+
Association,
|
|
431
|
+
Composition,
|
|
432
|
+
builtin,
|
|
433
|
+
on,
|
|
434
|
+
once,
|
|
435
|
+
exit,
|
|
436
|
+
_cds,
|
|
437
|
+
cds_services,
|
|
438
|
+
connect,
|
|
439
|
+
server,
|
|
440
|
+
serve,
|
|
441
|
+
services,
|
|
442
|
+
service,
|
|
443
|
+
cds_serve_fluent,
|
|
444
|
+
cds_connect_options,
|
|
445
|
+
Middlewares,
|
|
446
|
+
middlewares,
|
|
447
|
+
app,
|
|
448
|
+
env,
|
|
449
|
+
_TODO,
|
|
450
|
+
get,
|
|
451
|
+
load,
|
|
452
|
+
resolve,
|
|
453
|
+
minify,
|
|
454
|
+
reflect,
|
|
455
|
+
_flavor,
|
|
456
|
+
_odata_options,
|
|
457
|
+
_options,
|
|
458
|
+
JSON_2 as JSON,
|
|
459
|
+
YAML,
|
|
460
|
+
CDL,
|
|
461
|
+
SQL,
|
|
462
|
+
XML,
|
|
463
|
+
EDM,
|
|
464
|
+
EDMX,
|
|
465
|
+
filename,
|
|
466
|
+
model,
|
|
467
|
+
parse,
|
|
468
|
+
linked,
|
|
469
|
+
__type,
|
|
470
|
+
__aspect,
|
|
471
|
+
__any_,
|
|
472
|
+
__scalar,
|
|
473
|
+
__Boolean,
|
|
474
|
+
__UUID,
|
|
475
|
+
__String,
|
|
476
|
+
__LargeString,
|
|
477
|
+
__Binary,
|
|
478
|
+
__LargeBinary,
|
|
479
|
+
__Vector,
|
|
480
|
+
__Integer,
|
|
481
|
+
__UInt8,
|
|
482
|
+
__Int16,
|
|
483
|
+
__Int32,
|
|
484
|
+
__Int64,
|
|
485
|
+
__Float,
|
|
486
|
+
__Double,
|
|
487
|
+
__Decimal,
|
|
488
|
+
__date,
|
|
489
|
+
__Date,
|
|
490
|
+
__Time,
|
|
491
|
+
__DateTime,
|
|
492
|
+
__TimeStamp,
|
|
493
|
+
__array,
|
|
494
|
+
__struct,
|
|
495
|
+
__context_,
|
|
496
|
+
__service,
|
|
497
|
+
__entity,
|
|
498
|
+
__Association,
|
|
499
|
+
__Composition,
|
|
500
|
+
compile,
|
|
501
|
+
spawn,
|
|
502
|
+
Key,
|
|
503
|
+
QueryAPI,
|
|
504
|
+
PropertiesOf,
|
|
505
|
+
Service,
|
|
506
|
+
ApplicationService,
|
|
507
|
+
MessagingService,
|
|
508
|
+
RemoteService,
|
|
509
|
+
DatabaseService,
|
|
510
|
+
Transaction,
|
|
511
|
+
ResultSet,
|
|
512
|
+
ServiceImpl,
|
|
513
|
+
EventHandler,
|
|
514
|
+
OnEventHandler,
|
|
515
|
+
OnErrorHandler,
|
|
516
|
+
Partial_2 as Partial,
|
|
517
|
+
OneOrMany,
|
|
518
|
+
CdsFunction,
|
|
519
|
+
CdsFunctions,
|
|
520
|
+
HandlerFunction,
|
|
521
|
+
CRUDEventHandler,
|
|
522
|
+
ActionEventHandler,
|
|
523
|
+
ResultsHandler,
|
|
524
|
+
SpawnEvents,
|
|
525
|
+
SpawnEventEmitter,
|
|
526
|
+
types,
|
|
527
|
+
SpawnOptions,
|
|
528
|
+
context,
|
|
529
|
+
tx,
|
|
530
|
+
entities,
|
|
531
|
+
run,
|
|
532
|
+
foreach,
|
|
533
|
+
stream,
|
|
534
|
+
read,
|
|
535
|
+
create,
|
|
536
|
+
insert,
|
|
537
|
+
update,
|
|
538
|
+
transaction,
|
|
539
|
+
db,
|
|
540
|
+
outboxed,
|
|
541
|
+
unboxed,
|
|
542
|
+
EventContext,
|
|
543
|
+
Event_2 as Event,
|
|
544
|
+
Request_2 as Request,
|
|
545
|
+
User,
|
|
546
|
+
Anonymous,
|
|
547
|
+
Privileged,
|
|
548
|
+
utils,
|
|
549
|
+
Query,
|
|
550
|
+
SELECT_2 as SELECT,
|
|
551
|
+
INSERT_2 as INSERT,
|
|
552
|
+
UPSERT_2 as UPSERT,
|
|
553
|
+
UPDATE_2 as UPDATE,
|
|
554
|
+
DELETE_2 as DELETE,
|
|
555
|
+
CREATE_2 as CREATE,
|
|
556
|
+
DROP_2 as DROP,
|
|
557
|
+
primitive,
|
|
558
|
+
data,
|
|
559
|
+
name,
|
|
560
|
+
source,
|
|
561
|
+
column_expr,
|
|
562
|
+
predicate,
|
|
563
|
+
ordering_term,
|
|
564
|
+
expr,
|
|
565
|
+
ref,
|
|
566
|
+
_segment,
|
|
567
|
+
_named,
|
|
568
|
+
val,
|
|
569
|
+
xpr,
|
|
570
|
+
_xpr,
|
|
571
|
+
operator,
|
|
572
|
+
function_call,
|
|
573
|
+
enum_literal,
|
|
574
|
+
expr_literal,
|
|
575
|
+
Texts,
|
|
576
|
+
I18nBundle,
|
|
577
|
+
I18nFacade,
|
|
578
|
+
I18nFilesOptions,
|
|
579
|
+
I18nFiles,
|
|
580
|
+
i18n
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
type _cds_2 = typeof cds_2
|
|
388
585
|
|
|
389
586
|
export interface cds_connect_options {
|
|
390
587
|
impl?: string
|
|
@@ -458,6 +655,7 @@ namespace classes {
|
|
|
458
655
|
TimeStamp,
|
|
459
656
|
array,
|
|
460
657
|
struct,
|
|
658
|
+
Map_3 as Map,
|
|
461
659
|
context_,
|
|
462
660
|
service_,
|
|
463
661
|
action,
|
|
@@ -602,7 +800,7 @@ export const connect: {
|
|
|
602
800
|
* Shortcut for 'db' as the primary database returning `cds.DatabaseService`
|
|
603
801
|
* @example await cds.connect.to ('db')
|
|
604
802
|
*/
|
|
605
|
-
to(datasource: 'db', options?: cds_connect_options): Promise<
|
|
803
|
+
to(datasource: 'db', options?: cds_connect_options): Promise<cds_2.DatabaseService>,
|
|
606
804
|
|
|
607
805
|
/**
|
|
608
806
|
* Connects to a specific datasource via a Service subclass
|
|
@@ -618,7 +816,7 @@ export const connect: {
|
|
|
618
816
|
* await cds.connect.to (ServiceClass)
|
|
619
817
|
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-connect#cds-connect-to)
|
|
620
818
|
*/
|
|
621
|
-
to<S>(datasource: S, options?: cds_connect_options): Promise<
|
|
819
|
+
to<S>(datasource: S, options?: cds_connect_options): Promise<cds_2.CdsFunctions<S> & Service>,
|
|
622
820
|
|
|
623
821
|
/**
|
|
624
822
|
* Connects to a specific datasource via options.
|
|
@@ -644,7 +842,7 @@ class ConstructedQuery<T> {
|
|
|
644
842
|
// that don't make explicit use of the generic. So `UPDATE<Books> !<: UPDATE<number>`
|
|
645
843
|
private _: T
|
|
646
844
|
then (_resolved: (x: any) => any, _rejected: (e: Error) => any): any
|
|
647
|
-
|
|
845
|
+
bind (service: Service): this
|
|
648
846
|
}
|
|
649
847
|
|
|
650
848
|
/**
|
|
@@ -760,6 +958,7 @@ namespace csn {
|
|
|
760
958
|
service_2 as service,
|
|
761
959
|
type_2 as type,
|
|
762
960
|
struct_2 as struct,
|
|
961
|
+
Map_2 as Map,
|
|
763
962
|
entity_2 as entity,
|
|
764
963
|
EntityElements,
|
|
765
964
|
Association_2 as Association
|
|
@@ -817,175 +1016,6 @@ class Decimal extends Float {
|
|
|
817
1016
|
scale?: number
|
|
818
1017
|
}
|
|
819
1018
|
|
|
820
|
-
export namespace default_2 {
|
|
821
|
-
export {
|
|
822
|
-
log,
|
|
823
|
-
debug,
|
|
824
|
-
test,
|
|
825
|
-
ql,
|
|
826
|
-
QLExtensions,
|
|
827
|
-
csn,
|
|
828
|
-
delete_ as delete,
|
|
829
|
-
version,
|
|
830
|
-
home,
|
|
831
|
-
root,
|
|
832
|
-
cli,
|
|
833
|
-
requires,
|
|
834
|
-
extend,
|
|
835
|
-
lazify,
|
|
836
|
-
lazified,
|
|
837
|
-
entity,
|
|
838
|
-
event,
|
|
839
|
-
type,
|
|
840
|
-
array,
|
|
841
|
-
struct,
|
|
842
|
-
Association,
|
|
843
|
-
Composition,
|
|
844
|
-
builtin,
|
|
845
|
-
on,
|
|
846
|
-
once,
|
|
847
|
-
exit,
|
|
848
|
-
_cds,
|
|
849
|
-
cds_services,
|
|
850
|
-
connect,
|
|
851
|
-
server,
|
|
852
|
-
serve,
|
|
853
|
-
services,
|
|
854
|
-
service,
|
|
855
|
-
cds_serve_fluent,
|
|
856
|
-
cds_connect_options,
|
|
857
|
-
Middlewares,
|
|
858
|
-
middlewares,
|
|
859
|
-
app,
|
|
860
|
-
env,
|
|
861
|
-
_TODO,
|
|
862
|
-
get,
|
|
863
|
-
load,
|
|
864
|
-
resolve,
|
|
865
|
-
minify,
|
|
866
|
-
reflect,
|
|
867
|
-
_flavor,
|
|
868
|
-
_odata_options,
|
|
869
|
-
_options,
|
|
870
|
-
JSON_2 as JSON,
|
|
871
|
-
YAML,
|
|
872
|
-
CDL,
|
|
873
|
-
SQL,
|
|
874
|
-
XML,
|
|
875
|
-
EDM,
|
|
876
|
-
EDMX,
|
|
877
|
-
filename,
|
|
878
|
-
model,
|
|
879
|
-
parse,
|
|
880
|
-
linked,
|
|
881
|
-
__type,
|
|
882
|
-
__aspect,
|
|
883
|
-
__any_,
|
|
884
|
-
__scalar,
|
|
885
|
-
__Boolean,
|
|
886
|
-
__UUID,
|
|
887
|
-
__String,
|
|
888
|
-
__LargeString,
|
|
889
|
-
__Binary,
|
|
890
|
-
__LargeBinary,
|
|
891
|
-
__Vector,
|
|
892
|
-
__Integer,
|
|
893
|
-
__UInt8,
|
|
894
|
-
__Int16,
|
|
895
|
-
__Int32,
|
|
896
|
-
__Int64,
|
|
897
|
-
__Float,
|
|
898
|
-
__Double,
|
|
899
|
-
__Decimal,
|
|
900
|
-
__date,
|
|
901
|
-
__Date,
|
|
902
|
-
__Time,
|
|
903
|
-
__DateTime,
|
|
904
|
-
__TimeStamp,
|
|
905
|
-
__array,
|
|
906
|
-
__struct,
|
|
907
|
-
__context_,
|
|
908
|
-
__service,
|
|
909
|
-
__entity,
|
|
910
|
-
__Association,
|
|
911
|
-
__Composition,
|
|
912
|
-
compile,
|
|
913
|
-
spawn,
|
|
914
|
-
Key,
|
|
915
|
-
QueryAPI,
|
|
916
|
-
Service,
|
|
917
|
-
ApplicationService,
|
|
918
|
-
MessagingService,
|
|
919
|
-
RemoteService,
|
|
920
|
-
DatabaseService,
|
|
921
|
-
Transaction,
|
|
922
|
-
ResultSet,
|
|
923
|
-
ServiceImpl,
|
|
924
|
-
EventHandler,
|
|
925
|
-
OnEventHandler,
|
|
926
|
-
OnErrorHandler,
|
|
927
|
-
Partial_2 as Partial,
|
|
928
|
-
OneOrMany,
|
|
929
|
-
CdsFunction,
|
|
930
|
-
CdsFunctions,
|
|
931
|
-
HandlerFunction,
|
|
932
|
-
CRUDEventHandler,
|
|
933
|
-
ActionEventHandler,
|
|
934
|
-
ResultsHandler,
|
|
935
|
-
SpawnEvents,
|
|
936
|
-
SpawnEventEmitter,
|
|
937
|
-
types,
|
|
938
|
-
SpawnOptions,
|
|
939
|
-
context,
|
|
940
|
-
tx,
|
|
941
|
-
entities,
|
|
942
|
-
run,
|
|
943
|
-
foreach,
|
|
944
|
-
stream,
|
|
945
|
-
read,
|
|
946
|
-
create,
|
|
947
|
-
insert,
|
|
948
|
-
update,
|
|
949
|
-
transaction,
|
|
950
|
-
db,
|
|
951
|
-
outboxed,
|
|
952
|
-
unboxed,
|
|
953
|
-
EventContext,
|
|
954
|
-
Event_2 as Event,
|
|
955
|
-
Request_2 as Request,
|
|
956
|
-
User,
|
|
957
|
-
Anonymous,
|
|
958
|
-
Privileged,
|
|
959
|
-
utils,
|
|
960
|
-
Query,
|
|
961
|
-
SELECT_2 as SELECT,
|
|
962
|
-
INSERT_2 as INSERT,
|
|
963
|
-
UPSERT_2 as UPSERT,
|
|
964
|
-
UPDATE_2 as UPDATE,
|
|
965
|
-
DELETE_2 as DELETE,
|
|
966
|
-
CREATE_2 as CREATE,
|
|
967
|
-
DROP_2 as DROP,
|
|
968
|
-
primitive,
|
|
969
|
-
data,
|
|
970
|
-
name,
|
|
971
|
-
source,
|
|
972
|
-
column_expr,
|
|
973
|
-
predicate,
|
|
974
|
-
ordering_term,
|
|
975
|
-
expr,
|
|
976
|
-
ref,
|
|
977
|
-
_segment,
|
|
978
|
-
_named,
|
|
979
|
-
val,
|
|
980
|
-
xpr,
|
|
981
|
-
_xpr,
|
|
982
|
-
operator,
|
|
983
|
-
function_call,
|
|
984
|
-
enum_literal,
|
|
985
|
-
expr_literal
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
|
|
989
1019
|
/**
|
|
990
1020
|
* Definitions are the central elements of a CDS model.
|
|
991
1021
|
*/
|
|
@@ -1430,8 +1460,57 @@ type HavingWhere<This, E> =
|
|
|
1430
1460
|
& ((...expr: string[]) => This)
|
|
1431
1461
|
& TaggedTemplateQueryPart<This>
|
|
1432
1462
|
|
|
1463
|
+
interface Hints {
|
|
1464
|
+
hints: ((...hints: string[]) => this)
|
|
1465
|
+
& ((hints: string[]) => this)
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1433
1468
|
export const home: string;
|
|
1434
1469
|
|
|
1470
|
+
export const i18n: I18nFacade;
|
|
1471
|
+
|
|
1472
|
+
export class I18nBundle {
|
|
1473
|
+
constructor(options: I18nFilesOptions)
|
|
1474
|
+
for(key: number | string | object, locale?: string | object, args?: object): string | undefined
|
|
1475
|
+
at(key: number | string | object, locale?: string | object, args?: object): string | undefined
|
|
1476
|
+
files: I18nFiles
|
|
1477
|
+
get defaults(): Record<string, string>
|
|
1478
|
+
get fallback(): Record<string, string>
|
|
1479
|
+
key4(definition: entity): string
|
|
1480
|
+
texts4 (locale: string): Texts
|
|
1481
|
+
translations4 (...locales : string[]) : { [locale: string]: Texts }
|
|
1482
|
+
translations4 (locale : 'all' ) : { [locale: string]: Texts }
|
|
1483
|
+
all () : Record<string, Texts>
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
export interface I18nFacade {
|
|
1487
|
+
Bundle: typeof I18nBundle
|
|
1488
|
+
Facade: I18nFacade
|
|
1489
|
+
Files: typeof I18nFiles
|
|
1490
|
+
get file(): string
|
|
1491
|
+
get folders(): string[]
|
|
1492
|
+
get labels(): I18nBundle
|
|
1493
|
+
get messages(): I18nBundle
|
|
1494
|
+
|
|
1495
|
+
bundle4 (file: string, options?: I18nFilesOptions): I18nBundle
|
|
1496
|
+
bundle4 (model: csn.CSN): I18nBundle
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
export class I18nFiles {
|
|
1500
|
+
constructor (options: I18nFilesOptions)
|
|
1501
|
+
get options(): I18nFilesOptions
|
|
1502
|
+
get basename(): string
|
|
1503
|
+
content4(locale: string, suffix: string): Array<object>
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
export interface I18nFilesOptions {
|
|
1507
|
+
file? : string
|
|
1508
|
+
model? : csn.CSN
|
|
1509
|
+
roots? : string[]
|
|
1510
|
+
leafs? : string[]
|
|
1511
|
+
folders? : string[]
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1435
1514
|
export const insert: Service['insert'];
|
|
1436
1515
|
|
|
1437
1516
|
type INSERT_2 = { INSERT: {
|
|
@@ -1585,6 +1664,9 @@ export const linked: {
|
|
|
1585
1664
|
export namespace linked {
|
|
1586
1665
|
export type LinkedDefinitions = IterableMap<linked_2.classes.any_>
|
|
1587
1666
|
export type LinkedCSN = linked_2.LinkedCSN
|
|
1667
|
+
// synthetic class that is prominently featured in capire,
|
|
1668
|
+
// but described as "accessible through cds.linked.classes.any"
|
|
1669
|
+
export type LinkedDefinition = linked_2.classes.any_
|
|
1588
1670
|
|
|
1589
1671
|
export namespace classes {
|
|
1590
1672
|
export type type = __type
|
|
@@ -1874,6 +1956,17 @@ type ManagedAssociation = Association & {
|
|
|
1874
1956
|
keys: Column[],
|
|
1875
1957
|
}
|
|
1876
1958
|
|
|
1959
|
+
interface Map_2 extends Omit<struct_2, 'includes' | 'items'> {
|
|
1960
|
+
elements: Record<string,never>
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* @since 8.6.0
|
|
1965
|
+
*/
|
|
1966
|
+
interface Map_3 extends csn.Map {}
|
|
1967
|
+
|
|
1968
|
+
class Map_3 {}
|
|
1969
|
+
|
|
1877
1970
|
export class MessagingService extends Service {}
|
|
1878
1971
|
|
|
1879
1972
|
export type Middlewares = 'context' | 'trace' | 'auth' | 'ctx_model' | string
|
|
@@ -2127,6 +2220,10 @@ export class Privileged extends User {
|
|
|
2127
2220
|
|
|
2128
2221
|
type Projection<T> = (e: QLExtensions<T extends ArrayConstructable ? SingularInstanceType<T> : T>) => void
|
|
2129
2222
|
|
|
2223
|
+
export type PropertiesOf<T> = {
|
|
2224
|
+
[K in keyof T]?: T[K];
|
|
2225
|
+
};
|
|
2226
|
+
|
|
2130
2227
|
/**
|
|
2131
2228
|
* @alpha
|
|
2132
2229
|
* related to .protocols getters
|
|
@@ -2345,7 +2442,7 @@ class Request_2<T = any> extends Event_2<T> {
|
|
|
2345
2442
|
|
|
2346
2443
|
error (code: number, message: string, target?: string, args?: any[]): Error
|
|
2347
2444
|
|
|
2348
|
-
reject (code: number, message: string, target?: string, args?: any[]):
|
|
2445
|
+
reject (code: number, message: string, target?: string, args?: any[]): never
|
|
2349
2446
|
|
|
2350
2447
|
notify (code: number, message: string, args?: any[]): Error
|
|
2351
2448
|
|
|
@@ -2355,7 +2452,7 @@ class Request_2<T = any> extends Event_2<T> {
|
|
|
2355
2452
|
|
|
2356
2453
|
error (code: number, message: string, args?: any[]): Error
|
|
2357
2454
|
|
|
2358
|
-
reject (code: number, message: string, args?: any[]):
|
|
2455
|
+
reject (code: number, message: string, args?: any[]): never
|
|
2359
2456
|
|
|
2360
2457
|
notify (message: string, target?: string, args?: any[]): Error
|
|
2361
2458
|
|
|
@@ -2365,7 +2462,7 @@ class Request_2<T = any> extends Event_2<T> {
|
|
|
2365
2462
|
|
|
2366
2463
|
error (message: string, target?: string, args?: any[]): Error
|
|
2367
2464
|
|
|
2368
|
-
reject (message: string, target?: string, args?: any[]):
|
|
2465
|
+
reject (message: string, target?: string, args?: any[]): never
|
|
2369
2466
|
|
|
2370
2467
|
notify (message: { code?: number | string, message: string, target?: string, args?: any[] }): Error
|
|
2371
2468
|
|
|
@@ -2375,7 +2472,7 @@ class Request_2<T = any> extends Event_2<T> {
|
|
|
2375
2472
|
|
|
2376
2473
|
error (message: { code?: number | string, message: string, target?: string, args?: any[], status?: number }): Error
|
|
2377
2474
|
|
|
2378
|
-
reject (message: { code?: number | string, message: string, target?: string, args?: any[], status?: number }):
|
|
2475
|
+
reject (message: { code?: number | string, message: string, target?: string, args?: any[], status?: number }): never
|
|
2379
2476
|
|
|
2380
2477
|
}
|
|
2381
2478
|
export { Request_2 as Request }
|
|
@@ -2437,7 +2534,7 @@ type SELECT_2 = { SELECT: {
|
|
|
2437
2534
|
}, }
|
|
2438
2535
|
export { SELECT_2 as SELECT }
|
|
2439
2536
|
|
|
2440
|
-
interface SELECT_3<T> extends Where<T>, And, Having<T>, GroupBy, OrderBy<T>, Limit {
|
|
2537
|
+
interface SELECT_3<T> extends Where<T>, And, Having<T>, GroupBy, OrderBy<T>, Limit, Hints {
|
|
2441
2538
|
// overload specific to SELECT
|
|
2442
2539
|
columns: Columns<T, this>['columns'] & ((projection: Projection<T>) => this)
|
|
2443
2540
|
}
|
|
@@ -2464,17 +2561,6 @@ class SELECT_3<T, Q = SELECT_from> extends ConstructedQuery<T> {
|
|
|
2464
2561
|
alias (as: string): this
|
|
2465
2562
|
elements: EntityElements
|
|
2466
2563
|
|
|
2467
|
-
|
|
2468
|
-
// Not yet public
|
|
2469
|
-
// fullJoin (other: string, as: string) : this
|
|
2470
|
-
// leftJoin (other: string, as: string) : this
|
|
2471
|
-
// rightJoin (other: string, as: string) : this
|
|
2472
|
-
// innerJoin (other: string, as: string) : this
|
|
2473
|
-
// join (other: string, as: string, kind?: string) : this
|
|
2474
|
-
// on : TaggedTemplateQueryPart<this>
|
|
2475
|
-
// & ((...expr : string[]) => this)
|
|
2476
|
-
// & ((predicate:object) => this)
|
|
2477
|
-
|
|
2478
2564
|
SELECT: CQN.SELECT['SELECT'] & {
|
|
2479
2565
|
forUpdate?: { wait: number },
|
|
2480
2566
|
forShareLock?: { wait: number },
|
|
@@ -2624,6 +2710,14 @@ export class Service extends QueryAPI {
|
|
|
2624
2710
|
* @see [capire docs](https://cap.cloud.sap/docs/node.js/core-services#srv-emit-event)
|
|
2625
2711
|
*/
|
|
2626
2712
|
emit: {
|
|
2713
|
+
// we can only give very little guidance as to code completion here.
|
|
2714
|
+
// Users will receive suggestions/ code completion for the property names of P.
|
|
2715
|
+
// But they will see no complaints for when they pass a non-existing property or use the wrong type for it.
|
|
2716
|
+
// That is because classes still fulfill {name:string}, so they can be used for the overload where event of type types.event,
|
|
2717
|
+
// which allows for any object as data.
|
|
2718
|
+
<P extends Constructable, R>(event: P, data: PropertiesOf<InstanceType<P>>, headers?: object): Promise<R>,
|
|
2719
|
+
<P extends ArrayConstructable, R>(event: P, data: PropertiesOf<SingularInstanceType<P>>, headers?: object): Promise<R>,
|
|
2720
|
+
<T = any>(event: types.event, data?: object, headers?: object): Promise<T>,
|
|
2627
2721
|
<T = any>(details: { event: types.event, data?: object, headers?: object }): Promise<T>,
|
|
2628
2722
|
<T = any>(event: types.event, data?: object, headers?: object): Promise<T>,
|
|
2629
2723
|
}
|
|
@@ -2878,6 +2972,8 @@ type Subqueryable<T> = T extends Primitive ? unknown
|
|
|
2878
2972
|
* Note that you do not need to return anything from these subqueries.
|
|
2879
2973
|
*/
|
|
2880
2974
|
(fn: ((a: QLExtensions<T[number]>) => any) | '*'): T[number],
|
|
2975
|
+
// infix filters, like b.author`[city='Paris']`('*')
|
|
2976
|
+
(predicate: TemplateStringsArray): Subqueryable<T>,
|
|
2881
2977
|
}
|
|
2882
2978
|
// composition of one/ association to one
|
|
2883
2979
|
: {
|
|
@@ -2898,6 +2994,8 @@ type Subqueryable<T> = T extends Primitive ? unknown
|
|
|
2898
2994
|
* Note that you do not need to return anything from these subqueries.
|
|
2899
2995
|
*/
|
|
2900
2996
|
(fn: ((a: QLExtensions<T>) => any) | '*'): T,
|
|
2997
|
+
// infix filters, like b.author`[city='Paris']`('*')
|
|
2998
|
+
(predicate: TemplateStringsArray): Subqueryable<T>,
|
|
2901
2999
|
}
|
|
2902
3000
|
|
|
2903
3001
|
type TaggedTemplateQueryPart<T> = (strings: TemplateStringsArray, ...params: unknown[]) => T
|
|
@@ -2962,6 +3060,8 @@ export const test: {
|
|
|
2962
3060
|
log: Test['log'],
|
|
2963
3061
|
};
|
|
2964
3062
|
|
|
3063
|
+
export type Texts = Record<string, string>
|
|
3064
|
+
|
|
2965
3065
|
class Time extends date { }
|
|
2966
3066
|
|
|
2967
3067
|
class TimeStamp extends DateTime { }
|
|
@@ -3006,7 +3106,7 @@ interface type_2 extends any__2 {
|
|
|
3006
3106
|
'cds.UUID' | 'cds.String' | 'cds.LargeString' | 'cds.Binary' | 'cds.LargeBinary' | 'cds.Vector' |
|
|
3007
3107
|
'cds.Integer' | 'cds.UInt8' | 'cds.Int16' | 'cds.Int32' | 'cds.Int64' | 'cds.Double' | 'cds.Decimal' |
|
|
3008
3108
|
'cds.Date' | 'cds.Time' | 'cds.DateTime' | 'cds.Timestamp' |
|
|
3009
|
-
'cds.Association' | 'cds.Composition' |
|
|
3109
|
+
'cds.Association' | 'cds.Composition' | 'cds.Map' |
|
|
3010
3110
|
FQN & Record<never,never> // allow any other CDS type as well (e.g. 'User')
|
|
3011
3111
|
items?: type_2
|
|
3012
3112
|
}
|
|
@@ -3226,6 +3326,21 @@ export const utils: {
|
|
|
3226
3326
|
*/
|
|
3227
3327
|
rm: (...path: string[]) => Promise<ReturnType<typeof import('node:fs').promises.rm>>,
|
|
3228
3328
|
|
|
3329
|
+
/**
|
|
3330
|
+
* Shortcut for require("fs")
|
|
3331
|
+
*/
|
|
3332
|
+
fs: typeof import('node:fs'),
|
|
3333
|
+
|
|
3334
|
+
/**
|
|
3335
|
+
* Shortcut for require("path")
|
|
3336
|
+
*/
|
|
3337
|
+
path: typeof import('node:path'),
|
|
3338
|
+
|
|
3339
|
+
/**
|
|
3340
|
+
* Shortcut for require("util").inspect
|
|
3341
|
+
*/
|
|
3342
|
+
inspect: typeof import('node:util').inspect,
|
|
3343
|
+
|
|
3229
3344
|
/**
|
|
3230
3345
|
* @since 8.3.0
|
|
3231
3346
|
* @see https://cap.cloud.sap/docs/node.js/cds-utils#colors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/cds-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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/",
|
|
@@ -10,18 +10,25 @@
|
|
|
10
10
|
"Node.js"
|
|
11
11
|
],
|
|
12
12
|
"author": "SAP SE (https://www.sap.com)",
|
|
13
|
-
"license": "
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
14
|
"typings": "dist/cds-types.d.ts",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist/",
|
|
17
17
|
"scripts/",
|
|
18
|
-
"LICENSE",
|
|
19
18
|
"README.md"
|
|
20
19
|
],
|
|
21
20
|
"scripts": {
|
|
22
|
-
"test": "
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
21
|
+
"test:integration": "node --test ./test/postinstall.integrationtest.js",
|
|
22
|
+
"test:runtime": "npm run test:runtime:post-mortem; rm -rf test/typescript/_out",
|
|
23
|
+
"test:runtime:tsc": "npx tsc test/typescript/runtime.test.ts --outDir test/typescript/_out --target ES2020 --module commonjs --esModuleInterop",
|
|
24
|
+
"test:runtime:post-mortem": "npm run test:runtime:tsc && node --test './test/typescript/_out/runtime.test.js'",
|
|
25
|
+
"test:api-calls": "node --test './test/typescript/apis/cds-api-calls.test.js'",
|
|
26
|
+
"test:typings": "node --test './test/typescript/cds-typings.test.js'",
|
|
27
|
+
"test:all": "npm run test:runtime && npm run test:api-calls && npm run test:typings",
|
|
28
|
+
"test:setup": "npm install file:. --no-save --force && npm run prerelease:ci-fix",
|
|
29
|
+
"test": "npm run test:setup && npm run test:rollup-on",
|
|
30
|
+
"test:rollup-on": "npm run rollup && npm run rollup:on && npm run test:all --silent",
|
|
31
|
+
"test:rollup-off": "npm run rollup:off && npm run test:all --silent",
|
|
25
32
|
"rollup": "rm -rf dist/ && mkdir -p etc/ && npx -y @microsoft/api-extractor run --local --verbose && .github/rollup-patch.js",
|
|
26
33
|
"rollup:on": "npm pkg set typings=dist/cds-types.d.ts && [ -d 'apis' ] && mv -- apis -apis || true",
|
|
27
34
|
"rollup:off": "npm pkg set typings=apis/cds.d.ts && [ -d '-apis' ] && mv -- -apis apis || true",
|
|
@@ -33,28 +40,16 @@
|
|
|
33
40
|
"dependencies": "node ./scripts/postinstall.js"
|
|
34
41
|
},
|
|
35
42
|
"peerDependencies": {
|
|
36
|
-
"@sap/cds": "
|
|
43
|
+
"@sap/cds": ">=8.0.0",
|
|
37
44
|
"@types/express": ">=4"
|
|
38
45
|
},
|
|
39
46
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@stylistic/eslint-plugin-
|
|
43
|
-
"@stylistic/eslint-plugin-ts": "^2.1.0",
|
|
44
|
-
"@types/jest": "^29.5.11",
|
|
45
|
-
"@types/node": "^22",
|
|
47
|
+
"@cap-js/cds-test": "^0",
|
|
48
|
+
"@stylistic/eslint-plugin-js": "^4.0.1",
|
|
49
|
+
"@stylistic/eslint-plugin-ts": "^4.0.1",
|
|
46
50
|
"axios": "^1.6.2",
|
|
47
|
-
"chai": "^4.3.10",
|
|
48
51
|
"eslint": "^9.2.0",
|
|
49
|
-
"jest": "^29.7.0",
|
|
50
|
-
"ts-jest": "^29.1.1",
|
|
51
52
|
"typescript": "^5.4.5",
|
|
52
|
-
"typescript-eslint": "^8.0.0-alpha.51"
|
|
53
|
-
"winston": "^3.13.0"
|
|
54
|
-
},
|
|
55
|
-
"jest": {
|
|
56
|
-
"transform": {
|
|
57
|
-
"^.+\\.(ts|tsx)$": "ts-jest"
|
|
58
|
-
}
|
|
53
|
+
"typescript-eslint": "^8.0.0-alpha.51"
|
|
59
54
|
}
|
|
60
55
|
}
|