Skip to content

[cds^8]: remove deprecated api srv. stream #998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 2 additions & 53 deletions node.js/core-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,8 @@ When looking for overriding central event processing, rather choose [`srv.handl





### srv. handle (event) {.method}

```ts
Expand Down Expand Up @@ -1049,61 +1051,8 @@ All matching `.before`, `.on`, and `.after` handlers are executed in correspondi
In effect, for asynchronous event messages, that is, instances of `cds.Event`, sent via [`srv.emit()`](#srv-emit-event), all registered `.on` handlers are always executed. In contrast to that, for synchronous resuests, that is, instances of `cds.Requests` this is up to the individual handlers calling `next()`. See [`srv.on(request)`](#interceptor-stack-with-next) for an example.


<!-- ## Streaming API {#srv-stream } -->

### srv. stream (column) {.method}

::: warning
This API is deprecated and will be removed with the `@sap/cds` version 8. Please use [`SELECT` query](../cds/cqn) instead.
:::

```ts
async function srv.stream (column: string)
return : {
from(entity: CSN Definition | string): {
where(filter: any): ReadableStream // from node:stream
}
}
```

This method allows streaming binary data properties.
It returns a read stream which can be used to pipe to write streams, as shown in the following examples.

```js
const stream = srv.stream().from('T', { ID: 1 }, a => a.data)
stream.pipe(process.stdout)
```

```js
const stream = srv.stream('data').from('T', { ID: 1 })
stream.pipe(process.stdout)
```

```js
const stream = srv.stream('data').from('T').where({ ID: 1 })
stream.pipe(process.stdout)
```

### srv. stream (query) {.method}

::: warning
This API is deprecated and will be removed with the `@sap/cds` version 8. Please use [`SELECT` query](../cds/cqn) instead.
:::

```ts
async function srv.stream (query: CQN) : ReadableStream
```

This is a variant of `srv.stream`, which accepts a [`SELECT` query](../cds/cqn) as input and returns a Promise resolving to result stream when the query matched to an existing row in the database. The query is expected to select a single column and a single data row. Otherwise, an error is thrown.

```js
const stream = await srv.stream( SELECT('image').from('Foo',111) )
stream.pipe(process.stdout)
```

::: warning
This API is limited to [database services](databases).
:::

### srv. foreach (entity) {.method}

Expand Down
Loading