@quark-fw/plugin-trpc 0.0.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +33 -0
  2. package/package.json +9 -5
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @quark-fw/plugin-trpc
2
+
3
+ tRPC server plugin for the Quark framework. Importing it registers a plugin that serves your tRPC router over Express at `/api/trpc`.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm i @quark-fw/plugin-trpc
9
+ ```
10
+
11
+ Peers: `@quark-fw/core` (global `quark`), `express`.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import "@quark-fw/core";
17
+ import "@quark-fw/plugin-trpc"; // registers the plugin, mounts /api/trpc
18
+
19
+ // build your router with the shared tRPC instance:
20
+ import { router, publicProcedure } from "@quark-fw/plugin-trpc/src/trpc.js";
21
+
22
+ const appRouter = router({
23
+ ping: publicProcedure.query(() => "pong"),
24
+ });
25
+
26
+ // hand the router to the plugin (can happen after the server starts;
27
+ // until then /api/trpc answers 503)
28
+ quark.trpc.setRouter(appRouter);
29
+ ```
30
+
31
+ `@quark-fw/plugin-trpc/src/trpc.js` also exports `middleware`, `mergeRouters`, and the `TRPCContext` / `TRPCUser` types (augment `TRPCUser` in your auth layer).
32
+
33
+ The Express handler is registered through the middleware registry of [`@quark-fw/plugin`](https://www.npmjs.com/package/@quark-fw/plugin), so any Quark HTTP server picks it up automatically.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quark-fw/plugin-trpc",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "tRPC server plugin for the Quark framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,24 +14,28 @@
14
14
  "./src/*": "./dist/*",
15
15
  "./*": "./dist/*"
16
16
  },
17
- "files": ["dist"],
17
+ "files": [
18
+ "dist"
19
+ ],
18
20
  "scripts": {
19
21
  "dev": "tsx watch src/index.ts",
20
22
  "build": "tsc -p tsconfig.build.json && node ../../scripts/postbuild.mjs"
21
23
  },
22
- "keywords": ["quark"],
24
+ "keywords": [
25
+ "quark"
26
+ ],
23
27
  "author": "",
24
28
  "license": "ISC",
25
29
  "publishConfig": {
26
30
  "access": "public"
27
31
  },
28
32
  "dependencies": {
29
- "@quark-fw/plugin": "0.0.1",
33
+ "@quark-fw/plugin": "0.1.1",
30
34
  "@trpc/server": "^11.0.0",
31
35
  "zod": "^4.0.0"
32
36
  },
33
37
  "peerDependencies": {
34
- "@quark-fw/core": "0.0.1",
38
+ "@quark-fw/core": "0.1.1",
35
39
  "express": "^5.0.0"
36
40
  },
37
41
  "devDependencies": {