@aklinker1/zeta 2.1.2 → 2.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.
Files changed (41) hide show
  1. package/dist/adapters/zod-schema-adapter.d.mts +17 -0
  2. package/dist/adapters/zod-schema-adapter.mjs +726 -0
  3. package/dist/app-Bc9Kn3KA.mjs +1225 -0
  4. package/dist/client.d.mts +71 -0
  5. package/dist/client.mjs +73 -0
  6. package/dist/index.d.mts +317 -0
  7. package/dist/index.mjs +3 -0
  8. package/dist/schema-DKqL09oQ.d.mts +168 -0
  9. package/dist/schema.d.mts +2 -0
  10. package/dist/schema.mjs +151 -0
  11. package/dist/serialization-0dai2wUm.mjs +56 -0
  12. package/dist/testing.d.mts +26 -0
  13. package/dist/testing.mjs +52 -0
  14. package/dist/transports/bun-transport.d.mts +47 -0
  15. package/dist/transports/bun-transport.mjs +58 -0
  16. package/dist/transports/deno-transport.d.mts +48 -0
  17. package/dist/transports/deno-transport.mjs +57 -0
  18. package/dist/transports/fetch-transport.d.mts +6 -0
  19. package/dist/transports/fetch-transport.mjs +25 -0
  20. package/dist/types-BvjPE9EM.d.mts +712 -0
  21. package/dist/types.d.mts +2 -0
  22. package/dist/types.mjs +1 -0
  23. package/package.json +51 -19
  24. package/src/adapters/zod-schema-adapter.ts +0 -29
  25. package/src/app.ts +0 -479
  26. package/src/client.ts +0 -184
  27. package/src/errors.ts +0 -529
  28. package/src/index.ts +0 -5
  29. package/src/internal/compile-fetch-function.ts +0 -166
  30. package/src/internal/compile-route-handler.ts +0 -194
  31. package/src/internal/context.ts +0 -65
  32. package/src/internal/serialization.ts +0 -91
  33. package/src/internal/utils.ts +0 -191
  34. package/src/meta.ts +0 -14
  35. package/src/open-api.ts +0 -273
  36. package/src/schema.ts +0 -271
  37. package/src/status.ts +0 -143
  38. package/src/testing.ts +0 -62
  39. package/src/transports/bun-transport.ts +0 -17
  40. package/src/transports/deno-transport.ts +0 -13
  41. package/src/types.ts +0 -1102
package/src/testing.ts DELETED
@@ -1,62 +0,0 @@
1
- /**
2
- * Utilities for testing your server-side application.
3
- *
4
- * You don't need to use these utils, you can call the app's `fetch` function directly.
5
- *
6
- * ```ts
7
- * const app = createApp()
8
- * .get("/example", () => "Hello, world!")
9
- * const fetch = app.build();
10
- *
11
- * const res = await fetch("http://test/example");
12
- * expect(res.status).toEqual(200);
13
- * expect(await res.text()).toEqual("Hello, world!");
14
- * ```
15
- *
16
- * If you just care about the response body or error thrown, you can use the `createTestAppClient`.
17
- *
18
- * @see {@link createTestAppClient}
19
- * @module
20
- */
21
- import {
22
- createAppClient,
23
- type AppClient,
24
- type CreateAppClientOptions,
25
- type GetClientRoutes,
26
- } from "./client";
27
- import type { App } from "./types";
28
-
29
- /**
30
- * Create a client for testing your server-side application. When `fetch` is
31
- * called, the app's `fetch` function is called instead of using the global
32
- * `fetch`.
33
- *
34
- * @example
35
- * ```ts
36
- * const app = createApp()
37
- * .get("/example", () => "Hello, world!")
38
- *
39
- * const client = createTestAppClient(app);
40
- *
41
- * expect(await client.get("/example")).toEqual("Hello, world!");
42
- * ```
43
- *
44
- * @param app
45
- * @param options
46
- * @returns An app client used to test your server-side application.
47
- */
48
- export function createTestAppClient<TApp extends App>(
49
- app: TApp,
50
- options?: Omit<CreateAppClientOptions, "fetch">,
51
- ): AppClient<GetClientRoutes<TApp>> {
52
- const { baseUrl = "http://localhost" } = options ?? {};
53
-
54
- const fetch = app.build();
55
-
56
- return createAppClient({
57
- baseUrl,
58
- ...options,
59
- // @ts-expect-error: Fetch type varies between environments
60
- fetch: (...args) => fetch(new Request(...args)),
61
- });
62
- }
@@ -1,17 +0,0 @@
1
- import type { Transport } from "../types";
2
- // @ts-ignore: Bun types may not be available
3
- import type { ServeFunctionOptions } from "@types/bun";
4
-
5
- export function createBunTransport(
6
- options: Omit<ServeFunctionOptions<any, any>, "fetch" | "port">,
7
- ): Transport {
8
- const listen: Transport["listen"] = (port, fetch, cb) => {
9
- // @ts-ignore: Bun types may not be available
10
- Bun.serve({ ...options, port, fetch });
11
- if (cb) setTimeout(cb, 0);
12
- };
13
-
14
- return {
15
- listen,
16
- };
17
- }
@@ -1,13 +0,0 @@
1
- import type { Transport } from "../types";
2
-
3
- export function createDenoTransport(): Transport {
4
- const listen: Transport["listen"] = (port, fetch, cb) => {
5
- // @ts-ignore: Deno types may not be available
6
- Deno.serve({ port, fetch });
7
- if (cb) setTimeout(cb, 0);
8
- };
9
-
10
- return {
11
- listen,
12
- };
13
- }