@trpc/server 11.0.0-alpha-tmp-export-from-main.209 → 11.0.0-alpha-tmp-export-from-main-nuke-core.214
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 +1 -1
- package/dist/@trpc-server/http.d.ts.map +1 -1
- package/dist/@trpc-server.d.ts +3 -3
- package/dist/@trpc-server.d.ts.map +1 -1
- package/dist/TRPCError-10da405a.js +61 -0
- package/dist/TRPCError-14edcf88.mjs +63 -0
- package/dist/TRPCError-e2c8eb77.js +67 -0
- package/dist/adapters/aws-lambda/index.d.ts +1 -1
- package/dist/adapters/aws-lambda/index.js +12 -7
- package/dist/adapters/aws-lambda/index.mjs +8 -3
- package/dist/adapters/aws-lambda/utils.d.ts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/express.js +8 -2
- package/dist/adapters/express.mjs +8 -2
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +1 -1
- package/dist/adapters/fastify/index.js +12 -4
- package/dist/adapters/fastify/index.mjs +10 -2
- package/dist/adapters/fetch/fetchRequestHandler.d.ts +1 -1
- package/dist/adapters/fetch/index.js +10 -4
- package/dist/adapters/fetch/index.mjs +8 -2
- package/dist/adapters/fetch/types.d.ts +1 -1
- package/dist/adapters/next.d.ts +1 -1
- package/dist/adapters/next.js +11 -5
- package/dist/adapters/next.mjs +9 -3
- package/dist/adapters/node-http/content-type/json/index.js +5 -3
- package/dist/adapters/node-http/content-type/json/index.mjs +3 -1
- package/dist/adapters/node-http/index.js +8 -2
- package/dist/adapters/node-http/index.mjs +8 -2
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +1 -1
- package/dist/adapters/node-http/types.d.ts +2 -2
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/adapters/standalone.d.ts +1 -1
- package/dist/adapters/standalone.js +8 -2
- package/dist/adapters/standalone.mjs +8 -2
- package/dist/adapters/ws.d.ts +2 -1
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +31 -26
- package/dist/adapters/ws.mjs +6 -1
- package/dist/batchStreamFormatter-1971db27.js +32 -0
- package/dist/batchStreamFormatter-378277dc.mjs +30 -0
- package/dist/batchStreamFormatter-4375dc8b.js +31 -0
- package/dist/bundle-analysis.json +406 -59
- package/dist/contentType-2ed02bef.mjs +52 -0
- package/dist/contentType-3a829011.js +54 -0
- package/dist/contentType-e4a2373e.js +59 -0
- package/dist/createProxy-0306dcaa.mjs +121 -0
- package/dist/createProxy-7e413449.js +127 -0
- package/dist/createProxy-dce0c414.js +116 -0
- package/dist/http.d.ts +6 -6
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +12 -21
- package/dist/http.mjs +7 -1
- package/dist/index.js +15 -41
- package/dist/index.mjs +5 -1
- package/dist/initTRPC-2cef03ab.js +384 -0
- package/dist/initTRPC-38faa18f.js +371 -0
- package/dist/initTRPC-fa1b3d57.mjs +376 -0
- package/dist/{nodeHTTPRequestHandler-2d5c8791.mjs → nodeHTTPRequestHandler-257a3b5f.mjs} +4 -2
- package/dist/{nodeHTTPRequestHandler-7691fc79.js → nodeHTTPRequestHandler-29178135.js} +3 -1
- package/dist/{nodeHTTPRequestHandler-55f05150.js → nodeHTTPRequestHandler-f4b7e374.js} +6 -4
- package/dist/observable-2a5a96d5.js +125 -0
- package/dist/observable-62674916.js +125 -0
- package/dist/observable-6d025a37.mjs +121 -0
- package/dist/observable.d.ts +2 -2
- package/dist/observable.d.ts.map +1 -1
- package/dist/observable.js +9 -25
- package/dist/observable.mjs +3 -1
- package/dist/operators-0cc4956a.js +99 -0
- package/dist/operators-b08617cb.js +103 -0
- package/dist/operators-d0c3e794.mjs +99 -0
- package/dist/parseTRPCMessage-6e6c204e.js +65 -0
- package/dist/parseTRPCMessage-8eb0bbe9.mjs +62 -0
- package/dist/parseTRPCMessage-ebdfe3ca.js +67 -0
- package/dist/resolveHTTPResponse-833ca2b8.js +265 -0
- package/dist/resolveHTTPResponse-9322334c.mjs +291 -0
- package/dist/resolveHTTPResponse-d64c48e1.js +293 -0
- package/dist/rootConfig-3371c473.js +89 -0
- package/dist/rootConfig-571c9267.js +94 -0
- package/dist/rootConfig-6b04a6b8.mjs +81 -0
- package/dist/router-3344b52a.js +262 -0
- package/dist/router-919c37eb.js +259 -0
- package/dist/router-d6789e4b.mjs +252 -0
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +5 -13
- package/dist/rpc.mjs +2 -1
- package/dist/shared.js +4 -9
- package/dist/shared.mjs +2 -1
- package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts +6 -0
- package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/createProxy.d.ts +19 -0
- package/dist/unstable-core-do-not-import/createProxy.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +13 -0
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/error/formatter.d.ts +33 -0
- package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +15 -0
- package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +24 -0
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/contentType.d.ts +29 -0
- package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +5 -0
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/index.d.ts +7 -0
- package/dist/unstable-core-do-not-import/http/index.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts +51 -0
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/types.d.ts +96 -0
- package/dist/unstable-core-do-not-import/http/types.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/index.d.ts +35 -0
- package/dist/unstable-core-do-not-import/index.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/index.js +51 -0
- package/dist/unstable-core-do-not-import/index.mjs +11 -0
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +96 -0
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/middleware.d.ts +105 -0
- package/dist/unstable-core-do-not-import/middleware.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/observable/index.d.ts +5 -0
- package/dist/unstable-core-do-not-import/observable/index.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/observable/observable.d.ts +13 -0
- package/dist/unstable-core-do-not-import/observable/observable.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/observable/operators.d.ts +8 -0
- package/dist/unstable-core-do-not-import/observable/operators.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/observable/types.d.ts +26 -0
- package/dist/unstable-core-do-not-import/observable/types.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/parser.d.ts +30 -0
- package/dist/unstable-core-do-not-import/parser.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/procedure.d.ts +72 -0
- package/dist/unstable-core-do-not-import/procedure.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +101 -0
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +75 -0
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/router.d.ts +85 -0
- package/dist/unstable-core-do-not-import/router.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts +51 -0
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +97 -0
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/rpc/index.d.ts +5 -0
- package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +5 -0
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/serialize.d.ts +62 -0
- package/dist/unstable-core-do-not-import/serialize.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/transformer.d.ts +107 -0
- package/dist/unstable-core-do-not-import/transformer.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/types.d.ts +98 -0
- package/dist/unstable-core-do-not-import/types.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/utils.d.ts +31 -0
- package/dist/unstable-core-do-not-import/utils.d.ts.map +1 -0
- package/package.json +8 -5
- package/src/@trpc-server/http.ts +2 -1
- package/src/@trpc-server.ts +3 -3
- package/src/adapters/aws-lambda/index.ts +1 -1
- package/src/adapters/aws-lambda/utils.ts +1 -1
- package/src/adapters/express.ts +1 -2
- package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +1 -1
- package/src/adapters/fetch/fetchRequestHandler.ts +1 -1
- package/src/adapters/fetch/types.ts +1 -1
- package/src/adapters/next.ts +1 -1
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +1 -1
- package/src/adapters/node-http/types.ts +2 -3
- package/src/adapters/standalone.ts +1 -1
- package/src/adapters/ws.ts +9 -10
- package/src/http.ts +6 -6
- package/src/observable.ts +2 -2
- package/src/rpc.ts +2 -2
- package/src/unstable-core-do-not-import/TRPCInferrable.ts +9 -0
- package/src/unstable-core-do-not-import/createProxy.ts +59 -0
- package/src/unstable-core-do-not-import/error/TRPCError.ts +82 -0
- package/src/unstable-core-do-not-import/error/formatter.ts +51 -0
- package/src/unstable-core-do-not-import/error/getErrorShape.ts +36 -0
- package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +29 -0
- package/src/unstable-core-do-not-import/http/contentType.ts +99 -0
- package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +57 -0
- package/src/unstable-core-do-not-import/http/index.ts +23 -0
- package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +458 -0
- package/src/unstable-core-do-not-import/http/types.ts +111 -0
- package/src/unstable-core-do-not-import/index.ts +108 -0
- package/src/unstable-core-do-not-import/initTRPC.ts +206 -0
- package/src/unstable-core-do-not-import/middleware.ts +233 -0
- package/src/unstable-core-do-not-import/observable/index.ts +10 -0
- package/src/unstable-core-do-not-import/observable/observable.ts +155 -0
- package/src/unstable-core-do-not-import/observable/operators.ts +119 -0
- package/src/unstable-core-do-not-import/observable/types.ts +76 -0
- package/src/unstable-core-do-not-import/parser.ts +94 -0
- package/src/unstable-core-do-not-import/procedure.ts +108 -0
- package/src/unstable-core-do-not-import/procedureBuilder.ts +458 -0
- package/src/unstable-core-do-not-import/rootConfig.ts +90 -0
- package/src/unstable-core-do-not-import/router.ts +370 -0
- package/src/unstable-core-do-not-import/rpc/codes.ts +44 -0
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +136 -0
- package/src/unstable-core-do-not-import/rpc/index.ts +21 -0
- package/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +85 -0
- package/src/unstable-core-do-not-import/serialize.ts +122 -0
- package/src/unstable-core-do-not-import/transformer.ts +202 -0
- package/src/unstable-core-do-not-import/types.ts +151 -0
- package/src/unstable-core-do-not-import/utils.ts +66 -0
- package/unstable-core-do-not-import/index.d.ts +1 -0
- package/unstable-core-do-not-import/index.js +1 -0
- package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts +0 -9
- package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts.map +0 -1
- package/src/@trpc-core-unstable-do-not-import-this-please.ts +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '../unstable-core-do-not-import';
|
|
2
2
|
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/@trpc-server/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/@trpc-server/http.ts"],"names":[],"mappings":"AAEA,cAAc,gCAAgC,CAAC"}
|
package/dist/@trpc-server.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { TRPCError,
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated use `experimental_trpcMiddleware` instead
|
|
4
4
|
*/
|
|
5
|
-
experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type ProcedureRouterRecord as TRPCProcedureRouterRecord, type ProcedureArgs as TRPCProcedureArgs, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, } from '
|
|
5
|
+
experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type ProcedureRouterRecord as TRPCProcedureRouterRecord, type ProcedureArgs as TRPCProcedureArgs, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, } from './unstable-core-do-not-import';
|
|
6
6
|
export type {
|
|
7
7
|
/**
|
|
8
8
|
* @deprecated use `AnyTRPCProcedure` instead
|
|
@@ -51,7 +51,7 @@ ProcedureArgs,
|
|
|
51
51
|
/**
|
|
52
52
|
* @deprecated use `AnyTRPCSubscriptionProcedure` instead
|
|
53
53
|
*/
|
|
54
|
-
AnySubscriptionProcedure, } from '
|
|
54
|
+
AnySubscriptionProcedure, } from './unstable-core-do-not-import';
|
|
55
55
|
export {
|
|
56
56
|
/**
|
|
57
57
|
* @deprecated use `getTRPCErrorShape` instead
|
|
@@ -60,7 +60,7 @@ getErrorShape,
|
|
|
60
60
|
/**
|
|
61
61
|
* @deprecated use `callTRPCProcedure` instead
|
|
62
62
|
*/
|
|
63
|
-
callProcedure, } from '
|
|
63
|
+
callProcedure, } from './unstable-core-do-not-import';
|
|
64
64
|
/**
|
|
65
65
|
* @deprecated
|
|
66
66
|
* Use `Awaited<ReturnType<typeof myFunction>>` instead
|
|
@@ -1 +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,EAER,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,IAAI,mBAAmB,EACtC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,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,EACvC,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,wBAAwB,IAAI,4BAA4B,GAC9D,MAAM,
|
|
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,EAER,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,IAAI,mBAAmB,EACtC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,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,EACvC,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,wBAAwB,IAAI,4BAA4B,GAC9D,MAAM,+BAA+B,CAAC;AAEvC,YAAY;AACV;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,uBAAuB;AAEvB;;GAEG;AACH,IAAI;AAEJ;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,iBAAiB;AACjB;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO;AACL;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,aAAa,GACd,MAAM,+BAA+B,CAAC;AAEvC;;;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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { i as isObject } from './rootConfig-571c9267.js';
|
|
2
|
+
|
|
3
|
+
class UnknownCauseError extends Error {
|
|
4
|
+
}
|
|
5
|
+
function getCauseFromUnknown(cause) {
|
|
6
|
+
if (cause instanceof Error) {
|
|
7
|
+
return cause;
|
|
8
|
+
}
|
|
9
|
+
const type = typeof cause;
|
|
10
|
+
if (type === 'undefined' || type === 'function' || cause === null) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
// Primitive types just get wrapped in an error
|
|
14
|
+
if (type !== 'object') {
|
|
15
|
+
return new Error(String(cause));
|
|
16
|
+
}
|
|
17
|
+
// If it's an object, we'll create a synthetic error
|
|
18
|
+
if (isObject(cause)) {
|
|
19
|
+
const err = new UnknownCauseError();
|
|
20
|
+
for (const key in cause) {
|
|
21
|
+
err[key] = cause[key];
|
|
22
|
+
}
|
|
23
|
+
return err;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
function getTRPCErrorFromUnknown(cause) {
|
|
28
|
+
if (cause instanceof TRPCError) {
|
|
29
|
+
return cause;
|
|
30
|
+
}
|
|
31
|
+
if (cause instanceof Error && cause.name === 'TRPCError') {
|
|
32
|
+
// https://github.com/trpc/trpc/pull/4848
|
|
33
|
+
return cause;
|
|
34
|
+
}
|
|
35
|
+
const trpcError = new TRPCError({
|
|
36
|
+
code: 'INTERNAL_SERVER_ERROR',
|
|
37
|
+
cause,
|
|
38
|
+
});
|
|
39
|
+
// Inherit stack from error
|
|
40
|
+
if (cause instanceof Error && cause.stack) {
|
|
41
|
+
trpcError.stack = cause.stack;
|
|
42
|
+
}
|
|
43
|
+
return trpcError;
|
|
44
|
+
}
|
|
45
|
+
class TRPCError extends Error {
|
|
46
|
+
constructor(opts) {
|
|
47
|
+
const cause = getCauseFromUnknown(opts.cause);
|
|
48
|
+
const message = opts.message ?? cause?.message ?? opts.code;
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
+
// @ts-ignore https://github.com/tc39/proposal-error-cause
|
|
51
|
+
super(message, { cause });
|
|
52
|
+
this.code = opts.code;
|
|
53
|
+
this.name = 'TRPCError';
|
|
54
|
+
if (!this.cause) {
|
|
55
|
+
// < ES2022 / < Node 16.9.0 compatability
|
|
56
|
+
this.cause = cause;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { TRPCError as T, getCauseFromUnknown as a, getTRPCErrorFromUnknown as g };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { i as isObject } from './rootConfig-6b04a6b8.mjs';
|
|
2
|
+
|
|
3
|
+
class UnknownCauseError extends Error {
|
|
4
|
+
}
|
|
5
|
+
function getCauseFromUnknown(cause) {
|
|
6
|
+
if (cause instanceof Error) {
|
|
7
|
+
return cause;
|
|
8
|
+
}
|
|
9
|
+
const type = typeof cause;
|
|
10
|
+
if (type === 'undefined' || type === 'function' || cause === null) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
// Primitive types just get wrapped in an error
|
|
14
|
+
if (type !== 'object') {
|
|
15
|
+
return new Error(String(cause));
|
|
16
|
+
}
|
|
17
|
+
// If it's an object, we'll create a synthetic error
|
|
18
|
+
if (isObject(cause)) {
|
|
19
|
+
const err = new UnknownCauseError();
|
|
20
|
+
for(const key in cause){
|
|
21
|
+
err[key] = cause[key];
|
|
22
|
+
}
|
|
23
|
+
return err;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
function getTRPCErrorFromUnknown(cause) {
|
|
28
|
+
if (cause instanceof TRPCError) {
|
|
29
|
+
return cause;
|
|
30
|
+
}
|
|
31
|
+
if (cause instanceof Error && cause.name === 'TRPCError') {
|
|
32
|
+
// https://github.com/trpc/trpc/pull/4848
|
|
33
|
+
return cause;
|
|
34
|
+
}
|
|
35
|
+
const trpcError = new TRPCError({
|
|
36
|
+
code: 'INTERNAL_SERVER_ERROR',
|
|
37
|
+
cause
|
|
38
|
+
});
|
|
39
|
+
// Inherit stack from error
|
|
40
|
+
if (cause instanceof Error && cause.stack) {
|
|
41
|
+
trpcError.stack = cause.stack;
|
|
42
|
+
}
|
|
43
|
+
return trpcError;
|
|
44
|
+
}
|
|
45
|
+
class TRPCError extends Error {
|
|
46
|
+
constructor(opts){
|
|
47
|
+
const cause = getCauseFromUnknown(opts.cause);
|
|
48
|
+
const message = opts.message ?? cause?.message ?? opts.code;
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
+
// @ts-ignore https://github.com/tc39/proposal-error-cause
|
|
51
|
+
super(message, {
|
|
52
|
+
cause
|
|
53
|
+
});
|
|
54
|
+
this.code = opts.code;
|
|
55
|
+
this.name = 'TRPCError';
|
|
56
|
+
if (!this.cause) {
|
|
57
|
+
// < ES2022 / < Node 16.9.0 compatability
|
|
58
|
+
this.cause = cause;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { TRPCError as T, getCauseFromUnknown as a, getTRPCErrorFromUnknown as g };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var rootConfig = require('./rootConfig-3371c473.js');
|
|
4
|
+
|
|
5
|
+
class UnknownCauseError extends Error {
|
|
6
|
+
}
|
|
7
|
+
function getCauseFromUnknown(cause) {
|
|
8
|
+
if (cause instanceof Error) {
|
|
9
|
+
return cause;
|
|
10
|
+
}
|
|
11
|
+
const type = typeof cause;
|
|
12
|
+
if (type === 'undefined' || type === 'function' || cause === null) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
// Primitive types just get wrapped in an error
|
|
16
|
+
if (type !== 'object') {
|
|
17
|
+
return new Error(String(cause));
|
|
18
|
+
}
|
|
19
|
+
// If it's an object, we'll create a synthetic error
|
|
20
|
+
if (rootConfig.isObject(cause)) {
|
|
21
|
+
const err = new UnknownCauseError();
|
|
22
|
+
for(const key in cause){
|
|
23
|
+
err[key] = cause[key];
|
|
24
|
+
}
|
|
25
|
+
return err;
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
function getTRPCErrorFromUnknown(cause) {
|
|
30
|
+
if (cause instanceof TRPCError) {
|
|
31
|
+
return cause;
|
|
32
|
+
}
|
|
33
|
+
if (cause instanceof Error && cause.name === 'TRPCError') {
|
|
34
|
+
// https://github.com/trpc/trpc/pull/4848
|
|
35
|
+
return cause;
|
|
36
|
+
}
|
|
37
|
+
const trpcError = new TRPCError({
|
|
38
|
+
code: 'INTERNAL_SERVER_ERROR',
|
|
39
|
+
cause
|
|
40
|
+
});
|
|
41
|
+
// Inherit stack from error
|
|
42
|
+
if (cause instanceof Error && cause.stack) {
|
|
43
|
+
trpcError.stack = cause.stack;
|
|
44
|
+
}
|
|
45
|
+
return trpcError;
|
|
46
|
+
}
|
|
47
|
+
class TRPCError extends Error {
|
|
48
|
+
constructor(opts){
|
|
49
|
+
const cause = getCauseFromUnknown(opts.cause);
|
|
50
|
+
const message = opts.message ?? cause?.message ?? opts.code;
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
+
// @ts-ignore https://github.com/tc39/proposal-error-cause
|
|
53
|
+
super(message, {
|
|
54
|
+
cause
|
|
55
|
+
});
|
|
56
|
+
this.code = opts.code;
|
|
57
|
+
this.name = 'TRPCError';
|
|
58
|
+
if (!this.cause) {
|
|
59
|
+
// < ES2022 / < Node 16.9.0 compatability
|
|
60
|
+
this.cause = cause;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
exports.TRPCError = TRPCError;
|
|
66
|
+
exports.getCauseFromUnknown = getCauseFromUnknown;
|
|
67
|
+
exports.getTRPCErrorFromUnknown = getTRPCErrorFromUnknown;
|
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('../../rootConfig-3371c473.js');
|
|
6
|
+
var TRPCError = require('../../TRPCError-e2c8eb77.js');
|
|
7
|
+
var resolveHTTPResponse = require('../../resolveHTTPResponse-d64c48e1.js');
|
|
8
|
+
require('../../createProxy-7e413449.js');
|
|
9
|
+
require('../../router-3344b52a.js');
|
|
10
|
+
require('../../contentType-3a829011.js');
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* 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
14
|
*
|
|
10
|
-
* Do **not** import from `@trpc/core`
|
|
15
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
11
16
|
* @example
|
|
12
17
|
* ```ts
|
|
13
18
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -45,7 +50,7 @@ function getHTTPMethod(event) {
|
|
|
45
50
|
if (isPayloadV2(event)) {
|
|
46
51
|
return event.requestContext.http.method;
|
|
47
52
|
}
|
|
48
|
-
throw new
|
|
53
|
+
throw new TRPCError.TRPCError({
|
|
49
54
|
code: 'INTERNAL_SERVER_ERROR',
|
|
50
55
|
message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
|
|
51
56
|
});
|
|
@@ -77,7 +82,7 @@ function getPath(event) {
|
|
|
77
82
|
}
|
|
78
83
|
return event.rawPath.slice(1);
|
|
79
84
|
}
|
|
80
|
-
throw new
|
|
85
|
+
throw new TRPCError.TRPCError({
|
|
81
86
|
code: 'INTERNAL_SERVER_ERROR',
|
|
82
87
|
message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
|
|
83
88
|
});
|
|
@@ -97,7 +102,7 @@ const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format vers
|
|
|
97
102
|
/**
|
|
98
103
|
* 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`
|
|
99
104
|
*
|
|
100
|
-
* Do **not** import from `@trpc/core`
|
|
105
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
101
106
|
* @example
|
|
102
107
|
* ```ts
|
|
103
108
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -140,7 +145,7 @@ function tRPCOutputToAPIGatewayOutput(event, response) {
|
|
|
140
145
|
};
|
|
141
146
|
return resp1;
|
|
142
147
|
} else {
|
|
143
|
-
throw new
|
|
148
|
+
throw new TRPCError.TRPCError({
|
|
144
149
|
code: 'INTERNAL_SERVER_ERROR',
|
|
145
150
|
message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
|
|
146
151
|
});
|
|
@@ -157,7 +162,7 @@ function awsLambdaRequestHandler(opts) {
|
|
|
157
162
|
...innerOpts
|
|
158
163
|
});
|
|
159
164
|
};
|
|
160
|
-
const response = await
|
|
165
|
+
const response = await resolveHTTPResponse.resolveHTTPResponse({
|
|
161
166
|
router: opts.router,
|
|
162
167
|
batching: opts.batching,
|
|
163
168
|
responseMeta: opts?.responseMeta,
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../rootConfig-6b04a6b8.mjs';
|
|
2
|
+
import { T as TRPCError } from '../../TRPCError-14edcf88.mjs';
|
|
3
|
+
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-9322334c.mjs';
|
|
4
|
+
import '../../createProxy-0306dcaa.mjs';
|
|
5
|
+
import '../../router-d6789e4b.mjs';
|
|
6
|
+
import '../../contentType-2ed02bef.mjs';
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
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`
|
|
5
10
|
*
|
|
6
|
-
* Do **not** import from `@trpc/core`
|
|
11
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
7
12
|
* @example
|
|
8
13
|
* ```ts
|
|
9
14
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -93,7 +98,7 @@ const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format vers
|
|
|
93
98
|
/**
|
|
94
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`
|
|
95
100
|
*
|
|
96
|
-
* Do **not** import from `@trpc/core`
|
|
101
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
97
102
|
* @example
|
|
98
103
|
* ```ts
|
|
99
104
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AACxC,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,8 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-
|
|
6
|
-
require('
|
|
5
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-f4b7e374.js');
|
|
6
|
+
require('../rootConfig-3371c473.js');
|
|
7
|
+
require('../resolveHTTPResponse-d64c48e1.js');
|
|
8
|
+
require('../createProxy-7e413449.js');
|
|
9
|
+
require('../TRPCError-e2c8eb77.js');
|
|
10
|
+
require('../router-3344b52a.js');
|
|
11
|
+
require('../contentType-3a829011.js');
|
|
12
|
+
require('../batchStreamFormatter-1971db27.js');
|
|
7
13
|
require('./node-http/content-type/json/index.js');
|
|
8
14
|
require('../contentType-d9d22104.js');
|
|
9
15
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-
|
|
2
|
-
import '
|
|
1
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-257a3b5f.mjs';
|
|
2
|
+
import '../rootConfig-6b04a6b8.mjs';
|
|
3
|
+
import '../resolveHTTPResponse-9322334c.mjs';
|
|
4
|
+
import '../createProxy-0306dcaa.mjs';
|
|
5
|
+
import '../TRPCError-14edcf88.mjs';
|
|
6
|
+
import '../router-d6789e4b.mjs';
|
|
7
|
+
import '../contentType-2ed02bef.mjs';
|
|
8
|
+
import '../batchStreamFormatter-378277dc.mjs';
|
|
3
9
|
import './node-http/content-type/json/index.mjs';
|
|
4
10
|
import '../contentType-72ed9df5.mjs';
|
|
5
11
|
|
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var node_stream = require('node:stream');
|
|
6
|
-
|
|
6
|
+
require('../../rootConfig-3371c473.js');
|
|
7
|
+
var resolveHTTPResponse = require('../../resolveHTTPResponse-d64c48e1.js');
|
|
8
|
+
var batchStreamFormatter = require('../../batchStreamFormatter-1971db27.js');
|
|
7
9
|
var adapters_ws = require('../ws.js');
|
|
10
|
+
require('../../createProxy-7e413449.js');
|
|
11
|
+
require('../../TRPCError-e2c8eb77.js');
|
|
12
|
+
require('../../router-3344b52a.js');
|
|
13
|
+
require('../../contentType-3a829011.js');
|
|
14
|
+
require('../../observable-2a5a96d5.js');
|
|
15
|
+
require('../../parseTRPCMessage-6e6c204e.js');
|
|
8
16
|
|
|
9
17
|
async function fastifyRequestHandler(opts) {
|
|
10
18
|
const createContext = async (innerOpts)=>{
|
|
@@ -42,7 +50,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
42
50
|
stream._read = ()=>{}; // eslint-disable-line @typescript-eslint/no-empty-function -- https://github.com/fastify/fastify/issues/805#issuecomment-369172154
|
|
43
51
|
resolve(opts.res.send(stream));
|
|
44
52
|
isStream = true;
|
|
45
|
-
formatter =
|
|
53
|
+
formatter = batchStreamFormatter.getBatchStreamFormatter();
|
|
46
54
|
}
|
|
47
55
|
};
|
|
48
56
|
const unstable_onChunk = ([index, string])=>{
|
|
@@ -53,7 +61,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
53
61
|
stream.push(formatter(index, string));
|
|
54
62
|
}
|
|
55
63
|
};
|
|
56
|
-
|
|
64
|
+
resolveHTTPResponse.resolveHTTPResponse({
|
|
57
65
|
req,
|
|
58
66
|
createContext,
|
|
59
67
|
path: opts.path,
|
|
@@ -84,7 +92,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
84
92
|
/**
|
|
85
93
|
* 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`
|
|
86
94
|
*
|
|
87
|
-
* Do **not** import from `@trpc/core`
|
|
95
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
88
96
|
* @example
|
|
89
97
|
* ```ts
|
|
90
98
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import
|
|
2
|
+
import '../../rootConfig-6b04a6b8.mjs';
|
|
3
|
+
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-9322334c.mjs';
|
|
4
|
+
import { g as getBatchStreamFormatter } from '../../batchStreamFormatter-378277dc.mjs';
|
|
3
5
|
import { applyWSSHandler } from '../ws.mjs';
|
|
6
|
+
import '../../createProxy-0306dcaa.mjs';
|
|
7
|
+
import '../../TRPCError-14edcf88.mjs';
|
|
8
|
+
import '../../router-d6789e4b.mjs';
|
|
9
|
+
import '../../contentType-2ed02bef.mjs';
|
|
10
|
+
import '../../observable-6d025a37.mjs';
|
|
11
|
+
import '../../parseTRPCMessage-8eb0bbe9.mjs';
|
|
4
12
|
|
|
5
13
|
async function fastifyRequestHandler(opts) {
|
|
6
14
|
const createContext = async (innerOpts)=>{
|
|
@@ -80,7 +88,7 @@ async function fastifyRequestHandler(opts) {
|
|
|
80
88
|
/**
|
|
81
89
|
* 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`
|
|
82
90
|
*
|
|
83
|
-
* Do **not** import from `@trpc/core`
|
|
91
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
84
92
|
* @example
|
|
85
93
|
* ```ts
|
|
86
94
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('../../rootConfig-3371c473.js');
|
|
6
|
+
var resolveHTTPResponse = require('../../resolveHTTPResponse-d64c48e1.js');
|
|
7
|
+
var batchStreamFormatter = require('../../batchStreamFormatter-1971db27.js');
|
|
8
|
+
require('../../createProxy-7e413449.js');
|
|
9
|
+
require('../../TRPCError-e2c8eb77.js');
|
|
10
|
+
require('../../router-3344b52a.js');
|
|
11
|
+
require('../../contentType-3a829011.js');
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* 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
15
|
*
|
|
10
|
-
* Do **not** import from `@trpc/core`
|
|
16
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
11
17
|
* @example
|
|
12
18
|
* ```ts
|
|
13
19
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -73,7 +79,7 @@ async function fetchRequestHandler(opts) {
|
|
|
73
79
|
});
|
|
74
80
|
resolve(response);
|
|
75
81
|
encoder = new TextEncoder();
|
|
76
|
-
formatter =
|
|
82
|
+
formatter = batchStreamFormatter.getBatchStreamFormatter();
|
|
77
83
|
isStream = true;
|
|
78
84
|
}
|
|
79
85
|
};
|
|
@@ -89,7 +95,7 @@ async function fetchRequestHandler(opts) {
|
|
|
89
95
|
controller.enqueue(encoder.encode(formatter(index, string)));
|
|
90
96
|
}
|
|
91
97
|
};
|
|
92
|
-
|
|
98
|
+
resolveHTTPResponse.resolveHTTPResponse({
|
|
93
99
|
req,
|
|
94
100
|
createContext,
|
|
95
101
|
path,
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../rootConfig-6b04a6b8.mjs';
|
|
2
|
+
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-9322334c.mjs';
|
|
3
|
+
import { g as getBatchStreamFormatter } from '../../batchStreamFormatter-378277dc.mjs';
|
|
4
|
+
import '../../createProxy-0306dcaa.mjs';
|
|
5
|
+
import '../../TRPCError-14edcf88.mjs';
|
|
6
|
+
import '../../router-d6789e4b.mjs';
|
|
7
|
+
import '../../contentType-2ed02bef.mjs';
|
|
2
8
|
|
|
3
9
|
/**
|
|
4
10
|
* 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
11
|
*
|
|
6
|
-
* Do **not** import from `@trpc/core`
|
|
12
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
7
13
|
* @example
|
|
8
14
|
* ```ts
|
|
9
15
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
package/dist/adapters/next.d.ts
CHANGED
|
@@ -1,7 +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
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
package/dist/adapters/next.js
CHANGED
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var createProxy = require('../createProxy-7e413449.js');
|
|
6
|
+
var TRPCError = require('../TRPCError-e2c8eb77.js');
|
|
7
|
+
require('../rootConfig-3371c473.js');
|
|
8
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-f4b7e374.js');
|
|
9
|
+
require('../resolveHTTPResponse-d64c48e1.js');
|
|
10
|
+
require('../router-3344b52a.js');
|
|
11
|
+
require('../contentType-3a829011.js');
|
|
12
|
+
require('../batchStreamFormatter-1971db27.js');
|
|
7
13
|
require('./node-http/content-type/json/index.js');
|
|
8
14
|
require('../contentType-d9d22104.js');
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* 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`
|
|
12
18
|
*
|
|
13
|
-
* Do **not** import from `@trpc/core`
|
|
19
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
14
20
|
* @example
|
|
15
21
|
* ```ts
|
|
16
22
|
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
@@ -30,9 +36,9 @@ function createNextApiHandler(opts) {
|
|
|
30
36
|
}
|
|
31
37
|
const path = getPath();
|
|
32
38
|
if (path === null) {
|
|
33
|
-
const error =
|
|
39
|
+
const error = createProxy.getErrorShape({
|
|
34
40
|
config: opts.router._def._config,
|
|
35
|
-
error: new
|
|
41
|
+
error: new TRPCError.TRPCError({
|
|
36
42
|
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
37
43
|
code: 'INTERNAL_SERVER_ERROR'
|
|
38
44
|
}),
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { getErrorShape
|
|
2
|
-
import {
|
|
1
|
+
import { a as getErrorShape } from '../createProxy-0306dcaa.mjs';
|
|
2
|
+
import { T as TRPCError } from '../TRPCError-14edcf88.mjs';
|
|
3
|
+
import '../rootConfig-6b04a6b8.mjs';
|
|
4
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-257a3b5f.mjs';
|
|
5
|
+
import '../resolveHTTPResponse-9322334c.mjs';
|
|
6
|
+
import '../router-d6789e4b.mjs';
|
|
7
|
+
import '../contentType-2ed02bef.mjs';
|
|
8
|
+
import '../batchStreamFormatter-378277dc.mjs';
|
|
3
9
|
import './node-http/content-type/json/index.mjs';
|
|
4
10
|
import '../contentType-72ed9df5.mjs';
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* 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
14
|
*
|
|
9
|
-
* Do **not** import from `@trpc/core`
|
|
15
|
+
* Do **not** import from `@trpc/server/unstable-core-do-not-import`
|
|
10
16
|
* @example
|
|
11
17
|
* ```ts
|
|
12
18
|
* import type { AnyTRPCRouter } from '@trpc/server'
|