@supacloud/elysia 0.42.6 → 0.43.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/dist/bun-aot.js CHANGED
@@ -2820,6 +2820,7 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
2820
2820
  "contract",
2821
2821
  "schemaKinds",
2822
2822
  "nativeResponse",
2823
+ "inputFields",
2823
2824
  "invoker",
2824
2825
  "effectMode",
2825
2826
  "effect",
@@ -3066,7 +3067,7 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
3066
3067
  const source = controller.scope === "request" ? requestScope : services;
3067
3068
  const instance = source?.[controller.serviceKey];
3068
3069
  const normalizedCookie = ctx.cookie === undefined ? undefined : cookieValues(ctx.cookie);
3069
- const input = {
3070
+ const input = route.inputFields === undefined ? {
3070
3071
  body: ctx.body,
3071
3072
  params: ctx.params,
3072
3073
  query: ctx.query,
@@ -3076,6 +3077,13 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
3076
3077
  request: ctx.request,
3077
3078
  ...requestScope ? { scope: requestScope } : {},
3078
3079
  requestContext
3080
+ } : {
3081
+ body: ctx.body,
3082
+ params: ctx.params,
3083
+ query: ctx.query,
3084
+ ...route.inputFields.includes("headers") ? { headers: ctx.headers ?? Object.fromEntries(ctx.request.headers.entries()) } : {},
3085
+ ...route.inputFields.includes("cookie") && normalizedCookie !== undefined ? { cookie: normalizedCookie } : {},
3086
+ ...route.inputFields.includes("context") ? { context: requestContext } : {}
3079
3087
  };
3080
3088
  const handlerCall = () => {
3081
3089
  if (route.invoker)
package/dist/index.d.ts CHANGED
@@ -50,6 +50,8 @@ export interface CompiledRoute {
50
50
  query?: unknown;
51
51
  headers?: unknown;
52
52
  cookie?: unknown;
53
+ /** Compiler-selected request fields passed to positional route invokers. */
54
+ inputFields?: readonly ("body" | "params" | "query" | "headers" | "cookie" | "context")[];
53
55
  /** @deprecated Use `responses` with an explicit HTTP status map. */
54
56
  response?: unknown;
55
57
  responses?: Record<string | number, unknown>;
package/dist/index.js CHANGED
@@ -2820,6 +2820,7 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
2820
2820
  "contract",
2821
2821
  "schemaKinds",
2822
2822
  "nativeResponse",
2823
+ "inputFields",
2823
2824
  "invoker",
2824
2825
  "effectMode",
2825
2826
  "effect",
@@ -3066,7 +3067,7 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
3066
3067
  const source = controller.scope === "request" ? requestScope : services;
3067
3068
  const instance = source?.[controller.serviceKey];
3068
3069
  const normalizedCookie = ctx.cookie === undefined ? undefined : cookieValues(ctx.cookie);
3069
- const input = {
3070
+ const input = route.inputFields === undefined ? {
3070
3071
  body: ctx.body,
3071
3072
  params: ctx.params,
3072
3073
  query: ctx.query,
@@ -3076,6 +3077,13 @@ function createModulePlugin(compiled, services, ctxFactory = defaultRequestConte
3076
3077
  request: ctx.request,
3077
3078
  ...requestScope ? { scope: requestScope } : {},
3078
3079
  requestContext
3080
+ } : {
3081
+ body: ctx.body,
3082
+ params: ctx.params,
3083
+ query: ctx.query,
3084
+ ...route.inputFields.includes("headers") ? { headers: ctx.headers ?? Object.fromEntries(ctx.request.headers.entries()) } : {},
3085
+ ...route.inputFields.includes("cookie") && normalizedCookie !== undefined ? { cookie: normalizedCookie } : {},
3086
+ ...route.inputFields.includes("context") ? { context: requestContext } : {}
3079
3087
  };
3080
3088
  const handlerCall = () => {
3081
3089
  if (route.invoker)
@@ -141,7 +141,7 @@ export declare function responseStatusDeclared(responses: Readonly<Record<string
141
141
  export declare function responseStatusOf(value: unknown, configuredStatus: number | string | undefined): number;
142
142
  export declare function assertResponseStatusDeclared(responses: Readonly<Record<string | number, unknown>>, status: number): void;
143
143
  /** Convert the shared contract shape to Elysia's `response` route option. */
144
- export declare function toElysiaRouteSchema<const Schemas extends RouteContractSchemas>(contract: Schemas): InputSchema<never>;
144
+ export declare function toElysiaRouteSchema<const Schemas extends RouteContractSchemas>(contract: Schemas): InputSchema<never> & Record<string, unknown>;
145
145
  /**
146
146
  * Binds a shared contract to an Elysia-native handler. The handler callback is
147
147
  * contextually typed from the same schemas that will be registered at runtime.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/elysia",
3
- "version": "0.42.6",
3
+ "version": "0.43.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",
@@ -37,8 +37,8 @@
37
37
  "test:runtime-safety": "SUPACLOUD_REQUIRE_RUNTIME_SAFETY=1 bun test src/runtime-safety.test.ts",
38
38
  "test:contract-upgrade": "bun test src/contract-upgrade.test.ts",
39
39
  "bench:http-policy": "bun bench/http-policy.ts",
40
- "typecheck": "tsc -p tsconfig.json --noEmit",
41
- "typecheck:test": "tsc -p tsconfig.test.json --noEmit"
40
+ "typecheck": "bun check --no-script -p tsconfig.json",
41
+ "typecheck:test": "bun check --no-script -p tsconfig.test.json"
42
42
  },
43
43
  "keywords": [
44
44
  "supacloud",
@@ -54,18 +54,18 @@
54
54
  "directory": "packages/elysia"
55
55
  },
56
56
  "dependencies": {
57
- "@supacloud/app": "0.39.5",
58
- "@supacloud/commands": "0.12.1",
59
- "@supacloud/contracts": "0.16.3",
57
+ "@supacloud/app": "0.40.0",
58
+ "@supacloud/commands": "0.13.0",
59
+ "@supacloud/contracts": "0.17.0",
60
60
  "effect": "4.0.5",
61
61
  "exact-mirror": "1.2.7",
62
62
  "jose": "^6.2.13",
63
63
  "typebox": "1.4.3"
64
64
  },
65
65
  "overrides": {
66
- "@supacloud/delivery": "0.29.0",
67
- "@supacloud/contracts": "0.16.3",
68
- "@supacloud/commands": "0.12.1",
66
+ "@supacloud/delivery": "0.30.0",
67
+ "@supacloud/contracts": "0.17.0",
68
+ "@supacloud/commands": "0.13.0",
69
69
  "@graphql-tools/utils": "^12.0.4",
70
70
  "deepmerge-ts": "8.0.2",
71
71
  "prisma": "6.19.3"
@@ -74,9 +74,9 @@
74
74
  "elysia": "2.0.0-rc.4"
75
75
  },
76
76
  "devDependencies": {
77
- "@supacloud/compiler": "0.62.9",
78
- "@supacloud/delivery": "0.29.0",
79
- "@supacloud/db": "0.25.2",
77
+ "@supacloud/compiler": "0.67.0",
78
+ "@supacloud/delivery": "0.30.0",
79
+ "@supacloud/db": "0.27.0",
80
80
  "@types/bun": "^1.4.5",
81
81
  "elysia": "2.0.0-rc.4",
82
82
  "typescript": "7.1.0-beta"