@supacloud/elysia 0.23.0 → 0.24.0

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/README.md CHANGED
@@ -8,9 +8,9 @@ is a separately authorized business command, never an assumed rollback.
8
8
 
9
9
  ## Compatibility and Acceptance Boundary
10
10
 
11
- The Elysia peer and development dependency are pinned to `2.0.0-beta.19`.
11
+ The Elysia peer and development dependency are pinned to `2.0.0-beta.21`.
12
12
  `compatibility.json` records the acceptance target: Bun 1.4.2, Elysia
13
- 2.0.0-beta.19, `typebox` 1.3.34, `exact-mirror` 1.2.6, TypeScript CLI 7.0.2
13
+ 2.0.0-beta.21, `typebox` 1.3.34, `exact-mirror` 1.2.6, TypeScript CLI 7.0.2
14
14
  and the compiler's separate TypeScript 6 semantic API 6.0.2. The matrix is a
15
15
  required target, not proof of an execution. See the dated, commit-specific
16
16
  [framework acceptance record](../../docs/framework-acceptance.md) for actual
@@ -59,6 +59,14 @@ network listener. It is included in the normal `bun test` discovery.
59
59
  cookies.
60
60
  - Errors before context resolution have no request context. Error mappers must
61
61
  not assume identity or request-scoped services are available.
62
+ - When `pendingWork.capacity` is exhausted, compiled-route admission returns
63
+ HTTP 503 with `PENDING_WORK_CAPACITY_EXCEEDED` before the adapter's
64
+ `requestContext` factory or controller runs. Existing work remains registered
65
+ and is not cancelled; requests can be admitted again after capacity is freed.
66
+ A configured `errorMapper` retains precedence. Capacity errors thrown later
67
+ by application code are not automatically treated as admission failures.
68
+ The transport-neutral registry exports `PendingWorkCapacityError` from
69
+ `@supacloud/app/runtime`; it remains a `RangeError` subclass.
62
70
 
63
71
  ### Not Yet Proven by This Suite
64
72
 
@@ -308,7 +316,7 @@ Runtime adapter that turns `@supacloud/compiler` output into a production-ready
308
316
  ## Installation
309
317
 
310
318
  ```bash
311
- bun add --exact @supacloud/elysia elysia@2.0.0-beta.19
319
+ bun add --exact @supacloud/elysia elysia@2.0.0-beta.21
312
320
  ```
313
321
 
314
322
  ## Usage
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bun": "1.4.2",
3
3
  "packages": {
4
- "elysia": "2.0.0-beta.19",
4
+ "elysia": "2.0.0-beta.21",
5
5
  "typescript": "7.0.2",
6
6
  "typebox": "1.3.34",
7
7
  "exact-mirror": "1.2.6",
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/index.ts
2
2
  import { Elysia as Elysia3, setupTypebox, Validator as Validator2 } from "elysia";
3
- import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError } from "@supacloud/app/runtime";
3
+ import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError, PendingWorkCapacityError } from "@supacloud/app/runtime";
4
4
  import { decodeCommandPreview } from "@supacloud/contracts";
5
5
 
6
6
  // src/command-errors.ts
@@ -2379,7 +2379,14 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
2379
2379
  const plugin = mountHttp(options.http, `supacloud:${compiled.name}`, options.normalize ?? true).derive(async (context) => {
2380
2380
  if (pendingWork?.closed)
2381
2381
  throw new ApplicationError("Application is stopping", { status: 503, code: "APPLICATION_STOPPING" });
2382
- const complete = pendingWork?.add({ name: "http.request", kind: "request" });
2382
+ let complete;
2383
+ try {
2384
+ complete = pendingWork?.add({ name: "http.request", kind: "request" });
2385
+ } catch (error) {
2386
+ if (!(error instanceof PendingWorkCapacityError))
2387
+ throw error;
2388
+ throw new ApplicationError("Application work capacity exceeded", { status: 503, code: error.code });
2389
+ }
2383
2390
  if (complete)
2384
2391
  requestCompletions.set(context.request, complete);
2385
2392
  const signal = pendingWork ? AbortSignal.any([context.request.signal, pendingWork.signal]) : context.request.signal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/elysia",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Elysia runtime adapter for SupaCloud compiled modules: application/request scopes, route registration and validation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,27 +49,27 @@
49
49
  "directory": "packages/elysia"
50
50
  },
51
51
  "dependencies": {
52
- "@supacloud/app": "0.21.0",
52
+ "@supacloud/app": "0.23.0",
53
53
  "@supacloud/contracts": "0.8.0",
54
54
  "exact-mirror": "1.2.6",
55
55
  "jose": "^6.2.11",
56
56
  "typebox": "1.3.34"
57
57
  },
58
58
  "overrides": {
59
- "@supacloud/delivery": "0.4.0",
59
+ "@supacloud/delivery": "0.8.0",
60
60
  "@supacloud/contracts": "0.8.0",
61
- "@supacloud/commands": "0.9.0"
61
+ "@supacloud/commands": "0.9.1"
62
62
  },
63
63
  "peerDependencies": {
64
- "elysia": "2.0.0-beta.19"
64
+ "elysia": "2.0.0-beta.21"
65
65
  },
66
66
  "devDependencies": {
67
- "@supacloud/compiler": "0.30.0",
68
- "@supacloud/delivery": "0.4.0",
69
- "@supacloud/commands": "0.9.0",
70
- "@supacloud/db": "0.11.0",
67
+ "@supacloud/compiler": "0.37.0",
68
+ "@supacloud/delivery": "0.8.0",
69
+ "@supacloud/commands": "0.9.1",
70
+ "@supacloud/db": "0.13.1",
71
71
  "@types/bun": "^1.4.2",
72
- "elysia": "2.0.0-beta.19",
72
+ "elysia": "2.0.0-beta.21",
73
73
  "typescript": "^7.0.2"
74
74
  }
75
75
  }