@silkweave/fastify 1.3.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/.turbo/turbo-build.log +18 -0
- package/.turbo/turbo-check.log +13 -0
- package/.turbo/turbo-lint.log +6 -0
- package/.turbo/turbo-prepack.log +26 -0
- package/README.md +60 -0
- package/build/index.d.ts +13 -0
- package/build/index.js +130 -0
- package/build/index.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @silkweave/fastify@1.3.0 build /Users/atomic/projects/ai/silkweave/packages/fastify
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/atomic/projects/ai/silkweave/packages/fastify/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: es2022
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mbuild/index.js [22m[32m4.95 KB[39m
|
|
14
|
+
[32mESM[39m [1mbuild/index.js.map [22m[32m8.98 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 9ms
|
|
16
|
+
DTS Build start
|
|
17
|
+
DTS ⚡️ Build success in 975ms
|
|
18
|
+
DTS build/index.d.ts 455.00 B
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @silkweave/fastify@1.3.0 check /Users/atomic/projects/ai/silkweave/packages/fastify
|
|
4
|
+
> pnpm lint && pnpm typecheck
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
> @silkweave/fastify@1.3.0 lint /Users/atomic/projects/ai/silkweave/packages/fastify
|
|
8
|
+
> eslint
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
> @silkweave/fastify@1.3.0 typecheck /Users/atomic/projects/ai/silkweave/packages/fastify
|
|
12
|
+
> tsc --noEmit
|
|
13
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @silkweave/fastify@1.3.0 prepack /Users/atomic/projects/ai/mcphero/packages/fastify
|
|
4
|
+
> pnpm clean && pnpm build
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
> @silkweave/fastify@1.3.0 clean /Users/atomic/projects/ai/mcphero/packages/fastify
|
|
8
|
+
> rimraf build
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
> @silkweave/fastify@1.3.0 build /Users/atomic/projects/ai/mcphero/packages/fastify
|
|
12
|
+
> tsup
|
|
13
|
+
|
|
14
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
15
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
16
|
+
[34mCLI[39m tsup v8.5.1
|
|
17
|
+
[34mCLI[39m Using tsup config: /Users/atomic/projects/ai/mcphero/packages/fastify/tsup.config.ts
|
|
18
|
+
[34mCLI[39m Target: es2022
|
|
19
|
+
[34mCLI[39m Cleaning output folder
|
|
20
|
+
[34mESM[39m Build start
|
|
21
|
+
[32mESM[39m [1mbuild/index.js [22m[32m4.95 KB[39m
|
|
22
|
+
[32mESM[39m [1mbuild/index.js.map [22m[32m8.98 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 6ms
|
|
24
|
+
DTS Build start
|
|
25
|
+
DTS ⚡️ Build success in 782ms
|
|
26
|
+
DTS build/index.d.ts 455.00 B
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @silkweave/fastify
|
|
2
|
+
|
|
3
|
+
Fastify REST adapter for [Silkweave](https://github.com/atomicbi/silkweave) — expose your actions as a REST API with auto-generated OpenAPI/Swagger documentation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @silkweave/core @silkweave/fastify
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { silkweave } from '@silkweave/core'
|
|
15
|
+
import { fastify } from '@silkweave/fastify'
|
|
16
|
+
import { SearchAction } from './actions/search.js'
|
|
17
|
+
|
|
18
|
+
await silkweave({ name: 'my-api', description: 'My REST API', version: '1.0.0' })
|
|
19
|
+
.adapter(fastify({ host: 'localhost', port: 8080, logger: true }))
|
|
20
|
+
.action(SearchAction)
|
|
21
|
+
.start()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Visit `http://localhost:8080/` for the interactive Scalar API reference.
|
|
25
|
+
|
|
26
|
+
## Route Mapping
|
|
27
|
+
|
|
28
|
+
Each action becomes a `POST /{action.name}` route. Zod schemas are converted to JSON Schema for request body validation and OpenAPI documentation.
|
|
29
|
+
|
|
30
|
+
| Action | Route | Body |
|
|
31
|
+
|--------|-------|------|
|
|
32
|
+
| `name: 'search'` | `POST /search` | `{ "query": "...", "limit": 10 }` |
|
|
33
|
+
| `name: 'greet'` | `POST /greet` | `{ "name": "World" }` |
|
|
34
|
+
|
|
35
|
+
## Options
|
|
36
|
+
|
|
37
|
+
`FastifyAdapterOptions` extends Fastify's native `FastifyHttpOptions`, so any Fastify config is supported:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
fastify({
|
|
41
|
+
host: 'localhost',
|
|
42
|
+
port: 8080,
|
|
43
|
+
logger: {
|
|
44
|
+
level: 'debug',
|
|
45
|
+
transport: { target: 'pino-pretty' }
|
|
46
|
+
},
|
|
47
|
+
connectionTimeout: 30000
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Option | Type | Default | Description |
|
|
52
|
+
|--------|------|---------|-------------|
|
|
53
|
+
| `host` | `string` | `undefined` | Bind address |
|
|
54
|
+
| `port` | `number` | `undefined` | Listen port |
|
|
55
|
+
| *...* | | | Any `FastifyHttpOptions` |
|
|
56
|
+
|
|
57
|
+
## See Also
|
|
58
|
+
|
|
59
|
+
- [Silkweave README](https://github.com/atomicbi/silkweave) — Full documentation
|
|
60
|
+
- [`@silkweave/core`](https://www.npmjs.com/package/@silkweave/core) — Core library
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthConfig } from '@silkweave/auth';
|
|
2
|
+
import { AdapterFactory } from '@silkweave/core';
|
|
3
|
+
import { FastifyHttpOptions, FastifyBaseLogger } from 'fastify';
|
|
4
|
+
import { Server } from 'http';
|
|
5
|
+
|
|
6
|
+
interface FastifyAdapterOptions extends FastifyHttpOptions<Server, FastifyBaseLogger> {
|
|
7
|
+
host?: string;
|
|
8
|
+
port?: number;
|
|
9
|
+
auth?: AuthConfig;
|
|
10
|
+
}
|
|
11
|
+
declare const fastify: AdapterFactory<FastifyAdapterOptions>;
|
|
12
|
+
|
|
13
|
+
export { type FastifyAdapterOptions, fastify };
|
package/build/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// src/adapter/fastify.ts
|
|
2
|
+
import { generateProtectedResourceMetadata, validateToken } from "@silkweave/auth";
|
|
3
|
+
import { buildLogLevels } from "@silkweave/logger";
|
|
4
|
+
import { fastify as fastifyInstance } from "fastify";
|
|
5
|
+
var PINO_LEVEL_MAP = {
|
|
6
|
+
emergency: "fatal",
|
|
7
|
+
alert: "fatal",
|
|
8
|
+
critical: "fatal",
|
|
9
|
+
error: "error",
|
|
10
|
+
warning: "warn",
|
|
11
|
+
notice: "debug",
|
|
12
|
+
info: "info",
|
|
13
|
+
debug: "debug"
|
|
14
|
+
};
|
|
15
|
+
var fastify = ({ host, port, auth, ...fastifyOptions }) => {
|
|
16
|
+
const instance = fastifyInstance(fastifyOptions);
|
|
17
|
+
return (options, baseContext) => {
|
|
18
|
+
const context = baseContext.fork({ adapter: "fastify" });
|
|
19
|
+
return {
|
|
20
|
+
context,
|
|
21
|
+
start: async (actions) => {
|
|
22
|
+
await instance.register(import("@fastify/swagger"), {
|
|
23
|
+
openapi: {
|
|
24
|
+
info: {
|
|
25
|
+
title: options.name,
|
|
26
|
+
description: options.description,
|
|
27
|
+
version: options.version
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
await instance.register(import("@scalar/fastify-api-reference"), { routePrefix: "/" });
|
|
32
|
+
if (auth?.authorizationServers?.length && auth.resourceUrl) {
|
|
33
|
+
instance.get("/.well-known/oauth-protected-resource", () => {
|
|
34
|
+
return generateProtectedResourceMetadata(auth.resourceUrl, auth.authorizationServers);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const oauthPaths = /* @__PURE__ */ new Set();
|
|
38
|
+
if (auth?.provider) {
|
|
39
|
+
const provider = auth.provider;
|
|
40
|
+
const toOAuthReq = (request) => ({
|
|
41
|
+
method: request.method,
|
|
42
|
+
url: new URL(request.url, `http://${request.hostname}`),
|
|
43
|
+
headers: Object.fromEntries(Object.entries(request.headers).map(([k, v]) => [k, Array.isArray(v) ? v[0] : v])),
|
|
44
|
+
body: request.body
|
|
45
|
+
});
|
|
46
|
+
const sendOAuth = (reply, oauthRes) => {
|
|
47
|
+
for (const [key, value] of Object.entries(oauthRes.headers)) {
|
|
48
|
+
reply.header(key, value);
|
|
49
|
+
}
|
|
50
|
+
return reply.status(oauthRes.status).send(oauthRes.body);
|
|
51
|
+
};
|
|
52
|
+
oauthPaths.add("/.well-known/oauth-authorization-server");
|
|
53
|
+
oauthPaths.add("/authorize");
|
|
54
|
+
oauthPaths.add("/auth/callback");
|
|
55
|
+
oauthPaths.add("/token");
|
|
56
|
+
oauthPaths.add("/register");
|
|
57
|
+
instance.get("/.well-known/oauth-authorization-server", async (_req, reply) => {
|
|
58
|
+
return sendOAuth(reply, provider.metadata());
|
|
59
|
+
});
|
|
60
|
+
instance.get("/authorize", async (req, reply) => {
|
|
61
|
+
return sendOAuth(reply, await provider.authorize(toOAuthReq(req)));
|
|
62
|
+
});
|
|
63
|
+
instance.get("/auth/callback", async (req, reply) => {
|
|
64
|
+
return sendOAuth(reply, await provider.callback(toOAuthReq(req)));
|
|
65
|
+
});
|
|
66
|
+
instance.post("/token", async (req, reply) => {
|
|
67
|
+
return sendOAuth(reply, await provider.token(toOAuthReq(req)));
|
|
68
|
+
});
|
|
69
|
+
instance.post("/register", async (req, reply) => {
|
|
70
|
+
return sendOAuth(reply, await provider.register(toOAuthReq(req)));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (auth) {
|
|
74
|
+
instance.decorateRequest("__silkweave_auth", void 0);
|
|
75
|
+
instance.addHook("onRequest", async (request, reply) => {
|
|
76
|
+
if (request.url.startsWith("/.well-known/") || oauthPaths.has(request.url.split("?")[0])) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const result = await validateToken(request.headers.authorization, auth);
|
|
80
|
+
if (result.error) {
|
|
81
|
+
for (const [key, value] of Object.entries(result.error.headers)) {
|
|
82
|
+
reply.header(key, value);
|
|
83
|
+
}
|
|
84
|
+
return reply.status(result.error.statusCode).send(result.error.body);
|
|
85
|
+
}
|
|
86
|
+
if (result.auth) {
|
|
87
|
+
request.__silkweave_auth = result.auth;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
for (const action of actions) {
|
|
92
|
+
const schema = action.input.toJSONSchema();
|
|
93
|
+
instance.post(`/${action.name}`, {
|
|
94
|
+
schema: {
|
|
95
|
+
description: action.description,
|
|
96
|
+
body: {
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: schema.properties,
|
|
99
|
+
required: schema.required
|
|
100
|
+
},
|
|
101
|
+
response: {
|
|
102
|
+
200: { description: "Successful response" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, (request) => {
|
|
106
|
+
const logger = {
|
|
107
|
+
...buildLogLevels((level, data) => {
|
|
108
|
+
const pinoLevel = PINO_LEVEL_MAP[level] ?? "info";
|
|
109
|
+
instance.log[pinoLevel](data);
|
|
110
|
+
}),
|
|
111
|
+
progress: ({ progress, total, message }) => {
|
|
112
|
+
instance.log.trace({ progress, total }, message);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const authInfo = auth ? request.__silkweave_auth : void 0;
|
|
116
|
+
return action.run(request.body, context.fork({ logger, request, ...authInfo ? { auth: authInfo } : {} }));
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
await instance.listen({ host, port });
|
|
120
|
+
},
|
|
121
|
+
stop: async () => {
|
|
122
|
+
await instance.close();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
fastify
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapter/fastify.ts"],"sourcesContent":["import { AuthConfig, AuthInfo, generateProtectedResourceMetadata, OAuthRequest, OAuthResponse, validateToken } from '@silkweave/auth'\nimport { AdapterFactory } from '@silkweave/core'\nimport { buildLogLevels, Logger, LogLevel } from '@silkweave/logger'\nimport { FastifyBaseLogger, FastifyHttpOptions, fastify as fastifyInstance, FastifyReply, FastifyRequest } from 'fastify'\nimport { Server } from 'http'\n\ntype FastifyLogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace'\n\nconst PINO_LEVEL_MAP: Record<LogLevel, FastifyLogLevel> = {\n emergency: 'fatal',\n alert: 'fatal',\n critical: 'fatal',\n error: 'error',\n warning: 'warn',\n notice: 'debug',\n info: 'info',\n debug: 'debug'\n}\n\nexport interface FastifyAdapterOptions extends FastifyHttpOptions<Server, FastifyBaseLogger> {\n host?: string\n port?: number\n auth?: AuthConfig\n}\n\nexport const fastify: AdapterFactory<FastifyAdapterOptions> = ({ host, port, auth, ...fastifyOptions }) => {\n const instance = fastifyInstance(fastifyOptions)\n return (options, baseContext) => {\n const context = baseContext.fork({ adapter: 'fastify' })\n return {\n context,\n start: async (actions) => {\n await instance.register(import('@fastify/swagger'), {\n openapi: {\n info: {\n title: options.name,\n description: options.description,\n version: options.version\n }\n }\n })\n await instance.register(import('@scalar/fastify-api-reference'), { routePrefix: '/' as `/${string}` })\n\n if (auth?.authorizationServers?.length && auth.resourceUrl) {\n instance.get('/.well-known/oauth-protected-resource', () => {\n return generateProtectedResourceMetadata(auth.resourceUrl!, auth.authorizationServers!)\n })\n }\n\n const oauthPaths = new Set<string>()\n if (auth?.provider) {\n const provider = auth.provider\n const toOAuthReq = (request: FastifyRequest): OAuthRequest => ({\n method: request.method,\n url: new URL(request.url, `http://${request.hostname}`),\n headers: Object.fromEntries(Object.entries(request.headers).map(([k, v]) => [k, Array.isArray(v) ? v[0] : v])),\n body: request.body as Record<string, string> | undefined\n })\n const sendOAuth = (reply: FastifyReply, oauthRes: OAuthResponse) => {\n for (const [key, value] of Object.entries(oauthRes.headers)) { reply.header(key, value) }\n return reply.status(oauthRes.status).send(oauthRes.body)\n }\n\n oauthPaths.add('/.well-known/oauth-authorization-server')\n oauthPaths.add('/authorize')\n oauthPaths.add('/auth/callback')\n oauthPaths.add('/token')\n oauthPaths.add('/register')\n\n instance.get('/.well-known/oauth-authorization-server', async (_req, reply) => {\n return sendOAuth(reply, provider.metadata())\n })\n instance.get('/authorize', async (req, reply) => {\n return sendOAuth(reply, await provider.authorize(toOAuthReq(req)))\n })\n instance.get('/auth/callback', async (req, reply) => {\n return sendOAuth(reply, await provider.callback(toOAuthReq(req)))\n })\n instance.post('/token', async (req, reply) => {\n return sendOAuth(reply, await provider.token(toOAuthReq(req)))\n })\n instance.post('/register', async (req, reply) => {\n return sendOAuth(reply, await provider.register(toOAuthReq(req)))\n })\n }\n\n if (auth) {\n instance.decorateRequest('__silkweave_auth', undefined)\n instance.addHook('onRequest', async (request: FastifyRequest, reply: FastifyReply) => {\n if (request.url.startsWith('/.well-known/') || oauthPaths.has(request.url.split('?')[0])) { return }\n const result = await validateToken(request.headers.authorization, auth)\n if (result.error) {\n for (const [key, value] of Object.entries(result.error.headers)) {\n reply.header(key, value)\n }\n return reply.status(result.error.statusCode).send(result.error.body)\n }\n if (result.auth) {\n (request as FastifyRequest & { __silkweave_auth?: AuthInfo }).__silkweave_auth = result.auth\n }\n })\n }\n\n for (const action of actions) {\n const schema = action.input.toJSONSchema()\n instance.post(`/${action.name}`, {\n schema: {\n description: action.description,\n body: {\n type: 'object',\n properties: schema.properties,\n required: schema.required\n },\n response: {\n 200: { description: 'Successful response' }\n }\n }\n }, (request) => {\n const logger: Logger = {\n ...buildLogLevels((level, data) => {\n const pinoLevel = PINO_LEVEL_MAP[level] ?? 'info'\n instance.log[pinoLevel](data)\n }),\n progress: ({ progress, total, message }) => { instance.log.trace({ progress, total }, message) }\n }\n const authInfo = auth ? (request as FastifyRequest & { __silkweave_auth?: AuthInfo }).__silkweave_auth : undefined\n return action.run(request.body, context.fork({ logger, request, ...(authInfo ? { auth: authInfo } : {}) }))\n })\n }\n await instance.listen({ host, port })\n },\n stop: async () => { await instance.close() }\n }\n }\n}\n"],"mappings":";AAAA,SAA+B,mCAAgE,qBAAqB;AAEpH,SAAS,sBAAwC;AACjD,SAAgD,WAAW,uBAAqD;AAKhH,IAAM,iBAAoD;AAAA,EACxD,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AACT;AAQO,IAAM,UAAiD,CAAC,EAAE,MAAM,MAAM,MAAM,GAAG,eAAe,MAAM;AACzG,QAAM,WAAW,gBAAgB,cAAc;AAC/C,SAAO,CAAC,SAAS,gBAAgB;AAC/B,UAAM,UAAU,YAAY,KAAK,EAAE,SAAS,UAAU,CAAC;AACvD,WAAO;AAAA,MACL;AAAA,MACA,OAAO,OAAO,YAAY;AACxB,cAAM,SAAS,SAAS,OAAO,kBAAkB,GAAG;AAAA,UAClD,SAAS;AAAA,YACP,MAAM;A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I,IAAI;AAAA,YAC/B,QAAQ;AAAA,cACN,aAAa,OAAO;AAAA,cACpB,MAAM;AAAA,gBACJ,MAAM;AAAA,gBACN,YAAY,OAAO;AAAA,gBACnB,UAAU,OAAO;AAAA,cACnB;AAAA,cACA,UAAU;AAAA,gBACR,KAAK,EAAE,aAAa,sBAAsB;AAAA,cAC5C;AAAA,YACF;AAAA,UACF,GAAG,CAAC,YAAY;AACd,kBAAM,SAAiB;AAAA,cACrB,GAAG,eAAe,CAAC,OAAO,SAAS;AACjC,sBAAM,YAAY,eAAe,KAAK,KAAK;AAC3C,yBAAS,IAAI,SAAS,EAAE,IAAI;AAAA,cAC9B,CAAC;AAAA,cACD,UAAU,CAAC,EAAE,UAAU,OAAO,QAAQ,MAAM;AAAE,yBAAS,IAAI,MAAM,EAAE,UAAU,MAAM,GAAG,OAAO;AAAA,cAAE;AAAA,YACjG;AACA,kBAAM,WAAW,OAAQ,QAA6D,mBAAmB;AACzG,mBAAO,OAAO,IAAI,QAAQ,MAAM,QAAQ,KAAK,EAAE,QAAQ,SAAS,GAAI,WAAW,EAAE,MAAM,SAAS,IAAI,CAAC,EAAG,CAAC,CAAC;AAAA,UAC5G,CAAC;AAAA,QACH;AACA,cAAM,SAAS,OAAO,EAAE,MAAM,KAAK,CAAC;AAAA,MACtC;AAAA,MACA,MAAM,YAAY;AAAE,cAAM,SAAS,MAAM;AAAA,MAAE;AAAA,IAC7C;AAAA,EACF;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@silkweave/fastify",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Silkweave Fastify REST Adapter",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+ssh://git@github.com/atomicbi/silkweave.git",
|
|
8
|
+
"directory": "packages/fastify"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "build/index.js",
|
|
12
|
+
"types": "build/index.d.ts",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@fastify/swagger": "^9.7.0",
|
|
15
|
+
"@scalar/fastify-api-reference": "^1.49.0",
|
|
16
|
+
"fastify": "^5.8.2",
|
|
17
|
+
"zod": "^4.3.6",
|
|
18
|
+
"@silkweave/core": "1.3.0",
|
|
19
|
+
"@silkweave/auth": "1.3.0",
|
|
20
|
+
"@silkweave/logger": "1.3.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@eslint/js": "^10.0.1",
|
|
24
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
25
|
+
"@types/node": "^22.0.0",
|
|
26
|
+
"rimraf": "^6.1.3",
|
|
27
|
+
"tsup": "^8.5.1",
|
|
28
|
+
"tsx": "^4.21.0",
|
|
29
|
+
"typescript": "^5.9.3",
|
|
30
|
+
"typescript-eslint": "^8.56.1"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "rimraf build",
|
|
34
|
+
"build": "tsup",
|
|
35
|
+
"watch": "tsup --watch",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"lint": "eslint",
|
|
38
|
+
"check": "pnpm lint && pnpm typecheck"
|
|
39
|
+
}
|
|
40
|
+
}
|