@trpc/server 11.0.0-alpha-tmp.233 → 11.0.0-alpha-tmp-v11-trpc-sveltekit.191
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 +4 -4
- 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 +45 -0
- package/dist/@trpc-server.d.ts.map +1 -0
- package/dist/adapters/aws-lambda/index.d.ts +12 -2
- 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 +14 -5
- package/dist/adapters/aws-lambda/utils.d.ts.map +1 -1
- package/dist/adapters/express.d.ts +12 -2
- 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 +4 -4
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +14 -4
- 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 +12 -2
- 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 +14 -4
- package/dist/adapters/fetch/types.d.ts.map +1 -1
- package/dist/adapters/next.d.ts +12 -2
- 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/fileUploadHandler.d.ts +1 -1
- package/dist/adapters/node-http/content-type/form-data/fileUploadHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/form-data/index.d.ts +3 -3
- 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 +2 -2
- package/dist/adapters/node-http/content-type/form-data/index.mjs +2 -2
- package/dist/adapters/node-http/content-type/form-data/memoryUploadHandler.d.ts +2 -2
- package/dist/adapters/node-http/content-type/form-data/memoryUploadHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/form-data/streamSlice.d.ts +2 -1
- package/dist/adapters/node-http/content-type/form-data/streamSlice.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/form-data/uploadHandler.d.ts +2 -2
- package/dist/adapters/node-http/content-type/form-data/uploadHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.d.ts +2 -2
- 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 +3 -3
- package/dist/adapters/node-http/internals/contentType.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +12 -2
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/types.d.ts +17 -6
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/adapters/standalone.d.ts +12 -2
- 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 +10 -9
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +7 -3
- package/dist/adapters/ws.mjs +7 -3
- package/dist/bundle-analysis.json +80 -80
- 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 +71 -0
- package/src/adapters/aws-lambda/index.ts +20 -5
- package/src/adapters/aws-lambda/utils.ts +22 -6
- package/src/adapters/express.ts +14 -3
- package/src/adapters/fastify/fastifyRequestHandler.ts +16 -6
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +17 -5
- package/src/adapters/fetch/fetchRequestHandler.ts +15 -5
- package/src/adapters/fetch/types.ts +19 -4
- package/src/adapters/next.ts +16 -3
- package/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts +3 -2
- package/src/adapters/node-http/content-type/form-data/index.ts +7 -9
- package/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts +3 -2
- package/src/adapters/node-http/content-type/form-data/streamSlice.ts +2 -1
- package/src/adapters/node-http/content-type/form-data/uploadHandler.ts +2 -2
- package/src/adapters/node-http/content-type/json/getPostBody.ts +4 -3
- package/src/adapters/node-http/internals/contentType.ts +5 -3
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +16 -6
- package/src/adapters/node-http/types.ts +23 -6
- package/src/adapters/standalone.ts +14 -3
- package/src/adapters/ws.ts +29 -22
- package/src/http.ts +1 -2
- package/src/index.ts +1 -34
- 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/README.md
CHANGED
|
@@ -24,16 +24,16 @@ Full documentation for `@trpc/server` can be found [here](https://trpc.io/docs/r
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# npm
|
|
27
|
-
npm install @trpc/server
|
|
27
|
+
npm install @trpc/server@next
|
|
28
28
|
|
|
29
29
|
# Yarn
|
|
30
|
-
yarn add @trpc/server
|
|
30
|
+
yarn add @trpc/server@next
|
|
31
31
|
|
|
32
32
|
# pnpm
|
|
33
|
-
pnpm add @trpc/server
|
|
33
|
+
pnpm add @trpc/server@next
|
|
34
34
|
|
|
35
35
|
# Bun
|
|
36
|
-
bun add @trpc/server
|
|
36
|
+
bun add @trpc/server@next
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
We also recommend installing `zod` to validate procedure inputs.
|
package/dist/{unstableDoNotImportThis.d.ts → @trpc-core-unstable-do-not-import-this-please.d.ts}
RENAMED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* If you need to import anything from here, please open an issue at https://github.com/trpc/trpc/issues
|
|
7
7
|
*/
|
|
8
8
|
export * from '@trpc/core';
|
|
9
|
-
//# sourceMappingURL
|
|
9
|
+
//# sourceMappingURL=@trpc-core-unstable-do-not-import-this-please.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"@trpc-core-unstable-do-not-import-this-please.d.ts","sourceRoot":"","sources":["../src/@trpc-core-unstable-do-not-import-this-please.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/@trpc-server/http.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export { TRPCError,
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated use `experimental_trpcMiddleware` instead
|
|
4
|
+
*/
|
|
5
|
+
experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, type inferProcedureInput, type inferProcedureOutput, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, } from './@trpc-core-unstable-do-not-import-this-please';
|
|
6
|
+
export type {
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated use `AnyTRPCProcedure` instead
|
|
9
|
+
*/
|
|
10
|
+
AnyProcedure,
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use `AnyTRPCRouter` instead
|
|
13
|
+
*/
|
|
14
|
+
AnyRouter,
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use `AnyTRPCMiddlewareFunction` instead
|
|
17
|
+
*/
|
|
18
|
+
AnyMiddlewareFunction,
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use `TRPCCombinedDataTransformer` instead
|
|
21
|
+
*/
|
|
22
|
+
CombinedDataTransformer,
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated This is a utility type that is being removed
|
|
25
|
+
*/
|
|
26
|
+
Dict,
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated use `TRPCProcedureType` instead
|
|
29
|
+
*/
|
|
30
|
+
ProcedureType, } from '@trpc/core';
|
|
31
|
+
export {
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use `getTRPCErrorShape` instead
|
|
34
|
+
*/
|
|
35
|
+
getErrorShape,
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated use `callTRPCProcedure` instead
|
|
38
|
+
*/
|
|
39
|
+
callProcedure, } from '@trpc/core';
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
* Use `Awaited<ReturnType<typeof myFunction>>` instead
|
|
43
|
+
*/
|
|
44
|
+
export type inferAsyncReturnType<TFunction extends (...args: any[]) => any> = Awaited<ReturnType<TFunction>>;
|
|
45
|
+
//# sourceMappingURL=@trpc-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"@trpc-server.d.ts","sourceRoot":"","sources":["../src/@trpc-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS;AACT;;GAEG;AACH,iCAAiC,EACjC,iCAAiC,IAAI,2BAA2B,EAChE,QAAQ,EACR,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,aAAa,IAAI,iBAAiB,GACxC,MAAM,iDAAiD,CAAC;AAEzD,YAAY;AACV;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,uBAAuB;AAEvB;;GAEG;AACH,IAAI;AAEJ;;GAEG;AACH,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO;AACL;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IACxE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +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 { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyStructuredResultV2, Context as APIGWContext } from 'aws-lambda';
|
|
3
|
-
import {
|
|
12
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
13
|
+
import type { APIGatewayEvent, AWSLambdaOptions } from './utils';
|
|
4
14
|
export * from './utils';
|
|
5
15
|
/** 1:1 mapping of v1 or v2 input events, deduces which is which.
|
|
6
16
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,OAAO,IAAI,YAAY,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AASpD,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAUjB,cAAc,SAAS,CAAC;AAqDxB;;IAEI;AACJ,KAAK,gBAAgB,CAAC,KAAK,IAAI,KAAK,SAAS,oBAAoB,GAC7D,qBAAqB,GACrB,KAAK,SAAS,sBAAsB,GACpC,iCAAiC,GACjC,KAAK,CAAC;AACV,wBAAgB,uBAAuB,CACrC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,EAC9B,OAAO,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAExC,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,GACtC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CA4B5D"}
|
|
@@ -5,6 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var core = require('@trpc/core');
|
|
6
6
|
var http = require('@trpc/core/http');
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* 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`
|
|
10
|
+
*
|
|
11
|
+
* Do **not** import from `@trpc/core`
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
15
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
16
|
+
* ```
|
|
17
|
+
*/ // @trpc/server
|
|
8
18
|
function isPayloadV1(event) {
|
|
9
19
|
return determinePayloadFormat(event) == '1.0';
|
|
10
20
|
}
|
|
@@ -85,6 +95,16 @@ function transformHeaders(headers) {
|
|
|
85
95
|
}
|
|
86
96
|
const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
|
|
87
97
|
|
|
98
|
+
/**
|
|
99
|
+
* 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`
|
|
100
|
+
*
|
|
101
|
+
* Do **not** import from `@trpc/core`
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
105
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
106
|
+
* ```
|
|
107
|
+
*/ // @trpc/server
|
|
88
108
|
function lambdaEventToHTTPRequest(event) {
|
|
89
109
|
const query = new URLSearchParams();
|
|
90
110
|
for (const [key, value] of Object.entries(event.queryStringParameters ?? {})){
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { TRPCError } from '@trpc/core';
|
|
2
2
|
import { resolveHTTPResponse } from '@trpc/core/http';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 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`
|
|
6
|
+
*
|
|
7
|
+
* Do **not** import from `@trpc/core`
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
11
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
12
|
+
* ```
|
|
13
|
+
*/ // @trpc/server
|
|
4
14
|
function isPayloadV1(event) {
|
|
5
15
|
return determinePayloadFormat(event) == '1.0';
|
|
6
16
|
}
|
|
@@ -81,6 +91,16 @@ function transformHeaders(headers) {
|
|
|
81
91
|
}
|
|
82
92
|
const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
|
|
83
93
|
|
|
94
|
+
/**
|
|
95
|
+
* 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`
|
|
96
|
+
*
|
|
97
|
+
* Do **not** import from `@trpc/core`
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
101
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
102
|
+
* ```
|
|
103
|
+
*/ // @trpc/server
|
|
84
104
|
function lambdaEventToHTTPRequest(event) {
|
|
85
105
|
const query = new URLSearchParams();
|
|
86
106
|
for (const [key, value] of Object.entries(event.queryStringParameters ?? {})){
|
|
@@ -1,7 +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 { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyStructuredResultV2, Context as APIGWContext } from 'aws-lambda';
|
|
3
|
-
import {
|
|
4
|
-
import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn } from '../../http';
|
|
12
|
+
import type { AnyRouter, inferRouterContext } from '../../@trpc-server';
|
|
13
|
+
import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn, TRPCRequestInfo } from '../../http';
|
|
5
14
|
export type APIGatewayEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2;
|
|
6
15
|
export type APIGatewayResult = APIGatewayProxyResult | APIGatewayProxyStructuredResultV2;
|
|
7
16
|
export type CreateAWSLambdaContextOptions<TEvent extends APIGatewayEvent> = {
|
|
@@ -19,12 +28,12 @@ export type AWSLambdaOptions<TRouter extends AnyRouter, TEvent extends APIGatewa
|
|
|
19
28
|
responseMeta?: ResponseMetaFn<TRouter>;
|
|
20
29
|
} & ({
|
|
21
30
|
/**
|
|
22
|
-
* @link https://trpc.io/docs/context
|
|
31
|
+
* @link https://trpc.io/docs/v11/context
|
|
23
32
|
**/
|
|
24
33
|
createContext: AWSLambdaCreateContextFn<TRouter, TEvent>;
|
|
25
34
|
} | {
|
|
26
35
|
/**
|
|
27
|
-
* @link https://trpc.io/docs/context
|
|
36
|
+
* @link https://trpc.io/docs/v11/context
|
|
28
37
|
**/
|
|
29
38
|
createContext?: AWSLambdaCreateContextFn<TRouter, TEvent>;
|
|
30
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,OAAO,IAAI,YAAY,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxE,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AAEtC,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,eAAe,IAAI;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAC5B,CAAC,EACH,KAAK,EACL,OAAO,EACP,IAAI,GACL,EAAE,6BAA6B,CAAC,MAAM,CAAC,KACpC,kBAAkB,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzC,MAAM,MAAM,gBAAgB,CAC1B,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAE5B;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACxC,GAAG,CACA;IACE;;QAEI;IACJ,aAAa,EAAE,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC1D,GACD;IACE;;QAEI;IACJ,aAAa,CAAC,EAAE,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC3D,CACJ,CAAC;AAEN,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,oBAAoB,CAE/B;AACD,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,sBAAsB,CAEjC;AAoBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,UAWnD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,UA+B7C;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,GACnB,gBAAgB,CAAC,SAAS,CAAC,CAU7B;AAED,MAAM,MAAM,+BAA+B,GAAG,KAAK,GAAG,KAAK,CAAC;AAC5D,MAAM,MAAM,8BAA8B,GACtC,+BAA+B,GAC/B,QAAQ,CAAC;AAEb,eAAO,MAAM,4CAA4C,QAEiD,CAAC"}
|
|
@@ -1,6 +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';
|
|
3
|
-
import {
|
|
12
|
+
import type { AnyRouter } from '../@trpc-server';
|
|
13
|
+
import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from './node-http';
|
|
4
14
|
export type CreateExpressContextOptions = NodeHTTPCreateContextFnOptions<express.Request, express.Response>;
|
|
5
15
|
export declare function createExpressMiddleware<TRouter extends AnyRouter>(opts: NodeHTTPHandlerOptions<TRouter, express.Request, express.Response>): express.Handler;
|
|
6
16
|
//# sourceMappingURL=express.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/adapters/express.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/adapters/express.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CACtE,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,CACjB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,SAAS,EAC/D,IAAI,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GACvE,OAAO,CAAC,OAAO,CAgBjB"}
|
package/dist/adapters/express.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-83441c73.js');
|
|
6
6
|
require('@trpc/core/http');
|
|
7
7
|
require('./node-http/content-type/json/index.js');
|
|
8
|
-
require('../contentType-
|
|
8
|
+
require('../contentType-d9d22104.js');
|
|
9
9
|
require('@trpc/core');
|
|
10
10
|
|
|
11
11
|
function createExpressMiddleware(opts) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-
|
|
1
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-0223fac5.mjs';
|
|
2
2
|
import '@trpc/core/http';
|
|
3
3
|
import './node-http/content-type/json/index.mjs';
|
|
4
|
-
import '../contentType-
|
|
4
|
+
import '../contentType-72ed9df5.mjs';
|
|
5
5
|
import '@trpc/core';
|
|
6
6
|
|
|
7
7
|
function createExpressMiddleware(opts) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { HTTPBaseHandlerOptions } from '../../http';
|
|
4
|
-
import { NodeHTTPCreateContextOption } from '../node-http';
|
|
1
|
+
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
2
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
3
|
+
import type { HTTPBaseHandlerOptions } from '../../http';
|
|
4
|
+
import type { NodeHTTPCreateContextOption } from '../node-http';
|
|
5
5
|
export type FastifyHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = HTTPBaseHandlerOptions<TRouter, TRequest> & NodeHTTPCreateContextOption<TRouter, TRequest, TResponse>;
|
|
6
6
|
type FastifyRequestHandlerOptions<TRouter extends AnyRouter, TRequest extends FastifyRequest, TResponse extends FastifyReply> = FastifyHandlerOptions<TRouter, TRequest, TResponse> & {
|
|
7
7
|
req: TRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastifyRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyRequestHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fastifyRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyRequestHandler.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,MAAM,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,cAAc,EAC/B,SAAS,SAAS,YAAY,IAC5B,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAC3C,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAE5D,KAAK,4BAA4B,CAC/B,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,cAAc,EAC/B,SAAS,SAAS,YAAY,IAC5B,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG;IACxD,GAAG,EAAE,QAAQ,CAAC;IACd,GAAG,EAAE,SAAS,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,cAAc,EAC/B,SAAS,SAAS,YAAY,EAC9B,IAAI,EAAE,4BAA4B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,kBAyFjE"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
12
|
+
import type { FastifyHandlerOptions } from '.';
|
|
13
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
14
|
+
import type { NodeHTTPCreateContextFnOptions } from '../node-http';
|
|
5
15
|
export interface FastifyTRPCPluginOptions<TRouter extends AnyRouter> {
|
|
6
16
|
prefix?: string;
|
|
7
17
|
useWSS?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastifyTRPCPlugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fastifyTRPCPlugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,GAAG,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAKnE,MAAM,WAAW,wBAAwB,CAAC,OAAO,SAAS,SAAS;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CACtE,cAAc,EACd,YAAY,CACb,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,EACvC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,QAkC5B"}
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var node_stream = require('node:stream');
|
|
6
6
|
var http = require('@trpc/core/http');
|
|
7
7
|
var adapters_ws = require('../ws.js');
|
|
8
|
-
require('@trpc/core');
|
|
9
8
|
require('@trpc/core/observable');
|
|
10
9
|
require('@trpc/core/rpc');
|
|
10
|
+
require('@trpc/core');
|
|
11
11
|
|
|
12
12
|
async function fastifyRequestHandler(opts) {
|
|
13
13
|
const createContext = async (innerOpts)=>{
|
|
@@ -84,7 +84,16 @@ async function fastifyRequestHandler(opts) {
|
|
|
84
84
|
return promise;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* 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`
|
|
89
|
+
*
|
|
90
|
+
* Do **not** import from `@trpc/core`
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
94
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
95
|
+
* ```
|
|
96
|
+
*/ /// <reference types="@fastify/websocket" />
|
|
88
97
|
function fastifyTRPCPlugin(fastify, opts, done) {
|
|
89
98
|
fastify.removeContentTypeParser('application/json');
|
|
90
99
|
fastify.addContentTypeParser('application/json', {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
2
|
import { resolveHTTPResponse, getBatchStreamFormatter } from '@trpc/core/http';
|
|
3
3
|
import { applyWSSHandler } from '../ws.mjs';
|
|
4
|
-
import '@trpc/core';
|
|
5
4
|
import '@trpc/core/observable';
|
|
6
5
|
import '@trpc/core/rpc';
|
|
6
|
+
import '@trpc/core';
|
|
7
7
|
|
|
8
8
|
async function fastifyRequestHandler(opts) {
|
|
9
9
|
const createContext = async (innerOpts)=>{
|
|
@@ -80,7 +80,16 @@ async function fastifyRequestHandler(opts) {
|
|
|
80
80
|
return promise;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
/**
|
|
84
|
+
* 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`
|
|
85
|
+
*
|
|
86
|
+
* Do **not** import from `@trpc/core`
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
90
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
91
|
+
* ```
|
|
92
|
+
*/ /// <reference types="@fastify/websocket" />
|
|
84
93
|
function fastifyTRPCPlugin(fastify, opts, done) {
|
|
85
94
|
fastify.removeContentTypeParser('application/json');
|
|
86
95
|
fastify.addContentTypeParser('application/json', {
|
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
*/
|
|
11
|
+
import type { AnyRouter } from '../../@trpc-server';
|
|
12
|
+
import type { FetchHandlerOptions } from './types';
|
|
3
13
|
export type FetchHandlerRequestOptions<TRouter extends AnyRouter> = FetchHandlerOptions<TRouter> & {
|
|
4
14
|
req: Request;
|
|
5
15
|
endpoint: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,mBAAmB,CAAC,OAAO,CAAC,GAAG;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASJ,wBAAsB,mBAAmB,CAAC,OAAO,SAAS,SAAS,EACjE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,GACxC,OAAO,CAAC,QAAQ,CAAC,CAyGnB"}
|
|
@@ -4,6 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var http = require('@trpc/core/http');
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 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`
|
|
9
|
+
*
|
|
10
|
+
* Do **not** import from `@trpc/core`
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
14
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
15
|
+
* ```
|
|
16
|
+
*/ // @trpc/server
|
|
7
17
|
const trimSlashes = (path)=>{
|
|
8
18
|
path = path.startsWith('/') ? path.slice(1) : path;
|
|
9
19
|
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { resolveHTTPResponse, getBatchStreamFormatter } from '@trpc/core/http';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* 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`
|
|
5
|
+
*
|
|
6
|
+
* Do **not** import from `@trpc/core`
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
10
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
11
|
+
* ```
|
|
12
|
+
*/ // @trpc/server
|
|
3
13
|
const trimSlashes = (path)=>{
|
|
4
14
|
path = path.startsWith('/') ? path.slice(1) : path;
|
|
5
15
|
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
import type { AnyRouter, inferRouterContext } from '../../@trpc-server';
|
|
12
|
+
import type { HTTPBaseHandlerOptions, TRPCRequestInfo } from '../../@trpc-server/http';
|
|
3
13
|
export type FetchCreateContextFnOptions = {
|
|
4
14
|
req: Request;
|
|
5
15
|
resHeaders: Headers;
|
|
@@ -8,12 +18,12 @@ export type FetchCreateContextFnOptions = {
|
|
|
8
18
|
export type FetchCreateContextFn<TRouter extends AnyRouter> = (opts: FetchCreateContextFnOptions) => inferRouterContext<TRouter> | Promise<inferRouterContext<TRouter>>;
|
|
9
19
|
export type FetchCreateContextOption<TRouter extends AnyRouter> = unknown extends inferRouterContext<TRouter> ? {
|
|
10
20
|
/**
|
|
11
|
-
* @link https://trpc.io/docs/context
|
|
21
|
+
* @link https://trpc.io/docs/v11/context
|
|
12
22
|
**/
|
|
13
23
|
createContext?: FetchCreateContextFn<TRouter>;
|
|
14
24
|
} : {
|
|
15
25
|
/**
|
|
16
|
-
* @link https://trpc.io/docs/context
|
|
26
|
+
* @link https://trpc.io/docs/v11/context
|
|
17
27
|
**/
|
|
18
28
|
createContext: FetchCreateContextFn<TRouter>;
|
|
19
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,OAAO,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,SAAS,IAAI,CAC5D,IAAI,EAAE,2BAA2B,KAC9B,kBAAkB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAC5D,OAAO,SAAS,kBAAkB,CAAC,OAAO,CAAC,GACvC;IACE;;QAEI;IACJ,aAAa,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CAC/C,GACD;IACE;;QAEI;IACJ,aAAa,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CAC9C,CAAC;AAER,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,SAAS,IACvD,wBAAwB,CAAC,OAAO,CAAC,GAAG,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/adapters/next.d.ts
CHANGED
|
@@ -1,6 +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 { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
3
|
-
import {
|
|
12
|
+
import type { AnyRouter } from '../@trpc-server';
|
|
13
|
+
import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from './node-http';
|
|
4
14
|
export type CreateNextContextOptions = NodeHTTPCreateContextFnOptions<NextApiRequest, NextApiResponse>;
|
|
5
15
|
export type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
6
16
|
export declare function createNextApiHandler<TRouter extends AnyRouter>(opts: NodeHTTPHandlerOptions<TRouter, NextApiRequest, NextApiResponse>): NextApiHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/adapters/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/adapters/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CACnE,cAAc,EACd,eAAe,CAChB,CAAC;AACF,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5E,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,SAAS,EAC5D,IAAI,EAAE,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,eAAe,CAAC,GACrE,cAAc,CA8ChB"}
|
package/dist/adapters/next.js
CHANGED
|
@@ -3,11 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@trpc/core');
|
|
6
|
-
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-
|
|
6
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-83441c73.js');
|
|
7
7
|
require('@trpc/core/http');
|
|
8
8
|
require('./node-http/content-type/json/index.js');
|
|
9
|
-
require('../contentType-
|
|
9
|
+
require('../contentType-d9d22104.js');
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* 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`
|
|
13
|
+
*
|
|
14
|
+
* Do **not** import from `@trpc/core`
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
18
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
19
|
+
* ```
|
|
20
|
+
*/ // @trpc/server
|
|
11
21
|
function createNextApiHandler(opts) {
|
|
12
22
|
return async (req, res)=>{
|
|
13
23
|
function getPath() {
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { getErrorShape, TRPCError } from '@trpc/core';
|
|
2
|
-
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-
|
|
2
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-0223fac5.mjs';
|
|
3
3
|
import '@trpc/core/http';
|
|
4
4
|
import './node-http/content-type/json/index.mjs';
|
|
5
|
-
import '../contentType-
|
|
5
|
+
import '../contentType-72ed9df5.mjs';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 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`
|
|
9
|
+
*
|
|
10
|
+
* Do **not** import from `@trpc/core`
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
14
|
+
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
15
|
+
* ```
|
|
16
|
+
*/ // @trpc/server
|
|
7
17
|
function createNextApiHandler(opts) {
|
|
8
18
|
return async (req, res)=>{
|
|
9
19
|
function getPath() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { UploadHandler } from './uploadHandler';
|
|
3
|
+
import type { UploadHandler } from './uploadHandler';
|
|
4
4
|
export declare function readableStreamToString(stream: ReadableStream<Uint8Array>, encoding?: BufferEncoding): Promise<string>;
|
|
5
5
|
export type FileUploadHandlerFilterArgs = {
|
|
6
6
|
filename: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileUploadHandler.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/node-http/content-type/form-data/fileUploadHandler.ts"],"names":[],"mappings":";;AAoBA,OAAO,
|
|
1
|
+
{"version":3,"file":"fileUploadHandler.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/node-http/content-type/form-data/fileUploadHandler.ts"],"names":[],"mappings":";;AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,QAAQ,CAAC,EAAE,cAAc,mBAoB1B;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAC1C,IAAI,EAAE,iCAAiC,KACpC,MAAM,GAAG,SAAS,CAAC;AAExB,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,6BAA6B,GAAG,MAAM,CAAC;IACnD;;;OAGG;IACH,IAAI,CAAC,EAAE,6BAA6B,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACxE,CAAC;AA4BF,wBAAgB,uBAAuB,CAAC,EACtC,SAAoB,EACpB,kBAAyB,EACzB,IAA8B,EAC9B,MAAM,EACN,WAAqB,GACtB,GAAE,wBAA6B,GAAG,aAAa,CAyD/C;AAED,qBAAa,cAAc;IAMvB,OAAO,CAAC,QAAQ;IACT,IAAI,EAAE,MAAM;IACnB,OAAO,CAAC,MAAM,CAAC;IAPjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,SAAK;IACjB,kBAAkB,SAAM;gBAGd,QAAQ,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACX,MAAM,CAAC;eAAW,MAAM;aAAO,MAAM;iBAAE;IAKjD,IAAI,IAAI,IAAI,MAAM,CASjB;IAED,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc;IAkB5D,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAkBzC,MAAM,IAAI,cAAc,CAAC,GAAG,CAAC;IAC7B,MAAM,IAAI,MAAM,CAAC,cAAc;IAUzB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,SAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU;IAE9C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAGvB,WAAW,IAAI,MAAM;CAGtB"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
5
5
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
6
6
|
*/
|
|
7
|
-
import { NodeHTTPRequest } from '../../types';
|
|
8
|
-
import { UploadHandler } from './uploadHandler';
|
|
7
|
+
import type { NodeHTTPRequest } from '../../types';
|
|
8
|
+
import type { UploadHandler } from './uploadHandler';
|
|
9
9
|
/**
|
|
10
10
|
* Allows you to handle multipart forms (file uploads) for your app.
|
|
11
11
|
* Request body parts with a 'filename' property will be treated as files.
|
|
@@ -14,7 +14,7 @@ import { UploadHandler } from './uploadHandler';
|
|
|
14
14
|
* @param uploadHandler A function that handles file uploads and returns a value to be used in the request body. If uploaded to disk, the returned value is a NodeOnDiskFile. If uploaded to memory, the returned value is a File.
|
|
15
15
|
* @param maxBodySize The maximum size of the request body in bytes. Defaults to Infinity.
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @link https://remix.run/utils/parse-multipart-form-data
|
|
18
18
|
*/
|
|
19
19
|
declare function parseMultipartFormData(request: NodeHTTPRequest, uploadHandler: UploadHandler, maxBodySize?: number): Promise<FormData>;
|
|
20
20
|
declare function isMultipartFormDataRequest(req: NodeHTTPRequest): boolean;
|