@trpc/server 11.0.0-alpha-tmp-export-from-main-nuke-core.239 → 11.0.0-alpha-tmp-export-from-main.219
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/@trpc-server/http.d.ts +2 -0
- package/dist/@trpc-server/http.d.ts.map +1 -0
- package/dist/adapters/aws-lambda/index.d.ts +2 -1
- package/dist/adapters/aws-lambda/index.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/index.js +4 -6
- package/dist/adapters/aws-lambda/index.mjs +2 -4
- package/dist/adapters/aws-lambda/utils.d.ts +3 -2
- package/dist/adapters/aws-lambda/utils.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/utils.js +4 -5
- package/dist/adapters/aws-lambda/utils.mjs +2 -3
- package/dist/adapters/express.d.ts +2 -1
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts +2 -2
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyRequestHandler.js +3 -6
- package/dist/adapters/fastify/fastifyRequestHandler.mjs +1 -4
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +2 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.js +1 -0
- package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +1 -0
- package/dist/adapters/fetch/fetchRequestHandler.d.ts +2 -1
- package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fetch/fetchRequestHandler.js +4 -6
- package/dist/adapters/fetch/fetchRequestHandler.mjs +2 -4
- package/dist/adapters/fetch/types.d.ts +3 -2
- package/dist/adapters/fetch/types.d.ts.map +1 -1
- package/dist/adapters/next.d.ts +3 -1
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +4 -6
- package/dist/adapters/next.mjs +2 -4
- package/dist/adapters/node-http/content-type/json/getPostBody.d.ts +1 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/json/getPostBody.js +2 -4
- package/dist/adapters/node-http/content-type/json/getPostBody.mjs +1 -3
- package/dist/adapters/node-http/content-type/json/index.js +2 -4
- package/dist/adapters/node-http/content-type/json/index.mjs +1 -3
- 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 +2 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.js +4 -6
- package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +2 -4
- package/dist/adapters/node-http/types.d.ts +4 -3
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/adapters/standalone.d.ts +2 -1
- package/dist/adapters/standalone.d.ts.map +1 -1
- package/dist/adapters/standalone.js +0 -1
- package/dist/adapters/standalone.mjs +0 -1
- package/dist/adapters/ws.d.ts +2 -3
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +26 -33
- package/dist/adapters/ws.mjs +1 -8
- package/dist/http.d.ts +6 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +21 -11
- package/dist/http.mjs +1 -6
- package/dist/index.d.ts +68 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -18
- package/dist/index.mjs +1 -8
- package/dist/observable.d.ts +3 -0
- package/dist/observable.d.ts.map +1 -0
- package/dist/observable.js +30 -0
- package/dist/observable.mjs +1 -0
- package/dist/rpc.d.ts +2 -1
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +13 -6
- package/dist/rpc.mjs +1 -3
- package/dist/shared.d.ts +1 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +9 -6
- package/dist/shared.mjs +1 -4
- package/dist/unstableDontImportMe.d.ts +10 -0
- package/dist/unstableDontImportMe.d.ts.map +1 -0
- package/dist/unstableDontImportMe.js +142 -0
- package/dist/unstableDontImportMe.mjs +1 -0
- package/package.json +135 -52
- package/src/@trpc-server/http.ts +2 -0
- package/src/adapters/aws-lambda/index.ts +5 -4
- package/src/adapters/aws-lambda/utils.ts +4 -3
- package/src/adapters/express.ts +3 -1
- package/src/adapters/fastify/fastifyRequestHandler.ts +4 -6
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +2 -1
- package/src/adapters/fetch/fetchRequestHandler.ts +4 -6
- package/src/adapters/fetch/types.ts +3 -2
- package/src/adapters/next.ts +4 -2
- package/src/adapters/node-http/content-type/form-data/index.ts +1 -1
- package/src/adapters/node-http/content-type/json/getPostBody.ts +2 -2
- package/src/adapters/node-http/content-type/json/index.ts +1 -1
- package/src/adapters/node-http/internals/contentType.ts +2 -2
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +4 -6
- package/src/adapters/node-http/types.ts +5 -4
- package/src/adapters/standalone.ts +2 -2
- package/src/adapters/ws.ts +13 -14
- package/src/http.ts +26 -1
- package/src/index.ts +105 -1
- package/src/observable.ts +16 -0
- package/src/rpc.ts +26 -1
- package/src/shared.ts +1 -1
- package/src/unstableDontImportMe.ts +146 -0
- package/unstableDontImportMe/index.d.ts +1 -0
- package/unstableDontImportMe/index.js +1 -0
- package/dist/@trpc/server/http.d.ts +0 -7
- package/dist/@trpc/server/http.d.ts.map +0 -1
- package/dist/@trpc/server/index.d.ts +0 -69
- package/dist/@trpc/server/index.d.ts.map +0 -1
- package/dist/@trpc/server/rpc.d.ts +0 -3
- package/dist/@trpc/server/rpc.d.ts.map +0 -1
- package/dist/bundle-analysis.json +0 -757
- package/dist/observable/index.d.ts +0 -5
- package/dist/observable/index.d.ts.map +0 -1
- package/dist/observable/index.js +0 -13
- package/dist/observable/index.mjs +0 -2
- package/dist/observable/observable.d.ts +0 -13
- package/dist/observable/observable.d.ts.map +0 -1
- package/dist/observable/observable.js +0 -126
- package/dist/observable/observable.mjs +0 -122
- package/dist/observable/operators.d.ts +0 -8
- package/dist/observable/operators.d.ts.map +0 -1
- package/dist/observable/operators.js +0 -103
- package/dist/observable/operators.mjs +0 -99
- package/dist/observable/types.d.ts +0 -26
- package/dist/observable/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts +0 -6
- package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/createProxy.d.ts +0 -19
- package/dist/unstable-core-do-not-import/createProxy.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/createProxy.js +0 -52
- package/dist/unstable-core-do-not-import/createProxy.mjs +0 -49
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +0 -13
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/error/TRPCError.js +0 -67
- package/dist/unstable-core-do-not-import/error/TRPCError.mjs +0 -63
- package/dist/unstable-core-do-not-import/error/formatter.d.ts +0 -33
- package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/error/formatter.js +0 -7
- package/dist/unstable-core-do-not-import/error/formatter.mjs +0 -5
- package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +0 -15
- package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/error/getErrorShape.js +0 -31
- package/dist/unstable-core-do-not-import/error/getErrorShape.mjs +0 -29
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +0 -24
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.js +0 -32
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.mjs +0 -30
- package/dist/unstable-core-do-not-import/http/contentType.d.ts +0 -29
- package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/contentType.js +0 -54
- package/dist/unstable-core-do-not-import/http/contentType.mjs +0 -52
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +0 -5
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +0 -51
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +0 -48
- package/dist/unstable-core-do-not-import/http/index.d.ts +0 -7
- package/dist/unstable-core-do-not-import/http/index.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts +0 -51
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.js +0 -295
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs +0 -293
- package/dist/unstable-core-do-not-import/http/types.d.ts +0 -96
- package/dist/unstable-core-do-not-import/http/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/index.d.ts +0 -37
- package/dist/unstable-core-do-not-import/index.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/index.js +0 -48
- package/dist/unstable-core-do-not-import/index.mjs +0 -16
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +0 -96
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/initTRPC.js +0 -95
- package/dist/unstable-core-do-not-import/initTRPC.mjs +0 -93
- package/dist/unstable-core-do-not-import/middleware.d.ts +0 -105
- package/dist/unstable-core-do-not-import/middleware.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/middleware.js +0 -95
- package/dist/unstable-core-do-not-import/middleware.mjs +0 -89
- package/dist/unstable-core-do-not-import/parser.d.ts +0 -30
- package/dist/unstable-core-do-not-import/parser.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/parser.js +0 -37
- package/dist/unstable-core-do-not-import/parser.mjs +0 -35
- package/dist/unstable-core-do-not-import/procedure.d.ts +0 -72
- package/dist/unstable-core-do-not-import/procedure.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/procedure.js +0 -9
- package/dist/unstable-core-do-not-import/procedure.mjs +0 -7
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +0 -101
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.js +0 -176
- package/dist/unstable-core-do-not-import/procedureBuilder.mjs +0 -173
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +0 -75
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rootConfig.js +0 -8
- package/dist/unstable-core-do-not-import/rootConfig.mjs +0 -6
- package/dist/unstable-core-do-not-import/router.d.ts +0 -85
- package/dist/unstable-core-do-not-import/router.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/router.js +0 -156
- package/dist/unstable-core-do-not-import/router.mjs +0 -151
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts +0 -51
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/codes.js +0 -38
- package/dist/unstable-core-do-not-import/rpc/codes.mjs +0 -35
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +0 -97
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/index.d.ts +0 -5
- package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +0 -5
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.js +0 -59
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.mjs +0 -57
- package/dist/unstable-core-do-not-import/serialize.d.ts +0 -62
- package/dist/unstable-core-do-not-import/serialize.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/transformer.d.ts +0 -107
- package/dist/unstable-core-do-not-import/transformer.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/transformer.js +0 -107
- package/dist/unstable-core-do-not-import/transformer.mjs +0 -102
- package/dist/unstable-core-do-not-import/types.d.ts +0 -98
- package/dist/unstable-core-do-not-import/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/utils.d.ts +0 -27
- package/dist/unstable-core-do-not-import/utils.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/utils.js +0 -44
- package/dist/unstable-core-do-not-import/utils.mjs +0 -39
- package/src/@trpc/server/http.ts +0 -26
- package/src/@trpc/server/index.ts +0 -105
- package/src/@trpc/server/rpc.ts +0 -26
- package/src/observable/index.ts +0 -10
- package/src/observable/observable.ts +0 -158
- package/src/observable/operators.ts +0 -119
- package/src/observable/types.ts +0 -76
- package/src/unstable-core-do-not-import/TRPCInferrable.ts +0 -9
- package/src/unstable-core-do-not-import/createProxy.ts +0 -59
- package/src/unstable-core-do-not-import/error/TRPCError.ts +0 -82
- package/src/unstable-core-do-not-import/error/formatter.ts +0 -51
- package/src/unstable-core-do-not-import/error/getErrorShape.ts +0 -36
- package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +0 -29
- package/src/unstable-core-do-not-import/http/contentType.ts +0 -99
- package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +0 -57
- package/src/unstable-core-do-not-import/http/index.ts +0 -23
- package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +0 -458
- package/src/unstable-core-do-not-import/http/types.ts +0 -111
- package/src/unstable-core-do-not-import/index.ts +0 -110
- package/src/unstable-core-do-not-import/initTRPC.ts +0 -206
- package/src/unstable-core-do-not-import/middleware.ts +0 -233
- package/src/unstable-core-do-not-import/parser.ts +0 -94
- package/src/unstable-core-do-not-import/procedure.ts +0 -108
- package/src/unstable-core-do-not-import/procedureBuilder.ts +0 -458
- package/src/unstable-core-do-not-import/rootConfig.ts +0 -90
- package/src/unstable-core-do-not-import/router.ts +0 -370
- package/src/unstable-core-do-not-import/rpc/codes.ts +0 -44
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +0 -136
- package/src/unstable-core-do-not-import/rpc/index.ts +0 -21
- package/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +0 -85
- package/src/unstable-core-do-not-import/serialize.ts +0 -122
- package/src/unstable-core-do-not-import/transformer.ts +0 -202
- package/src/unstable-core-do-not-import/types.ts +0 -151
- package/src/unstable-core-do-not-import/utils.ts +0 -59
- package/unstable-core-do-not-import/index.d.ts +0 -1
- package/unstable-core-do-not-import/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/@trpc-server/http.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
11
|
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyStructuredResultV2, Context as APIGWContext } from 'aws-lambda';
|
|
11
|
-
import type { AnyRouter } from '
|
|
12
|
+
import type { AnyRouter } from '../..';
|
|
12
13
|
import type { APIGatewayEvent, AWSLambdaOptions } from './utils';
|
|
13
14
|
export * from './utils';
|
|
14
15
|
/** 1:1 mapping of v1 or v2 input events, deduces which is which.
|
|
@@ -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,OAAO,CAAC;AASvC,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"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
4
|
-
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
6
|
-
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
7
4
|
var utils = require('./utils.js');
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* 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`
|
|
11
8
|
*
|
|
9
|
+
* Do **not** import from `@trpc/core`
|
|
12
10
|
* @example
|
|
13
11
|
* ```ts
|
|
14
12
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -51,7 +49,7 @@ function tRPCOutputToAPIGatewayOutput(event, response) {
|
|
|
51
49
|
};
|
|
52
50
|
return resp1;
|
|
53
51
|
} else {
|
|
54
|
-
throw new
|
|
52
|
+
throw new core.TRPCError({
|
|
55
53
|
code: 'INTERNAL_SERVER_ERROR',
|
|
56
54
|
message: utils.UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
|
|
57
55
|
});
|
|
@@ -68,7 +66,7 @@ function awsLambdaRequestHandler(opts) {
|
|
|
68
66
|
...innerOpts
|
|
69
67
|
});
|
|
70
68
|
};
|
|
71
|
-
const response = await
|
|
69
|
+
const response = await core.resolveHTTPResponse({
|
|
72
70
|
router: opts.router,
|
|
73
71
|
batching: opts.batching,
|
|
74
72
|
responseMeta: opts?.responseMeta,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
|
-
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
1
|
+
import { resolveHTTPResponse, TRPCError } from '@trpc/core';
|
|
5
2
|
import { getPath, getHTTPMethod, isPayloadV1, transformHeaders, isPayloadV2, UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE } from './utils.mjs';
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
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`
|
|
9
6
|
*
|
|
7
|
+
* Do **not** import from `@trpc/core`
|
|
10
8
|
* @example
|
|
11
9
|
* ```ts
|
|
12
10
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -8,8 +9,8 @@
|
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
11
|
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyStructuredResultV2, Context as APIGWContext } from 'aws-lambda';
|
|
11
|
-
import type { AnyRouter, inferRouterContext } from '
|
|
12
|
-
import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn, TRPCRequestInfo } from '
|
|
12
|
+
import type { AnyRouter, inferRouterContext } from '../..';
|
|
13
|
+
import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn, TRPCRequestInfo } from '../../http';
|
|
13
14
|
export type APIGatewayEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2;
|
|
14
15
|
export type APIGatewayResult = APIGatewayProxyResult | APIGatewayProxyStructuredResultV2;
|
|
15
16
|
export type CreateAWSLambdaContextOptions<TEvent extends APIGatewayEvent> = {
|
|
@@ -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,OAAO,CAAC;AAI3D,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,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
4
|
-
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* 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
7
|
*
|
|
8
|
+
* Do **not** import from `@trpc/core`
|
|
10
9
|
* @example
|
|
11
10
|
* ```ts
|
|
12
11
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -44,7 +43,7 @@ function getHTTPMethod(event) {
|
|
|
44
43
|
if (isPayloadV2(event)) {
|
|
45
44
|
return event.requestContext.http.method;
|
|
46
45
|
}
|
|
47
|
-
throw new
|
|
46
|
+
throw new core.TRPCError({
|
|
48
47
|
code: 'INTERNAL_SERVER_ERROR',
|
|
49
48
|
message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
|
|
50
49
|
});
|
|
@@ -76,7 +75,7 @@ function getPath(event) {
|
|
|
76
75
|
}
|
|
77
76
|
return event.rawPath.slice(1);
|
|
78
77
|
}
|
|
79
|
-
throw new
|
|
78
|
+
throw new core.TRPCError({
|
|
80
79
|
code: 'INTERNAL_SERVER_ERROR',
|
|
81
80
|
message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
|
|
82
81
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
1
|
+
import { TRPCError } from '@trpc/core';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
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`
|
|
7
5
|
*
|
|
6
|
+
* Do **not** import from `@trpc/core`
|
|
8
7
|
* @example
|
|
9
8
|
* ```ts
|
|
10
9
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
11
|
import type * as express from 'express';
|
|
11
|
-
import type { AnyRouter } from '
|
|
12
|
+
import type { AnyRouter } from '..';
|
|
12
13
|
import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from './node-http';
|
|
13
14
|
export type CreateExpressContextOptions = NodeHTTPCreateContextFnOptions<express.Request, express.Response>;
|
|
14
15
|
export declare function createExpressMiddleware<TRouter extends AnyRouter>(opts: NodeHTTPHandlerOptions<TRouter, express.Request, express.Response>): express.Handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/adapters/express.ts"],"names":[],"mappings":"AAAA
|
|
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,IAAI,CAAC;AACpC,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
2
|
-
import type { AnyRouter } from '
|
|
3
|
-
import type { HTTPBaseHandlerOptions } from '
|
|
2
|
+
import type { AnyRouter } from '../..';
|
|
3
|
+
import type { HTTPBaseHandlerOptions } from '../../http';
|
|
4
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> & {
|
|
@@ -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,OAAO,CAAC;AACvC,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,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_stream = require('node:stream');
|
|
4
|
-
require('
|
|
5
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
6
|
-
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
7
|
-
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
4
|
+
var core = require('@trpc/core');
|
|
8
5
|
|
|
9
6
|
async function fastifyRequestHandler(opts) {
|
|
10
7
|
const createContext = async (innerOpts)=>{
|
|
@@ -42,7 +39,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
42
39
|
stream._read = ()=>{}; // eslint-disable-line @typescript-eslint/no-empty-function -- https://github.com/fastify/fastify/issues/805#issuecomment-369172154
|
|
43
40
|
resolve(opts.res.send(stream));
|
|
44
41
|
isStream = true;
|
|
45
|
-
formatter =
|
|
42
|
+
formatter = core.getBatchStreamFormatter();
|
|
46
43
|
}
|
|
47
44
|
};
|
|
48
45
|
const unstable_onChunk = ([index, string])=>{
|
|
@@ -53,7 +50,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
53
50
|
stream.push(formatter(index, string));
|
|
54
51
|
}
|
|
55
52
|
};
|
|
56
|
-
|
|
53
|
+
core.resolveHTTPResponse({
|
|
57
54
|
req,
|
|
58
55
|
createContext,
|
|
59
56
|
path: opts.path,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import '
|
|
3
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
|
-
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
5
|
-
import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
2
|
+
import { resolveHTTPResponse, getBatchStreamFormatter } from '@trpc/core';
|
|
6
3
|
|
|
7
4
|
async function fastifyRequestHandler(opts) {
|
|
8
5
|
const createContext = async (innerOpts)=>{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
*/
|
|
10
11
|
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
11
12
|
import type { FastifyHandlerOptions } from '.';
|
|
12
|
-
import type { AnyRouter } from '
|
|
13
|
+
import type { AnyRouter } from '../..';
|
|
13
14
|
import type { NodeHTTPCreateContextFnOptions } from '../node-http';
|
|
14
15
|
export interface FastifyTRPCPluginOptions<TRouter extends AnyRouter> {
|
|
15
16
|
prefix?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastifyTRPCPlugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"names":[],"mappings":"AAAA
|
|
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,OAAO,CAAC;AACvC,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"}
|
|
@@ -6,6 +6,7 @@ var fastifyRequestHandler = require('./fastifyRequestHandler.js');
|
|
|
6
6
|
/**
|
|
7
7
|
* 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`
|
|
8
8
|
*
|
|
9
|
+
* Do **not** import from `@trpc/core`
|
|
9
10
|
* @example
|
|
10
11
|
* ```ts
|
|
11
12
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -4,6 +4,7 @@ import { fastifyRequestHandler } from './fastifyRequestHandler.mjs';
|
|
|
4
4
|
/**
|
|
5
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
6
|
*
|
|
7
|
+
* Do **not** import from `@trpc/core`
|
|
7
8
|
* @example
|
|
8
9
|
* ```ts
|
|
9
10
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
7
8
|
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
|
-
import type { AnyRouter } from '
|
|
11
|
+
import type { AnyRouter } from '../..';
|
|
11
12
|
import type { FetchHandlerOptions } from './types';
|
|
12
13
|
export type FetchHandlerRequestOptions<TRouter extends AnyRouter> = FetchHandlerOptions<TRouter> & {
|
|
13
14
|
req: Request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA
|
|
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,OAAO,CAAC;AAQvC,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"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
4
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
5
|
-
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
6
|
-
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
6
|
* 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
7
|
*
|
|
8
|
+
* Do **not** import from `@trpc/core`
|
|
11
9
|
* @example
|
|
12
10
|
* ```ts
|
|
13
11
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -73,7 +71,7 @@ async function fetchRequestHandler(opts) {
|
|
|
73
71
|
});
|
|
74
72
|
resolve(response);
|
|
75
73
|
encoder = new TextEncoder();
|
|
76
|
-
formatter =
|
|
74
|
+
formatter = core.getBatchStreamFormatter();
|
|
77
75
|
isStream = true;
|
|
78
76
|
}
|
|
79
77
|
};
|
|
@@ -89,7 +87,7 @@ async function fetchRequestHandler(opts) {
|
|
|
89
87
|
controller.enqueue(encoder.encode(formatter(index, string)));
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
|
-
|
|
90
|
+
core.resolveHTTPResponse({
|
|
93
91
|
req,
|
|
94
92
|
createContext,
|
|
95
93
|
path,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
3
|
-
import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
|
|
4
|
-
import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
|
|
1
|
+
import { resolveHTTPResponse, getBatchStreamFormatter } from '@trpc/core';
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
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`
|
|
8
5
|
*
|
|
6
|
+
* Do **not** import from `@trpc/core`
|
|
9
7
|
* @example
|
|
10
8
|
* ```ts
|
|
11
9
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
7
8
|
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
|
-
import type { AnyRouter, inferRouterContext } from '
|
|
11
|
-
import type { HTTPBaseHandlerOptions, TRPCRequestInfo } from '../../@trpc
|
|
11
|
+
import type { AnyRouter, inferRouterContext } from '../..';
|
|
12
|
+
import type { HTTPBaseHandlerOptions, TRPCRequestInfo } from '../../@trpc-server/http';
|
|
12
13
|
export type FetchCreateContextFnOptions = {
|
|
13
14
|
req: Request;
|
|
14
15
|
resHeaders: Headers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/types.ts"],"names":[],"mappings":"AAAA
|
|
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,OAAO,CAAC;AAE3D,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,7 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -8,8 +9,9 @@
|
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
11
|
import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
11
|
-
import type { AnyRouter } from '
|
|
12
|
+
import type { AnyRouter } from '..';
|
|
12
13
|
import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from './node-http';
|
|
13
14
|
export type CreateNextContextOptions = NodeHTTPCreateContextFnOptions<NextApiRequest, NextApiResponse>;
|
|
15
|
+
export type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
14
16
|
export declare function createNextApiHandler<TRouter extends AnyRouter>(opts: NodeHTTPHandlerOptions<TRouter, NextApiRequest, NextApiResponse>): NextApiHandler;
|
|
15
17
|
//# sourceMappingURL=next.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/adapters/next.ts"],"names":[],"mappings":"AAAA
|
|
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,IAAI,CAAC;AAGpC,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
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var TRPCError = require('../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../unstable-core-do-not-import/rootConfig.js');
|
|
6
|
-
require('../unstable-core-do-not-import/rpc/codes.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
7
4
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* 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`
|
|
11
8
|
*
|
|
9
|
+
* Do **not** import from `@trpc/core`
|
|
12
10
|
* @example
|
|
13
11
|
* ```ts
|
|
14
12
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -28,9 +26,9 @@ function createNextApiHandler(opts) {
|
|
|
28
26
|
}
|
|
29
27
|
const path = getPath();
|
|
30
28
|
if (path === null) {
|
|
31
|
-
const error =
|
|
29
|
+
const error = core.getErrorShape({
|
|
32
30
|
config: opts.router._def._config,
|
|
33
|
-
error: new
|
|
31
|
+
error: new core.TRPCError({
|
|
34
32
|
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
35
33
|
code: 'INTERNAL_SERVER_ERROR'
|
|
36
34
|
}),
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { getErrorShape } from '
|
|
2
|
-
import { TRPCError } from '../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
|
-
import '../unstable-core-do-not-import/rpc/codes.mjs';
|
|
1
|
+
import { getErrorShape, TRPCError } from '@trpc/core';
|
|
5
2
|
import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
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`
|
|
9
6
|
*
|
|
7
|
+
* Do **not** import from `@trpc/core`
|
|
10
8
|
* @example
|
|
11
9
|
* ```ts
|
|
12
10
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPostBody.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/node-http/content-type/json/getPostBody.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"getPostBody.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/node-http/content-type/json/getPostBody.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,eAAe,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,UAAU,CAAC,CAiCtB"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
4
|
-
var TRPCError = require('../../../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../../../../unstable-core-do-not-import/rootConfig.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
6
4
|
|
|
7
5
|
// @trpc/server
|
|
8
6
|
async function getPostBody(opts) {
|
|
@@ -25,7 +23,7 @@ async function getPostBody(opts) {
|
|
|
25
23
|
if (body.length > maxBodySize) {
|
|
26
24
|
resolve({
|
|
27
25
|
ok: false,
|
|
28
|
-
error: new
|
|
26
|
+
error: new core.TRPCError({
|
|
29
27
|
code: 'PAYLOAD_TOO_LARGE'
|
|
30
28
|
})
|
|
31
29
|
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { TRPCError } from '../../../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../../../../unstable-core-do-not-import/rootConfig.mjs';
|
|
1
|
+
import { TRPCError } from '@trpc/core';
|
|
4
2
|
|
|
5
3
|
// @trpc/server
|
|
6
4
|
async function getPostBody(opts) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
4
|
-
require('../../../../unstable-core-do-not-import/rootConfig.js');
|
|
5
|
-
var contentType$1 = require('../../../../unstable-core-do-not-import/http/contentType.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
6
4
|
var contentType = require('../../internals/contentType.js');
|
|
7
5
|
var getPostBody = require('./getPostBody.js');
|
|
8
6
|
|
|
@@ -11,7 +9,7 @@ const nodeHTTPJSONContentTypeHandler = contentType.createNodeHTTPContentTypeHand
|
|
|
11
9
|
return !!opts.req.headers['content-type']?.startsWith('application/json');
|
|
12
10
|
},
|
|
13
11
|
getBody: getPostBody.getPostBody,
|
|
14
|
-
getInputs:
|
|
12
|
+
getInputs: core.getJsonContentTypeInputs
|
|
15
13
|
});
|
|
16
14
|
|
|
17
15
|
exports.nodeHTTPJSONContentTypeHandler = nodeHTTPJSONContentTypeHandler;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '../../../../unstable-core-do-not-import/rootConfig.mjs';
|
|
3
|
-
import { getJsonContentTypeInputs } from '../../../../unstable-core-do-not-import/http/contentType.mjs';
|
|
1
|
+
import { getJsonContentTypeInputs } from '@trpc/core';
|
|
4
2
|
import { createNodeHTTPContentTypeHandler } from '../../internals/contentType.mjs';
|
|
5
3
|
import { getPostBody } from './getPostBody.mjs';
|
|
6
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AnyRouter } from '
|
|
2
|
-
import type { BaseContentTypeHandler } from '../../../@trpc
|
|
1
|
+
import type { AnyRouter } from '../../..';
|
|
2
|
+
import type { BaseContentTypeHandler } from '../../../@trpc-server/http';
|
|
3
3
|
import type { NodeHTTPRequest, NodeHTTPRequestHandlerOptions, NodeHTTPResponse } from '../types';
|
|
4
4
|
export interface NodeHTTPContentTypeHandler<TRequest extends NodeHTTPRequest, TResponse extends NodeHTTPResponse> extends BaseContentTypeHandler<NodeHTTPRequestHandlerOptions<AnyRouter, TRequest, TResponse> & {
|
|
5
5
|
query: URLSearchParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentType.d.ts","sourceRoot":"","sources":["../../../../src/adapters/node-http/internals/contentType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contentType.d.ts","sourceRoot":"","sources":["../../../../src/adapters/node-http/internals/contentType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,0BAA0B,CACzC,QAAQ,SAAS,eAAe,EAChC,SAAS,SAAS,gBAAgB,CAClC,SAAQ,sBAAsB,CAC5B,6BAA6B,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG;IAC9D,KAAK,EAAE,eAAe,CAAC;CACxB,CACF;CAAG;AAEN,wBAAgB,gCAAgC,CAC9C,kBAAkB,EAAE,0BAA0B,CAC5C,eAAe,EACf,gBAAgB,CACjB,+HAOF"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
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
3
|
*
|
|
4
|
+
* Do **not** import from `@trpc/core`
|
|
4
5
|
* @example
|
|
5
6
|
* ```ts
|
|
6
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
7
8
|
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
|
-
import type { AnyRouter } from '
|
|
11
|
+
import type { AnyRouter } from '../..';
|
|
11
12
|
import type { NodeHTTPRequest, NodeHTTPRequestHandlerOptions, NodeHTTPResponse } from './types';
|
|
12
13
|
export declare function nodeHTTPRequestHandler<TRouter extends AnyRouter, TRequest extends NodeHTTPRequest, TResponse extends NodeHTTPResponse>(opts: NodeHTTPRequestHandlerOptions<TRouter, TRequest, TResponse>): Promise<void>;
|
|
13
14
|
//# sourceMappingURL=nodeHTTPRequestHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeHTTPRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"nodeHTTPRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAIjB,wBAAsB,sBAAsB,CAC1C,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,eAAe,EAChC,SAAS,SAAS,gBAAgB,EAClC,IAAI,EAAE,6BAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,iBA4HlE"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
4
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
5
|
-
var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
|
|
6
|
-
var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
|
|
3
|
+
var core = require('@trpc/core');
|
|
7
4
|
var index = require('./content-type/json/index.js');
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* 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`
|
|
11
8
|
*
|
|
9
|
+
* Do **not** import from `@trpc/core`
|
|
12
10
|
* @example
|
|
13
11
|
* ```ts
|
|
14
12
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -65,7 +63,7 @@ async function nodeHTTPRequestHandler(opts) {
|
|
|
65
63
|
const vary = opts.res.getHeader('Vary');
|
|
66
64
|
opts.res.setHeader('Vary', vary ? 'trpc-batch-mode, ' + vary : 'trpc-batch-mode');
|
|
67
65
|
isStream = true;
|
|
68
|
-
formatter =
|
|
66
|
+
formatter = core.getBatchStreamFormatter();
|
|
69
67
|
opts.res.flushHeaders();
|
|
70
68
|
}
|
|
71
69
|
};
|
|
@@ -81,7 +79,7 @@ async function nodeHTTPRequestHandler(opts) {
|
|
|
81
79
|
opts.res.flush?.();
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
await
|
|
82
|
+
await core.resolveHTTPResponse({
|
|
85
83
|
batching: opts.batching,
|
|
86
84
|
responseMeta: opts.responseMeta,
|
|
87
85
|
path: opts.path,
|