@cap-js/cds-types 0.7.0 → 0.8.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.
Files changed (2) hide show
  1. package/dist/cds-types.d.ts +32 -19
  2. package/package.json +1 -1
@@ -247,6 +247,7 @@ namespace cds {
247
247
  get,
248
248
  load,
249
249
  resolve,
250
+ minify,
250
251
  reflect,
251
252
  _flavor,
252
253
  _odata_options,
@@ -364,8 +365,7 @@ namespace cds {
364
365
  operator,
365
366
  function_call,
366
367
  enum_literal,
367
- expr_literal,
368
- minify
368
+ expr_literal
369
369
  }
370
370
  }
371
371
 
@@ -390,7 +390,9 @@ export interface cds_serve_fluent {
390
390
  // (req,res) : void
391
391
  }
392
392
 
393
- export type cds_services = { [name: string]: Service }
393
+ export interface cds_services {
394
+ [name: string]: Service
395
+ }
394
396
 
395
397
  export type CdsFunction = {
396
398
  (...args: any[]): any,
@@ -837,6 +839,7 @@ export namespace default_2 {
837
839
  get,
838
840
  load,
839
841
  resolve,
842
+ minify,
840
843
  reflect,
841
844
  _flavor,
842
845
  _odata_options,
@@ -954,8 +957,7 @@ export namespace default_2 {
954
957
  operator,
955
958
  function_call,
956
959
  enum_literal,
957
- expr_literal,
958
- minify
960
+ expr_literal
959
961
  }
960
962
  }
961
963
 
@@ -1222,6 +1224,10 @@ class Event_2 extends EventContext {
1222
1224
 
1223
1225
  headers: any
1224
1226
 
1227
+ before(phase: 'commit', handler: () => void)
1228
+
1229
+ on(phase: 'succeeded' | 'failed' | 'done', handler: () => void)
1230
+
1225
1231
  }
1226
1232
  export { Event_2 as Event }
1227
1233
 
@@ -1824,7 +1830,7 @@ export const middlewares: {
1824
1830
  * Minifies a given CSN model by removing all unused1 types and aspects, as well all entities tagged with `@cds.persistence.skip:'if-unused'`
1825
1831
  * @see [capire](https://cap.cloud.sap/docs/node.js/cds-compile#cds-minify)
1826
1832
  */
1827
- export function minify (model: CSN): CSN
1833
+ export function minify (model: csn.CSN): csn.CSN
1828
1834
 
1829
1835
  /**
1830
1836
  * Allows arbitrary property access. Can be used for explicitly casting
@@ -1870,6 +1876,7 @@ namespace models {
1870
1876
  get,
1871
1877
  load,
1872
1878
  resolve,
1879
+ minify,
1873
1880
  reflect,
1874
1881
  _flavor,
1875
1882
  _odata_options,
@@ -2018,7 +2025,7 @@ interface OrderBy<T> {
2018
2025
  }
2019
2026
 
2020
2027
  /** @private */
2021
- export type ordering_term = expr & { sort?: 'asc' | 'desc', nulls?: 'first' | 'last' }
2028
+ export type ordering_term = UnionToIntersection<expr> & { sort?: 'asc' | 'desc', nulls?: 'first' | 'last' }
2022
2029
 
2023
2030
  export const outboxed: (service: Service) => Service;
2024
2031
 
@@ -2360,19 +2367,23 @@ type SELECT_2 = { SELECT: {
2360
2367
  columns?: column_expr[],
2361
2368
  excluding?: string[],
2362
2369
  where?: predicate,
2363
- having?: predicate,
2364
2370
  groupBy?: expr[],
2371
+ having?: predicate,
2365
2372
  orderBy?: ordering_term[],
2366
2373
  limit?: { rows: val, offset: val },
2374
+ forUpdate?: { wait: number },
2375
+ forShareLock?: { wait: number },
2376
+ search?: predicate,
2377
+ count?: boolean,
2367
2378
  }, }
2368
2379
  export { SELECT_2 as SELECT }
2369
2380
 
2370
2381
  interface SELECT_3<T> extends Where<T>, And, Having<T>, GroupBy, OrderBy<T>, Limit {
2371
2382
  // overload specific to SELECT
2372
- columns: Columns<T, SELECT_3<T>>['columns'] & ((projection: Projection<T>) => this)
2383
+ columns: Columns<T, this>['columns'] & ((projection: Projection<T>) => this)
2373
2384
  }
2374
2385
 
2375
- class SELECT_3<T> extends ConstructedQuery<T> {
2386
+ class SELECT_3<T, Q = SELECT_from> extends ConstructedQuery<T> {
2376
2387
  private constructor();
2377
2388
 
2378
2389
  static one: SELECT_one & { from: SELECT_one } & { localized: SELECT_one }
@@ -2383,7 +2394,7 @@ class SELECT_3<T> extends ConstructedQuery<T> {
2383
2394
 
2384
2395
  static localized: SELECT_from & { from: SELECT_from }
2385
2396
 
2386
- from: SELECT_from
2397
+ from: Q // SELECT_from | SELECT_one
2387
2398
  & TaggedTemplateQueryPart<this>
2388
2399
  & ((entity: EntityDescription, primaryKey?: PK, projection?: Projection<unknown>) => this)
2389
2400
 
@@ -2454,22 +2465,22 @@ projection?: Projection<InstanceType<T>>
2454
2465
  ) => Awaitable<SELECT_3<InstanceType<T>>, InstanceType<T>>)
2455
2466
 
2456
2467
  type SELECT_one =
2457
- TaggedTemplateQueryPart<Awaitable<SELECT_3<_TODO_2>, InstanceType<_TODO_2>>>
2468
+ TaggedTemplateQueryPart<Awaitable<SELECT_3<_TODO_2, SELECT_one>, InstanceType<_TODO_2>>>
2458
2469
  &
2459
2470
  // calling with class
2460
2471
  (<T extends ArrayConstructable>
2461
2472
  (entityType: T, projection?: Projection<QLExtensions<SingularInstanceType<T>>>)
2462
- => Awaitable<SELECT_3<SingularInstanceType<T>>, SingularInstanceType<T>>)
2473
+ => Awaitable<SELECT_3<SingularInstanceType<T>, SELECT_one>, SingularInstanceType<T>>)
2463
2474
  &
2464
2475
  (<T extends ArrayConstructable>
2465
2476
  (entityType: T, primaryKey: PK, projection?: Projection<QLExtensions<SingularInstanceType<T>>>)
2466
- => Awaitable<SELECT_3<SingularInstanceType<T>>, SingularInstanceType<T>>)
2477
+ => Awaitable<SELECT_3<SingularInstanceType<T>, SELECT_one>, SingularInstanceType<T>>)
2467
2478
 
2468
- & ((entity: EntityDescription, primaryKey?: PK, projection?: Projection<unknown>) => SELECT_3<_TODO_2>)
2469
- & (<T> (entity: T[], projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
2470
- & (<T> (entity: T[], primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
2471
- & (<T> (entity: { new(): T }, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
2472
- & (<T> (entity: { new(): T }, primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T>, T>)
2479
+ & ((entity: EntityDescription, primaryKey?: PK, projection?: Projection<unknown>) => SELECT_3<_TODO_2, SELECT_one>)
2480
+ & (<T> (entity: T[], projection?: Projection<T>) => Awaitable<SELECT_3<T, SELECT_one>, T>)
2481
+ & (<T> (entity: T[], primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T, SELECT_one>, T>)
2482
+ & (<T> (entity: { new(): T }, projection?: Projection<T>) => Awaitable<SELECT_3<T, SELECT_one>, T>)
2483
+ & (<T> (entity: { new(): T }, primaryKey: PK, projection?: Projection<T>) => Awaitable<SELECT_3<T, SELECT_one>, T>)
2473
2484
  & ((subject: ref) => SELECT_3<_TODO_2>)
2474
2485
 
2475
2486
  /**
@@ -2888,6 +2899,8 @@ export const test: {
2888
2899
  (command: string, ...args: string[]): Test,
2889
2900
 
2890
2901
  in (dirname: string): Test,
2902
+
2903
+ log: Test['log'],
2891
2904
  };
2892
2905
 
2893
2906
  class Time extends date { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/cds-types",
3
- "version": "0.7.0",
3
+ "version": "0.8.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/",