@supacloud/elysia 0.23.0 → 0.23.1

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
@@ -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
 
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.23.1",
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,7 +49,7 @@
49
49
  "directory": "packages/elysia"
50
50
  },
51
51
  "dependencies": {
52
- "@supacloud/app": "0.21.0",
52
+ "@supacloud/app": "0.21.1",
53
53
  "@supacloud/contracts": "0.8.0",
54
54
  "exact-mirror": "1.2.6",
55
55
  "jose": "^6.2.11",
@@ -64,7 +64,7 @@
64
64
  "elysia": "2.0.0-beta.19"
65
65
  },
66
66
  "devDependencies": {
67
- "@supacloud/compiler": "0.30.0",
67
+ "@supacloud/compiler": "0.31.0",
68
68
  "@supacloud/delivery": "0.4.0",
69
69
  "@supacloud/commands": "0.9.0",
70
70
  "@supacloud/db": "0.11.0",