@hyper-fetch/elysia 10.1.0 → 10.2.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 +7 -6
- package/__bun__/edge.test.ts +3 -3
- package/__bun__/sdk.test.ts +3 -3
- package/__tests__/features/deprecated/deprecated.types.spec.ts +13 -0
- package/__tests__/features/schema/schema.edge.sdk.spec.ts +5 -5
- package/__tests__/features/schema/schema.edge.types.spec.ts +9 -9
- package/__tests__/features/schema/schema.sdk.spec.ts +3 -3
- package/__tests__/features/schema/schema.types.spec.ts +11 -11
- package/dist/elysia.types.d.ts +7 -2
- package/dist/elysia.types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/elysia.types.ts +8 -2
- package/src/index.ts +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://hyperfetch.bettertyped.com/docs/integrations/elysia/overview"><b>Quick Start</b></a> ·
|
|
7
7
|
<a href="https://hyperfetch.bettertyped.com/docs/integrations/elysia/overview">Documentation</a> ·
|
|
8
|
-
<a href="https://hyperfetch.bettertyped.com/docs/api/elysia/Types/
|
|
8
|
+
<a href="https://hyperfetch.bettertyped.com/docs/api/elysia/Types/ElysiaSchema">API Reference</a> ·
|
|
9
9
|
<a href="https://github.com/BetterTyped/hyper-fetch">GitHub</a> ·
|
|
10
10
|
<a href="https://discord.gg/7upC2kVmyM">Discord</a>
|
|
11
11
|
</p>
|
|
@@ -46,11 +46,11 @@ npm install @hyper-fetch/core @hyper-fetch/elysia
|
|
|
46
46
|
```ts
|
|
47
47
|
// backend
|
|
48
48
|
import { Elysia } from "elysia";
|
|
49
|
-
import type {
|
|
49
|
+
import type { ElysiaSchema } from "@hyper-fetch/elysia";
|
|
50
50
|
|
|
51
51
|
const app = new Elysia().get("/users/:userId", ({ params }) => ({ id: params.userId, name: "Ann" }));
|
|
52
52
|
|
|
53
|
-
export type AppSchema =
|
|
53
|
+
export type AppSchema = ElysiaSchema<typeof app>;
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
```ts
|
|
@@ -69,7 +69,7 @@ const { data } = await sdk.users.$userId.$get.setParams({ userId: "1" }).send();
|
|
|
69
69
|
- **[Elysia Integration](https://hyperfetch.bettertyped.com/docs/integrations/elysia/overview)** - Setup, schemas, errors and plugins
|
|
70
70
|
- **[SDK](https://hyperfetch.bettertyped.com/docs/core/sdk)** - How `createSdk` turns a schema into requests
|
|
71
71
|
- **[Getting Started](https://hyperfetch.bettertyped.com/docs/getting-started/quick-start)** - The core request API
|
|
72
|
-
- **[API Reference](https://hyperfetch.bettertyped.com/docs/api/elysia/Types/
|
|
72
|
+
- **[API Reference](https://hyperfetch.bettertyped.com/docs/api/elysia/Types/ElysiaSchema)** - Every exported type
|
|
73
73
|
|
|
74
74
|
## 💡 Examples
|
|
75
75
|
|
|
@@ -77,7 +77,7 @@ const { data } = await sdk.users.$userId.$get.setParams({ userId: "1" }).send();
|
|
|
77
77
|
|
|
78
78
|
```ts
|
|
79
79
|
import { Elysia, t } from "elysia";
|
|
80
|
-
import type {
|
|
80
|
+
import type { ElysiaSchema } from "@hyper-fetch/elysia";
|
|
81
81
|
|
|
82
82
|
const users = new Elysia({ prefix: "/users" })
|
|
83
83
|
.post("/", ({ body, status }) => status(201, { id: "2", name: body.name }), {
|
|
@@ -91,7 +91,7 @@ const auth = new Elysia({ prefix: "/auth" }).get("/google-login", () => ({ authU
|
|
|
91
91
|
|
|
92
92
|
const app = new Elysia().use(users).use(auth);
|
|
93
93
|
|
|
94
|
-
export type AppSchema =
|
|
94
|
+
export type AppSchema = ElysiaSchema<typeof app>;
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
```ts
|
|
@@ -132,6 +132,7 @@ One typed client for every backend. Swap the adapter and keep the same `createRe
|
|
|
132
132
|
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/core"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-hyper-fetch.svg" width="36" height="36" alt="" /><br /><sub><b>Core</b></sub></a></td>
|
|
133
133
|
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/react"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-react.svg" width="36" height="36" alt="" /><br /><sub><b>React</b></sub></a></td>
|
|
134
134
|
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/sockets"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-sockets.svg" width="36" height="36" alt="" /><br /><sub><b>Sockets</b></sub></a></td>
|
|
135
|
+
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/db"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-hyper-fetch.svg" width="36" height="36" alt="" /><br /><sub><b>DB</b></sub></a></td>
|
|
135
136
|
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/cli"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-openapi.svg" width="36" height="36" alt="" /><br /><sub><b>OpenAPI CLI</b></sub></a></td>
|
|
136
137
|
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/adapter-graphql"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-graphql.svg" width="36" height="36" alt="" /><br /><sub><b>GraphQL</b></sub></a></td>
|
|
137
138
|
<td align="center" width="110"><a href="https://github.com/BetterTyped/hyper-fetch/tree/main/packages/adapter-trpc"><img src="https://raw.githubusercontent.com/BetterTyped/hyper-fetch/main/documentation/static/img/integration-trpc.svg" width="36" height="36" alt="" /><br /><sub><b>tRPC</b></sub></a></td>
|
package/__bun__/edge.test.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { createClient, createSdk } from "@hyper-fetch/core";
|
|
|
2
2
|
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
|
|
3
3
|
|
|
4
4
|
import { edgeApp } from "../__tests__/utils/edge-app";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ElysiaSchema } from "../src";
|
|
6
6
|
|
|
7
|
-
type Schema =
|
|
7
|
+
type Schema = ElysiaSchema<typeof edgeApp>;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The cases whose wire format depends on the runtime: Bun serializes bodies, streams, redirects and
|
|
11
11
|
* multipart forms itself, so the types must match what arrives there as well as on Node.
|
|
12
12
|
*/
|
|
13
|
-
describe("
|
|
13
|
+
describe("ElysiaSchema [ Edge cases against Elysia on Bun ]", () => {
|
|
14
14
|
let url: string;
|
|
15
15
|
|
|
16
16
|
const createAppSdk = () => {
|
package/__bun__/sdk.test.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { createClient, createSdk } from "@hyper-fetch/core";
|
|
|
2
2
|
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
|
|
3
3
|
|
|
4
4
|
import { app } from "../__tests__/utils/app";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ElysiaSchema } from "../src";
|
|
6
6
|
|
|
7
|
-
type Schema =
|
|
7
|
+
type Schema = ElysiaSchema<typeof app>;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Runs with `bun test`, so Elysia serves through `Bun.serve` and Hyper Fetch sends with the fetch
|
|
11
11
|
* of Bun. The vitest specs cover the same routes on Node.
|
|
12
12
|
*/
|
|
13
|
-
describe("
|
|
13
|
+
describe("ElysiaSchema [ Requests against Elysia on Bun ]", () => {
|
|
14
14
|
let url: string;
|
|
15
15
|
|
|
16
16
|
const createAppSdk = () => {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { expectTypeOf } from "vitest";
|
|
2
|
+
|
|
3
|
+
import type { ElysiaAppToHyperFetch, ElysiaSchema } from "../../../src";
|
|
4
|
+
import type { app } from "../../utils/app";
|
|
5
|
+
|
|
6
|
+
describe("Elysia [ Deprecated names ]", () => {
|
|
7
|
+
it("should keep ElysiaAppToHyperFetch as an alias of ElysiaSchema", () => {
|
|
8
|
+
expectTypeOf<ElysiaAppToHyperFetch<typeof app>>().toEqualTypeOf<
|
|
9
|
+
ElysiaSchema<typeof app>
|
|
10
|
+
>();
|
|
11
|
+
expect(true).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -3,11 +3,11 @@ import type { ServerType } from "@hono/node-server";
|
|
|
3
3
|
import { createClient, createSdk } from "@hyper-fetch/core";
|
|
4
4
|
import type { AddressInfo } from "node:net";
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { ElysiaSchema } from "../../../src";
|
|
7
7
|
import { edgeApp, rootParamApp } from "../../utils/edge-app";
|
|
8
8
|
|
|
9
|
-
type Schema =
|
|
10
|
-
type RootSchema =
|
|
9
|
+
type Schema = ElysiaSchema<typeof edgeApp>;
|
|
10
|
+
type RootSchema = ElysiaSchema<typeof rootParamApp>;
|
|
11
11
|
|
|
12
12
|
const startServer = (fetch: (request: Request) => Response | Promise<Response>) =>
|
|
13
13
|
new Promise<ServerType>((resolve) => {
|
|
@@ -21,7 +21,7 @@ const stopServer = (server: ServerType) =>
|
|
|
21
21
|
|
|
22
22
|
const getUrl = (server: ServerType) => `http://localhost:${(server.address() as AddressInfo).port}`;
|
|
23
23
|
|
|
24
|
-
describe("
|
|
24
|
+
describe("ElysiaSchema [ Edge cases against an Elysia server ]", () => {
|
|
25
25
|
let server: ServerType;
|
|
26
26
|
let url: string;
|
|
27
27
|
|
|
@@ -337,7 +337,7 @@ describe("ElysiaAppToHyperFetch [ Edge cases against an Elysia server ]", () =>
|
|
|
337
337
|
});
|
|
338
338
|
});
|
|
339
339
|
|
|
340
|
-
describe("
|
|
340
|
+
describe("ElysiaSchema [ Root param against an Elysia server ]", () => {
|
|
341
341
|
let server: ServerType;
|
|
342
342
|
|
|
343
343
|
beforeAll(async () => {
|
|
@@ -9,14 +9,14 @@ import type {
|
|
|
9
9
|
import { Elysia } from "elysia";
|
|
10
10
|
import { expectTypeOf } from "vitest";
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type { ElysiaSchema } from "../../../src";
|
|
13
13
|
import type { edgeApp, rootParamApp } from "../../utils/edge-app";
|
|
14
14
|
|
|
15
|
-
type Schema =
|
|
15
|
+
type Schema = ElysiaSchema<typeof edgeApp>;
|
|
16
16
|
|
|
17
17
|
type ValidationError = { type: "validation" };
|
|
18
18
|
|
|
19
|
-
describe("
|
|
19
|
+
describe("ElysiaSchema [ Paths ]", () => {
|
|
20
20
|
it("should keep every HTTP route and leave out the mounted handler", () => {
|
|
21
21
|
expectTypeOf<keyof Schema>().toEqualTypeOf<
|
|
22
22
|
| "$get"
|
|
@@ -122,7 +122,7 @@ describe("ElysiaAppToHyperFetch [ Paths ]", () => {
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
it("should put a root param at the top level", () => {
|
|
125
|
-
type RootSchema =
|
|
125
|
+
type RootSchema = ElysiaSchema<typeof rootParamApp>;
|
|
126
126
|
|
|
127
127
|
expectTypeOf<keyof RootSchema>().toEqualTypeOf<"$id">();
|
|
128
128
|
expectTypeOf<ExtractEndpointType<RootSchema["$id"]["$get"]>>().toEqualTypeOf<"/:id">();
|
|
@@ -149,7 +149,7 @@ describe("ElysiaAppToHyperFetch [ Paths ]", () => {
|
|
|
149
149
|
const deep = new Elysia()
|
|
150
150
|
.get("/1/2/3/4/5/6/7/8/9", () => 9 as const)
|
|
151
151
|
.get("/a/2/3/4/5/6/7/8/9/10", () => 10 as const);
|
|
152
|
-
type DeepSchema =
|
|
152
|
+
type DeepSchema = ElysiaSchema<typeof deep>;
|
|
153
153
|
|
|
154
154
|
expectTypeOf<ExtractResponseType<DeepSchema[1][2][3][4][5][6][7][8][9]["$get"]>>().toEqualTypeOf<9>();
|
|
155
155
|
expectTypeOf<keyof DeepSchema>().toEqualTypeOf<"1">();
|
|
@@ -163,7 +163,7 @@ describe("ElysiaAppToHyperFetch [ Paths ]", () => {
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
describe("
|
|
166
|
+
describe("ElysiaSchema [ Responses ]", () => {
|
|
167
167
|
it("should keep literal and primitive responses", () => {
|
|
168
168
|
expectTypeOf<ExtractResponseType<Schema["number"]["$get"]>>().toEqualTypeOf<1>();
|
|
169
169
|
expectTypeOf<ExtractResponseType<Schema["true"]["$get"]>>().toEqualTypeOf<boolean>();
|
|
@@ -244,7 +244,7 @@ describe("ElysiaAppToHyperFetch [ Responses ]", () => {
|
|
|
244
244
|
});
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
describe("
|
|
247
|
+
describe("ElysiaSchema [ Payloads ]", () => {
|
|
248
248
|
it("should resolve a body schema referenced by its model name", () => {
|
|
249
249
|
expectTypeOf<ExtractPayloadType<Schema["deep"]["nested"]["mirror"]["$post"]>>().toEqualTypeOf<{
|
|
250
250
|
username: string;
|
|
@@ -287,7 +287,7 @@ describe("ElysiaAppToHyperFetch [ Payloads ]", () => {
|
|
|
287
287
|
});
|
|
288
288
|
});
|
|
289
289
|
|
|
290
|
-
describe("
|
|
290
|
+
describe("ElysiaSchema [ Query params ]", () => {
|
|
291
291
|
it("should type transformed, literal and array query fields", () => {
|
|
292
292
|
expectTypeOf<ExtractQueryParamsType<Schema["queryTypes"]["$get"]>>().toEqualTypeOf<{
|
|
293
293
|
day: Date;
|
|
@@ -317,7 +317,7 @@ describe("ElysiaAppToHyperFetch [ Query params ]", () => {
|
|
|
317
317
|
});
|
|
318
318
|
});
|
|
319
319
|
|
|
320
|
-
describe("
|
|
320
|
+
describe("ElysiaSchema [ createSdk inputs ]", () => {
|
|
321
321
|
const client = createClient({ url: "http://localhost" });
|
|
322
322
|
const sdk = createSdk<typeof client, Schema>(client);
|
|
323
323
|
|
|
@@ -3,10 +3,10 @@ import type { ServerType } from "@hono/node-server";
|
|
|
3
3
|
import { createClient, createSdk } from "@hyper-fetch/core";
|
|
4
4
|
import type { AddressInfo } from "node:net";
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { ElysiaSchema } from "../../../src";
|
|
7
7
|
import { app } from "../../utils/app";
|
|
8
8
|
|
|
9
|
-
type Schema =
|
|
9
|
+
type Schema = ElysiaSchema<typeof app>;
|
|
10
10
|
|
|
11
11
|
// `app.fetch` is the web standard handler Elysia runs on every runtime, served here on a free port
|
|
12
12
|
const startServer = () =>
|
|
@@ -19,7 +19,7 @@ const stopServer = (server: ServerType) =>
|
|
|
19
19
|
server.close((error) => (error ? reject(error) : resolve()));
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
describe("
|
|
22
|
+
describe("ElysiaSchema [ Requests against an Elysia server ]", () => {
|
|
23
23
|
let server: ServerType;
|
|
24
24
|
let url: string;
|
|
25
25
|
|
|
@@ -14,14 +14,14 @@ import type {
|
|
|
14
14
|
import { Elysia } from "elysia";
|
|
15
15
|
import { expectTypeOf } from "vitest";
|
|
16
16
|
|
|
17
|
-
import type {
|
|
17
|
+
import type { ElysiaSchema } from "../../../src";
|
|
18
18
|
import type { User, apiApp, app, groupApp } from "../../utils/app";
|
|
19
19
|
|
|
20
|
-
type Schema =
|
|
20
|
+
type Schema = ElysiaSchema<typeof app>;
|
|
21
21
|
|
|
22
22
|
type ValidationError = { type: "validation" };
|
|
23
23
|
|
|
24
|
-
describe("
|
|
24
|
+
describe("ElysiaSchema [ Schema shape ]", () => {
|
|
25
25
|
it("should nest plugin routes under their path segments", () => {
|
|
26
26
|
expectTypeOf<keyof Schema["users"]>().toEqualTypeOf<"$get" | "$post" | "$userId">();
|
|
27
27
|
expectTypeOf<keyof Schema["users"]["$userId"]>().toEqualTypeOf<"$get" | "posts">();
|
|
@@ -62,7 +62,7 @@ describe("ElysiaAppToHyperFetch [ Schema shape ]", () => {
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it("should prefix endpoints with the plugin prefix", () => {
|
|
65
|
-
type ApiSchema =
|
|
65
|
+
type ApiSchema = ElysiaSchema<typeof apiApp>;
|
|
66
66
|
|
|
67
67
|
expectTypeOf<keyof ApiSchema>().toEqualTypeOf<"api">();
|
|
68
68
|
expectTypeOf<ExtractEndpointType<ApiSchema["api"]["users"]["$get"]>>().toEqualTypeOf<"/api/users">();
|
|
@@ -70,7 +70,7 @@ describe("ElysiaAppToHyperFetch [ Schema shape ]", () => {
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it("should prefix endpoints with the group prefix", () => {
|
|
73
|
-
type GroupSchema =
|
|
73
|
+
type GroupSchema = ElysiaSchema<typeof groupApp>;
|
|
74
74
|
|
|
75
75
|
expectTypeOf<keyof GroupSchema>().toEqualTypeOf<"v1">();
|
|
76
76
|
expectTypeOf<
|
|
@@ -87,15 +87,15 @@ describe("ElysiaAppToHyperFetch [ Schema shape ]", () => {
|
|
|
87
87
|
|
|
88
88
|
it("should keep a path segment named like a method", () => {
|
|
89
89
|
const methodNamed = new Elysia().get("/get/delete", () => ({ nested: true as const }));
|
|
90
|
-
type MethodNamedSchema =
|
|
90
|
+
type MethodNamedSchema = ElysiaSchema<typeof methodNamed>;
|
|
91
91
|
|
|
92
92
|
expectTypeOf<ExtractEndpointType<MethodNamedSchema["get"]["delete"]["$get"]>>().toEqualTypeOf<"/get/delete">();
|
|
93
93
|
expect(true).toBe(true);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
it("should resolve to an empty schema for anything that is not an Elysia app", () => {
|
|
97
|
-
expectTypeOf<
|
|
98
|
-
expectTypeOf<
|
|
97
|
+
expectTypeOf<ElysiaSchema<{ routes: [] }>>().toEqualTypeOf<{}>();
|
|
98
|
+
expectTypeOf<ElysiaSchema<typeof Elysia>>().toEqualTypeOf<{}>();
|
|
99
99
|
expect(true).toBe(true);
|
|
100
100
|
});
|
|
101
101
|
|
|
@@ -111,7 +111,7 @@ describe("ElysiaAppToHyperFetch [ Schema shape ]", () => {
|
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
describe("
|
|
114
|
+
describe("ElysiaSchema [ Request types ]", () => {
|
|
115
115
|
it("should take the response from the 2xx statuses of the handler", () => {
|
|
116
116
|
expectTypeOf<ExtractResponseType<Schema["users"]["$get"]>>().toEqualTypeOf<User[]>();
|
|
117
117
|
expectTypeOf<ExtractResponseType<Schema["users"]["$post"]>>().toEqualTypeOf<User>();
|
|
@@ -163,7 +163,7 @@ describe("ElysiaAppToHyperFetch [ Request types ]", () => {
|
|
|
163
163
|
|
|
164
164
|
it("should default the client to ClientInstance and accept a custom one", () => {
|
|
165
165
|
type AppClient = Client<{ code: string }, HttpAdapterType>;
|
|
166
|
-
type TypedSchema =
|
|
166
|
+
type TypedSchema = ElysiaSchema<typeof app, AppClient>;
|
|
167
167
|
|
|
168
168
|
expectTypeOf<ExtractClientType<Schema["users"]["$get"]>>().toEqualTypeOf<ClientInstance>();
|
|
169
169
|
expectTypeOf<ExtractClientType<TypedSchema["users"]["$get"]>>().toEqualTypeOf<AppClient>();
|
|
@@ -171,7 +171,7 @@ describe("ElysiaAppToHyperFetch [ Request types ]", () => {
|
|
|
171
171
|
});
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
describe("
|
|
174
|
+
describe("ElysiaSchema [ createSdk ]", () => {
|
|
175
175
|
const client = createClient({ url: "http://localhost" });
|
|
176
176
|
const sdk = createSdk<typeof client, Schema>(client);
|
|
177
177
|
|
package/dist/elysia.types.d.ts
CHANGED
|
@@ -122,15 +122,20 @@ type ConvertNode<Node, Path extends string, Client extends ClientInstance, Depth
|
|
|
122
122
|
* ```ts
|
|
123
123
|
* // backend
|
|
124
124
|
* const app = new Elysia().get("/users/:userId", ({ params }) => ({ id: params.userId }));
|
|
125
|
-
* export type AppSchema =
|
|
125
|
+
* export type AppSchema = ElysiaSchema<typeof app>;
|
|
126
126
|
*
|
|
127
127
|
* // frontend
|
|
128
128
|
* const sdk = createSdk<typeof client, AppSchema>(client);
|
|
129
129
|
* const { data } = await sdk.users.$userId.$get.setParams({ userId: "1" }).send();
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
|
-
export type
|
|
132
|
+
export type ElysiaSchema<App, Client extends ClientInstance = ClientInstance> = App extends {
|
|
133
133
|
"~Routes": infer Routes;
|
|
134
134
|
} ? ConvertNode<Routes, "", Client> : {};
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated Renamed to {@link ElysiaSchema}, to match `TrpcSchema` and `OrpcSchema`. This alias will be removed in
|
|
137
|
+
* the next major version.
|
|
138
|
+
*/
|
|
139
|
+
export type ElysiaAppToHyperFetch<App, Client extends ClientInstance = ClientInstance> = ElysiaSchema<App, Client>;
|
|
135
140
|
export {};
|
|
136
141
|
//# sourceMappingURL=elysia.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elysia.types.d.ts","sourceRoot":"","sources":["../src/elysia.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjE,KAAK,QAAQ,CAAC,CAAC,IAAI;KAChB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GAAG,EAAE,CAAC;AAMP;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,KAAK,UAAU,CAAC,IAAI,IAAI;KACrB,CAAC,IAAI,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,SAAS,CAAC,GACxC,KAAK,GACL,CAAC,SAAS,WAAW,GACnB,KAAK,GACL,IAAI,CAAC,CAAC,CAAC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M,YAAY,CAAC,GAAG,EAAE,MAAM,SAAS,cAAc,GAAG,cAAc,IAAI,GAAG,SAAS;IAC1F,SAAS,EAAE,MAAM,MAAM,CAAC;CACzB,GACG,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAC/B,EAAE,CAAC;AAEP;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,GAAG,EAAE,MAAM,SAAS,cAAc,GAAG,cAAc,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { ElysiaAppToHyperFetch } from './elysia.types';
|
|
1
|
+
export type { ElysiaSchema, ElysiaAppToHyperFetch } from './elysia.types';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyper-fetch/elysia",
|
|
3
|
-
"version": "10.
|
|
4
|
-
"description": "Turn an Elysia app type into a fully typed
|
|
3
|
+
"version": "10.2.0",
|
|
4
|
+
"description": "Turn an Elysia app type into a fully typed HyperFetch SDK schema",
|
|
5
5
|
"author": "Maciej Pyrc <maciekpyrc@gmail.com>, Kacper Skawina <kacper.skawina@gmail.com>",
|
|
6
|
-
"homepage": "https://hyperfetch.bettertyped.com/",
|
|
6
|
+
"homepage": "https://hyperfetch.bettertyped.com/docs/integrations/elysia/overview/",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "dist/index.mjs",
|
|
9
9
|
"module": "dist/index.mjs",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"sdk",
|
|
59
59
|
"rpc",
|
|
60
60
|
"type-safe",
|
|
61
|
-
"
|
|
61
|
+
"typescript",
|
|
62
|
+
"hyperfetch"
|
|
62
63
|
],
|
|
63
64
|
"devDependencies": {
|
|
64
65
|
"@hono/node-server": "^2.1.9",
|
package/src/elysia.types.ts
CHANGED
|
@@ -212,15 +212,21 @@ type ConvertNode<
|
|
|
212
212
|
* ```ts
|
|
213
213
|
* // backend
|
|
214
214
|
* const app = new Elysia().get("/users/:userId", ({ params }) => ({ id: params.userId }));
|
|
215
|
-
* export type AppSchema =
|
|
215
|
+
* export type AppSchema = ElysiaSchema<typeof app>;
|
|
216
216
|
*
|
|
217
217
|
* // frontend
|
|
218
218
|
* const sdk = createSdk<typeof client, AppSchema>(client);
|
|
219
219
|
* const { data } = await sdk.users.$userId.$get.setParams({ userId: "1" }).send();
|
|
220
220
|
* ```
|
|
221
221
|
*/
|
|
222
|
-
export type
|
|
222
|
+
export type ElysiaSchema<App, Client extends ClientInstance = ClientInstance> = App extends {
|
|
223
223
|
"~Routes": infer Routes;
|
|
224
224
|
}
|
|
225
225
|
? ConvertNode<Routes, "", Client>
|
|
226
226
|
: {};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated Renamed to {@link ElysiaSchema}, to match `TrpcSchema` and `OrpcSchema`. This alias will be removed in
|
|
230
|
+
* the next major version.
|
|
231
|
+
*/
|
|
232
|
+
export type ElysiaAppToHyperFetch<App, Client extends ClientInstance = ClientInstance> = ElysiaSchema<App, Client>;
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { ElysiaAppToHyperFetch } from "./elysia.types";
|
|
1
|
+
export type { ElysiaSchema, ElysiaAppToHyperFetch } from "./elysia.types";
|