trpc-nuxt-module 4.3.1 → 4.4.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/README.md +13 -26
- package/package.json +12 -35
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -73
- package/dist/models/ExportReference.d.ts +0 -6
- package/dist/models/ModuleOptions.d.ts +0 -10
- package/dist/models/TrpcServerFetch.d.ts +0 -4
- package/dist/models/WebSocketOptions.d.ts +0 -8
- package/dist/runtime/client/createTRPCNuxtClient.d.ts +0 -6
- package/dist/runtime/client/createTRPCNuxtClient.js +0 -29
- package/dist/runtime/client/getMutationKey.d.ts +0 -4
- package/dist/runtime/client/getMutationKey.js +0 -5
- package/dist/runtime/client/getQueryKey.d.ts +0 -4
- package/dist/runtime/client/getQueryKey.js +0 -5
- package/dist/runtime/client/httpBatchLink.d.ts +0 -5
- package/dist/runtime/client/httpBatchLink.js +0 -9
- package/dist/runtime/client/httpLink.d.ts +0 -5
- package/dist/runtime/client/httpLink.js +0 -9
- package/dist/runtime/client/models/DecoratedMutation.d.ts +0 -11
- package/dist/runtime/client/models/DecoratedMutation.js +0 -1
- package/dist/runtime/client/models/DecoratedProcedure.d.ts +0 -8
- package/dist/runtime/client/models/DecoratedProcedure.js +0 -1
- package/dist/runtime/client/models/DecoratedQuery.d.ts +0 -10
- package/dist/runtime/client/models/DecoratedQuery.js +0 -1
- package/dist/runtime/client/models/DecoratedRouterRecord.d.ts +0 -11
- package/dist/runtime/client/models/DecoratedRouterRecord.js +0 -1
- package/dist/runtime/client/models/DecoratedSubscription.d.ts +0 -10
- package/dist/runtime/client/models/DecoratedSubscription.js +0 -1
- package/dist/runtime/client/models/KeysOf.d.ts +0 -3
- package/dist/runtime/client/models/KeysOf.js +0 -1
- package/dist/runtime/client/models/PickFrom.d.ts +0 -3
- package/dist/runtime/client/models/PickFrom.js +0 -1
- package/dist/runtime/client/models/ProcedureNode.d.ts +0 -6
- package/dist/runtime/client/models/ProcedureNode.js +0 -1
- package/dist/runtime/client/models/ProcedurePath.d.ts +0 -5
- package/dist/runtime/client/models/ProcedurePath.js +0 -1
- package/dist/runtime/client/models/QueryAsyncData.d.ts +0 -8
- package/dist/runtime/client/models/QueryAsyncData.js +0 -1
- package/dist/runtime/client/models/QueryError.d.ts +0 -5
- package/dist/runtime/client/models/QueryError.js +0 -1
- package/dist/runtime/client/models/SubscriptionStatus.d.ts +0 -9
- package/dist/runtime/client/models/SubscriptionStatus.js +0 -9
- package/dist/runtime/client/models/TRPCNuxtClient.d.ts +0 -5
- package/dist/runtime/client/models/TRPCNuxtClient.js +0 -1
- package/dist/runtime/client/models/UseMutationOptions.d.ts +0 -10
- package/dist/runtime/client/models/UseMutationOptions.js +0 -1
- package/dist/runtime/client/models/UseMutationReturn.d.ts +0 -9
- package/dist/runtime/client/models/UseMutationReturn.js +0 -1
- package/dist/runtime/client/models/UseQuery.d.ts +0 -8
- package/dist/runtime/client/models/UseQuery.js +0 -1
- package/dist/runtime/client/models/UseQueryOptions.d.ts +0 -11
- package/dist/runtime/client/models/UseQueryOptions.js +0 -1
- package/dist/runtime/client/models/UseSubscriptionOptions.d.ts +0 -7
- package/dist/runtime/client/models/UseSubscriptionOptions.js +0 -1
- package/dist/runtime/client/models/UseSubscriptionReturn.d.ts +0 -10
- package/dist/runtime/client/models/UseSubscriptionReturn.js +0 -1
- package/dist/runtime/client/services/getLinkFetch.d.ts +0 -4
- package/dist/runtime/client/services/getLinkFetch.js +0 -25
- package/dist/runtime/client/services/getProcedureKey.d.ts +0 -3
- package/dist/runtime/client/services/getProcedureKey.js +0 -5
- package/dist/runtime/client/services/mergeSignals.d.ts +0 -3
- package/dist/runtime/client/services/mergeSignals.js +0 -4
- package/dist/runtime/client/services/useProcedureMutation.d.ts +0 -8
- package/dist/runtime/client/services/useProcedureMutation.js +0 -23
- package/dist/runtime/client/services/useProcedureQuery.d.ts +0 -9
- package/dist/runtime/client/services/useProcedureQuery.js +0 -14
- package/dist/runtime/client/services/useProcedureSubscription.d.ts +0 -8
- package/dist/runtime/client/services/useProcedureSubscription.js +0 -68
- package/dist/runtime/client/services/useTrpcServerFetch.d.ts +0 -4
- package/dist/runtime/client/services/useTrpcServerFetch.js +0 -8
- package/dist/runtime/constants.d.ts +0 -6
- package/dist/runtime/constants.js +0 -7
- package/dist/runtime/server/createTRPCEventHandler.d.ts +0 -6
- package/dist/runtime/server/createTRPCEventHandler.js +0 -31
- package/dist/runtime/server/createTRPCWebSocketHandler.d.ts +0 -6
- package/dist/runtime/server/createTRPCWebSocketHandler.js +0 -63
- package/dist/runtime/server/models/PeerWebSocketAdapter.d.ts +0 -19
- package/dist/runtime/server/models/PeerWebSocketAdapter.js +0 -37
- package/dist/runtime/server/models/TRPCEventHandlerOptions.d.ts +0 -11
- package/dist/runtime/server/models/TRPCEventHandlerOptions.js +0 -1
- package/dist/runtime/server/models/TRPCWebSocketConnection.d.ts +0 -7
- package/dist/runtime/server/models/TRPCWebSocketConnection.js +0 -1
- package/dist/runtime/server/models/TRPCWebSocketHandler.d.ts +0 -7
- package/dist/runtime/server/models/TRPCWebSocketHandler.js +0 -1
- package/dist/runtime/server/models/TRPCWebSocketHandlerOptions.d.ts +0 -13
- package/dist/runtime/server/models/TRPCWebSocketHandlerOptions.js +0 -1
- package/dist/runtime/server/models/WebSocketServerAdapter.d.ts +0 -8
- package/dist/runtime/server/models/WebSocketServerAdapter.js +0 -14
- package/dist/runtime/server/services/toIncomingMessage.d.ts +0 -5
- package/dist/runtime/server/services/toIncomingMessage.js +0 -12
- package/dist/services/getEventHandlerTemplate.js +0 -11
- package/dist/services/getImportStatement.js +0 -4
- package/dist/services/getWebSocketHandlerTemplate.js +0 -23
- package/dist/services/getWebSocketHooksTypeTemplate.js +0 -18
package/README.md
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
6
|
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
7
|
|
|
8
|
-
tRPC for [Nuxt](https://nuxt.com)
|
|
8
|
+
tRPC for [Nuxt](https://nuxt.com): a Nuxt module that registers your router's HTTP handler — and, when you ask for it, a WebSocket handler over Nitro's own WebSockets — fetches through the request event during server rendering so a call never leaves the process, and decorates the typed client with `useQuery`, `useLazyQuery`, `useMutation` and `useSubscription`, each a composable over Nuxt's own `useAsyncData`.
|
|
9
|
+
|
|
10
|
+
Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs/trpc-nuxt-module).
|
|
9
11
|
|
|
10
12
|
## Table of Contents
|
|
11
13
|
|
|
12
14
|
- 🚀 [Getting Started](#getting-started)
|
|
13
|
-
-
|
|
15
|
+
- 🧩 [Key Exports](#key-exports)
|
|
14
16
|
- ⚖️ [License](#license)
|
|
15
17
|
|
|
16
18
|
---
|
|
@@ -75,34 +77,19 @@ const { data } = await $trpc.greeting.useQuery(name);
|
|
|
75
77
|
</template>
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
## <a name="
|
|
79
|
-
|
|
80
|
-
We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs/trpc-nuxt-module) to level up. It covers the design and the upstream `trpc-nuxt` issues this module answers.
|
|
80
|
+
## <a name="key-exports">🧩 Key Exports</a>
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `trpc-nuxt-module/runtime/server/createTRPCEventHandler` | The HTTP handler over tRPC's fetch adapter, for a Nitro app without Nuxt |
|
|
82
|
+
| Export | Description |
|
|
83
|
+
| ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
|
|
84
|
+
| `createTRPCNuxtClient` | The typed client, every procedure decorated with `useQuery`, `useLazyQuery`, `useMutation` or `useSubscription` |
|
|
85
|
+
| `getMutationKey`, `getQueryKey` | The `useAsyncData` keys a procedure's data is cached under, for `useNuxtData` and `refreshNuxtData` |
|
|
86
|
+
| `httpBatchLink`, `httpLink` | tRPC's links, sending through the request event during server rendering |
|
|
87
|
+
| `trpc-nuxt-module` | The module — `router`, `createContext`, `endpoint` and `webSocket` options |
|
|
88
|
+
| `trpc-nuxt-module/runtime/server/createTRPCEventHandler` | The HTTP handler over tRPC's fetch adapter, for a Nitro app without Nuxt |
|
|
89
|
+
| `trpc-nuxt-module/runtime/server/createTRPCWebSocketHandler` | The WebSocket handler over tRPC's `applyWSSHandler` and crossws, for a Nitro app without Nuxt |
|
|
91
90
|
|
|
92
91
|
A WebSocket connection's open and close call the `trpc-nuxt-module:webSocket:open` and `trpc-nuxt-module:webSocket:close` Nitro runtime hooks with its context, typed off your router.
|
|
93
92
|
|
|
94
|
-
### Commands
|
|
95
|
-
|
|
96
|
-
Run from `packages/trpc-nuxt-module/`:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
pnpm build # compile to dist/
|
|
100
|
-
pnpm test # vitest watch mode (coverage is run from the repo root)
|
|
101
|
-
pnpm bench # the event handler against tRPC's own fetch adapter
|
|
102
|
-
pnpm lint:fix # auto-fix lint
|
|
103
|
-
pnpm typecheck # type check
|
|
104
|
-
```
|
|
105
|
-
|
|
106
93
|
## <a name="license">⚖️ License</a>
|
|
107
94
|
|
|
108
95
|
This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trpc-nuxt-module",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "tRPC for Nuxt — a Nuxt module that registers your router's HTTP and WebSocket handlers, fetches through the request event during SSR, and decorates the typed client with useQuery, useMutation and useSubscription over useAsyncData.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nitro",
|
|
@@ -38,33 +38,10 @@
|
|
|
38
38
|
"./runtime/client/getQueryKey": "./dist/runtime/client/getQueryKey.js",
|
|
39
39
|
"./runtime/client/httpBatchLink": "./dist/runtime/client/httpBatchLink.js",
|
|
40
40
|
"./runtime/client/httpLink": "./dist/runtime/client/httpLink.js",
|
|
41
|
-
"./runtime/client/models/DecoratedMutation": "./dist/runtime/client/models/DecoratedMutation.js",
|
|
42
|
-
"./runtime/client/models/DecoratedProcedure": "./dist/runtime/client/models/DecoratedProcedure.js",
|
|
43
|
-
"./runtime/client/models/DecoratedQuery": "./dist/runtime/client/models/DecoratedQuery.js",
|
|
44
|
-
"./runtime/client/models/DecoratedRouterRecord": "./dist/runtime/client/models/DecoratedRouterRecord.js",
|
|
45
|
-
"./runtime/client/models/DecoratedSubscription": "./dist/runtime/client/models/DecoratedSubscription.js",
|
|
46
|
-
"./runtime/client/models/KeysOf": "./dist/runtime/client/models/KeysOf.js",
|
|
47
|
-
"./runtime/client/models/PickFrom": "./dist/runtime/client/models/PickFrom.js",
|
|
48
|
-
"./runtime/client/models/ProcedureNode": "./dist/runtime/client/models/ProcedureNode.js",
|
|
49
|
-
"./runtime/client/models/ProcedurePath": "./dist/runtime/client/models/ProcedurePath.js",
|
|
50
|
-
"./runtime/client/models/QueryAsyncData": "./dist/runtime/client/models/QueryAsyncData.js",
|
|
51
|
-
"./runtime/client/models/QueryError": "./dist/runtime/client/models/QueryError.js",
|
|
52
|
-
"./runtime/client/models/SubscriptionStatus": "./dist/runtime/client/models/SubscriptionStatus.js",
|
|
53
|
-
"./runtime/client/models/TRPCNuxtClient": "./dist/runtime/client/models/TRPCNuxtClient.js",
|
|
54
|
-
"./runtime/client/models/UseMutationOptions": "./dist/runtime/client/models/UseMutationOptions.js",
|
|
55
|
-
"./runtime/client/models/UseMutationReturn": "./dist/runtime/client/models/UseMutationReturn.js",
|
|
56
|
-
"./runtime/client/models/UseQuery": "./dist/runtime/client/models/UseQuery.js",
|
|
57
|
-
"./runtime/client/models/UseQueryOptions": "./dist/runtime/client/models/UseQueryOptions.js",
|
|
58
|
-
"./runtime/client/models/UseSubscriptionOptions": "./dist/runtime/client/models/UseSubscriptionOptions.js",
|
|
59
|
-
"./runtime/client/models/UseSubscriptionReturn": "./dist/runtime/client/models/UseSubscriptionReturn.js",
|
|
60
41
|
"./runtime/constants": "./dist/runtime/constants.js",
|
|
61
42
|
"./runtime/server/createTRPCEventHandler": "./dist/runtime/server/createTRPCEventHandler.js",
|
|
62
43
|
"./runtime/server/createTRPCWebSocketHandler": "./dist/runtime/server/createTRPCWebSocketHandler.js",
|
|
63
|
-
"./runtime/server/models/PeerWebSocketAdapter": "./dist/runtime/server/models/PeerWebSocketAdapter.js",
|
|
64
|
-
"./runtime/server/models/TRPCEventHandlerOptions": "./dist/runtime/server/models/TRPCEventHandlerOptions.js",
|
|
65
44
|
"./runtime/server/models/TRPCWebSocketConnection": "./dist/runtime/server/models/TRPCWebSocketConnection.js",
|
|
66
|
-
"./runtime/server/models/TRPCWebSocketHandler": "./dist/runtime/server/models/TRPCWebSocketHandler.js",
|
|
67
|
-
"./runtime/server/models/TRPCWebSocketHandlerOptions": "./dist/runtime/server/models/TRPCWebSocketHandlerOptions.js",
|
|
68
45
|
"./runtime/server/models/WebSocketServerAdapter": "./dist/runtime/server/models/WebSocketServerAdapter.js",
|
|
69
46
|
"./package.json": "./package.json"
|
|
70
47
|
},
|
|
@@ -77,33 +54,33 @@
|
|
|
77
54
|
"lint": "eslint .",
|
|
78
55
|
"lint:fix": "eslint --fix .",
|
|
79
56
|
"test": "vitest",
|
|
80
|
-
"typecheck": "
|
|
57
|
+
"typecheck": "tsrs --fast"
|
|
81
58
|
},
|
|
82
59
|
"dependencies": {
|
|
83
|
-
"@esposter/shared": "4.
|
|
60
|
+
"@esposter/shared": "4.4.0",
|
|
84
61
|
"@nuxt/kit": "npm:@nuxt/kit-nightly@5x",
|
|
85
62
|
"@nuxt/schema": "npm:@nuxt/schema-nightly@5x",
|
|
86
63
|
"ohash": "^2.0.12",
|
|
87
64
|
"type-fest": "^5.10.0"
|
|
88
65
|
},
|
|
89
66
|
"devDependencies": {
|
|
90
|
-
"@esposter/configuration": "4.
|
|
91
|
-
"@esposter/shared-node": "4.
|
|
67
|
+
"@esposter/configuration": "4.4.0",
|
|
68
|
+
"@esposter/shared-node": "4.4.0",
|
|
92
69
|
"@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@5x",
|
|
93
70
|
"@nuxt/test-utils": "^4.3.4",
|
|
94
|
-
"@types/node": "^26.6.
|
|
71
|
+
"@types/node": "^26.6.6",
|
|
95
72
|
"happy-dom": "^21.0.4",
|
|
96
73
|
"superjson": "^2.2.6",
|
|
97
|
-
"tsdown": "
|
|
74
|
+
"tsdown": "0.23.2",
|
|
98
75
|
"zod": "^4.6.7"
|
|
99
76
|
},
|
|
100
77
|
"peerDependencies": {
|
|
101
|
-
"@trpc/client": "^11.
|
|
102
|
-
"@trpc/server": "^11.
|
|
103
|
-
"crossws": "^0.4.
|
|
104
|
-
"nitro": "npm:nitro-nightly@
|
|
78
|
+
"@trpc/client": "^11.22.1",
|
|
79
|
+
"@trpc/server": "^11.22.1",
|
|
80
|
+
"crossws": "^0.4.17",
|
|
81
|
+
"nitro": "npm:nitro-nightly@latest",
|
|
105
82
|
"nuxt": "npm:nuxt-nightly@5x",
|
|
106
83
|
"vue": "^3.5.44"
|
|
107
84
|
},
|
|
108
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "e1a416c4b91da69cc2aa259b50a4d656f204d272"
|
|
109
86
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ModuleOptions } from "./models/ModuleOptions.js";
|
|
2
|
-
import { NuxtModule } from "@nuxt/schema";
|
|
3
|
-
//#region src/module.d.ts
|
|
4
|
-
declare module "@nuxt/schema" {
|
|
5
|
-
interface NuxtConfig {
|
|
6
|
-
trpc?: Partial<ModuleOptions>;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
declare const trpcNuxtModule: NuxtModule<ModuleOptions>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { type ModuleOptions, trpcNuxtModule as default };
|
package/dist/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ENDPOINT, MODULE_NAME } from "./runtime/constants.js";
|
|
2
|
-
import { getEventHandlerTemplate } from "./services/getEventHandlerTemplate.js";
|
|
3
|
-
import { getWebSocketHandlerTemplate } from "./services/getWebSocketHandlerTemplate.js";
|
|
4
|
-
import { getWebSocketHooksTypeTemplate } from "./services/getWebSocketHooksTypeTemplate.js";
|
|
5
|
-
import { addImports, addServerHandler, addServerTemplate, addTypeTemplate, defineNuxtModule, resolvePath } from "@nuxt/kit";
|
|
6
|
-
//#region src/module.ts
|
|
7
|
-
const CLIENT_IMPORTS = [
|
|
8
|
-
"createTRPCNuxtClient",
|
|
9
|
-
"getMutationKey",
|
|
10
|
-
"getQueryKey",
|
|
11
|
-
"httpBatchLink",
|
|
12
|
-
"httpLink"
|
|
13
|
-
];
|
|
14
|
-
const EVENT_HANDLER_FILENAME = `#${MODULE_NAME}/eventHandler.mjs`;
|
|
15
|
-
const WEBSOCKET_HANDLER_FILENAME = `#${MODULE_NAME}/webSocketHandler.mjs`;
|
|
16
|
-
const trpcNuxtModule = defineNuxtModule({
|
|
17
|
-
defaults: { endpoint: DEFAULT_ENDPOINT },
|
|
18
|
-
meta: {
|
|
19
|
-
compatibility: { nuxt: ">=5.0.0-0" },
|
|
20
|
-
configKey: "trpc",
|
|
21
|
-
name: MODULE_NAME
|
|
22
|
-
},
|
|
23
|
-
async setup({ createContext, endpoint, router, webSocket }, nuxt) {
|
|
24
|
-
const resolvedRouter = {
|
|
25
|
-
...router,
|
|
26
|
-
from: await resolvePath(router.from)
|
|
27
|
-
};
|
|
28
|
-
const resolvedCreateContext = createContext && {
|
|
29
|
-
...createContext,
|
|
30
|
-
from: await resolvePath(createContext.from)
|
|
31
|
-
};
|
|
32
|
-
const routedEndpoint = `${nuxt.options.app.baseURL.replace(/\/$/u, "")}${endpoint}`;
|
|
33
|
-
addServerTemplate({
|
|
34
|
-
filename: EVENT_HANDLER_FILENAME,
|
|
35
|
-
getContents: () => getEventHandlerTemplate(resolvedRouter, routedEndpoint, resolvedCreateContext)
|
|
36
|
-
});
|
|
37
|
-
addServerHandler({
|
|
38
|
-
handler: EVENT_HANDLER_FILENAME,
|
|
39
|
-
route: `${endpoint}/**`
|
|
40
|
-
});
|
|
41
|
-
if (webSocket) {
|
|
42
|
-
nuxt.options.nitro.features = {
|
|
43
|
-
...nuxt.options.nitro.features,
|
|
44
|
-
websocket: true
|
|
45
|
-
};
|
|
46
|
-
addServerTemplate({
|
|
47
|
-
filename: WEBSOCKET_HANDLER_FILENAME,
|
|
48
|
-
getContents: () => getWebSocketHandlerTemplate(resolvedRouter, webSocket, resolvedCreateContext)
|
|
49
|
-
});
|
|
50
|
-
addServerHandler({
|
|
51
|
-
handler: WEBSOCKET_HANDLER_FILENAME,
|
|
52
|
-
lazy: true,
|
|
53
|
-
route: webSocket.endpoint
|
|
54
|
-
});
|
|
55
|
-
addTypeTemplate({
|
|
56
|
-
filename: `types/${MODULE_NAME}.d.ts`,
|
|
57
|
-
getContents: () => getWebSocketHooksTypeTemplate({
|
|
58
|
-
...resolvedRouter,
|
|
59
|
-
from: resolvedRouter.from.replace(/\.[cm]?ts$/u, "")
|
|
60
|
-
})
|
|
61
|
-
}, {
|
|
62
|
-
nitro: true,
|
|
63
|
-
nuxt: true
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
addImports(CLIENT_IMPORTS.map((name) => ({
|
|
67
|
-
from: `${MODULE_NAME}/runtime/client/${name}`,
|
|
68
|
-
name
|
|
69
|
-
})));
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
//#endregion
|
|
73
|
-
export { trpcNuxtModule as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExportReference } from "./ExportReference.js";
|
|
2
|
-
import { WebSocketOptions } from "./WebSocketOptions.js";
|
|
3
|
-
//#region src/models/ModuleOptions.d.ts
|
|
4
|
-
export interface ModuleOptions {
|
|
5
|
-
createContext?: ExportReference;
|
|
6
|
-
endpoint: string;
|
|
7
|
-
router: ExportReference;
|
|
8
|
-
webSocket?: WebSocketOptions;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AnyTRPCRouter } from "@trpc/server";
|
|
2
|
-
import { WSSHandlerOptions } from "@trpc/server/adapters/ws";
|
|
3
|
-
//#region src/models/WebSocketOptions.d.ts
|
|
4
|
-
export interface WebSocketOptions {
|
|
5
|
-
endpoint: string;
|
|
6
|
-
keepAlive?: WSSHandlerOptions<AnyTRPCRouter>["keepAlive"];
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { TRPCNuxtClient } from "./models/TRPCNuxtClient.js";
|
|
2
|
-
import { CreateTRPCClientOptions } from "@trpc/client";
|
|
3
|
-
import { AnyTRPCRouter } from "@trpc/server";
|
|
4
|
-
//#region src/runtime/client/createTRPCNuxtClient.d.ts
|
|
5
|
-
export declare const createTRPCNuxtClient: <TRouter extends AnyTRPCRouter>(options: CreateTRPCClientOptions<TRouter>) => TRPCNuxtClient<TRouter>;
|
|
6
|
-
//#endregion
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useProcedureMutation } from "./services/useProcedureMutation.js";
|
|
2
|
-
import { useProcedureQuery } from "./services/useProcedureQuery.js";
|
|
3
|
-
import { useProcedureSubscription } from "./services/useProcedureSubscription.js";
|
|
4
|
-
import { createTRPCUntypedClient } from "@trpc/client";
|
|
5
|
-
import { createTRPCRecursiveProxy } from "@trpc/server";
|
|
6
|
-
//#region src/runtime/client/createTRPCNuxtClient.ts
|
|
7
|
-
const createTRPCNuxtClient = (options) => {
|
|
8
|
-
const client = createTRPCUntypedClient(options);
|
|
9
|
-
return createTRPCRecursiveProxy(({ args: [first, second], path }) => {
|
|
10
|
-
const procedurePath = path.slice(0, -1);
|
|
11
|
-
const procedure = procedurePath.join(".");
|
|
12
|
-
switch (path.at(-1)) {
|
|
13
|
-
case "_def": return { path: procedurePath };
|
|
14
|
-
case "mutate": return client.mutation(procedure, first, second);
|
|
15
|
-
case "query": return client.query(procedure, first, second);
|
|
16
|
-
case "subscribe": return client.subscription(procedure, first, second);
|
|
17
|
-
case "useLazyQuery": return useProcedureQuery(client, procedure, first, {
|
|
18
|
-
...second,
|
|
19
|
-
lazy: true
|
|
20
|
-
});
|
|
21
|
-
case "useMutation": return useProcedureMutation(client, procedure, first);
|
|
22
|
-
case "useQuery": return useProcedureQuery(client, procedure, first, second);
|
|
23
|
-
case "useSubscription": return useProcedureSubscription(client, procedure, first, second);
|
|
24
|
-
default: throw new TypeError(`"${path.join(".")}" is not a procedure call`);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
export { createTRPCNuxtClient };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { HTTPBatchLinkOptions, TRPCLink } from "@trpc/client";
|
|
2
|
-
import { AnyTRPCRouter } from "@trpc/server";
|
|
3
|
-
//#region src/runtime/client/httpBatchLink.d.ts
|
|
4
|
-
export declare const httpBatchLink: <TRouter extends AnyTRPCRouter>(options: HTTPBatchLinkOptions<TRouter["_def"]["_config"]["$types"]>) => TRPCLink<TRouter>;
|
|
5
|
-
//#endregion
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getLinkFetch } from "./services/getLinkFetch.js";
|
|
2
|
-
import { httpBatchLink as httpBatchLink$1 } from "@trpc/client";
|
|
3
|
-
//#region src/runtime/client/httpBatchLink.ts
|
|
4
|
-
const httpBatchLink = (options) => httpBatchLink$1({
|
|
5
|
-
fetch: getLinkFetch(),
|
|
6
|
-
...options
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|
|
9
|
-
export { httpBatchLink };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { HTTPLinkOptions, TRPCLink } from "@trpc/client";
|
|
2
|
-
import { AnyTRPCRouter } from "@trpc/server";
|
|
3
|
-
//#region src/runtime/client/httpLink.d.ts
|
|
4
|
-
export declare const httpLink: <TRouter extends AnyTRPCRouter>(options: HTTPLinkOptions<TRouter["_def"]["_config"]["$types"]>) => TRPCLink<TRouter>;
|
|
5
|
-
//#endregion
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getLinkFetch } from "./services/getLinkFetch.js";
|
|
2
|
-
import { httpLink as httpLink$1 } from "@trpc/client";
|
|
3
|
-
//#region src/runtime/client/httpLink.ts
|
|
4
|
-
const httpLink = (options) => httpLink$1({
|
|
5
|
-
fetch: getLinkFetch(),
|
|
6
|
-
...options
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|
|
9
|
-
export { httpLink };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { KeysOf } from "./KeysOf.js";
|
|
2
|
-
import { ProcedureNode } from "./ProcedureNode.js";
|
|
3
|
-
import { UseMutationOptions } from "./UseMutationOptions.js";
|
|
4
|
-
import { UseMutationReturn } from "./UseMutationReturn.js";
|
|
5
|
-
import { Resolver, TRPCResolverDef } from "@trpc/client";
|
|
6
|
-
//#region src/runtime/client/models/DecoratedMutation.d.ts
|
|
7
|
-
export interface DecoratedMutation<TDefinition extends TRPCResolverDef> extends ProcedureNode {
|
|
8
|
-
mutate: Resolver<TDefinition>;
|
|
9
|
-
useMutation: <TData = TDefinition["output"], TPickKeys extends KeysOf<TData> = KeysOf<TData>, TDefault = undefined>(options?: UseMutationOptions<TDefinition, TData, TPickKeys, TDefault>) => UseMutationReturn<TDefinition, TData, TPickKeys, TDefault>;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DecoratedMutation } from "./DecoratedMutation.js";
|
|
2
|
-
import { DecoratedQuery } from "./DecoratedQuery.js";
|
|
3
|
-
import { DecoratedSubscription } from "./DecoratedSubscription.js";
|
|
4
|
-
import { TRPCResolverDef } from "@trpc/client";
|
|
5
|
-
import { TRPCProcedureType } from "@trpc/server";
|
|
6
|
-
//#region src/runtime/client/models/DecoratedProcedure.d.ts
|
|
7
|
-
export type DecoratedProcedure<TType extends TRPCProcedureType, TDefinition extends TRPCResolverDef> = TType extends "query" ? DecoratedQuery<TDefinition> : TType extends "mutation" ? DecoratedMutation<TDefinition> : DecoratedSubscription<TDefinition>;
|
|
8
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ProcedureNode } from "./ProcedureNode.js";
|
|
2
|
-
import { UseQuery } from "./UseQuery.js";
|
|
3
|
-
import { Resolver, TRPCResolverDef } from "@trpc/client";
|
|
4
|
-
//#region src/runtime/client/models/DecoratedQuery.d.ts
|
|
5
|
-
export interface DecoratedQuery<TDefinition extends TRPCResolverDef> extends ProcedureNode {
|
|
6
|
-
query: Resolver<TDefinition>;
|
|
7
|
-
useLazyQuery: UseQuery<TDefinition>;
|
|
8
|
-
useQuery: UseQuery<TDefinition>;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ProcedureNode } from "./ProcedureNode.js";
|
|
2
|
-
import { DecoratedProcedure } from "./DecoratedProcedure.js";
|
|
3
|
-
import { AnyTRPCProcedure, AnyTRPCRootTypes, TRPCRouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server";
|
|
4
|
-
//#region src/runtime/client/models/DecoratedRouterRecord.d.ts
|
|
5
|
-
export type DecoratedRouterRecord<TRoot extends AnyTRPCRootTypes, TRecord extends TRPCRouterRecord> = ProcedureNode & { readonly [TKey in keyof TRecord]: TRecord[TKey] extends AnyTRPCProcedure ? DecoratedProcedure<TRecord[TKey]["_def"]["type"], {
|
|
6
|
-
errorShape: TRoot["errorShape"];
|
|
7
|
-
input: inferProcedureInput<TRecord[TKey]>;
|
|
8
|
-
output: inferTransformedProcedureOutput<TRoot, TRecord[TKey]>;
|
|
9
|
-
transformer: TRoot["transformer"];
|
|
10
|
-
}> : TRecord[TKey] extends TRPCRouterRecord ? DecoratedRouterRecord<TRoot, TRecord[TKey]> : never; };
|
|
11
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UseSubscriptionOptions } from "./UseSubscriptionOptions.js";
|
|
2
|
-
import { UseSubscriptionReturn } from "./UseSubscriptionReturn.js";
|
|
3
|
-
import { MaybeRefOrGetter } from "vue";
|
|
4
|
-
import { SubscriptionResolver, TRPCClientError, TRPCResolverDef } from "@trpc/client";
|
|
5
|
-
//#region src/runtime/client/models/DecoratedSubscription.d.ts
|
|
6
|
-
export interface DecoratedSubscription<TDefinition extends TRPCResolverDef> {
|
|
7
|
-
subscribe: SubscriptionResolver<TDefinition>;
|
|
8
|
-
useSubscription: (input: MaybeRefOrGetter<TDefinition["input"]>, options?: UseSubscriptionOptions<TDefinition>) => UseSubscriptionReturn<Parameters<NonNullable<UseSubscriptionOptions<TDefinition>["onData"]>>[0], TRPCClientError<TDefinition>>;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/client/models/PickFrom.d.ts
|
|
2
|
-
export type PickFrom<T, TKeys extends string[]> = T extends unknown[] ? T : T extends Record<string, unknown> ? keyof T extends TKeys[number] ? T : TKeys[number] extends never ? T : Pick<T, TKeys[number]> : T;
|
|
3
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { KeysOf } from "./KeysOf.js";
|
|
2
|
-
import { PickFrom } from "./PickFrom.js";
|
|
3
|
-
import { QueryError } from "./QueryError.js";
|
|
4
|
-
import { AsyncData } from "nuxt/app";
|
|
5
|
-
import { TRPCResolverDef } from "@trpc/client";
|
|
6
|
-
//#region src/runtime/client/models/QueryAsyncData.d.ts
|
|
7
|
-
export type QueryAsyncData<TDefinition extends TRPCResolverDef, TData, TPickKeys extends KeysOf<TData>, TDefault> = AsyncData<PickFrom<TData, TPickKeys> | TDefault, QueryError<TDefinition> | undefined>;
|
|
8
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { NuxtError } from "nuxt/app";
|
|
2
|
-
import { TRPCClientErrorLike, TRPCResolverDef } from "@trpc/client";
|
|
3
|
-
//#region src/runtime/client/models/QueryError.d.ts
|
|
4
|
-
export type QueryError<TDefinition extends TRPCResolverDef> = NuxtError<TRPCClientErrorLike<TDefinition>["data"]>;
|
|
5
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/client/models/SubscriptionStatus.d.ts
|
|
2
|
-
export declare const SubscriptionStatus: {
|
|
3
|
-
readonly Connecting: "connecting";
|
|
4
|
-
readonly Error: "error";
|
|
5
|
-
readonly Idle: "idle";
|
|
6
|
-
readonly Pending: "pending";
|
|
7
|
-
};
|
|
8
|
-
export type SubscriptionStatus = (typeof SubscriptionStatus)[keyof typeof SubscriptionStatus];
|
|
9
|
-
//#endregion
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { DecoratedRouterRecord } from "./DecoratedRouterRecord.js";
|
|
2
|
-
import { AnyTRPCRouter } from "@trpc/server";
|
|
3
|
-
//#region src/runtime/client/models/TRPCNuxtClient.d.ts
|
|
4
|
-
export type TRPCNuxtClient<TRouter extends AnyTRPCRouter> = DecoratedRouterRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>;
|
|
5
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { KeysOf } from "./KeysOf.js";
|
|
2
|
-
import { AsyncDataOptions } from "nuxt/app";
|
|
3
|
-
import { TRPCRequestOptions, TRPCResolverDef } from "@trpc/client";
|
|
4
|
-
import { Except } from "type-fest";
|
|
5
|
-
//#region src/runtime/client/models/UseMutationOptions.d.ts
|
|
6
|
-
export type UseMutationOptions<TDefinition extends TRPCResolverDef, TData = TDefinition["output"], TPickKeys extends KeysOf<TData> = KeysOf<TData>, TDefault = undefined> = Except<AsyncDataOptions<TDefinition["output"], TData, TPickKeys, TDefault>, "enabled" | "immediate" | "lazy" | "server" | "watch"> & {
|
|
7
|
-
mutationKey?: string;
|
|
8
|
-
trpc?: TRPCRequestOptions;
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { KeysOf } from "./KeysOf.js";
|
|
2
|
-
import { PickFrom } from "./PickFrom.js";
|
|
3
|
-
import { QueryAsyncData } from "./QueryAsyncData.js";
|
|
4
|
-
import { TRPCResolverDef } from "@trpc/client";
|
|
5
|
-
//#region src/runtime/client/models/UseMutationReturn.d.ts
|
|
6
|
-
export type UseMutationReturn<TDefinition extends TRPCResolverDef, TData, TPickKeys extends KeysOf<TData>, TDefault> = QueryAsyncData<TDefinition, TData, TPickKeys, TDefault> & {
|
|
7
|
-
mutate: (input: TDefinition["input"]) => Promise<PickFrom<TData, TPickKeys> | TDefault>;
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { KeysOf } from "./KeysOf.js";
|
|
2
|
-
import { QueryAsyncData } from "./QueryAsyncData.js";
|
|
3
|
-
import { UseQueryOptions } from "./UseQueryOptions.js";
|
|
4
|
-
import { MaybeRefOrGetter } from "vue";
|
|
5
|
-
import { TRPCResolverDef } from "@trpc/client";
|
|
6
|
-
//#region src/runtime/client/models/UseQuery.d.ts
|
|
7
|
-
export type UseQuery<TDefinition extends TRPCResolverDef> = <TData = TDefinition["output"], TPickKeys extends KeysOf<TData> = KeysOf<TData>, TDefault = undefined>(input: MaybeRefOrGetter<TDefinition["input"]>, options?: UseQueryOptions<TDefinition, TData, TPickKeys, TDefault>) => QueryAsyncData<TDefinition, TData, TPickKeys, TDefault>;
|
|
8
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { KeysOf } from "./KeysOf.js";
|
|
2
|
-
import { AsyncDataOptions } from "nuxt/app";
|
|
3
|
-
import { TRPCRequestOptions, TRPCResolverDef } from "@trpc/client";
|
|
4
|
-
import { Except } from "type-fest";
|
|
5
|
-
//#region src/runtime/client/models/UseQueryOptions.d.ts
|
|
6
|
-
export type UseQueryOptions<TDefinition extends TRPCResolverDef, TData = TDefinition["output"], TPickKeys extends KeysOf<TData> = KeysOf<TData>, TDefault = undefined> = Except<AsyncDataOptions<TDefinition["output"], TData, TPickKeys, TDefault>, "watch"> & {
|
|
7
|
-
queryKey?: string;
|
|
8
|
-
trpc?: TRPCRequestOptions;
|
|
9
|
-
watch?: false | NonNullable<AsyncDataOptions<TDefinition["output"], TData, TPickKeys, TDefault>["watch"]>;
|
|
10
|
-
};
|
|
11
|
-
//#endregion
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MaybeRefOrGetter } from "vue";
|
|
2
|
-
import { SubscriptionResolver, TRPCResolverDef } from "@trpc/client";
|
|
3
|
-
//#region src/runtime/client/models/UseSubscriptionOptions.d.ts
|
|
4
|
-
export type UseSubscriptionOptions<TDefinition extends TRPCResolverDef> = Parameters<SubscriptionResolver<TDefinition>>[1] & {
|
|
5
|
-
enabled?: MaybeRefOrGetter<boolean>;
|
|
6
|
-
};
|
|
7
|
-
//#endregion
|