@sap/cds 7.1.2 → 7.2.1

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 (83) hide show
  1. package/CHANGELOG.md +68 -4
  2. package/apis/cds.d.ts +10 -6
  3. package/apis/connect.d.ts +1 -2
  4. package/apis/core.d.ts +54 -5
  5. package/apis/log.d.ts +19 -6
  6. package/apis/models.d.ts +0 -18
  7. package/apis/ql.d.ts +23 -23
  8. package/apis/serve.d.ts +18 -15
  9. package/apis/services.d.ts +67 -56
  10. package/apis/test.d.ts +1 -2
  11. package/bin/serve.js +4 -4
  12. package/common.cds +4 -4
  13. package/lib/auth/basic-auth.js +1 -1
  14. package/lib/auth/dummy-auth.js +2 -1
  15. package/lib/auth/ias-auth.js +68 -2
  16. package/lib/auth/index.js +5 -5
  17. package/lib/auth/jwt-auth.js +40 -24
  18. package/lib/auth/mocked-users.js +0 -13
  19. package/lib/auth/passport-basic.js +2 -0
  20. package/lib/auth/passport-digest.js +2 -0
  21. package/lib/compile/etc/_localized.js +0 -1
  22. package/lib/compile/extend.js +16 -0
  23. package/lib/compile/for/lean_drafts.js +38 -6
  24. package/lib/compile/resolve.js +7 -5
  25. package/lib/compile/to/json.js +6 -2
  26. package/lib/dbs/cds-deploy.js +3 -3
  27. package/lib/env/cds-env.js +3 -3
  28. package/lib/env/cds-requires.js +1 -0
  29. package/lib/env/defaults.js +8 -1
  30. package/lib/env/schemas/cds-rc.json +27 -3
  31. package/lib/i18n/localize.js +3 -3
  32. package/lib/index.js +4 -0
  33. package/lib/log/cds-log.js +10 -1
  34. package/lib/ql/Whereable.js +7 -3
  35. package/lib/req/user.js +18 -16
  36. package/lib/srv/middlewares/sap-statistics.js +3 -3
  37. package/lib/srv/middlewares/trace.js +5 -4
  38. package/lib/srv/srv-dispatch.js +10 -9
  39. package/lib/utils/axios.js +3 -0
  40. package/lib/utils/cds-test.js +3 -0
  41. package/lib/utils/cds-utils.js +2 -0
  42. package/libx/_runtime/auth/index.js +8 -32
  43. package/libx/_runtime/auth/strategies/ias-auth.js +1 -77
  44. package/libx/_runtime/auth/strategies/mock.js +1 -12
  45. package/libx/_runtime/auth/strategies/xssecUtils.js +2 -2
  46. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +11 -9
  47. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +5 -0
  48. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/applyToCQN.js +5 -2
  49. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParser.js +4 -0
  50. package/libx/_runtime/common/composition/data.js +5 -3
  51. package/libx/_runtime/common/composition/insert.js +6 -3
  52. package/libx/_runtime/common/composition/update.js +12 -8
  53. package/libx/_runtime/common/error/constants.js +6 -1
  54. package/libx/_runtime/common/generic/auth/requires.js +11 -3
  55. package/libx/_runtime/common/generic/auth/restrict.js +21 -15
  56. package/libx/_runtime/common/generic/auth/restrictions.js +5 -2
  57. package/libx/_runtime/common/generic/crud.js +6 -0
  58. package/libx/_runtime/common/generic/paging.js +3 -1
  59. package/libx/_runtime/common/i18n/messages.properties +1 -0
  60. package/libx/_runtime/common/utils/cqn2cqn4sql.js +3 -5
  61. package/libx/_runtime/common/utils/resolveView.js +3 -1
  62. package/libx/_runtime/common/utils/restrictions.js +47 -0
  63. package/libx/_runtime/db/data-conversion/post-processing.js +3 -3
  64. package/libx/_runtime/db/generic/input.js +1 -1
  65. package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +0 -17
  66. package/libx/_runtime/fiori/lean-draft.js +27 -24
  67. package/libx/_runtime/hana/driver.js +2 -4
  68. package/libx/_runtime/hana/pool.js +1 -1
  69. package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +2 -2
  70. package/libx/_runtime/messaging/outbox/utils.js +1 -2
  71. package/libx/_runtime/remote/Service.js +10 -9
  72. package/libx/_runtime/remote/utils/client.js +4 -3
  73. package/libx/_runtime/sqlite/Service.js +0 -4
  74. package/libx/_runtime/sqlite/customBuilder/CustomFunctionBuilder.js +2 -1
  75. package/libx/odata/afterburner.js +5 -3
  76. package/libx/odata/cqn2odata.js +7 -7
  77. package/libx/odata/utils.js +4 -1
  78. package/libx/rest/RestAdapter.js +15 -16
  79. package/package.json +1 -1
  80. package/lib/auth/xsuaa-auth.js +0 -2
  81. package/libx/_runtime/auth/utils.js +0 -32
  82. package/libx/audit-log/client.cds +0 -0
  83. package/libx/audit-log/client.js +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,56 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+
8
+ ## Version 7.2.1 - 2023-09-21
9
+
10
+ ### Fixed
11
+
12
+ - HTTP headers argument was not forwarded to remote services when using the `srv.send(...)` API.
13
+ - Not existing draft upon `SAVE` has own error code.
14
+ - Links to documentation in Typescript definitions.
15
+ - Remote service won't check for `credentials.url` in case of messaging.
16
+ - Lean draft: Implicitly added `limit` in some lean draft read scenarios.
17
+ - Lean draft: Association keys in lean draft.
18
+ - Remote service: Preserve namespaces in URLs that do not match the service's namespace.
19
+
20
+ ## Version 7.2.0 - 2023-09-04
21
+
22
+ ### Added
23
+
24
+ - Typescript definition for:
25
+ - The `cds.exit()` method.
26
+ - The `label` option parameter in the `cds.log()` API. For example: `cds.log('log message', { label: 'adapter' }`.
27
+ - `@restrict` annotations can now prevent the creation of drafts([see documentation](https://pages.github.tools.sap/cap/docs/guides/authorization#restrictions-and-draft-mode))
28
+ - JSON Schema validation for `cds.requires.multitenancy.jobs` settings.
29
+ - Managed associations to-one with exactly one foreign key can now have a default value.
30
+ - Skip Okra's parsing of query options via experimental feature flag `cds.env.features.okra_skip_query_options = true`.
31
+ Only allowed in combination with new OData parser, i.e., `cds.env.features.odata_new_parser = true`.
32
+ - Support for `@requires: 'any'` to make service public, i.e., no authenticated user is required
33
+
34
+ ### Changed
35
+
36
+ - The built-in `java` profile sets `build.target` to `.` by default
37
+ - Decimals from query options (e.g., `$filter`) are represented as strings in CQN
38
+ - Improve error message for unsupported transformations with `$apply`
39
+ - For database dialect H2, specialized localized views for languages `de` and `fr` are no longer generated.
40
+ - Authentication kinds `jwt`, `xsuaa`, and `ias` throw an error during bootstrapping if the necessary credentials are not available.
41
+ Previously, a warning was logged and authentication was skipped.
42
+ See `cds bind`/ Hybrid Testing in CAPire for how to combine local development and cloud resources.
43
+ - The Typescript definitions now make use of the default export.
44
+
45
+ ### Fixed
46
+
47
+ - Trace middleware: Adapted usage of `performance.now()` for Node 20.
48
+ - Draft: Associations to non-draft enabled entities must never point to drafts
49
+ - Avoid type error in old db post processing
50
+ - `<remote-srv>.run('/arbitrary-url')` properly defaults to a get request and does not add request body
51
+ - `@cds.query.limit` is cached per projection
52
+ - Application crash for incorrect usage of REST-style API to run queries
53
+ - The `@requires` annotation on entity level didn't get applied to bound operations
54
+ - `cds.test` run with a profile parameter such as `cds.test('run', '--profile', 'integration-tests')` will use the correct profile.
55
+ - `cds.env.requires.auth.restrict_all_services = false` in combination with `cds.env.requires.middlewares = true` (the default)
56
+
7
57
  ## Version 7.1.2 - 2023-08-11
8
58
 
9
59
  ### Fixed
@@ -21,14 +71,13 @@
21
71
  ### Fixed
22
72
 
23
73
  - Lean draft: read actives via service on draft edit
24
- - Resolve column name for `STREAM` CQN queries that point to views
25
74
  - Only log the error in case of an unhandled rejection
75
+ - Resolve column name for experimental `STREAM` CQN queries that point to views
26
76
 
27
77
  ## Version 7.1.0 - 2023-07-28
28
78
 
29
79
  ### Added
30
80
 
31
- - Support for resolving of `STREAM` CQN queries that point to views
32
81
  - Enable PDF export via GET to collection with accept header `appplication/pdf`.
33
82
  Custom handler must return the following:
34
83
  ```
@@ -48,6 +97,15 @@
48
97
  { kind: 'rest', path: '/rest/browse' }
49
98
  ]
50
99
  ```
100
+ - Service level support for @restrict. Limited to grant: '*' and all filter conditions in `where` are ignored.
101
+ Example:
102
+ ```
103
+ @(restrict: [{
104
+ grant: '*',
105
+ to: ['authenticated-user']
106
+ }])
107
+ ```
108
+ - Support for resolving of experimental `STREAM` CQN queries that point to views
51
109
 
52
110
  ### Fixed
53
111
 
@@ -152,13 +210,19 @@
152
210
  - Deprecated compat mode `cds.env.features.cds_tx_protection = false`
153
211
  - Beta `AuditLogService` and out-of-the-box audit logging. Use plugin `@cap-js/audit-logging` instead.
154
212
 
213
+ ## Version 6.8.4 - 2023-06-14
214
+
215
+ ### Fixed
216
+
217
+ - `$metadata` requests for multitenant applications
218
+
155
219
  ## Version 6.8.3 - 2023-06-13
156
220
 
157
221
  ### Fixed
158
222
 
159
223
  - `cds build` no longer reports CAP Java Classic runtime usage by mistake.
160
224
  - `cds version` prints the local `@sap/cds` version, even if called from a different `@sap/cds` installation.
161
- - User challenges handling in case of `cds.env.auth.restrict_all_services: false`
225
+ - User challenges handling in case of `cds.env.requires.auth.restrict_all_services: false`
162
226
 
163
227
  ## Version 6.8.2 - 2023-05-26
164
228
 
@@ -1030,7 +1094,7 @@ In such scenarios, now the HTTP `404 Not Found` status code is returned rather t
1030
1094
  - Avoid error that is caused e.g. in a streaming scenario when there is an issue while processing the stream. Trying to change/send the response object could cause a crash because the response was sent already.
1031
1095
  - Correct URL generation for `Integer64` and `Decimal` for remote services
1032
1096
  - Operation parameters from structured type and annotated with @open are not filtered from the input query
1033
- - Services are secured by default in production. Can be disabled via feature flag `cds.env.auth.restrict_all_services: false` or by using `mocked-auth`.
1097
+ - Services are secured by default in production. Can be disabled via feature flag `cds.env.requires.auth.restrict_all_services: false` or by using `mocked-auth`.
1034
1098
  - Optimized Search: Exception when searching on views using built-in SQL SAP HANA functions
1035
1099
  - In some cases, custom error handlers were not called for rest
1036
1100
  - `cds build` adds newline at EOF for `hdbmigrationtable` files
package/apis/cds.d.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  import * as ql from './ql'
2
2
 
3
- type cds_facade = import('./core')
3
+ declare const cds : {}
4
+ & import('./core').default
4
5
  & import('./models')
5
6
  & import('./connect')
6
- & import('./serve')
7
+ & import('./serve').default
7
8
  & import('./ql').cds_ql
8
- & import('./services').cds
9
+ & import('./services').default
9
10
  & import('./services').QueryAPI
10
11
  & import('./log')
11
12
  & import('./utils')
12
13
  & import('./test')
14
+ export default cds
15
+
16
+ export * from './core'
17
+ export * from './serve'
18
+ export * from './services'
13
19
 
14
20
  declare global {
15
- const cds : cds_facade
21
+
16
22
  // these provide the functionality from SELECT, INSERT, etc in the global facade
17
23
  const SELECT: typeof cds.ql.SELECT
18
24
  const INSERT: typeof cds.ql.INSERT
@@ -31,5 +37,3 @@ declare global {
31
37
  type CREATE<T> = ql.CREATE<T>
32
38
  type DROP<T> = ql.DROP<T>
33
39
  }
34
-
35
- export = cds
package/apis/connect.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Service } from "./services"
2
- import * as cds_facade from './cds'
3
2
 
4
3
  export = cds
5
4
  declare class cds {
@@ -19,7 +18,7 @@ declare class cds {
19
18
 
20
19
  /**
21
20
  * Connects the primary datasource.
22
- * @see [capire](https://cap.cloud.sap/docs/node.js/api#cds-connect)
21
+ * @see [capire](https://cap.cloud.sap/docs/node.js/cds-connect)
23
22
  */
24
23
  (options?: string | ConnectOptions) : Promise<typeof cds> //> cds.connect(<options>)
25
24
  }
package/apis/core.d.ts CHANGED
@@ -1,16 +1,27 @@
1
1
  // import types from '../lib/core'
2
- import { ReflectedModel, LinkedModel, LinkedDefinition } from './reflect'
2
+ import { ReflectedModel, LinkedModel } from './reflect'
3
3
  import { CSN as csn, Definition } from './csn'
4
4
 
5
5
  type UserInput = string | { id: string; attr: Record<string, string>; roles: Record<string, string> } | User
6
6
 
7
+ export type Association = Definition
8
+ export type Composition = Association
9
+ export type entity = Definition
10
+ export type event = Definition
11
+ export type type = Definition
12
+ export type array = Definition
13
+ export type struct = Definition
14
+
15
+
7
16
  export class User {
8
17
  constructor(obj?: UserInput)
9
18
  id: string
19
+
10
20
  /**
11
21
  * @deprecated Use https://cap.cloud.sap/docs/node.js/events#locale instead
12
22
  */
13
23
  locale: string
24
+
14
25
  /**
15
26
  * @deprecated Use https://cap.cloud.sap/docs/node.js/events#tenant instead
16
27
  */
@@ -20,6 +31,7 @@ export class User {
20
31
  static Privileged: typeof Privileged
21
32
  is(role: string): boolean
22
33
  }
34
+
23
35
  /**
24
36
  * Subclass for executing code with superuser privileges.
25
37
  */
@@ -72,19 +84,24 @@ declare class cds {
72
84
  * Base class for linked Associations from reflected models.
73
85
  * @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-Association)
74
86
  */
75
- Association: Definition
87
+ Association: Association
76
88
 
77
89
  /**
78
90
  * Base class for linked Compositions from reflected models.
79
91
  * @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-Association)
80
92
  */
81
- Composition: Definition
93
+ Composition: Composition
82
94
 
83
95
  /**
84
96
  * Base class for linked entities from reflected models.
85
97
  * @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-entity)
86
98
  */
87
- entity: Definition
99
+ entity: entity
100
+
101
+ event: event
102
+ type: type
103
+ array: array
104
+ struct: struct
88
105
 
89
106
  /**
90
107
  * Add aspects to a given object, for example:
@@ -126,6 +143,38 @@ declare class cds {
126
143
  * using standard Node.js's `module.require` functions.
127
144
  */
128
145
  lazified: <T>(target: T) => T
146
+
147
+ /**
148
+ * Provides a graceful shutdown for running servers, by first emitting `cds.emit('shutdown')`.
149
+ * @see [capire](https://cap.cloud.sap/docs/node.js/cds-facade#cds-exit)
150
+ */
151
+ exit(): void
152
+
153
+
154
+ /**
155
+ * Access to the configuration for Node.js runtime and tools.
156
+ * The object is the effective result of configuration merged from various sources,
157
+ * filtered through the currently active profiles, thus highly dependent on the current working
158
+ * directory and process environment.
159
+ */
160
+ env : {
161
+ build: any,
162
+ hana: any,
163
+ i18n: any,
164
+ mtx: any,
165
+ requires: any,
166
+ folders: any,
167
+ odata: any,
168
+ query: any,
169
+ sql: any
170
+ }
171
+
172
+ requires: any
173
+ version: string
174
+ home: string
175
+ root: string
176
+
129
177
  }
178
+
130
179
  // & typeof import ('../lib/index')
131
- export = cds
180
+ export default cds
package/apis/log.d.ts CHANGED
@@ -20,6 +20,7 @@ declare class cds {
20
20
  }
21
21
 
22
22
  declare type LogFactory = {
23
+
23
24
  /**
24
25
  * Returns a trace logger for the given module if trace is switched on for it,
25
26
  * otherwise returns null. All cds runtime packages use this method for their
@@ -27,24 +28,27 @@ declare type LogFactory = {
27
28
  *
28
29
  * By default this logger would prefix all output with `[sql] - `
29
30
  * You can change this by specifying another prefix in the options:
31
+ *
30
32
  * ```
31
- * const LOG = cds.log('sql|db',{ prefix:'cds.ql' })
33
+ * const LOG = cds.log('sql|db', { prefix: 'cds.ql' })
32
34
  * ```
35
+ *
33
36
  * Call `cds.log()` for a given module again to dynamically change the log level
34
37
  * of all formerly created loggers, for example:
38
+ *
35
39
  * ```
36
40
  * const LOG = cds.log('sql')
37
41
  * LOG.info ('this will show, as default level is info')
38
- * cds.log('sql','warn')
39
- * LOG.info ('this will be suppressed now')
42
+ * cds.log('sql', 'warn')
43
+ * LOG.info('this will be suppressed now')
40
44
  * ```
45
+ *
41
46
  * @param name logger name
42
- * @param options level and prefix
47
+ * @param options level, label and prefix
43
48
  * @returns the logger
44
- *
45
49
  * @see [capire](https://cap.cloud.sap/docs/node.js/cds-log)
46
50
  */
47
- (name: string, options?: string | number | { level?: number, prefix?: string }): Logger
51
+ (name: string, options?: string | number | { level?: number, label?: string, prefix?: string }): Logger
48
52
 
49
53
  /**
50
54
  * Set a custom formatter function like that:
@@ -72,22 +76,27 @@ declare class Logger {
72
76
  * Logs with 'trace' level
73
77
  */
74
78
  trace: Log
79
+
75
80
  /**
76
81
  * Logs with 'debug' level
77
82
  */
78
83
  debug: Log
84
+
79
85
  /**
80
86
  * Logs with 'info' level
81
87
  */
82
88
  info: Log
89
+
83
90
  /**
84
91
  * Logs with 'warn' level
85
92
  */
86
93
  warn: Log
94
+
87
95
  /**
88
96
  * Logs with 'error' level
89
97
  */
90
98
  error: Log
99
+
91
100
  /**
92
101
  * Logs with default level
93
102
  */
@@ -97,18 +106,22 @@ declare class Logger {
97
106
  * @returns whether 'trace' level is active
98
107
  */
99
108
  _trace: boolean
109
+
100
110
  /**
101
111
  * @returns whether 'debug' level is active
102
112
  */
103
113
  _debug: boolean
114
+
104
115
  /**
105
116
  * @returns whether 'info' level is active
106
117
  */
107
118
  _info: boolean
119
+
108
120
  /**
109
121
  * @returns whether 'warn' level is active
110
122
  */
111
123
  _warn: boolean
124
+
112
125
  /**
113
126
  * @returns whether 'error' level is active
114
127
  */
package/apis/models.d.ts CHANGED
@@ -162,22 +162,4 @@ declare class cds {
162
162
  */
163
163
  resolve (files: '*' | filename | filename[]) : filename[] | undefined
164
164
 
165
- /**
166
- * Access to the configuration for Node.js runtime and tools.
167
- * The object is the effective result of configuration merged from various sources,
168
- * filtered through the currently active profiles, thus highly dependent on the current working
169
- * directory and process environment.
170
- */
171
- env : {
172
- build: object,
173
- hana: object,
174
- i18n: object,
175
- mtx: object,
176
- requires: object,
177
- folders: object,
178
- odata: object,
179
- query: object,
180
- sql: object
181
- }
182
-
183
165
  }
package/apis/ql.d.ts CHANGED
@@ -43,7 +43,7 @@ type QLExtensions_<T> = {
43
43
  get: (path: string) => any
44
44
 
45
45
  // have to exclude undefined from the type, or we'd end up with a distribution of Subqueryable
46
- // over T and undefined, which gives us zero code completion within the callable.
46
+ // over T and undefined, which gives us zero code completion within the callable.
47
47
  } & Subqueryable<Exclude<T, undefined>>
48
48
 
49
49
  /**
@@ -51,45 +51,45 @@ type QLExtensions_<T> = {
51
51
  * The final result of each subquery will be the property itself:
52
52
  * `Book.title` == `Subqueryable<Book>.title()`
53
53
  */
54
- type Subqueryable<T> =
54
+ type Subqueryable<T> =
55
55
  T extends Primitive ? {}
56
56
  // composition of many/ association to many
57
- : T extends readonly unknown[] ? {
57
+ : T extends readonly unknown[] ? {
58
58
  /**
59
59
  * @example
60
60
  * ```js
61
61
  * SELECT.from(Books, b => b.author)
62
62
  * ```
63
63
  * means: "select all books and project each book's author"
64
- *
64
+ *
65
65
  * whereas
66
66
  * ```js
67
67
  * SELECT.from(Books, b => b.author(a => a.ID))
68
68
  * ```
69
69
  * means: "select all books, subselect each book's author's ID
70
- *
70
+ *
71
71
  * Note that you do not need to return anything from these subqueries.
72
72
  */
73
- (fn: ((a:QLExtensions<T[number]>) => any) | '*'): T[number]
73
+ (fn: ((a:QLExtensions<T[number]>) => any) | '*'): T[number]
74
74
  }
75
75
  // composition of one/ association to one
76
- : {
76
+ : {
77
77
  /**
78
78
  * @example
79
79
  * ```js
80
80
  * SELECT.from(Books, b => b.author)
81
81
  * ```
82
82
  * means: "select all books and project each book's author"
83
- *
83
+ *
84
84
  * whereas
85
85
  * ```js
86
86
  * SELECT.from(Books, b => b.author(a => a.ID))
87
87
  * ```
88
88
  * means: "select all books, subselect each book's author's ID
89
- *
89
+ *
90
90
  * Note that you do not need to return anything from these subqueries.
91
91
  */
92
- (fn: ((a:QLExtensions<T>) => any) | '*'): T
92
+ (fn: ((a:QLExtensions<T>) => any) | '*'): T
93
93
  }
94
94
  ;
95
95
 
@@ -102,7 +102,7 @@ export type Projection<T> = (e:QLExtensions<T extends ArrayConstructable ? Sing
102
102
  // awaited to materialise the result:
103
103
  // `Awaitable<SELECT<Book>, Book> = SELECT<Book> & Promise<Book>`
104
104
  //
105
- // While the benefit is probably not immediately obvious as we don't exactly
105
+ // While the benefit is probably not immediately obvious as we don't exactly
106
106
  // save a lot of typing over explicitly writing `SELECT<Book> & Promise<Book>`,
107
107
  // it makes the semantics more explicit. Also sets us up for when TypeScript ever
108
108
  // improves their generics to support:
@@ -116,7 +116,7 @@ export type Awaitable<T, I> = T & Promise<I>
116
116
  // new SELECT(...).(...) == SELECT(...)
117
117
  export type StaticSELECT<T> = typeof SELECT
118
118
  & ((...columns: (T extends ArrayConstructable<any> ? keyof SingularType<T> : keyof T)[]) => SELECT<T>)
119
- & ((...columns:string[]) => SELECT<T>)
119
+ & ((...columns:string[]) => SELECT<T>)
120
120
  & ((columns:string[]) => SELECT<T>)
121
121
  & (TaggedTemplateQueryPart<SELECT<T>>)
122
122
  & SELECT_one // as it is not directly quantified, ...
@@ -124,11 +124,11 @@ export type StaticSELECT<T> = typeof SELECT
124
124
 
125
125
  declare class QL<T> {
126
126
  SELECT : StaticSELECT<T>
127
- INSERT : typeof INSERT
127
+ INSERT : typeof INSERT
128
128
  & ((...entries:object[]) => INSERT<any>) & ((entries:object[]) => INSERT<any>)
129
129
  UPSERT: typeof UPSERT
130
130
  & ((...entries:object[]) => UPSERT<any>) & ((entries:object[]) => UPSERT<any>)
131
- UPDATE : typeof UPDATE
131
+ UPDATE : typeof UPDATE
132
132
  & typeof UPDATE.entity
133
133
  DELETE : typeof DELETE
134
134
  CREATE : typeof CREATE
@@ -146,7 +146,7 @@ export class SELECT<T> extends ConstructedQuery {
146
146
  static one : SELECT_one & { from: SELECT_one }
147
147
  static distinct : typeof SELECT
148
148
  static from : SELECT_from
149
- from: TaggedTemplateQueryPart<this>
149
+ from: TaggedTemplateQueryPart<this>
150
150
  & ((entity: Definition | string, primaryKey? : PK, projection? : Projection<unknown>) => this)
151
151
  byKey (primaryKey? : PK) : this
152
152
  columns: TaggedTemplateQueryPart<this>
@@ -230,9 +230,9 @@ export class INSERT<T> extends ConstructedQuery {
230
230
  & ((entity : Definition | string, entries? : object | object[]) => INSERT<any>)
231
231
  & (<T> (entity:Constructable<T>, entries? : object | object[]) => INSERT<T>)
232
232
  & (<T> (entity:T, entries? : T | object | object[]) => INSERT<T>)
233
-
234
- into: (<T extends ArrayConstructable> (entity:T) => this)
235
- & TaggedTemplateQueryPart<this>
233
+
234
+ into: (<T extends ArrayConstructable> (entity:T) => this)
235
+ & TaggedTemplateQueryPart<this>
236
236
  & ((entity : Definition | string) => this)
237
237
  data (block : (e:T)=>void) : this
238
238
  entries (...entries : object[]) : this
@@ -251,9 +251,9 @@ export class UPSERT<T> extends ConstructedQuery {
251
251
  & ((entity : Definition | string, entries? : object | object[]) => UPSERT<any>)
252
252
  & (<T> (entity:Constructable<T>, entries? : object | object[]) => UPSERT<T>)
253
253
  & (<T> (entity:T, entries? : T | object | object[]) => UPSERT<T>)
254
-
255
- into: (<T extends ArrayConstructable> (entity:T) => this)
256
- & TaggedTemplateQueryPart<this>
254
+
255
+ into: (<T extends ArrayConstructable> (entity:T) => this)
256
+ & TaggedTemplateQueryPart<this>
257
257
  & ((entity : Definition | string) => this)
258
258
  data (block : (e:T)=>void) : this
259
259
  entries (...entries : object[]) : this
@@ -290,7 +290,7 @@ export class UPDATE<T> extends ConstructedQuery {
290
290
  // set (block: (e:T)=>void) : this
291
291
  set: TaggedTemplateQueryPart<this>
292
292
  & ((data:object) => this)
293
- with: TaggedTemplateQueryPart<this>
293
+ with: TaggedTemplateQueryPart<this>
294
294
  & ((data:object) => this)
295
295
  where (predicate:object) : this
296
296
  where (...expr : any[]) : this
@@ -307,4 +307,4 @@ export class CREATE<T> extends ConstructedQuery {
307
307
  export class DROP<T> extends ConstructedQuery {
308
308
  static entity (entity : Definition | string) : DROP<any>
309
309
  DROP : CQN.DROP["DROP"]
310
- }
310
+ }
package/apis/serve.d.ts CHANGED
@@ -22,12 +22,12 @@ interface service_options {
22
22
  [key: string]: unknown
23
23
  }
24
24
 
25
- export = cds_serve
25
+ export default cds_serve
26
26
  declare class cds_serve {
27
27
 
28
28
  /**
29
29
  * Constructs service providers from respective service definitions
30
- * @see [capire](https://cap.cloud.sap/docs/node.js/api#cds-serve)
30
+ * @see [capire](https://cap.cloud.sap/docs/node.js/cds-serve)
31
31
  */
32
32
  serve (service : string, options?: service_options) : _fluent & Promise<cds_services>
33
33
 
@@ -36,7 +36,7 @@ declare class cds_serve {
36
36
  */
37
37
  server: cds_server
38
38
 
39
-
39
+
40
40
 
41
41
  /**
42
42
  * Emitted at the very beginning of the bootsrapping process, when the
@@ -81,18 +81,7 @@ declare class cds_serve {
81
81
  * Shortcut to base class for all service definitions from linked models.
82
82
  * Plus accessors to impl functions and constructed providers.
83
83
  */
84
- service : LinkedDefinition & {
85
- /**
86
- * Dummy wrapper for service implementation functions.
87
- * Use that in modules to get IntelliSense.
88
- */
89
- impl (impl: ServiceImpl) : typeof impl
90
- impl <T> (srv:T, impl: ( this: T, srv: (T) ) => any) : typeof impl
91
- /**
92
- * Array of all services constructed.
93
- */
94
- providers : Service
95
- }
84
+ service : service
96
85
 
97
86
  /**
98
87
  * The effective CDS model loaded during bootstrapping, which contains all service and entity definitions,
@@ -102,5 +91,19 @@ declare class cds_serve {
102
91
 
103
92
  }
104
93
 
94
+ export type service = LinkedDefinition & {
95
+ /**
96
+ * Dummy wrapper for service implementation functions.
97
+ * Use that in modules to get IntelliSense.
98
+ */
99
+ impl (impl: ServiceImpl) : typeof impl
100
+ impl <T> (srv:T, impl: ( this: T, srv: (T) ) => any) : typeof impl
101
+ /**
102
+ * Array of all services constructed.
103
+ */
104
+ providers : Service
105
+ }
106
+
107
+
105
108
  declare type cds_services = { [name:string]: Service }
106
109
  declare type cds_server = Function