@tstdl/base 0.93.5 → 0.93.6

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.
@@ -220,7 +220,21 @@ let ApiGateway = ApiGateway_1 = class ApiGateway {
220
220
  .when(isBlob, (value) => ({ stream: value.stream() }))
221
221
  .when((isReadableStream), (stream) => ({ stream }))
222
222
  .when((value) => value instanceof ServerSentEventsSource, (events) => ({ events }))
223
- .when(() => (context.endpoint.definition.result == DataStream), (value) => ({ events: DataStreamSource.fromIterable(value).eventSource }))
223
+ .when(() => (context.endpoint.definition.result == DataStream), (value) => {
224
+ const logger = this.#logger;
225
+ async function* iterableWithError() {
226
+ try {
227
+ for await (const item of value) {
228
+ yield item;
229
+ }
230
+ }
231
+ catch (error) {
232
+ logger.error(error);
233
+ throw error;
234
+ }
235
+ }
236
+ return ({ events: DataStreamSource.fromIterable(iterableWithError()).eventSource });
237
+ })
224
238
  .when(() => (context.endpoint.definition.result == String), (text) => ({ text: text }))
225
239
  .otherwise((json) => ({ json }));
226
240
  }
@@ -9,6 +9,7 @@ var DocumentManagementService_1;
9
9
  import { and, eq } from 'drizzle-orm';
10
10
  import { union } from 'drizzle-orm/pg-core';
11
11
  import { Enumerable } from '../../../enumerable/index.js';
12
+ import { BadRequestError } from '../../../errors/bad-request.error.js';
12
13
  import { inject } from '../../../injector/index.js';
13
14
  import { Logger } from '../../../logger/logger.js';
14
15
  import { Transactional, injectRepository, injectTransactional } from '../../../orm/server/index.js';
@@ -87,6 +88,9 @@ let DocumentManagementService = DocumentManagementService_1 = class DocumentMana
87
88
  }
88
89
  }
89
90
  async loadData(tenantId, collectionIds) {
91
+ if (collectionIds.length == 0) {
92
+ throw new BadRequestError('At least one collection ID must be provided to load document management data.');
93
+ }
90
94
  return await this.transaction(async (tx) => {
91
95
  const [collections, documentCollectionAssignments, requestAssignments, assignmentScopes, { categories, types }] = await Promise.all([
92
96
  this.#documentCollectionService.repository.withTransaction(tx).loadManyByQuery({ tenantId, id: { $in: collectionIds } }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.5",
3
+ "version": "0.93.6",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"