diff --git a/apis/server.d.ts b/apis/server.d.ts index d36a04a4..7296abf6 100644 --- a/apis/server.d.ts +++ b/apis/server.d.ts @@ -15,24 +15,33 @@ export const connect: { /** * Connects to a specific datasource. - * @example cds.connect.to ('service') + * @example await cds.connect.to ('service') * @see [capire](https://cap.cloud.sap/docs/node.js/cds-connect#cds-connect-to) */ to(datasource: string, options?: cds_connect_options): Promise, /** * Shortcut for 'db' as the primary database returning `cds.DatabaseService` - * @example cds.connect.to ('db') + * @example await cds.connect.to ('db') */ to(datasource: 'db', options?: cds_connect_options): Promise, /** * Connects to a specific datasource via a Service subclass - * @example cds.connect.to (ServiceClass) + * @example await cds.connect.to (ServiceClass) * @see [capire](https://cap.cloud.sap/docs/node.js/cds-connect#cds-connect-to) */ to(datasource: {new(): S}, options?: cds_connect_options): Promise, + /** + * Connects to a specific datasource via a Service class from cds-typer + * @example + * import ServiceClass from '#cds-models/SomeService' + * await cds.connect.to (ServiceClass) + * @see [capire](https://cap.cloud.sap/docs/node.js/cds-connect#cds-connect-to) + */ + to(datasource: S, options?: cds_connect_options): Promise & Service>, + /** * Connects to a specific datasource via options. * @example cds.connect.to ({ kind:..., impl:... }) diff --git a/apis/services.d.ts b/apis/services.d.ts index 777ea2bb..becb766c 100644 --- a/apis/services.d.ts +++ b/apis/services.d.ts @@ -356,6 +356,12 @@ type CdsFunction = { __returns: any, } +// extracts all CdsFunction properties from T +/** + * @beta helper + */ +type CdsFunctions = Pick + /** * Types herein can be used to type handler functions that are not declared in line: * @example