@lenne.tech/nest-server 12.6.10 → 12.6.11
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.
- package/.claude/rules/configurable-features.md +1 -1
- package/.claude/rules/testing.md +3 -3
- package/FRAMEWORK-API.md +1 -1
- package/dist/core/modules/ai/core-ai.controller.js +8 -4
- package/dist/core/modules/ai/core-ai.controller.js.map +1 -1
- package/dist/core/modules/file/core-file.controller.d.ts +1 -0
- package/dist/core/modules/file/core-file.controller.js +26 -23
- package/dist/core/modules/file/core-file.controller.js.map +1 -1
- package/docs/REQUEST-LIFECYCLE.md +1 -1
- package/migration-guides/12.6.10-to-12.6.11.md +75 -0
- package/migration-guides/12.6.9-to-12.6.10.md +15 -3
- package/package.json +1 -1
- package/src/core/modules/ai/core-ai.controller.ts +12 -4
- package/src/core/modules/file/INTEGRATION-CHECKLIST.md +16 -15
- package/src/core/modules/file/README.md +17 -2
- package/src/core/modules/file/core-file.controller.ts +63 -29
|
@@ -339,7 +339,7 @@ This pattern is currently applied to:
|
|
|
339
339
|
| File Access Roles | `file.downloadRoles`, `file.uploadRoles`, `file.deleteRoles` | Config-Driven Role List | `[RoleEnum.ADMIN]` each. **These are the only breaking change a single-replica project gets in 11.33.0** — six members moved from `@Roles(S_EVERYONE)` to these knobs: `GET /files/id/:id`, `GET /files/:filename` and `getFileInfo` (`downloadRoles`), `uploadFile` / `uploadFiles` (`uploadRoles`), `deleteFile` (`deleteRoles`). Plain role STRINGS, not `RoleEnum` members, so project roles work (`['company-admin', 'editor']`). Applied at boot by `applyFileRoles()` via `Reflect.defineMetadata('roles', …)` on the base-class methods — the same runtime mechanism `CorePermissionsModule` uses, because the value is only known from config. **`[]`, a non-array, or an array holding a non-string is REJECTED with a warning and the default applies** — an all-empty role set reads to the guards as "no roles required" and would OPEN the route, the exact opposite of the intent. **ADMIN is always unioned in**: both `CoreFileController` and `CoreFileResolver` carry a class-level `@Roles(RoleEnum.ADMIN)` and the guards UNION class + handler metadata, so these knobs can grant but never exclude admins. Both classes also carry `@SkipTenantCheck()` — GridFS and the S3 metadata collection are reached outside Mongoose, so `mongooseTenantPlugin` never scopes them and a role name alone cannot express a per-tenant rule; roles resolve against `user.roles`, never `membership.role`. **A subclass that OVERRIDES a member opts out permanently** (decorator metadata lives on the function object, and an override is a different function) — inherit the member instead. **Since 11.35.1 that opt-out is REPORTED**: `CoreFileAccessAuditInitializer` reads the roles off the class the project actually registered at `onApplicationBootstrap` (the earliest point at which the route table exists, which is why it is a provider and not part of `applyFileRoles()`) and warns when a member is open beyond ADMIN for a reason the configuration cannot explain — the case the construction-time warning below is structurally blind to. It only REPORTS: overwriting an override's metadata, the way `TusModule.applyRoles()` does, would silently relax a route a project pinned on purpose. Roles are the coarse filter only; per-file rules belong in `CoreFileService.checkRights()`, which now receives `currentUser` and can read raw metadata via `getRawFileInfo()`. **Since 11.35.0 a reused FILENAME resolves to the most recent file** in all three stores (`uploadDate` desc, `_id` tie-break) and every by-name read path resolves a document and then reads by ID — under GridFS the by-name metadata lookup answered the oldest document while `openDownloadStreamByName()` served the newest, so a per-file rule approved one file and the bytes of another came back. Consequence: `duplicateById()` keeps the source's filename and the copy carries no metadata, so the copy now wins the name and an `ownerId` rule refuses it — give the copy its own metadata or its own name. **Since 11.35.0 `CoreFileService` WARNS at construction** when `multiTenancy` is active AND a knob names a role other than ADMIN AND `checkRights()` is not overridden — the file stores are reached outside Mongoose, so these role names resolve against `user.roles` (global) and every holder reaches every tenant's files; only `checkRights()` can narrow that. Silent on the admin-only default and silent when a per-file rule exists. Implementation: `src/core/modules/file/file-roles.config.ts` (`FILE_ROLE_DEFAULTS`, `FILE_ROLE_MEMBERS`, the three warnings, the shared `hasDeclaredFilePolicy()` silencer) + `file-roles.helper.ts` (`applyFileRoles`) + `core-file-access-audit.initializer.ts` (the registered-class audit) |
|
|
340
340
|
| TUS Roles | `tus.roles` | Config-Driven Role List | `[RoleEnum.S_USER]` (was `S_EVERYONE` — breaking). A TUS upload writes into the SAME store the download routes guard, and the termination extension (on by default) can delete from it, so anonymous writes into a store only privileged callers may read is the wrong way round. Applied by `TusModule.applyRoles()` onto the registered controller class **and** onto `handleTus` / `handleTusWithId`. Same rejection rule as the file roles: `[]` / non-array / non-string → warning + `DEFAULT_TUS_CONFIG.roles`. **`OPTIONS` is deliberately exempt**: `handleTusOptions` / `handleTusOptionsWithId` keep their own handler-level `@Roles(RoleEnum.S_EVERYONE)`, because that is the CORS preflight — browsers send it WITHOUT credentials, and it returns server capabilities only. Gating it would make every browser upload fail before the first byte. `CoreTusController` also carries `@SkipTenantCheck()`. A custom controller is covered as long as it INHERITS the handlers; one that re-declares `@All()` / `@Roles()` carries its own metadata and thereby opts out — the documented way to hard-code a policy config must not be able to change. **Set `roles: [RoleEnum.S_EVERYONE]` explicitly if you accept attachments on a public form.** **Since 11.35.0 `tus.roles` is no longer the only gate**: `onUploadCreate` records the authenticated creator under `TUS_OWNER_METADATA_KEY` (`ltOwnerId`, always OVERWRITING any client-supplied value) and `onIncomingRequest` refuses HEAD/PATCH/DELETE naming an upload the caller does not own — with **404**, the file module's refusal policy. Before that, any authenticated caller who learned an upload id could APPEND BYTES to somebody else's upload, which are then migrated into the file store under the victim's filename. The finished file also gains `metadata.ownerId`, without which the documented per-file ownership rule could never authorize a tus-uploaded file (admin-only in practice). An OWNER-LESS upload stays reachable — uploads predating 11.35.0 have none, and neither does a deliberately public form. `readRequestUserId()` / `assertUploadOwnership()` are `protected`. **Since 11.41.9 the tenant is recorded too, but ONLY with `multiTenancy` configured** (not `enabled: false`) and a tenant guard registered: `onUploadCreate` validates the tenant header against the caller's active memberships through `core-tenant-context.registry.ts` (the routes carry `@SkipTenantCheck()`, so the guard did not), refuses a non-member with **403**, writes it under `TUS_TENANT_METADATA_KEY` (`ltTenantId`, always overwritten like the owner key) and the finished file gains `metadata.tenantId`. No header → tenant-less, as before; without `multiTenancy` nothing is read or written. A project hooks in through `TusModule.forRoot({ service })` (a `CoreTusService` subclass, constructed by the module as `(connection, options)` — project providers come from `options.moduleRef` at call time) and the `protected onUploadCreate(req, upload)`, the one point where `Upload-Length` is known and nothing is stored yet; an override must return `super.onUploadCreate()`. Note that `@tus/server` v2 hands its hooks a WHATWG `ServerRequest`, so a guard's `req.user` is reachable only via `runtime.node.req`. **CORS (11.42.1)**: the tus handler's `Access-Control-Allow-Origin` comes from `buildCorsConfig()` (or `tus.allowedOrigins`), plus `allowedCredentials` — without it `@tus/server` answered `*`, which browsers refuse on a credentialed request, so cookie-authenticated uploads across split app/API origins failed in every browser while the server answered 201; no credentialed CORS configured → the `*` default stays. **compression (11.42.2)**: `@tus/server` finishes responses with `res.end(callback)`, which `compression`'s two-argument `res.end(chunk, encoding)` patch reads as a chunk (`ERR_INVALID_ARG_TYPE … Received function`); with the starter's `filter: () => true, threshold: 0` every finished upload HUNG without an answer AFTER the file was stored (headers already sent, so no error response could follow). `CoreTusService` wraps `server.handle()` and normalises `res.end` per response (`normalizeEndCallback()`, callback on `finish`/`close`), so no `main.ts` change is needed. Implementation: `src/core/modules/tus/tus.module.ts`, `src/core/modules/tus/core-tus.service.ts`, `src/core/modules/tus/tus.constants.ts` |
|
|
341
341
|
| File Storage | `file.storage` + `file.storageDir` + `s3` | Explicit Enum with DERIVED default | `'filesystem' \| 'gridfs' \| 's3'`. **Unset → derived**, most capable first: `'s3'` when `s3.bucket` is set, else `'filesystem'` with `database: false` or when `database` routes the file metadata to a SQL source (`fileMetadataSqlSource()`; GridFS would put bytes and metadata into MongoDB — an explicit `'gridfs'` keeps working), else `'gridfs'` when `mongoose.uri` is set, else `'filesystem'`. **Set → enforced**: an unavailable store FAILS THE BOOT (`assertFileStorageAvailable()`), it never falls back — a silent fallback puts files in a store the operator does not believe they are in, unrecoverably. A DERIVED driver is enforced too (`s3.bucket` set but `s3Service` not forwarded to `super()` → boot error). Metadata stays queryable whichever driver holds the bytes (`fs.files` / `s3-files` / `filesystem-files`, the latter two as the tables `s3_files` / `filesystem_files` when `database` routes them to a SQL source) — `findFileInfo()` and `checkRights()` need it. Reads consult ALL stores so switching drivers is forward-only with no migration; writes go to the active driver only. `'filesystem'` is pod-local: not shared between replicas, lost on restart unless `storageDir` is a mounted volume. `s3`: `bucket` (required — the one thing S3 cannot default, hence the eligibility test), `region: 'us-east-1'`, `forcePathStyle: false`, `autoCreateBucket: false` (off by design: production buckets come from infrastructure code, whose credentials usually cannot CreateBucket), `stagingBucket: bucket`, `presignedDownloads: false` (`true`/`{}` → `expiresInSeconds: 300`), `endpoint` (MinIO/RustFS), `accessKeyId`/`secretAccessKey` (omit → AWS default credential chain), `enabled: false` to pre-configure. Requires the OPTIONAL peer `@aws-sdk/client-s3`, plus `@aws-sdk/s3-request-presigner` for presigned downloads. **Uploads are never buffered on the S3 path** (11.41.7): a known length (`FileUploadSource.size`, TUS, a buffer) goes up as one streamed PutObject up to `CoreS3Service.MAX_SINGLE_PUT_BYTES` (5 GiB — AWS S3 refuses more in one request, `EntityTooLarge`) and as a multipart upload above it, an unknown one — every GraphQL and streamed REST upload — as a multipart upload via the OPTIONAL peer `@aws-sdk/lib-storage`. Missing peer → one boot warning and the old in-memory buffering, NOT a boot failure (multipart optimises a path that works without it). `size` must be the file's EXACT length — never a multipart request's `Content-Length`; anything but a positive integer counts as unknown (`isKnownUploadSize()`), and the recorded length of an unknown-length upload comes from a HEAD of the stored object. `presignedDownloads` makes `GET /files/id/:id` answer `302` to a time-limited S3 URL instead of streaming — the URL is a bearer capability, authorized once at issue time. The resolved driver is logged at boot (`[CoreFileStorage] File storage: …`) |
|
|
342
|
-
| S3 Connection Pool & Download Guard | `s3.maxSockets`, `s3.connectionTimeoutMs`, `s3.socketTimeoutMs`, `s3.downloadIdleTimeoutMs`; `file.downloadIdleTimeoutMs`, `file.downloadCaching` | Numeric — invalid → default, never off (Family C without opt-out) + Explicit Enum | **12.6.10, after a production outage**: S3 downloads delivered with a bare `stream.pipe(res)` kept their sockets when clients aborted; after 50 the SDK's pool was full, every S3 request waited forever (health check green), heap OOM hours later. Since then: `CoreS3Service` builds its client with OWN agents (`maxSockets` **200**, keep-alive), `connectionTimeout` **15 000** per attempt (the SDK starts it when the request is CREATED, so it also bounds the wait for a free socket — a short value fails healthy downloads under load; the SDK retries a timed-out attempt, 3 attempts in all, so a download that gets no socket answers **503** + `Retry-After: 5` after about 46 s — keep 3 × the value below the reverse proxy's read timeout, commonly 60 s), `socketTimeout` **120 000** (inactivity backstop for every request, uploads and copies included). The SDK's `requestTimeout` stops at the headers and its socket timeout destroys the body WITH an error (a process crash without a listener), so the real guard is `guardIdleStream()` (`common/helpers/idle-stream.helper.ts`): every stream from `getObject()` (`s3.downloadIdleTimeoutMs`, 30 000) and from `CoreFileService.getFileStream()` / `getFileStreamByName()` (`file.downloadIdleTimeoutMs`, 30 000 — GridFS cursors, file handles) is destroyed after that long WITHOUT READ PROGRESS, measured on the consumer side (`_read`) and at the source; a slow reader that keeps reading is never cut off; code that opens a stream and reads it LATE (an archive appending every file first) breaks — per call `downloadIdleTimeoutMs: false` (`FileServiceOptions`) / `getObject(key, { idleTimeoutMs: false })` opts out. `pipeFileToResponse()` destroys the source when the client goes — the response's `close`, the request's `close` (before its end and while the response is unfinished — Node closes a request whose body was read to the end by itself, a POST export stays deliverable) or the socket's `end`/`close`: measured under a k6 abort storm, about one in six aborted downloads never got a `close` on the response and reported it only through the request or the socket — and at once when it had ALREADY gone (`isResponseGone()`: response destroyed/closed OR request destroyed before its end OR socket destroyed; a client that gave up while waiting for a socket — the avalanche path); the routes pass an `abortSignal` (`downloadAbortSignal()`, exported:
|
|
342
|
+
| S3 Connection Pool & Download Guard | `s3.maxSockets`, `s3.connectionTimeoutMs`, `s3.socketTimeoutMs`, `s3.downloadIdleTimeoutMs`; `file.downloadIdleTimeoutMs`, `file.downloadCaching` | Numeric — invalid → default, never off (Family C without opt-out) + Explicit Enum | **12.6.10, after a production outage**: S3 downloads delivered with a bare `stream.pipe(res)` kept their sockets when clients aborted; after 50 the SDK's pool was full, every S3 request waited forever (health check green), heap OOM hours later. Since then: `CoreS3Service` builds its client with OWN agents (`maxSockets` **200**, keep-alive), `connectionTimeout` **15 000** per attempt (the SDK starts it when the request is CREATED, so it also bounds the wait for a free socket — a short value fails healthy downloads under load; the SDK retries a timed-out attempt, 3 attempts in all, so a download that gets no socket answers **503** + `Retry-After: 5` after about 46 s — keep 3 × the value below the reverse proxy's read timeout, commonly 60 s), `socketTimeout` **120 000** (inactivity backstop for every request, uploads and copies included). The SDK's `requestTimeout` stops at the headers and its socket timeout destroys the body WITH an error (a process crash without a listener), so the real guard is `guardIdleStream()` (`common/helpers/idle-stream.helper.ts`): every stream from `getObject()` (`s3.downloadIdleTimeoutMs`, 30 000) and from `CoreFileService.getFileStream()` / `getFileStreamByName()` (`file.downloadIdleTimeoutMs`, 30 000 — GridFS cursors, file handles) is destroyed after that long WITHOUT READ PROGRESS, measured on the consumer side (`_read`) and at the source; a slow reader that keeps reading is never cut off; code that opens a stream and reads it LATE (an archive appending every file first) breaks — per call `downloadIdleTimeoutMs: false` (`FileServiceOptions`) / `getObject(key, { idleTimeoutMs: false })` opts out. `pipeFileToResponse()` destroys the source when the client goes — the response's `close`, the request's `close` (before its end and while the response is unfinished — Node closes a request whose body was read to the end by itself, a POST export stays deliverable) or the socket's `end`/`close`: measured under a k6 abort storm, about one in six aborted downloads never got a `close` on the response and reported it only through the request or the socket — and at once when it had ALREADY gone (`isResponseGone()`: response destroyed/closed OR request destroyed before its end OR socket destroyed; a client that gave up while waiting for a socket — the avalanche path); the routes pass an `abortSignal` (`downloadAbortSignal()`, exported: the same client-gone signals) down to `GetObjectCommand` and open the stream through `openDownloadStream()` (exported since 12.6.11 for a project's own routes): no store request for a gone client, `RESPONSE_GONE` instead of an ERROR when the store request failed because the client left (an aborted S3 request rejects with `AbortError`), a late stream destroyed, `TimeoutError` → 503 + `Retry-After`. An exhausted pool is logged as an ERROR once per minute with numbers (`getSocketPoolStats()` exposes them); deliberately NOT a health-check failure. `file.downloadCaching`: `'none'` (default, `private, no-store`) or `'revalidate'` (`private, no-cache` — the browser revalidates every use, `304` after the rights check without a store read); both send a WEAK `ETag` `W/"<id>"` (bytes under an id never change, but a `compression` middleware sends a gzip and an identity representation of the same file — RFC 9110 §8.8.3 forbids one strong validator for both; `If-None-Match` compares weakly) and `Content-Length`. The reference `src/main.ts` uses `compression.filter` (no gzip for JPEG/PNG/PDF/ZIP). Pinned by `tests/unit/idle-stream.spec.ts`, `tests/unit/core-file.controller.spec.ts`, `tests/unit/download-idle-opt-out.spec.ts` and `tests/s3-download-resilience.e2e-spec.ts` (real RustFS: dropped streams, abort storm with bare `pipe()`, clients giving up while waiting, 500 parallel downloads with `maxSockets: 4`, slow reader; mutations `idle-guard-*`, `s3-get-object-*`, `pipe-file-to-response-*`, `download-route-keeps-late-stream`, `file-stream-drops-idle-opt-out`). Implementation: `core-s3.service.ts`, `core-file.controller.ts`, `core-file.service.ts` |
|
|
343
343
|
| TUS S3 Staging | `tus.s3Staging` | Explicit Boolean (default ON when S3 configured) | `true` when `s3` is configured, otherwise inert. Stages in-progress uploads in `s3.stagingBucket` via `@tus/s3-store` instead of `tus.uploadDir` on local disk, so resumable uploads survive replica restarts and need no sticky sessions. Set `false` to force local disk. Missing OPTIONAL peer `@tus/s3-store` → warning + fall back to local disk (NOT a boot failure). **Give the staging bucket a lifecycle rule expiring incomplete multipart uploads** — the framework's own expiration cleanup is skipped in S3 mode (S3 is the right place for that policy), so aborted uploads otherwise accumulate parts nothing removes |
|
|
344
344
|
| TUS Configuration Source, Path & Extensions | `tus` (server config) / `TusModule.forRoot({ config })` | Enabled by Default + explicit-config-wins | **Since 11.42.9 `TusModule.forRoot()` without `config` reads the server config's `tus` key** (`ConfigService.get('tus')`, the zero-config rule `CoreBetterAuthModule.forRoot()` follows); an explicit `config` wins. Before, the key was never read: `tus: false`, `allowedTypes`, `maxSize`, `roles` in `config.env.ts` did nothing — real projects had upload restrictions they believed were enforced. **`path`** has three readings (`applyPath()`): unset → follows the controller's route; a new route (`/uploads`) → mounts the registered controller there (writes `PATH_METADATA`, config wins like the roles; the declared route is remembered per class and restored by a later `forRoot()` without `path`); a path ENDING with the controller's route (`/api/tus`, `/files/tus`) → the PUBLIC URL: the controller stays and upload URLs use it. The third reading is load-bearing: it was the only working setting under a global prefix or a prefix-stripping proxy before 11.42.9, and treating it as a route doubled the prefix (`/api/api/tus`, 404 on every upload — caught in the second pre-release review). The upload URL (`Location`) is built from the path the creation request arrived at (`uploadCollectionPath(req)`), or from `path` when that is longer and ends with it (proxy strip); `@tus/server` built it from `path` alone, which broke every resume below a global prefix, a URI version or a project route. **`relativeLocation`** (new): the framework owns `generateUrl`, which takes precedence over `@tus/server`'s option of that name, so it is honoured from `tus.relativeLocation` AND from the tus server's own options (a vendored core may pass it there). **Extensions**: `@tus/server` consults no flag, so `creation`, `creationWithUpload` and `termination` are enforced by `CoreTusService` — the store's advertised `extensions` are narrowed, and `assertExtensionEnabled()` answers 501 inside the server's `onIncomingRequest` / `onUploadCreate` options (not in the overridable hook, so an override without `super` cannot reopen it). `checksum` / `concatenation` have no effect: neither built-in store supports them. `configure(false)` now yields a DISABLED config (before it kept the defaults and started a tus server behind a module with no endpoint). Implementation: `tus.module.ts`, `core-tus.service.ts` |
|
|
345
345
|
| Health Check | `healthCheck` | Presence Implies Enabled | Absent → no endpoints. Any object registers `GET /health-check` + the `healthCheck` query; **`enabled: false` leaves them out (honoured since 11.42.9 — before, it was declared and ignored)**. Individual checks under `configs.*` each have their own `enabled`. Implementation: `core.module.ts` |
|
package/.claude/rules/testing.md
CHANGED
|
@@ -410,7 +410,7 @@ pnpm run check:mutations -- --id=<id> # one mutation
|
|
|
410
410
|
pnpm run check:mutations -- --list # the registry, without running anything
|
|
411
411
|
pnpm run check:mutations -- --allow-dirty # when the fix and its evidence share a working tree
|
|
412
412
|
pnpm run check:mutations -- --jobs=4 # N mutations at a time (default: 2, or 4 on >=12 cores)
|
|
413
|
-
pnpm run check:mutations -- --no-infra # only the
|
|
413
|
+
pnpm run check:mutations -- --no-infra # only the 405 that need no MongoDB
|
|
414
414
|
pnpm run check:mutations -- --since=<ref> # only mutations touching files changed since <ref>
|
|
415
415
|
pnpm run check:mutations -- --shard=2/4 # this job's quarter of the selection (CI splits the full run)
|
|
416
416
|
```
|
|
@@ -430,7 +430,7 @@ when the registry, a vitest config or a setup file changed, since those can move
|
|
|
430
430
|
commit, and in CI alongside the publish without blocking it. The price of caching is a cache that
|
|
431
431
|
has to model each spec's full dependency closure correctly, and getting that wrong produces a stale
|
|
432
432
|
PASS for a test that has since gone vacuous — exactly what the gate is there to prevent. Bad trade
|
|
433
|
-
at
|
|
433
|
+
at 638 mutations.
|
|
434
434
|
|
|
435
435
|
**Decided 2026-10-03 (repo owner): keep the full run.** Measured at 128 mutations, the CI job for
|
|
436
436
|
11.41.6 took **14 minutes**. The trigger to revisit is that wall time, not the mutation count —
|
|
@@ -503,7 +503,7 @@ exactly the environment where the answer matters.
|
|
|
503
503
|
|
|
504
504
|
Worth knowing before optimising the wrong thing: the specs behind all 233 e2e mutations add up to
|
|
505
505
|
**~40 seconds**. The step takes ~740s. The remaining ~700s is paying vitest's startup — process
|
|
506
|
-
spawn, transform, module graph, mongod connect, DB create and drop — once per mutation,
|
|
506
|
+
spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 638 times.
|
|
507
507
|
That work is largely single-threaded I/O and barely scales with cores: the full registry measures
|
|
508
508
|
**744s on a 12-core laptop and 777s on a 4-vCPU CI runner**.
|
|
509
509
|
|
package/FRAMEWORK-API.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lenne.tech/nest-server — Framework API Reference
|
|
2
2
|
|
|
3
|
-
> Auto-generated from source code as of 2026-11-11 (v12.6.
|
|
3
|
+
> Auto-generated from source code as of 2026-11-11 (v12.6.11)
|
|
4
4
|
> File: `FRAMEWORK-API.md` — compact, machine-readable API surface for Claude Code
|
|
5
5
|
|
|
6
6
|
## CoreModule.forRoot()
|
|
@@ -76,22 +76,26 @@ let CoreAiController = class CoreAiController {
|
|
|
76
76
|
return this.aiService.prompt(input, serviceOptions);
|
|
77
77
|
}
|
|
78
78
|
async stream(serviceOptions, input, res) {
|
|
79
|
-
res.setHeader('Cache-Control', 'no-cache');
|
|
79
|
+
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
|
80
80
|
res.setHeader('Connection', 'keep-alive');
|
|
81
81
|
res.setHeader('Content-Type', 'text/event-stream');
|
|
82
82
|
res.setHeader('X-Accel-Buffering', 'no');
|
|
83
83
|
res.flushHeaders?.();
|
|
84
|
+
const send = (chunk) => {
|
|
85
|
+
res.write(chunk);
|
|
86
|
+
res.flush?.();
|
|
87
|
+
};
|
|
84
88
|
const heartbeat = setInterval(() => {
|
|
85
|
-
|
|
89
|
+
send(': keep-alive\n\n');
|
|
86
90
|
}, 15_000);
|
|
87
91
|
heartbeat.unref?.();
|
|
88
92
|
try {
|
|
89
93
|
for await (const event of this.aiService.promptStream(input, serviceOptions)) {
|
|
90
|
-
|
|
94
|
+
send(`data: ${JSON.stringify(event)}\n\n`);
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
catch (err) {
|
|
94
|
-
|
|
98
|
+
send(`data: ${JSON.stringify({ message: err.message, type: 'error' })}\n\n`);
|
|
95
99
|
}
|
|
96
100
|
finally {
|
|
97
101
|
clearInterval(heartbeat);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-ai.controller.js","sourceRoot":"","sources":["../../../../src/core/modules/ai/core-ai.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,4CA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AU,CAAC,IAAI,CAAC;IAChB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;qCAGY,aAAa;QACL,uBAAuB;QACrB,yBAAyB;QAC1B,wBAAwB;QAC7B,mBAAmB;QACd,+BAA+B;QAChC,iCAAiC;QACvC,iBAAiB;QACX,uBAAuB;QAC3B,mBAAmB;QACb,yBAAyB;GAZxD,gBAAgB,CAujB5B"}
|
|
@@ -8,6 +8,7 @@ export { buildContentDisposition };
|
|
|
8
8
|
export declare function pipeFileToResponse(stream: Readable, res: Response): Response;
|
|
9
9
|
export declare function isResponseGone(res: Response): boolean;
|
|
10
10
|
export declare function downloadAbortSignal(res: Response): AbortSignal;
|
|
11
|
+
export declare function openDownloadStream<T extends null | Readable | undefined>(res: Response, open: () => Promise<T>): Promise<T | typeof RESPONSE_GONE>;
|
|
11
12
|
export declare abstract class CoreFileController {
|
|
12
13
|
protected fileService: CoreFileService;
|
|
13
14
|
protected constructor(fileService: CoreFileService);
|
|
@@ -176,6 +176,31 @@ export function downloadAbortSignal(res) {
|
|
|
176
176
|
});
|
|
177
177
|
return controller.signal;
|
|
178
178
|
}
|
|
179
|
+
export async function openDownloadStream(res, open) {
|
|
180
|
+
if (isResponseGone(res)) {
|
|
181
|
+
return RESPONSE_GONE;
|
|
182
|
+
}
|
|
183
|
+
let stream;
|
|
184
|
+
try {
|
|
185
|
+
stream = await open();
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (isResponseGone(res)) {
|
|
189
|
+
return RESPONSE_GONE;
|
|
190
|
+
}
|
|
191
|
+
if (error?.name === 'TimeoutError') {
|
|
192
|
+
fileStreamLogger.warn(`File store busy, download answered 503: ${error.message}`);
|
|
193
|
+
res.header('Retry-After', '5');
|
|
194
|
+
throw new ServiceUnavailableException('File storage is busy, please retry');
|
|
195
|
+
}
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
if (stream && isResponseGone(res)) {
|
|
199
|
+
stream.destroy();
|
|
200
|
+
return RESPONSE_GONE;
|
|
201
|
+
}
|
|
202
|
+
return stream;
|
|
203
|
+
}
|
|
179
204
|
let CoreFileController = class CoreFileController {
|
|
180
205
|
fileService;
|
|
181
206
|
constructor(fileService) {
|
|
@@ -256,29 +281,7 @@ let CoreFileController = class CoreFileController {
|
|
|
256
281
|
return downloadAbortSignal(res);
|
|
257
282
|
}
|
|
258
283
|
async openDownloadStream(res, open) {
|
|
259
|
-
|
|
260
|
-
return RESPONSE_GONE;
|
|
261
|
-
}
|
|
262
|
-
let stream;
|
|
263
|
-
try {
|
|
264
|
-
stream = await open();
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
if (isResponseGone(res)) {
|
|
268
|
-
return RESPONSE_GONE;
|
|
269
|
-
}
|
|
270
|
-
if (error?.name === 'TimeoutError') {
|
|
271
|
-
fileStreamLogger.warn(`File store busy, download answered 503: ${error.message}`);
|
|
272
|
-
res.header('Retry-After', '5');
|
|
273
|
-
throw new ServiceUnavailableException('File storage is busy, please retry');
|
|
274
|
-
}
|
|
275
|
-
throw error;
|
|
276
|
-
}
|
|
277
|
-
if (stream && isResponseGone(res)) {
|
|
278
|
-
stream.destroy();
|
|
279
|
-
return RESPONSE_GONE;
|
|
280
|
-
}
|
|
281
|
-
return stream;
|
|
284
|
+
return openDownloadStream(res, open);
|
|
282
285
|
}
|
|
283
286
|
setFileHeaders(res, file) {
|
|
284
287
|
this.setCacheHeaders(res, file);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-file.controller.js","sourceRoot":"","sources":["../../../../src/core/modules/file/core-file.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,GAAG,EACH,MAAM,EACN,iBAAiB,EACjB,KAAK,EACL,GAAG,EACH,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,KAAK,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IACjB,WAAA,GAAG,EAAE,CAAA;IACL,WAAA,WAAW,EAAE,CAAA;;;;iDAkCf;AAhLmB,kBAAkB;IAHvC,UAAU,CAAC,OAAO,CAAC;IACnB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IACrB,eAAe,EAAE;qCAK6B,eAAe;GAJxC,kBAAkB,CA2SvC"}
|
|
@@ -168,7 +168,7 @@ JWT-based authentication for existing projects:
|
|
|
168
168
|
| Feature | Description |
|
|
169
169
|
|---------|-------------|
|
|
170
170
|
| **File Module** | Upload/download with MongoDB GridFS storage |
|
|
171
|
-
| **REST Endpoints** | `GET /files/id/:id`, `GET /files/:filename` (core, gated by `file.downloadRoles`, default ADMIN); `POST /files/upload`, `DELETE /files/:id` (project-specific). Since 12.6.10 the download routes answer after the rights check: weak `ETag` + `If-None-Match` → `304` without a store read, `Cache-Control` per `file.downloadCaching`, `Content-Length`; the store request carries an abort signal (`downloadAbortSignal()`), delivery goes through `pipeFileToResponse()` (releases the source when the client goes), every stream is idle-guarded (`file.downloadIdleTimeoutMs`), and a store that gives no connection in time answers `503` + `Retry-After` |
|
|
171
|
+
| **REST Endpoints** | `GET /files/id/:id`, `GET /files/:filename` (core, gated by `file.downloadRoles`, default ADMIN); `POST /files/upload`, `DELETE /files/:id` (project-specific). Since 12.6.10 the download routes answer after the rights check: weak `ETag` + `If-None-Match` → `304` without a store read, `Cache-Control` per `file.downloadCaching`, `Content-Length`; the store request carries an abort signal (`downloadAbortSignal()`) and is opened through `openDownloadStream()` (exported since 12.6.11: a gone client is `RESPONSE_GONE`, never an error), delivery goes through `pipeFileToResponse()` (releases the source when the client goes), every stream is idle-guarded (`file.downloadIdleTimeoutMs`), and a store that gives no connection in time answers `503` + `Retry-After` |
|
|
172
172
|
| **GraphQL Endpoints** | `getFileInfo` (`file.downloadRoles`), `uploadFile` / `uploadFiles` (`file.uploadRoles`), `deleteFile` (`file.deleteRoles`) — all default ADMIN |
|
|
173
173
|
| **File access control** | Roles are the coarse filter; per-file rules go in `CoreFileService.checkRights()` using metadata written at upload time. Cover BOTH the `id` and the `filename` branch — the filename route authorizes on the by-name lookup alone when presigned S3 downloads are on, and `deleteFileByName()` always does. Working reference: `src/server/modules/file/file.service.ts` (with `file.downloadRoles: [S_USER]` in `src/config.env.ts`, so the rule is actually reached). Both file classes carry `@SkipTenantCheck()` — GridFS is not tenant-scoped |
|
|
174
174
|
| **TUS Module** | Resumable uploads via tus.io protocol (creation, termination, expiration), gated by `tus.roles` (default `S_USER`); `OPTIONS` stays public for the CORS preflight. Records owner and, with `multiTenancy` only, the validated tenant at upload creation; a custom service plugs in via `TusModule.forRoot({ service })`. Configured by `TusModule.forRoot({ config })`, else the server config's `tus` key (11.42.9+). Switched-off `creation` / `termination` answer 501 (enforced by `CoreTusService`, not `@tus/server`); upload URLs follow the path the upload was created at. The response that completes an upload carries the stored file's ID as `X-File-Id` (11.42.13+, listed in `Access-Control-Expose-Headers`) — the last segment of the TUS URL is the upload id, not the file id |
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Migration Guide: 12.6.10 → 12.6.11
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
| Category | Details |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Breaking Changes** | None |
|
|
8
|
+
| **New Features** | `openDownloadStream(res, open)` is exported — the function the framework's download routes open a file stream with |
|
|
9
|
+
| **Bugfixes** | The documented pattern for an own download route logged an ERROR with a stack trace for every client that left before S3 answered, and answered a busy store with 500 instead of 503 (§1) |
|
|
10
|
+
| **Migration Effort** | Projects with their OWN download route: open the stream with `openDownloadStream()` (§1). Everyone else: `pnpm run update` |
|
|
11
|
+
|
|
12
|
+
## Quick Migration
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @lenne.tech/nest-server@12.6.11
|
|
16
|
+
pnpm run update # nest-server-starter based projects
|
|
17
|
+
grep -rn "downloadAbortSignal(" src/ # own download routes: open the stream with openDownloadStream() (§1)
|
|
18
|
+
pnpm run build
|
|
19
|
+
pnpm test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Vendor mode**: run `/lt-dev:backend:update-nest-server-core` as usual.
|
|
23
|
+
|
|
24
|
+
## 1. Own download routes
|
|
25
|
+
|
|
26
|
+
12.6.10 documented passing `downloadAbortSignal(res)` to `getFileStream()`, so an S3 request whose client has gone is
|
|
27
|
+
dropped while it waits for a socket. The aborted request then REJECTS with `AbortError`. Nothing in the documented
|
|
28
|
+
pattern caught it: every client that left before S3 answered became `ERROR [ExceptionsHandler] … AbortError` with a
|
|
29
|
+
stack trace and a `500` sent into a closed response — under exactly the load the `S3 socket pool exhausted:` line has
|
|
30
|
+
to stand out in. A store that handed out no connection in time (`TimeoutError`) reached Nest as a `500` instead of the
|
|
31
|
+
`503` with `Retry-After` the framework's routes answer.
|
|
32
|
+
|
|
33
|
+
The framework's routes were not affected: they open the stream through `openDownloadStream()`, which was a protected
|
|
34
|
+
controller method until now. It is exported since 12.6.11:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { downloadAbortSignal, openDownloadStream, pipeFileToResponse, RESPONSE_GONE } from '@lenne.tech/nest-server';
|
|
38
|
+
|
|
39
|
+
@Get('image/:id')
|
|
40
|
+
async image(@Param('id') id: string, @Res() res: Response, @CurrentUser() currentUser) {
|
|
41
|
+
const stream = await openDownloadStream(res, () =>
|
|
42
|
+
this.fileService.getFileStream(id, { abortSignal: downloadAbortSignal(res), currentUser }),
|
|
43
|
+
);
|
|
44
|
+
if (stream === RESPONSE_GONE) {
|
|
45
|
+
return res; // nobody left to deliver to
|
|
46
|
+
}
|
|
47
|
+
if (!stream) {
|
|
48
|
+
throw new NotFoundException();
|
|
49
|
+
}
|
|
50
|
+
res.header('Content-Type', 'image/png');
|
|
51
|
+
return pipeFileToResponse(stream, res);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`openDownloadStream()`:
|
|
56
|
+
|
|
57
|
+
- does not ask the store when the client has already gone,
|
|
58
|
+
- answers `RESPONSE_GONE` when the store request failed because the client left meanwhile,
|
|
59
|
+
- destroys a stream that arrives after the client left,
|
|
60
|
+
- answers `503` with `Retry-After: 5` for `TimeoutError`, and rethrows every other error,
|
|
61
|
+
- passes `null` (the service's rights check refused) on unchanged.
|
|
62
|
+
|
|
63
|
+
`open` may return any stream: `CoreS3Service.getObject()` callers pass `async () => (await s3.getObject(key, { abortSignal })).body`.
|
|
64
|
+
|
|
65
|
+
## Troubleshooting
|
|
66
|
+
|
|
67
|
+
| Symptom | Cause | Fix |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `ERROR [ExceptionsHandler] … AbortError` with a stack trace, often in bursts under load | an own download route passes `downloadAbortSignal(res)` but opens the stream without `openDownloadStream()` | §1 |
|
|
70
|
+
| Own download route answers `500` while `S3 socket pool exhausted` is logged | the `TimeoutError` of a busy store is not turned into a `503` | §1 |
|
|
71
|
+
|
|
72
|
+
## Module Documentation
|
|
73
|
+
|
|
74
|
+
- `src/core/modules/file/README.md` — "Delivering a file from your own route"
|
|
75
|
+
- `src/core/modules/file/INTEGRATION-CHECKLIST.md` — Common Mistakes
|
|
@@ -79,16 +79,28 @@ package default); nest-server-starter follows.
|
|
|
79
79
|
|
|
80
80
|
## 3. Own download routes
|
|
81
81
|
|
|
82
|
-
Replace every `stream.pipe(res)` that delivers a file with `pipeFileToResponse(stream, res)`, and pass an abort signal
|
|
82
|
+
Replace every `stream.pipe(res)` that delivers a file with `pipeFileToResponse(stream, res)`, and pass an abort signal.
|
|
83
|
+
|
|
84
|
+
**Since 12.6.11, open the stream with `openDownloadStream()`** — see `migration-guides/12.6.10-to-12.6.11.md`. With the
|
|
85
|
+
abort signal alone, a client that leaves before S3 answers makes the store request reject with `AbortError`, and an
|
|
86
|
+
uncaught one is an ERROR with a stack trace per aborted download. On 12.6.10, catch it yourself:
|
|
83
87
|
|
|
84
88
|
```typescript
|
|
85
|
-
import { downloadAbortSignal, pipeFileToResponse } from '@lenne.tech/nest-server';
|
|
89
|
+
import { downloadAbortSignal, isResponseGone, pipeFileToResponse } from '@lenne.tech/nest-server';
|
|
86
90
|
|
|
87
91
|
@Get('image/:id')
|
|
88
92
|
async image(@Param('id') id: string, @Res() res: Response, @CurrentUser() currentUser) {
|
|
89
93
|
// Fires when the client goes (response or request close), so a store request waiting for a socket is dropped
|
|
90
94
|
const abortSignal = downloadAbortSignal(res);
|
|
91
|
-
|
|
95
|
+
let stream: Readable | null;
|
|
96
|
+
try {
|
|
97
|
+
stream = await this.fileService.getFileStream(id, { abortSignal, currentUser });
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (isResponseGone(res)) {
|
|
100
|
+
return res; // the client left; the aborted store request is not an error
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
92
104
|
if (!stream) {
|
|
93
105
|
throw new NotFoundException();
|
|
94
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "12.6.
|
|
3
|
+
"version": "12.6.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Server framework in TypeScript on top of NestJS: GraphQL and REST APIs on MongoDB, PostgreSQL, MySQL or MariaDB, with authentication, field-level permissions, multi-tenancy, offline sync and an AI assistant.",
|
|
6
6
|
"keywords": [
|
|
@@ -122,7 +122,9 @@ export class CoreAiController {
|
|
|
122
122
|
@Body() input: CoreAiPromptInput,
|
|
123
123
|
@Res() res: Response,
|
|
124
124
|
): Promise<void> {
|
|
125
|
-
|
|
125
|
+
// `no-transform` keeps a `compression` middleware out of the stream: gzip would otherwise hold every event until
|
|
126
|
+
// the response ends (measured: events written at 0, 300 and 600 ms all arrived together at about 900 ms)
|
|
127
|
+
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
|
126
128
|
res.setHeader('Connection', 'keep-alive');
|
|
127
129
|
res.setHeader('Content-Type', 'text/event-stream');
|
|
128
130
|
// Disable proxy-side response buffering (nginx and friends honour this); without
|
|
@@ -136,17 +138,23 @@ export class CoreAiController {
|
|
|
136
138
|
// idle connection at 60 s, which the client then sees as a turn that silently
|
|
137
139
|
// vanished. Comment frames are ignored by every SSE client and keep the
|
|
138
140
|
// connection observably alive.
|
|
141
|
+
// A compressor that ignores `no-transform` still sends what was written once it is flushed (`compression` adds
|
|
142
|
+
// `flush()` to the response)
|
|
143
|
+
const send = (chunk: string) => {
|
|
144
|
+
res.write(chunk);
|
|
145
|
+
(res as Response & { flush?: () => void }).flush?.();
|
|
146
|
+
};
|
|
139
147
|
const heartbeat = setInterval(() => {
|
|
140
|
-
|
|
148
|
+
send(': keep-alive\n\n');
|
|
141
149
|
}, 15_000);
|
|
142
150
|
heartbeat.unref?.();
|
|
143
151
|
|
|
144
152
|
try {
|
|
145
153
|
for await (const event of this.aiService.promptStream(input, serviceOptions)) {
|
|
146
|
-
|
|
154
|
+
send(`data: ${JSON.stringify(event)}\n\n`);
|
|
147
155
|
}
|
|
148
156
|
} catch (err) {
|
|
149
|
-
|
|
157
|
+
send(`data: ${JSON.stringify({ message: (err as Error).message, type: 'error' })}\n\n`);
|
|
150
158
|
} finally {
|
|
151
159
|
clearInterval(heartbeat);
|
|
152
160
|
res.end();
|
|
@@ -226,18 +226,19 @@ personal or medical, a per-file rule is not optional.
|
|
|
226
226
|
|
|
227
227
|
## Common Mistakes
|
|
228
228
|
|
|
229
|
-
| Mistake
|
|
230
|
-
|
|
|
231
|
-
| Overriding `getFileById` to add Swagger decorators
|
|
232
|
-
| Overriding without re-declaring `@Get(...)`
|
|
233
|
-
| `downloadRoles: []`
|
|
234
|
-
| Expecting `metadata` back from `getFileInfo()`
|
|
235
|
-
| `downloadRoles: ['member']` with multiTenancy
|
|
236
|
-
| Signed-in user can upload via TUS but not download
|
|
237
|
-
| Rule narrows only `'id'` / `'filename'`
|
|
238
|
-
| Treating the file id as unguessable
|
|
239
|
-
| Approving the caller's `filterArgs` as "narrowed"
|
|
240
|
-
| `super(connection)` in `FileService` with `file.storage: 's3'`
|
|
241
|
-
| Own download route with `stream.pipe(res)`
|
|
242
|
-
|
|
|
243
|
-
|
|
|
229
|
+
| Mistake | Symptom | Fix |
|
|
230
|
+
| --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
231
|
+
| Overriding `getFileById` to add Swagger decorators | `file.downloadRoles` silently ignored | Don't override; document at class level |
|
|
232
|
+
| Overriding without re-declaring `@Get(...)` | Route 404s for everyone, no error logged | Don't override |
|
|
233
|
+
| `downloadRoles: []` | Warning logged, default applied | Use a non-empty array; `[]` would read as "no roles required" and open the route |
|
|
234
|
+
| Expecting `metadata` back from `getFileInfo()` | `undefined` | Use `getRawFileInfo()` inside `checkRights()` |
|
|
235
|
+
| `downloadRoles: ['member']` with multiTenancy | Works from code, fails from `<img>` | Both file classes carry `@SkipTenantCheck()`; roles resolve against `user.roles`. Use `checkRights()` for tenant rules |
|
|
236
|
+
| Signed-in user can upload via TUS but not download | 403 on their own file | `tus.roles` and `file.downloadRoles` are separate. Add an owner to the metadata and authorize per file |
|
|
237
|
+
| Rule narrows only `'id'` / `'filename'` | `findFileInfo()` returns every file | Refuse `'filterArgs'`; force a per-user filter server-side with `{ force: true }` |
|
|
238
|
+
| Treating the file id as unguessable | Enumerable inventory | Ids share a per-process random part and an incrementing counter — authorize every read, do not rely on the id |
|
|
239
|
+
| Approving the caller's `filterArgs` as "narrowed" | Bypass via a different filter shape | `filterArgs` is client-controlled. Override the filter; never approve it |
|
|
240
|
+
| `super(connection)` in `FileService` with `file.storage: 's3'` | Boot fails: "that storage is not available" | Forward `{ configService, s3Service }` — step 6 |
|
|
241
|
+
| Own download route with `stream.pipe(res)` | After enough aborted downloads every S3 request hangs; health check stays green | `pipeFileToResponse(stream, res)` — it destroys the source when the response closes (README, "Delivering a file from your own route") |
|
|
242
|
+
| Own download route passing `downloadAbortSignal(res)` to `getFileStream()` without `openDownloadStream()` | Every client that leaves before S3 answers logs `ERROR [ExceptionsHandler] … AbortError` with a stack trace; a busy store answers 500 instead of 503 | Open the stream with `openDownloadStream(res, () => getFileStream(…))` and end the route with `return res` on `RESPONSE_GONE` (12.6.11+) |
|
|
243
|
+
| S3 packages in `devDependencies` | Production image cannot load S3 | Move them to `dependencies` — step 6 |
|
|
244
|
+
| A quota aggregating only `fs.files` | Reads 0 on the S3 / filesystem driver | Aggregate `fs.files`, `filesystem-files` and `s3-files` — step 6 |
|
|
@@ -509,10 +509,25 @@ check stays green. A production outage had exactly this cause. `pipeFileToRespon
|
|
|
509
509
|
client goes — on the response's `close`, the request's `close` before its end or the socket's `end`/`close`, and at once when the client
|
|
510
510
|
had already gone before the call — and answers a store error before the first byte with `404`.
|
|
511
511
|
|
|
512
|
+
**Open the stream with `openDownloadStream(res, open)` (12.6.11+)**, the function the framework's own routes use. It
|
|
513
|
+
does not ask the store when the client has already gone, destroys a stream that arrives after the client left, and
|
|
514
|
+
answers `503` with `Retry-After` when the store hands out no connection in time. It also turns a store request that
|
|
515
|
+
failed BECAUSE the client left into `RESPONSE_GONE`: an S3 request aborted through `downloadAbortSignal(res)` rejects
|
|
516
|
+
with `AbortError`, and without it every aborted download is an ERROR with a stack trace in the log and a `500` sent
|
|
517
|
+
into a closed response — under the load the `S3 socket pool exhausted:` line has to stand out in.
|
|
518
|
+
|
|
512
519
|
```typescript
|
|
513
|
-
import { downloadAbortSignal, pipeFileToResponse } from '@lenne.tech/nest-server';
|
|
520
|
+
import { downloadAbortSignal, openDownloadStream, pipeFileToResponse, RESPONSE_GONE } from '@lenne.tech/nest-server';
|
|
514
521
|
|
|
515
|
-
const stream = await
|
|
522
|
+
const stream = await openDownloadStream(res, () =>
|
|
523
|
+
this.fileService.getFileStream(id, { abortSignal: downloadAbortSignal(res), currentUser }),
|
|
524
|
+
);
|
|
525
|
+
if (stream === RESPONSE_GONE) {
|
|
526
|
+
return res; // nobody left to deliver to
|
|
527
|
+
}
|
|
528
|
+
if (!stream) {
|
|
529
|
+
throw new NotFoundException();
|
|
530
|
+
}
|
|
516
531
|
return pipeFileToResponse(stream, res);
|
|
517
532
|
```
|
|
518
533
|
|
|
@@ -310,6 +310,66 @@ export function downloadAbortSignal(res: Response): AbortSignal {
|
|
|
310
310
|
return controller.signal;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Open a download stream unless the client has already gone, and release a stream that arrives after it left — the
|
|
315
|
+
* framework's download routes use it, and so should a project's own (with {@link pipeFileToResponse} for delivery):
|
|
316
|
+
*
|
|
317
|
+
* ```typescript
|
|
318
|
+
* const stream = await openDownloadStream(res, () =>
|
|
319
|
+
* this.fileService.getFileStream(id, { abortSignal: downloadAbortSignal(res), currentUser }),
|
|
320
|
+
* );
|
|
321
|
+
* if (stream === RESPONSE_GONE) {
|
|
322
|
+
* return res;
|
|
323
|
+
* }
|
|
324
|
+
* if (!stream) {
|
|
325
|
+
* throw new NotFoundException();
|
|
326
|
+
* }
|
|
327
|
+
* return pipeFileToResponse(stream, res);
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* Answers {@link RESPONSE_GONE} when there is nobody left to deliver to — end the route with `return res` then:
|
|
331
|
+
* - the client had gone before the store was asked;
|
|
332
|
+
* - the store request failed because the client left meanwhile. An S3 request aborted through
|
|
333
|
+
* {@link downloadAbortSignal} rejects with `AbortError`; rethrown, every aborted download became an ERROR with a
|
|
334
|
+
* stack trace in the log and a 500 sent into a closed response, under exactly the load the log line
|
|
335
|
+
* `S3 socket pool exhausted:` has to stand out in;
|
|
336
|
+
* - the stream arrived after the client left — it is destroyed here, so its socket, file handle or cursor is free at
|
|
337
|
+
* once.
|
|
338
|
+
*
|
|
339
|
+
* A store that handed out no connection in time (`TimeoutError`, see `s3.connectionTimeoutMs`) answers `503` with
|
|
340
|
+
* `Retry-After: 5`. Any other error is rethrown. `null` or `undefined` (the service's rights check refused) is passed
|
|
341
|
+
* on unchanged.
|
|
342
|
+
*/
|
|
343
|
+
export async function openDownloadStream<T extends null | Readable | undefined>(
|
|
344
|
+
res: Response,
|
|
345
|
+
open: () => Promise<T>,
|
|
346
|
+
): Promise<T | typeof RESPONSE_GONE> {
|
|
347
|
+
if (isResponseGone(res)) {
|
|
348
|
+
return RESPONSE_GONE;
|
|
349
|
+
}
|
|
350
|
+
let stream: T;
|
|
351
|
+
try {
|
|
352
|
+
stream = await open();
|
|
353
|
+
} catch (error) {
|
|
354
|
+
if (isResponseGone(res)) {
|
|
355
|
+
return RESPONSE_GONE;
|
|
356
|
+
}
|
|
357
|
+
// The store did not hand out a connection in time (`s3.connectionTimeoutMs`, which includes the wait for a
|
|
358
|
+
// free socket): the store is busy, not broken, and the client may try again — 503, not 500
|
|
359
|
+
if ((error as { name?: string })?.name === 'TimeoutError') {
|
|
360
|
+
fileStreamLogger.warn(`File store busy, download answered 503: ${(error as Error).message}`);
|
|
361
|
+
res.header('Retry-After', '5');
|
|
362
|
+
throw new ServiceUnavailableException('File storage is busy, please retry');
|
|
363
|
+
}
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
if (stream && isResponseGone(res)) {
|
|
367
|
+
stream.destroy();
|
|
368
|
+
return RESPONSE_GONE;
|
|
369
|
+
}
|
|
370
|
+
return stream;
|
|
371
|
+
}
|
|
372
|
+
|
|
313
373
|
/**
|
|
314
374
|
* File controller
|
|
315
375
|
*
|
|
@@ -517,40 +577,14 @@ export abstract class CoreFileController {
|
|
|
517
577
|
}
|
|
518
578
|
|
|
519
579
|
/**
|
|
520
|
-
* Open the download stream unless the client has already gone, and release a stream that arrives after it left
|
|
521
|
-
*
|
|
522
|
-
* Answers {@link RESPONSE_GONE} when there is nobody left to deliver to: before the store is asked, when the
|
|
523
|
-
* store request was aborted because the response closed, or when the stream arrived after it closed (then the
|
|
524
|
-
* stream is destroyed here, so its socket, file handle or cursor is free at once).
|
|
580
|
+
* Open the download stream unless the client has already gone, and release a stream that arrives after it left —
|
|
581
|
+
* see the exported {@link openDownloadStream}, which a project's own download route uses the same way.
|
|
525
582
|
*/
|
|
526
583
|
protected async openDownloadStream(
|
|
527
584
|
res: Response,
|
|
528
585
|
open: () => Promise<Readable>,
|
|
529
586
|
): Promise<Readable | typeof RESPONSE_GONE> {
|
|
530
|
-
|
|
531
|
-
return RESPONSE_GONE;
|
|
532
|
-
}
|
|
533
|
-
let stream: Readable;
|
|
534
|
-
try {
|
|
535
|
-
stream = await open();
|
|
536
|
-
} catch (error) {
|
|
537
|
-
if (isResponseGone(res)) {
|
|
538
|
-
return RESPONSE_GONE;
|
|
539
|
-
}
|
|
540
|
-
// The store did not hand out a connection in time (`s3.connectionTimeoutMs`, which includes the wait for a
|
|
541
|
-
// free socket): the store is busy, not broken, and the client may try again — 503, not 500
|
|
542
|
-
if ((error as { name?: string })?.name === 'TimeoutError') {
|
|
543
|
-
fileStreamLogger.warn(`File store busy, download answered 503: ${(error as Error).message}`);
|
|
544
|
-
res.header('Retry-After', '5');
|
|
545
|
-
throw new ServiceUnavailableException('File storage is busy, please retry');
|
|
546
|
-
}
|
|
547
|
-
throw error;
|
|
548
|
-
}
|
|
549
|
-
if (stream && isResponseGone(res)) {
|
|
550
|
-
stream.destroy();
|
|
551
|
-
return RESPONSE_GONE;
|
|
552
|
-
}
|
|
553
|
-
return stream;
|
|
587
|
+
return openDownloadStream(res, open);
|
|
554
588
|
}
|
|
555
589
|
|
|
556
590
|
/**
|