@trpc/server 11.0.0-next-alpha.170 → 11.0.0-next-alpha.175
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/dist/{unstableDoNotImportThis.d.ts → @trpc-core-unstable-do-not-import-this-please.d.ts} +1 -1
- package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts.map +1 -0
- package/dist/@trpc-server/http.d.ts +2 -0
- package/dist/@trpc-server/http.d.ts.map +1 -0
- package/dist/@trpc-server.d.ts +37 -0
- package/dist/@trpc-server.d.ts.map +1 -0
- package/dist/adapters/aws-lambda/index.d.ts +11 -1
- package/dist/adapters/aws-lambda/index.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/index.js +20 -0
- package/dist/adapters/aws-lambda/index.mjs +20 -0
- package/dist/adapters/aws-lambda/utils.d.ts +11 -1
- package/dist/adapters/aws-lambda/utils.d.ts.map +1 -1
- package/dist/adapters/express.d.ts +11 -1
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/express.js +2 -2
- package/dist/adapters/express.mjs +2 -2
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts +1 -1
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +11 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
- package/dist/adapters/fastify/index.js +11 -2
- package/dist/adapters/fastify/index.mjs +11 -2
- package/dist/adapters/fetch/fetchRequestHandler.d.ts +11 -1
- package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fetch/index.js +10 -0
- package/dist/adapters/fetch/index.mjs +10 -0
- package/dist/adapters/fetch/types.d.ts +12 -2
- package/dist/adapters/fetch/types.d.ts.map +1 -1
- package/dist/adapters/next.d.ts +11 -1
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +12 -2
- package/dist/adapters/next.mjs +12 -2
- package/dist/adapters/node-http/content-type/form-data/index.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/form-data/index.js +1 -1
- package/dist/adapters/node-http/content-type/form-data/index.mjs +1 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/json/index.js +2 -1
- package/dist/adapters/node-http/content-type/json/index.mjs +2 -1
- package/dist/adapters/node-http/index.js +2 -2
- package/dist/adapters/node-http/index.mjs +2 -2
- package/dist/adapters/node-http/internals/contentType.d.ts +2 -2
- package/dist/adapters/node-http/internals/contentType.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +11 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/types.d.ts +13 -2
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/adapters/standalone.d.ts +11 -1
- package/dist/adapters/standalone.d.ts.map +1 -1
- package/dist/adapters/standalone.js +2 -2
- package/dist/adapters/standalone.mjs +2 -2
- package/dist/adapters/ws.d.ts +2 -1
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +1 -1
- package/dist/adapters/ws.mjs +1 -1
- package/dist/bundle-analysis.json +72 -72
- package/dist/{contentType-3194ed5f.mjs → contentType-72ed9df5.mjs} +1 -0
- package/dist/{contentType-8c16408e.js → contentType-d9d22104.js} +1 -0
- package/dist/http.d.ts +1 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/index.d.ts +1 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -8
- package/dist/index.mjs +1 -1
- package/dist/{nodeHTTPRequestHandler-36974696.mjs → nodeHTTPRequestHandler-0223fac5.mjs} +10 -0
- package/dist/{nodeHTTPRequestHandler-30028c9a.js → nodeHTTPRequestHandler-83441c73.js} +10 -0
- package/package.json +4 -20
- package/src/@trpc-server/http.ts +2 -0
- package/src/@trpc-server.ts +60 -0
- package/src/adapters/aws-lambda/index.ts +14 -2
- package/src/adapters/aws-lambda/utils.ts +14 -2
- package/src/adapters/express.ts +12 -1
- package/src/adapters/fastify/fastifyRequestHandler.ts +12 -1
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +12 -1
- package/src/adapters/fetch/fetchRequestHandler.ts +12 -1
- package/src/adapters/fetch/types.ts +17 -2
- package/src/adapters/next.ts +14 -2
- package/src/adapters/node-http/content-type/form-data/index.ts +2 -1
- package/src/adapters/node-http/content-type/json/getPostBody.ts +2 -1
- package/src/adapters/node-http/internals/contentType.ts +4 -2
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +12 -1
- package/src/adapters/node-http/types.ts +19 -2
- package/src/adapters/standalone.ts +12 -1
- package/src/adapters/ws.ts +10 -8
- package/src/http.ts +1 -2
- package/src/index.ts +1 -35
- package/dist/unstableDoNotImportThis.d.ts.map +0 -1
- /package/dist/{nodeHTTPRequestHandler-640c1f60.js → nodeHTTPRequestHandler-aa0dce4e.js} +0 -0
- /package/src/{unstableDoNotImportThis.ts → @trpc-core-unstable-do-not-import-this-please.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-next-alpha.
|
|
3
|
+
"version": "11.0.0-next-alpha.175+2d1b3f6ac",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,28 +13,12 @@
|
|
|
13
13
|
"url": "git+https://github.com/trpc/trpc.git",
|
|
14
14
|
"directory": "packages/server"
|
|
15
15
|
},
|
|
16
|
-
"eslintConfig": {
|
|
17
|
-
"overrides": [
|
|
18
|
-
{
|
|
19
|
-
"files": [
|
|
20
|
-
"src"
|
|
21
|
-
],
|
|
22
|
-
"rules": {
|
|
23
|
-
"explicit-module-boundary-types": "off",
|
|
24
|
-
"no-restricted-imports": [
|
|
25
|
-
"error",
|
|
26
|
-
"@trpc/server"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
16
|
"scripts": {
|
|
33
17
|
"build": "rollup --config rollup.config.ts --configPlugin rollup-plugin-swc3",
|
|
34
18
|
"dev": "pnpm build --watch",
|
|
35
19
|
"codegen-entrypoints": "tsx entrypoints.script.ts",
|
|
36
20
|
"benchmark": "tsc --project tsconfig.benchmark.json",
|
|
37
|
-
"lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore
|
|
21
|
+
"lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore src",
|
|
38
22
|
"ts-watch": "tsc --watch"
|
|
39
23
|
},
|
|
40
24
|
"exports": {
|
|
@@ -131,7 +115,7 @@
|
|
|
131
115
|
"access": "public"
|
|
132
116
|
},
|
|
133
117
|
"dependencies": {
|
|
134
|
-
"@trpc/core": "11.0.0-next-alpha.
|
|
118
|
+
"@trpc/core": "11.0.0-next-alpha.175+2d1b3f6ac"
|
|
135
119
|
},
|
|
136
120
|
"devDependencies": {
|
|
137
121
|
"@fastify/websocket": "^7.1.2",
|
|
@@ -170,5 +154,5 @@
|
|
|
170
154
|
"funding": [
|
|
171
155
|
"https://trpc.io/sponsor"
|
|
172
156
|
],
|
|
173
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "2d1b3f6ac5bcb646f634bd27cd6ff04155feab8e"
|
|
174
158
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export {
|
|
2
|
+
TRPCError,
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated use `experimental_trpcMiddleware` instead
|
|
5
|
+
*/
|
|
6
|
+
experimental_standaloneMiddleware,
|
|
7
|
+
experimental_standaloneMiddleware as experimental_trpcMiddleware,
|
|
8
|
+
initTRPC,
|
|
9
|
+
callProcedure as callTRPCProcedure,
|
|
10
|
+
getTRPCErrorFromUnknown,
|
|
11
|
+
transformTRPCResponse,
|
|
12
|
+
type inferProcedureInput,
|
|
13
|
+
type inferProcedureOutput,
|
|
14
|
+
type inferRouterError,
|
|
15
|
+
type inferRouterInputs,
|
|
16
|
+
type inferRouterOutputs,
|
|
17
|
+
type inferRouterContext,
|
|
18
|
+
type AnyProcedure as AnyTRPCProcedure,
|
|
19
|
+
type AnyRouter as AnyTRPCRouter,
|
|
20
|
+
type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction,
|
|
21
|
+
type CombinedDataTransformer as TRPCCombinedDataTransformer,
|
|
22
|
+
} from './@trpc-core-unstable-do-not-import-this-please';
|
|
23
|
+
|
|
24
|
+
export type {
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use `AnyTRPCProcedure` instead
|
|
27
|
+
*/
|
|
28
|
+
AnyProcedure,
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated use `AnyTRPCRouter` instead
|
|
31
|
+
*/
|
|
32
|
+
AnyRouter,
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use `AnyTRPCMiddlewareFunction` instead
|
|
35
|
+
*/
|
|
36
|
+
AnyMiddlewareFunction,
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated use `TRPCCombinedDataTransformer` instead
|
|
39
|
+
*/
|
|
40
|
+
CombinedDataTransformer,
|
|
41
|
+
} from '@trpc/core';
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated use `getTRPCErrorShape` instead
|
|
46
|
+
*/
|
|
47
|
+
getErrorShape,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated use `callTRPCProcedure` instead
|
|
51
|
+
*/
|
|
52
|
+
callProcedure,
|
|
53
|
+
} from '@trpc/core';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated
|
|
57
|
+
* Use `Awaited<ReturnType<typeof myFunction>>` instead
|
|
58
|
+
*/
|
|
59
|
+
export type inferAsyncReturnType<TFunction extends (...args: any[]) => any> =
|
|
60
|
+
Awaited<ReturnType<TFunction>>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
import type {
|
|
4
12
|
APIGatewayProxyEvent,
|
|
5
13
|
APIGatewayProxyEventV2,
|
|
@@ -7,6 +15,10 @@ import type {
|
|
|
7
15
|
APIGatewayProxyStructuredResultV2,
|
|
8
16
|
Context as APIGWContext,
|
|
9
17
|
} from 'aws-lambda';
|
|
18
|
+
// @trpc/server
|
|
19
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
20
|
+
// @trpc/server
|
|
21
|
+
import { TRPCError } from '../../@trpc-server';
|
|
10
22
|
import type {
|
|
11
23
|
HTTPRequest,
|
|
12
24
|
HTTPResponse,
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
import type {
|
|
4
12
|
APIGatewayProxyEvent,
|
|
5
13
|
APIGatewayProxyEventV2,
|
|
@@ -7,6 +15,10 @@ import type {
|
|
|
7
15
|
APIGatewayProxyStructuredResultV2,
|
|
8
16
|
Context as APIGWContext,
|
|
9
17
|
} from 'aws-lambda';
|
|
18
|
+
import type { AnyRouter, inferRouterContext } from '../../@trpc-server'; // import @trpc/server
|
|
19
|
+
|
|
20
|
+
// @trpc/server
|
|
21
|
+
import { TRPCError } from '../../@trpc-server';
|
|
10
22
|
import type {
|
|
11
23
|
HTTPHeaders,
|
|
12
24
|
OnErrorFunction,
|
package/src/adapters/express.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
2
11
|
import type * as express from 'express';
|
|
12
|
+
// @trpc/server
|
|
13
|
+
import type { AnyRouter } from '../@trpc-server';
|
|
3
14
|
import type {
|
|
4
15
|
NodeHTTPCreateContextFnOptions,
|
|
5
16
|
NodeHTTPHandlerOptions,
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
import { Readable } from 'node:stream';
|
|
2
|
-
import type { AnyRouter } from '@trpc/core';
|
|
3
12
|
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
13
|
+
// @trpc/server
|
|
14
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
4
15
|
import type {
|
|
5
16
|
HTTPBaseHandlerOptions,
|
|
6
17
|
HTTPRequest,
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
/// <reference types="@fastify/websocket" />
|
|
2
|
-
import type { AnyRouter } from '@trpc/core';
|
|
3
12
|
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
4
13
|
import type { FastifyHandlerOptions } from '.';
|
|
14
|
+
// @trpc/server
|
|
15
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
5
16
|
import type { NodeHTTPCreateContextFnOptions } from '../node-http';
|
|
6
17
|
import type { WSSHandlerOptions } from '../ws';
|
|
7
18
|
import { applyWSSHandler } from '../ws';
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
// @trpc/server
|
|
12
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
2
13
|
import type {
|
|
3
14
|
HTTPRequest,
|
|
4
15
|
HTTPResponse,
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
// @trpc/server
|
|
12
|
+
import type { AnyRouter, inferRouterContext } from '../../@trpc-server';
|
|
13
|
+
// @trpc/server/http
|
|
14
|
+
import type {
|
|
15
|
+
HTTPBaseHandlerOptions,
|
|
16
|
+
TRPCRequestInfo,
|
|
17
|
+
} from '../../@trpc-server/http';
|
|
3
18
|
|
|
4
19
|
export type FetchCreateContextFnOptions = {
|
|
5
20
|
req: Request;
|
package/src/adapters/next.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
12
|
+
// @trpc/server
|
|
13
|
+
import type { AnyRouter } from '../@trpc-server';
|
|
14
|
+
// @trpc/server
|
|
15
|
+
import { getErrorShape, TRPCError } from '../@trpc-server';
|
|
4
16
|
import type {
|
|
5
17
|
NodeHTTPCreateContextFnOptions,
|
|
6
18
|
NodeHTTPHandlerOptions,
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as fs from 'fs/promises';
|
|
12
12
|
import { Readable } from 'node:stream';
|
|
13
|
-
import type { CombinedDataTransformer } from '@trpc/core';
|
|
14
13
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
14
|
// @ts-ignore the type definitions for this package are borked
|
|
16
15
|
import { streamMultipart } from '@web3-storage/multipart-parser';
|
|
16
|
+
// @trpc/server
|
|
17
|
+
import type { CombinedDataTransformer } from '../../../../@trpc-server';
|
|
17
18
|
import { createNodeHTTPContentTypeHandler } from '../../internals/contentType';
|
|
18
19
|
import type { NodeHTTPRequest } from '../../types';
|
|
19
20
|
import { NodeOnDiskFile } from './fileUploadHandler';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
// @trpc/server
|
|
2
|
+
import type { AnyRouter } from '../../../@trpc-server';
|
|
3
|
+
// @trpc/server/http
|
|
4
|
+
import type { BaseContentTypeHandler } from '../../../@trpc-server/http';
|
|
3
5
|
import type {
|
|
4
6
|
NodeHTTPRequest,
|
|
5
7
|
NodeHTTPRequestHandlerOptions,
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
|
|
12
|
+
// @trpc/server
|
|
13
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
3
14
|
import type {
|
|
4
15
|
HTTPRequest,
|
|
5
16
|
HTTPResponse,
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
-
|
|
3
|
-
import type {
|
|
12
|
+
// eslint-disable-next-line no-restricted-imports
|
|
13
|
+
import type { MaybePromise } from '@trpc/core';
|
|
14
|
+
// @trpc/server
|
|
15
|
+
import type { AnyRouter, inferRouterContext } from '../../@trpc-server';
|
|
16
|
+
// @trpc/server/http
|
|
17
|
+
import type {
|
|
18
|
+
HTTPBaseHandlerOptions,
|
|
19
|
+
TRPCRequestInfo,
|
|
20
|
+
} from '../../@trpc-server/http';
|
|
4
21
|
import type { NodeHTTPContentTypeHandler } from './internals/contentType';
|
|
5
22
|
|
|
6
23
|
interface ParsedQs {
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
+
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
8
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
12
|
import http from 'http';
|
|
3
|
-
|
|
13
|
+
// @trpc/server
|
|
14
|
+
import type { AnyRouter } from '../@trpc-server';
|
|
4
15
|
import type {
|
|
5
16
|
NodeHTTPCreateContextFnOptions,
|
|
6
17
|
NodeHTTPHandlerOptions,
|
package/src/adapters/ws.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'http';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
callProcedure,
|
|
5
|
-
getErrorShape,
|
|
6
|
-
getTRPCErrorFromUnknown,
|
|
7
|
-
transformTRPCResponse,
|
|
8
|
-
TRPCError,
|
|
9
|
-
} from '@trpc/core';
|
|
2
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3
|
+
import type { MaybePromise } from '@trpc/core';
|
|
10
4
|
import type { BaseHandlerOptions } from '@trpc/core/http';
|
|
11
5
|
import type { Unsubscribable } from '@trpc/core/observable';
|
|
12
6
|
import { isObservable } from '@trpc/core/observable';
|
|
@@ -18,6 +12,14 @@ import type {
|
|
|
18
12
|
} from '@trpc/core/rpc';
|
|
19
13
|
import { parseTRPCMessage } from '@trpc/core/rpc';
|
|
20
14
|
import type ws from 'ws';
|
|
15
|
+
import type { AnyRouter, inferRouterContext } from '../@trpc-server';
|
|
16
|
+
import {
|
|
17
|
+
callProcedure,
|
|
18
|
+
getErrorShape,
|
|
19
|
+
getTRPCErrorFromUnknown,
|
|
20
|
+
transformTRPCResponse,
|
|
21
|
+
TRPCError,
|
|
22
|
+
} from '../@trpc-server';
|
|
21
23
|
import type { NodeHTTPCreateContextFnOptions } from './node-http';
|
|
22
24
|
|
|
23
25
|
/**
|
package/src/http.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '@trpc/core/http';
|
|
1
|
+
export * from './@trpc-server/http';
|
package/src/index.ts
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
TRPCError,
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated use `experimental_trpcMiddleware` instead
|
|
5
|
-
*/
|
|
6
|
-
experimental_standaloneMiddleware,
|
|
7
|
-
experimental_standaloneMiddleware as experimental_trpcMiddleware,
|
|
8
|
-
initTRPC,
|
|
9
|
-
type inferProcedureInput,
|
|
10
|
-
type inferProcedureOutput,
|
|
11
|
-
type inferRouterError,
|
|
12
|
-
type inferRouterInputs,
|
|
13
|
-
type inferRouterOutputs,
|
|
14
|
-
type AnyProcedure as AnyTRPCProcedure,
|
|
15
|
-
type AnyRouter as AnyTRPCRouter,
|
|
16
|
-
} from './unstableDoNotImportThis';
|
|
17
|
-
|
|
18
|
-
export type {
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated use `AnyTRPCProcedure` instead
|
|
21
|
-
*/
|
|
22
|
-
AnyProcedure,
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated use `AnyTRPCRouter` instead
|
|
25
|
-
*/
|
|
26
|
-
AnyRouter,
|
|
27
|
-
AnyMiddlewareFunction,
|
|
28
|
-
} from '@trpc/core';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated
|
|
32
|
-
* Use `Awaited<ReturnType<typeof myFunction>>` instead
|
|
33
|
-
*/
|
|
34
|
-
export type inferAsyncReturnType<TFunction extends (...args: any[]) => any> =
|
|
35
|
-
Awaited<ReturnType<TFunction>>;
|
|
1
|
+
export * from './@trpc-server';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unstableDoNotImportThis.d.ts","sourceRoot":"","sources":["../src/unstableDoNotImportThis.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC"}
|
|
File without changes
|
/package/src/{unstableDoNotImportThis.ts → @trpc-core-unstable-do-not-import-this-please.ts}
RENAMED
|
File without changes
|