@rexeus/typeweaver 0.5.1 → 0.6.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 +8 -5
- package/bin/typeweaver.mjs +18 -0
- package/dist/cli-gJQliCVf.mjs +4250 -0
- package/dist/cli.cjs +4019 -14707
- package/dist/cli.d.cts +1 -2
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +4250 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/entry.mjs +30 -0
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +3 -0
- package/dist/tsx-loader-DUG5if6z.mjs +4 -0
- package/package.json +21 -21
- package/dist/chunk-AYKTAXMI.js +0 -14954
- package/dist/chunk-K3NQKI34.js +0 -8
- package/dist/cli-Q5T6SL57.js +0 -14951
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -1
- package/dist/entry.js +0 -31
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
- package/dist/tsx-loader-3QUDYASH.js +0 -2
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ Now you are ready to start building! Check out [Quickstart](#-get-started)
|
|
|
56
56
|
| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
57
57
|
| [@rexeus/typeweaver-types](https://github.com/rexeus/typeweaver/tree/main/packages/types/README.md) | Plugin for request/response types and validation - the foundation for all other plugins and always included |  |
|
|
58
58
|
| [@rexeus/typeweaver-clients](https://github.com/rexeus/typeweaver/tree/main/packages/clients/README.md) | Plugin for HTTP clients using fetch |  |
|
|
59
|
+
| [@rexeus/typeweaver-server](https://github.com/rexeus/typeweaver/tree/main/packages/server/README.md) | Plugin for a zero-dependency, Fetch API-native server with built-in routing and middleware |  |
|
|
59
60
|
| [@rexeus/typeweaver-hono](https://github.com/rexeus/typeweaver/tree/main/packages/hono/README.md) | Plugin for Hono routers |  |
|
|
60
61
|
| [@rexeus/typeweaver-aws-cdk](https://github.com/rexeus/typeweaver/tree/main/packages/aws-cdk/README.md) | Plugin for AWS CDK constructs for API Gateway V2 |  |
|
|
61
62
|
|
|
@@ -95,7 +96,7 @@ bunx typeweaver generate --input ./api/definition --output ./api/generated --plu
|
|
|
95
96
|
- `--config, -c <path>`: Configuration file path (optional)
|
|
96
97
|
- `--plugins, -p <plugins>`: Comma-separated list of plugins to use (e.g., "clients,hono" or "all"
|
|
97
98
|
for all plugins)
|
|
98
|
-
- `--
|
|
99
|
+
- `--format / --no-format`: Enable/disable code formatting with oxfmt (default: true)
|
|
99
100
|
- `--clean / --no-clean`: Enable/disable output directory cleaning (default: true)
|
|
100
101
|
|
|
101
102
|
### 📝 Configuration File
|
|
@@ -107,7 +108,7 @@ export default {
|
|
|
107
108
|
input: "./api/definition",
|
|
108
109
|
output: "./api/generated",
|
|
109
110
|
plugins: ["clients", "hono", "aws-cdk"],
|
|
110
|
-
|
|
111
|
+
format: true,
|
|
111
112
|
clean: true,
|
|
112
113
|
};
|
|
113
114
|
```
|
|
@@ -375,7 +376,7 @@ npx typeweaver generate --input ./api/definition --output ./api/generated --plug
|
|
|
375
376
|
// api/user-handlers.ts
|
|
376
377
|
import { HttpResponse, HttpStatusCode } from "@rexeus/typeweaver-core";
|
|
377
378
|
import {
|
|
378
|
-
type
|
|
379
|
+
type HonoUserApiHandler,
|
|
379
380
|
type IGetUserRequest,
|
|
380
381
|
GetUserResponse,
|
|
381
382
|
GetUserSuccessResponse,
|
|
@@ -387,7 +388,7 @@ import {
|
|
|
387
388
|
ListUserResponse,
|
|
388
389
|
} from "./generated";
|
|
389
390
|
|
|
390
|
-
export class UserHandlers implements
|
|
391
|
+
export class UserHandlers implements HonoUserApiHandler {
|
|
391
392
|
public constructor() {}
|
|
392
393
|
|
|
393
394
|
public async handleGetUserRequest(request: IGetUserRequest): Promise<GetUserResponse> {
|
|
@@ -476,7 +477,9 @@ import { UserClient, GetUserRequestCommand, UserNotFoundErrorResponse } from "./
|
|
|
476
477
|
const client = new UserClient({ baseUrl: "http://localhost:3000" });
|
|
477
478
|
|
|
478
479
|
try {
|
|
479
|
-
const getUserRequestCommand = new GetUserRequestCommand({
|
|
480
|
+
const getUserRequestCommand = new GetUserRequestCommand({
|
|
481
|
+
param: { userId: "123" },
|
|
482
|
+
});
|
|
480
483
|
const result = await client.send(getUserRequestCommand);
|
|
481
484
|
|
|
482
485
|
console.log("Successfully fetched user:", result.body);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { dirname, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const entry = resolve(__dirname, "../dist/entry.mjs");
|
|
9
|
+
|
|
10
|
+
if (!existsSync(entry)) {
|
|
11
|
+
console.error(
|
|
12
|
+
"TypeWeaver CLI has not been built yet.\n" +
|
|
13
|
+
"Run 'pnpm build' in the project root first."
|
|
14
|
+
);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
await import(entry);
|