@supacloud/elysia 0.30.0 → 0.30.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
@@ -8,11 +8,11 @@ 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.21`.
12
- The runtime adapter pins Effect `4.0.2` and consumes its `Exit`-based
11
+ The Elysia peer and development dependency are pinned to `2.0.0-beta.32`.
12
+ The runtime adapter pins Effect `4.0.5` and consumes its `Exit`-based
13
13
  execution boundary.
14
14
  `compatibility.json` records the acceptance target: Bun 1.4.3, Elysia
15
- 2.0.0-beta.21, Effect 4.0.2, `typebox` 1.3.34, `exact-mirror` 1.2.6,
15
+ 2.0.0-beta.32, Effect 4.0.5, `typebox` 1.3.37, `exact-mirror` 1.2.6,
16
16
  TypeScript CLI 7.0.2 and the compiler's separate TypeScript 6 semantic API 6.0.2.
17
17
  The matrix is a
18
18
  required target, not proof of an execution. See the dated, commit-specific
@@ -319,7 +319,7 @@ Runtime adapter that turns `@supacloud/compiler` output into a production-ready
319
319
  ## Installation
320
320
 
321
321
  ```bash
322
- bun add --exact @supacloud/elysia elysia@2.0.0-beta.21
322
+ bun add --exact @supacloud/elysia elysia@2.0.0-beta.32
323
323
  ```
324
324
 
325
325
  ## Usage
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "bun": "1.4.3",
3
3
  "packages": {
4
- "elysia": "2.0.0-beta.21",
5
- "effect": "4.0.2",
4
+ "elysia": "2.0.0-beta.32",
5
+ "effect": "4.0.5",
6
6
  "typescript": "7.0.2",
7
- "typebox": "1.3.36",
7
+ "typebox": "1.3.37",
8
8
  "exact-mirror": "1.2.6",
9
9
  "@typescript/typescript6": "6.0.2"
10
10
  }
@@ -29,8 +29,8 @@ export declare function createSupaCloudFramework<const Http extends AnyElysia =
29
29
  macro: (import("elysia").DefaultMetadata & Http["~Metadata"])["macro"];
30
30
  macroFn: (import("elysia").DefaultMetadata & Http["~Metadata"])["macroFn"];
31
31
  parser: (import("elysia").DefaultMetadata & Http["~Metadata"])["parser"];
32
- response: import("elysia/types").UnionResponseStatus<(import("elysia").DefaultMetadata & Http["~Metadata"])["response"], import("elysia/types").UnionResponseStatus<{} & Http["~Ephemeral"]["response"], {}>>;
33
- }, import("elysia/types").ResolveRouteErrors<{}, [...Http["~Definitions"]["error"], ...Http["~Ephemeral"]["error"]]> & Http["~Routes"], import("elysia").DefaultEphemeral, {
32
+ response: import("elysia/types").UnionResponseStatus<(import("elysia").DefaultMetadata & Http["~Metadata"])["response"], import("elysia/types").UnionResponseStatus<Http["~Ephemeral"]["response"], {}>>;
33
+ }, {} & Http["~Routes"], import("elysia").DefaultEphemeral, {
34
34
  derive: {};
35
35
  schema: {};
36
36
  schemas: {};
@@ -16,12 +16,18 @@ export declare function createHttpTelemetry(observe: HttpTelemetryObserver): Ely
16
16
  derive: {};
17
17
  }, {
18
18
  typebox: {};
19
- error: [];
19
+ error: [{
20
+ error: Error;
21
+ response: {};
22
+ passes: true;
23
+ '~return': undefined;
24
+ '~catchAll': true;
25
+ }];
20
26
  }, {
21
27
  schema: {};
22
28
  schemas: {};
23
29
  macro: {};
24
30
  macroFn: {};
25
31
  parser: {};
26
- response: {};
32
+ response: import("elysia/types").ExtractErrorFromHandle<undefined>;
27
33
  }, {}, import("elysia").DefaultEphemeral, import("elysia").DefaultEphemeral>;
package/dist/index.d.ts CHANGED
@@ -255,7 +255,7 @@ export interface ErrorContext {
255
255
  *
256
256
  * Declaring the runtime classes here lets Elysia's type system (and therefore
257
257
  * Eden Treaty / generated clients) know these errors are *handled*: the generic
258
- * `.error(handler)` catch-all no longer widens every route's response schema
258
+ * `.onError(handler)` catch-all no longer widens every route's response schema
259
259
  * with an untyped fallback. Each entry also documents the public `code` served
260
260
  * by {@link defaultErrorResponse} when a caller does not install an
261
261
  * `errorMapper`.
@@ -399,16 +399,13 @@ export declare function createModulePlugin<const Services extends Record<string,
399
399
  }, {
400
400
  typebox: {} & Http["~Definitions"]["typebox"];
401
401
  error: [...Http["~Definitions"]["error"]];
402
- }, import("elysia").DefaultMetadata & Http["~Metadata"], import("elysia/types").ResolveRouteErrors<{}, [...Http["~Definitions"]["error"], ...Http["~Ephemeral"]["error"]]> & Http["~Routes"], import("elysia").DefaultEphemeral, {
402
+ }, import("elysia").DefaultMetadata & Http["~Metadata"], {} & Http["~Routes"], import("elysia").DefaultEphemeral, {
403
403
  derive: {} & Http["~Ephemeral"]["derive"];
404
404
  schema: {} & import("elysia/types").MergeSchema<{} & Http["~Ephemeral"]["schema"], {}, "", false>;
405
405
  schemas: {} & Http["~Ephemeral"]["schemas"];
406
- response: {} & Http["~Ephemeral"]["response"];
406
+ response: Http["~Ephemeral"]["response"];
407
407
  error: [...Http["~Ephemeral"]["error"]];
408
- }, import("elysia/types").ExtractErrorFromHandle<{
409
- readonly services: Services;
410
- readonly requestContext: unknown;
411
- }>, {
408
+ }, {}, {
412
409
  readonly services: Services;
413
410
  readonly requestContext: unknown;
414
411
  }>;
@@ -441,8 +438,8 @@ export declare function createApplication<const Http extends AnyElysia = Elysia>
441
438
  macro: (import("elysia").DefaultMetadata & Http["~Metadata"])["macro"];
442
439
  macroFn: (import("elysia").DefaultMetadata & Http["~Metadata"])["macroFn"];
443
440
  parser: (import("elysia").DefaultMetadata & Http["~Metadata"])["parser"];
444
- response: import("elysia/types").UnionResponseStatus<(import("elysia").DefaultMetadata & Http["~Metadata"])["response"], import("elysia/types").UnionResponseStatus<{} & Http["~Ephemeral"]["response"], {}>>;
445
- }, import("elysia/types").ResolveRouteErrors<{}, [...Http["~Definitions"]["error"], ...Http["~Ephemeral"]["error"]]> & Http["~Routes"], import("elysia").DefaultEphemeral, {
441
+ response: import("elysia/types").UnionResponseStatus<(import("elysia").DefaultMetadata & Http["~Metadata"])["response"], import("elysia/types").UnionResponseStatus<Http["~Ephemeral"]["response"], {}>>;
442
+ }, {} & Http["~Routes"], import("elysia").DefaultEphemeral, {
446
443
  derive: {};
447
444
  schema: {};
448
445
  schemas: {};
@@ -463,8 +460,8 @@ export declare function createTestApp<const Http extends AnyElysia = Elysia>(opt
463
460
  macro: (import("elysia").DefaultMetadata & Http["~Metadata"])["macro"];
464
461
  macroFn: (import("elysia").DefaultMetadata & Http["~Metadata"])["macroFn"];
465
462
  parser: (import("elysia").DefaultMetadata & Http["~Metadata"])["parser"];
466
- response: import("elysia/types").UnionResponseStatus<(import("elysia").DefaultMetadata & Http["~Metadata"])["response"], import("elysia/types").UnionResponseStatus<{} & Http["~Ephemeral"]["response"], {}>>;
467
- }, import("elysia/types").ResolveRouteErrors<{}, [...Http["~Definitions"]["error"], ...Http["~Ephemeral"]["error"]]> & Http["~Routes"], import("elysia").DefaultEphemeral, {
463
+ response: import("elysia/types").UnionResponseStatus<(import("elysia").DefaultMetadata & Http["~Metadata"])["response"], import("elysia/types").UnionResponseStatus<Http["~Ephemeral"]["response"], {}>>;
464
+ }, {} & Http["~Routes"], import("elysia").DefaultEphemeral, {
468
465
  derive: {};
469
466
  schema: {};
470
467
  schemas: {};
package/dist/index.js CHANGED
@@ -84,15 +84,15 @@ function httpRequestId(request) {
84
84
  }
85
85
  function createHttpTelemetry(observe) {
86
86
  const starts = new WeakMap;
87
- return new Elysia().request(({ request, set }) => {
87
+ return new Elysia().onRequest(({ request, set }) => {
88
88
  const supplied = request.headers.get("x-request-id");
89
89
  const requestId = supplied && /^[A-Za-z0-9._:-]{1,128}$/.test(supplied) ? supplied : crypto.randomUUID();
90
90
  starts.set(request, { time: performance.now(), requestId });
91
91
  requestIds.set(request, requestId);
92
92
  set.headers["x-request-id"] = requestId;
93
- }).error(() => {
93
+ }).onError(() => {
94
94
  return;
95
- }).afterResponse(async ({ request, responseValue: response, set, route }) => {
95
+ }).onAfterResponse(async ({ request, responseValue: response, set, route }) => {
96
96
  const start = starts.get(request);
97
97
  if (!start)
98
98
  return;
@@ -861,7 +861,7 @@ function registerElysiaRoute(app, route) {
861
861
  }
862
862
  return value;
863
863
  };
864
- app.method(route.method, route.path, toElysiaRouteSchema(route.contract), handler);
864
+ app.method(route.method, route.path, { ...toElysiaRouteSchema(route.contract) }, handler);
865
865
  return app;
866
866
  }
867
867
 
@@ -2492,7 +2492,7 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
2492
2492
  });
2493
2493
  const createRequestScope = compiled.createRequestScope;
2494
2494
  const requestScopes = new WeakMap;
2495
- plugin.afterResponse(async ({ request }) => {
2495
+ plugin.onAfterResponse(async ({ request }) => {
2496
2496
  const scope = requestScopes.get(request);
2497
2497
  requestScopes.delete(request);
2498
2498
  try {
@@ -2514,9 +2514,9 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
2514
2514
  const mapped = await options.errorMapper?.(error, context);
2515
2515
  return mapped ?? defaultErrorResponse(error, frameworkCode);
2516
2516
  };
2517
- plugin.error(ApplicationError, ({ error, request }) => mapError(error, frameworkErrorCode(error), request));
2518
- plugin.error(SchemaContractError, ({ error, request }) => mapError(error, frameworkErrorCode(error), request));
2519
- plugin.error(({ error, request }) => mapError(error, frameworkErrorCode(error), request));
2517
+ plugin.onError(ApplicationError, ({ error, request }) => mapError(error, frameworkErrorCode(error), request));
2518
+ plugin.onError(SchemaContractError, ({ error, request }) => mapError(error, frameworkErrorCode(error), request));
2519
+ plugin.onError(({ error, request }) => mapError(error, frameworkErrorCode(error), request));
2520
2520
  const routeRegistrar = plugin;
2521
2521
  for (const controller of compiled.controllers) {
2522
2522
  for (const route of controller.routes) {
@@ -2565,7 +2565,7 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
2565
2565
  requestContext: requestContexts.get(context.request),
2566
2566
  response,
2567
2567
  encodeResponse: async (value) => {
2568
- const validator = responseValidators?.[responseStatusOf(value, context.set.status)];
2568
+ const validator = responseValidators?.get(responseStatusOf(value, context.set.status));
2569
2569
  if (!validator)
2570
2570
  return value;
2571
2571
  if (!("EncodeFrom" in validator) || typeof validator.EncodeFrom !== "function") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/elysia",
3
- "version": "0.30.0",
3
+ "version": "0.30.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,29 +49,29 @@
49
49
  "directory": "packages/elysia"
50
50
  },
51
51
  "dependencies": {
52
- "@supacloud/app": "0.27.0",
52
+ "@supacloud/app": "0.27.1",
53
53
  "@supacloud/contracts": "0.9.0",
54
- "effect": "4.0.2",
54
+ "effect": "4.0.5",
55
55
  "exact-mirror": "1.2.6",
56
56
  "jose": "^6.2.12",
57
- "typebox": "1.3.36"
57
+ "typebox": "1.3.37"
58
58
  },
59
59
  "overrides": {
60
- "@supacloud/delivery": "0.18.0",
60
+ "@supacloud/delivery": "0.18.1",
61
61
  "@supacloud/contracts": "0.9.0",
62
- "@supacloud/commands": "0.9.2",
63
- "@graphql-tools/utils": "^12.0.3"
62
+ "@supacloud/commands": "0.9.3",
63
+ "@graphql-tools/utils": "^12.0.4"
64
64
  },
65
65
  "peerDependencies": {
66
- "elysia": "2.0.0-beta.21"
66
+ "elysia": "2.0.0-beta.32"
67
67
  },
68
68
  "devDependencies": {
69
- "@supacloud/compiler": "0.46.0",
70
- "@supacloud/delivery": "0.18.0",
71
- "@supacloud/commands": "0.9.2",
72
- "@supacloud/db": "0.17.0",
69
+ "@supacloud/compiler": "0.46.2",
70
+ "@supacloud/delivery": "0.18.1",
71
+ "@supacloud/commands": "0.9.3",
72
+ "@supacloud/db": "0.17.1",
73
73
  "@types/bun": "^1.4.3",
74
- "elysia": "2.0.0-beta.21",
74
+ "elysia": "2.0.0-beta.32",
75
75
  "typescript": "^7.0.2"
76
76
  }
77
77
  }