silgi 0.51.4 → 0.51.6
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/LICENSE +21 -0
- package/README.md +1 -83
- package/package.json +20 -26
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present productdevbook
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,88 +8,7 @@
|
|
|
8
8
|
<a href="https://github.com/productdevbook/silgi/blob/main/LICENSE"><img src="https://img.shields.io/github/license/productdevbook/silgi?style=flat&colorA=0a0908&colorB=edc462" alt="license"></a>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install silgi
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { silgi } from 'silgi'
|
|
19
|
-
import { z } from 'zod'
|
|
20
|
-
|
|
21
|
-
const s = silgi({ context: (req) => ({ db: getDB() }) })
|
|
22
|
-
|
|
23
|
-
const appRouter = s.router({
|
|
24
|
-
users: {
|
|
25
|
-
list: k
|
|
26
|
-
.$input(z.object({ limit: z.number().optional() }))
|
|
27
|
-
.$resolve(({ input, ctx }) => ctx.db.users.find({ take: input.limit })),
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
s.serve(appRouter, { port: 3000, scalar: true })
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Features
|
|
35
|
-
|
|
36
|
-
- **Single package** — server, client, 15 plugins, 14 adapters. One install.
|
|
37
|
-
- **Compiled pipeline** — guards unrolled, handlers pre-linked at startup.
|
|
38
|
-
- **Guard / Wrap** — guards enrich context (flat, sync fast-path). Wraps run before + after (onion).
|
|
39
|
-
- **Content negotiation** — JSON, MessagePack, devalue. Automatic from `Accept` header.
|
|
40
|
-
- **Contract-first** — define API shape, share types, implement separately.
|
|
41
|
-
- **Standard Schema** — Zod, Valibot, ArkType.
|
|
42
|
-
|
|
43
|
-
## Adapters
|
|
44
|
-
|
|
45
|
-
| | Import |
|
|
46
|
-
|---|---|
|
|
47
|
-
| Standalone | `s.serve()` / `s.handler()` |
|
|
48
|
-
| Nitro v3 | `serverEntry` + `s.handler()` |
|
|
49
|
-
| Express | `silgi/express` |
|
|
50
|
-
| Fastify | `silgi/fastify` |
|
|
51
|
-
| Elysia | `silgi/elysia` |
|
|
52
|
-
| Next.js | `silgi/nextjs` |
|
|
53
|
-
| Nuxt | via Nitro `serverEntry` |
|
|
54
|
-
| SvelteKit | `silgi/sveltekit` |
|
|
55
|
-
| Remix | `silgi/remix` |
|
|
56
|
-
| Astro | `silgi/astro` |
|
|
57
|
-
| SolidStart | `silgi/solidstart` |
|
|
58
|
-
| NestJS | `silgi/nestjs` |
|
|
59
|
-
| AWS Lambda | `silgi/aws-lambda` |
|
|
60
|
-
| MessagePort | `silgi/message-port` |
|
|
61
|
-
|
|
62
|
-
## Ecosystem
|
|
63
|
-
|
|
64
|
-
Built-in re-exports — no extra dependencies needed:
|
|
65
|
-
|
|
66
|
-
| Import | Package | Use case |
|
|
67
|
-
|---|---|---|
|
|
68
|
-
| `silgi/unstorage` | unstorage | Key-value storage (Redis, KV, S3) |
|
|
69
|
-
| `silgi/ocache` | ocache | Cached functions with TTL + SWR |
|
|
70
|
-
| `silgi/ofetch` | ofetch | Universal fetch with auto-retry |
|
|
71
|
-
| `silgi/srvx` | srvx | Universal server (Node, Deno, Bun) |
|
|
72
|
-
|
|
73
|
-
## Integrations
|
|
74
|
-
|
|
75
|
-
- **TanStack Query** — `queryOptions`, `mutationOptions`, `infiniteOptions`, `skipToken`
|
|
76
|
-
- **React Server Actions** — `createAction`, `useServerAction`, `useOptimisticServerAction`
|
|
77
|
-
- **AI SDK** — `routerToTools()` turns procedures into LLM tools
|
|
78
|
-
- **tRPC Interop** — `fromTRPC()` for incremental migration
|
|
79
|
-
|
|
80
|
-
## Examples
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
npx giget@latest gh:productdevbook/silgi/examples/standalone my-app
|
|
84
|
-
npx giget@latest gh:productdevbook/silgi/examples/nextjs my-nextjs-app
|
|
85
|
-
npx giget@latest gh:productdevbook/silgi/examples/nuxt my-nuxt-app
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
10 examples: standalone, bun, express, elysia, nitro, nitro-h3, nextjs, nuxt, sveltekit, client-react.
|
|
89
|
-
|
|
90
|
-
## Documentation
|
|
91
|
-
|
|
92
|
-
[silgi.dev](https://silgi.dev)
|
|
11
|
+
End-to-end type-safe RPC framework for TypeScript. Single package — server, client, 15 plugins, 14 adapters. Full docs at [silgi.dev](https://silgi.dev).
|
|
93
12
|
|
|
94
13
|
## Credits
|
|
95
14
|
|
|
@@ -97,7 +16,6 @@ npx giget@latest gh:productdevbook/silgi/examples/nuxt my-nuxt-app
|
|
|
97
16
|
- [tRPC](https://github.com/trpc/trpc) — Router/procedure model, end-to-end type inference
|
|
98
17
|
- [Elysia](https://github.com/elysiajs/elysia) — Sucrose-style static handler analysis
|
|
99
18
|
|
|
100
|
-
|
|
101
19
|
## License
|
|
102
20
|
|
|
103
21
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The fastest end-to-end type-safe RPC framework for TypeScript — compiled pipelines, single package, every runtime",
|
|
6
6
|
"keywords": [
|
|
@@ -236,25 +236,6 @@
|
|
|
236
236
|
"types": "./lib/srvx.d.mts"
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
"scripts": {
|
|
240
|
-
"build": "pnpm --filter silgi-analytics-dashboard build && tsdown",
|
|
241
|
-
"build:dashboard": "pnpm --filter silgi-analytics-dashboard build",
|
|
242
|
-
"dev": "vitest",
|
|
243
|
-
"bench": "node --experimental-strip-types bench/update-benchmarks.ts",
|
|
244
|
-
"bench:http": "node --experimental-strip-types bench/http.ts",
|
|
245
|
-
"bench:http:bun": "bun bench/http-bun.ts",
|
|
246
|
-
"bench:memory": "node --expose-gc --experimental-strip-types bench/memory.ts",
|
|
247
|
-
"bench:types": "tsx bench/types.ts",
|
|
248
|
-
"bench:bun": "bun test/bun-compat.ts",
|
|
249
|
-
"play": "pnpm build && pnpm --filter silgi-playground dev",
|
|
250
|
-
"lint": "oxlint . && oxfmt --check --ignore-path .oxfmtignore .",
|
|
251
|
-
"lint:fix": "oxlint --fix . && oxfmt --ignore-path .oxfmtignore .",
|
|
252
|
-
"format": "oxfmt --ignore-path .oxfmtignore .",
|
|
253
|
-
"fix": "oxlint --fix . && oxfmt --ignore-path .oxfmtignore .",
|
|
254
|
-
"test": "vitest run",
|
|
255
|
-
"typecheck": "tsgo --noEmit",
|
|
256
|
-
"release": "bumpp"
|
|
257
|
-
},
|
|
258
239
|
"dependencies": {
|
|
259
240
|
"@standard-schema/spec": "^1.1.0",
|
|
260
241
|
"cookie-es": "^3.1.1",
|
|
@@ -339,10 +320,23 @@
|
|
|
339
320
|
"node": ">=24",
|
|
340
321
|
"pnpm": ">=10"
|
|
341
322
|
},
|
|
342
|
-
"
|
|
343
|
-
|
|
344
|
-
"
|
|
345
|
-
|
|
346
|
-
|
|
323
|
+
"scripts": {
|
|
324
|
+
"build": "pnpm --filter silgi-analytics-dashboard build && tsdown",
|
|
325
|
+
"build:dashboard": "pnpm --filter silgi-analytics-dashboard build",
|
|
326
|
+
"dev": "vitest",
|
|
327
|
+
"bench": "node --experimental-strip-types bench/update-benchmarks.ts",
|
|
328
|
+
"bench:http": "node --experimental-strip-types bench/http.ts",
|
|
329
|
+
"bench:http:bun": "bun bench/http-bun.ts",
|
|
330
|
+
"bench:memory": "node --expose-gc --experimental-strip-types bench/memory.ts",
|
|
331
|
+
"bench:types": "tsx bench/types.ts",
|
|
332
|
+
"bench:bun": "bun test/bun-compat.ts",
|
|
333
|
+
"play": "pnpm build && pnpm --filter silgi-playground dev",
|
|
334
|
+
"lint": "oxlint . && oxfmt --check --ignore-path .oxfmtignore .",
|
|
335
|
+
"lint:fix": "oxlint --fix . && oxfmt --ignore-path .oxfmtignore .",
|
|
336
|
+
"format": "oxfmt --ignore-path .oxfmtignore .",
|
|
337
|
+
"fix": "oxlint --fix . && oxfmt --ignore-path .oxfmtignore .",
|
|
338
|
+
"test": "vitest run",
|
|
339
|
+
"typecheck": "tsgo --noEmit",
|
|
340
|
+
"release": "bumpp"
|
|
347
341
|
}
|
|
348
|
-
}
|
|
342
|
+
}
|