@trpc/server 11.3.1 → 11.3.2-canary.4
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/adapters/aws-lambda/package.json +1 -0
- package/adapters/express/package.json +1 -0
- package/adapters/fastify/package.json +1 -0
- package/adapters/fetch/package.json +1 -0
- package/adapters/next/package.json +1 -0
- package/adapters/next-app-dir/package.json +1 -0
- package/adapters/node-http/package.json +1 -0
- package/adapters/standalone/package.json +1 -0
- package/adapters/ws/package.json +1 -0
- package/dist/adapters/aws-lambda/index.cjs +255 -0
- package/dist/adapters/aws-lambda/index.d.cts +31 -0
- package/dist/adapters/aws-lambda/index.d.cts.map +1 -0
- package/dist/adapters/aws-lambda/index.d.mts +31 -0
- package/dist/adapters/aws-lambda/index.d.mts.map +1 -0
- package/dist/adapters/aws-lambda/index.mjs +248 -57
- package/dist/adapters/aws-lambda/index.mjs.map +1 -0
- package/dist/adapters/express.cjs +34 -0
- package/dist/adapters/express.d.cts +15 -0
- package/dist/adapters/express.d.cts.map +1 -0
- package/dist/adapters/express.d.mts +15 -0
- package/dist/adapters/express.d.mts.map +1 -0
- package/dist/adapters/express.mjs +30 -32
- package/dist/adapters/express.mjs.map +1 -0
- package/dist/adapters/fastify/index.cjs +75 -0
- package/dist/adapters/fastify/index.d.cts +29 -0
- package/dist/adapters/fastify/index.d.cts.map +1 -0
- package/dist/adapters/fastify/index.d.mts +29 -0
- package/dist/adapters/fastify/index.d.mts.map +1 -0
- package/dist/adapters/fastify/index.mjs +75 -2
- package/dist/adapters/fastify/index.mjs.map +1 -0
- package/dist/adapters/fetch/index.cjs +58 -0
- package/dist/adapters/fetch/index.d.cts +30 -0
- package/dist/adapters/fetch/index.d.cts.map +1 -0
- package/dist/adapters/fetch/index.d.mts +30 -0
- package/dist/adapters/fetch/index.d.mts.map +1 -0
- package/dist/adapters/fetch/index.mjs +59 -1
- package/dist/adapters/fetch/index.mjs.map +1 -0
- package/dist/adapters/next-app-dir.cjs +3050 -0
- package/dist/adapters/next-app-dir.d.cts +58 -0
- package/dist/adapters/next-app-dir.d.cts.map +1 -0
- package/dist/adapters/next-app-dir.d.mts +58 -0
- package/dist/adapters/next-app-dir.d.mts.map +1 -0
- package/dist/adapters/next-app-dir.mjs +3048 -4
- package/dist/adapters/next-app-dir.mjs.map +1 -0
- package/dist/adapters/next.cjs +41 -0
- package/dist/adapters/next.d.cts +19 -0
- package/dist/adapters/next.d.cts.map +1 -0
- package/dist/adapters/next.d.mts +19 -0
- package/dist/adapters/next.d.mts.map +1 -0
- package/dist/adapters/next.mjs +37 -44
- package/dist/adapters/next.mjs.map +1 -0
- package/dist/adapters/node-http/index.cjs +15 -0
- package/dist/adapters/node-http/index.d.cts +5 -0
- package/dist/adapters/node-http/index.d.mts +5 -0
- package/dist/adapters/node-http/index.mjs +12 -2
- package/dist/adapters/standalone.cjs +52 -0
- package/dist/adapters/standalone.d.cts +33 -0
- package/dist/adapters/standalone.d.cts.map +1 -0
- package/dist/adapters/standalone.d.mts +33 -0
- package/dist/adapters/standalone.d.mts.map +1 -0
- package/dist/adapters/standalone.mjs +40 -34
- package/dist/adapters/standalone.mjs.map +1 -0
- package/dist/adapters/ws.cjs +17 -0
- package/dist/adapters/ws.d.cts +61 -0
- package/dist/adapters/ws.d.cts.map +1 -0
- package/dist/adapters/ws.d.mts +61 -0
- package/dist/adapters/ws.d.mts.map +1 -0
- package/dist/adapters/ws.mjs +14 -539
- package/dist/contentTypeParsers-SN4WL9ze.mjs +13 -0
- package/dist/contentTypeParsers-SN4WL9ze.mjs.map +1 -0
- package/dist/contentTypeParsers-iAFF_pJG.cjs +18 -0
- package/dist/getErrorShape-CsikfkAc.cjs +201 -0
- package/dist/getErrorShape-DyYil4aT.mjs +149 -0
- package/dist/getErrorShape-DyYil4aT.mjs.map +1 -0
- package/dist/http-CWyjOa1l.mjs +0 -0
- package/dist/http-DXy3XyhL.cjs +0 -0
- package/dist/http.cjs +14 -0
- package/dist/http.d.cts +3 -0
- package/dist/http.d.mts +3 -0
- package/dist/http.mjs +9 -8
- package/dist/index.cjs +22 -0
- package/dist/index.d-BiUz7kM_.d.cts +65 -0
- package/dist/index.d-BiUz7kM_.d.cts.map +1 -0
- package/dist/index.d-ChWYhXbd.d.cts +99 -0
- package/dist/index.d-ChWYhXbd.d.cts.map +1 -0
- package/dist/index.d-CvZXeEyR.d.cts +11 -0
- package/dist/index.d-CvZXeEyR.d.cts.map +1 -0
- package/dist/index.d-D4qZxQJh.d.mts +65 -0
- package/dist/index.d-D4qZxQJh.d.mts.map +1 -0
- package/dist/index.d-Ocy_AnXj.d.mts +99 -0
- package/dist/index.d-Ocy_AnXj.d.mts.map +1 -0
- package/dist/index.d-vq_QHko2.d.mts +11 -0
- package/dist/index.d-vq_QHko2.d.mts.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +6 -13
- package/dist/initTRPC-COaJMShh.mjs +339 -0
- package/dist/initTRPC-COaJMShh.mjs.map +1 -0
- package/dist/initTRPC-DjEpHmY2.cjs +397 -0
- package/dist/node-http-BPR68yI4.cjs +243 -0
- package/dist/node-http-BUQnHuGI.mjs +221 -0
- package/dist/node-http-BUQnHuGI.mjs.map +1 -0
- package/dist/observable/index.cjs +13 -0
- package/dist/observable/index.d.cts +2 -0
- package/dist/observable/index.d.mts +2 -0
- package/dist/observable/index.mjs +4 -3
- package/dist/observable-B1orLHHI.mjs +155 -0
- package/dist/observable-B1orLHHI.mjs.map +1 -0
- package/dist/observable-BwdrSFZU.cjs +178 -0
- package/dist/observable-C6qq2Ydk.cjs +180 -0
- package/dist/observable-CFXA_tyK.mjs +146 -0
- package/dist/observable-CFXA_tyK.mjs.map +1 -0
- package/dist/parseTRPCMessage-ByQWigsq.cjs +73 -0
- package/dist/parseTRPCMessage-CNyYMSRB.mjs +63 -0
- package/dist/parseTRPCMessage-CNyYMSRB.mjs.map +1 -0
- package/dist/resolveResponse-B2CuaT_1.cjs +2042 -0
- package/dist/resolveResponse-DPbYgJDD.mjs +1912 -0
- package/dist/resolveResponse-DPbYgJDD.mjs.map +1 -0
- package/dist/rpc.cjs +6 -0
- package/dist/rpc.d.cts +3 -0
- package/dist/rpc.d.mts +3 -0
- package/dist/rpc.mjs +4 -5
- package/dist/shared.cjs +5 -0
- package/dist/shared.d.cts +4 -0
- package/dist/shared.d.mts +4 -0
- package/dist/shared.mjs +4 -6
- package/dist/tracked-Dl9sBZxY.cjs +483 -0
- package/dist/tracked-GEWPoL0C.mjs +383 -0
- package/dist/tracked-GEWPoL0C.mjs.map +1 -0
- package/dist/unstable-core-do-not-import-D89CaGtL.mjs +29 -0
- package/dist/unstable-core-do-not-import-D89CaGtL.mjs.map +1 -0
- package/dist/unstable-core-do-not-import-DFQys1IC.cjs +34 -0
- package/dist/unstable-core-do-not-import.cjs +83 -0
- package/dist/unstable-core-do-not-import.d-CSxj_rbP.d.cts +1974 -0
- package/dist/unstable-core-do-not-import.d-CSxj_rbP.d.cts.map +1 -0
- package/dist/unstable-core-do-not-import.d-ptrxwuSa.d.mts +1974 -0
- package/dist/unstable-core-do-not-import.d-ptrxwuSa.d.mts.map +1 -0
- package/dist/unstable-core-do-not-import.d.cts +3 -0
- package/dist/unstable-core-do-not-import.d.mts +3 -0
- package/dist/unstable-core-do-not-import.mjs +11 -30
- package/dist/utils-BHZJcBRv.mjs +137 -0
- package/dist/utils-BHZJcBRv.mjs.map +1 -0
- package/dist/utils-DVO6HZiR.cjs +220 -0
- package/dist/ws-C2nEUNk_.cjs +425 -0
- package/dist/ws-eIVIMTrw.mjs +409 -0
- package/dist/ws-eIVIMTrw.mjs.map +1 -0
- package/http/package.json +1 -0
- package/observable/package.json +1 -0
- package/package.json +131 -55
- package/rpc/package.json +1 -0
- package/shared/package.json +1 -0
- package/src/@trpc/server/index.ts +24 -0
- package/src/unstable-core-do-not-import/http/contentType.ts +5 -4
- package/src/unstable-core-do-not-import/initTRPC.ts +79 -4
- package/src/unstable-core-do-not-import/router.ts +36 -12
- package/src/unstable-core-do-not-import/utils.ts +3 -2
- package/unstable-core-do-not-import/package.json +1 -0
- package/adapters/aws-lambda/index.d.ts +0 -1
- package/adapters/aws-lambda/index.js +0 -1
- package/adapters/express/index.d.ts +0 -1
- package/adapters/express/index.js +0 -1
- package/adapters/fastify/index.d.ts +0 -1
- package/adapters/fastify/index.js +0 -1
- package/adapters/fetch/index.d.ts +0 -1
- package/adapters/fetch/index.js +0 -1
- package/adapters/next/index.d.ts +0 -1
- package/adapters/next/index.js +0 -1
- package/adapters/next-app-dir/index.d.ts +0 -1
- package/adapters/next-app-dir/index.js +0 -1
- package/adapters/node-http/content-type/form-data/index.d.ts +0 -1
- package/adapters/node-http/content-type/form-data/index.js +0 -1
- package/adapters/node-http/content-type/json/index.d.ts +0 -1
- package/adapters/node-http/content-type/json/index.js +0 -1
- package/adapters/node-http/index.d.ts +0 -1
- package/adapters/node-http/index.js +0 -1
- package/adapters/standalone/index.d.ts +0 -1
- package/adapters/standalone/index.js +0 -1
- package/adapters/ws/index.d.ts +0 -1
- package/adapters/ws/index.js +0 -1
- package/dist/@trpc/server/http.d.ts +0 -8
- package/dist/@trpc/server/http.d.ts.map +0 -1
- package/dist/@trpc/server/index.d.ts +0 -65
- 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/adapters/aws-lambda/getPlanner.d.ts +0 -15
- package/dist/adapters/aws-lambda/getPlanner.d.ts.map +0 -1
- package/dist/adapters/aws-lambda/getPlanner.js +0 -179
- package/dist/adapters/aws-lambda/getPlanner.mjs +0 -177
- package/dist/adapters/aws-lambda/index.d.ts +0 -23
- package/dist/adapters/aws-lambda/index.d.ts.map +0 -1
- package/dist/adapters/aws-lambda/index.js +0 -67
- package/dist/adapters/express.d.ts +0 -15
- package/dist/adapters/express.d.ts.map +0 -1
- package/dist/adapters/express.js +0 -39
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts +0 -22
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +0 -1
- package/dist/adapters/fastify/fastifyRequestHandler.js +0 -49
- package/dist/adapters/fastify/fastifyRequestHandler.mjs +0 -47
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +0 -21
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +0 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.js +0 -56
- package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +0 -54
- package/dist/adapters/fastify/index.d.ts +0 -3
- package/dist/adapters/fastify/index.d.ts.map +0 -1
- package/dist/adapters/fastify/index.js +0 -9
- package/dist/adapters/fetch/fetchRequestHandler.d.ts +0 -13
- package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +0 -1
- package/dist/adapters/fetch/fetchRequestHandler.js +0 -77
- package/dist/adapters/fetch/fetchRequestHandler.mjs +0 -75
- package/dist/adapters/fetch/index.d.ts +0 -3
- package/dist/adapters/fetch/index.d.ts.map +0 -1
- package/dist/adapters/fetch/index.js +0 -7
- package/dist/adapters/fetch/types.d.ts +0 -27
- package/dist/adapters/fetch/types.d.ts.map +0 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.d.ts +0 -25
- package/dist/adapters/next-app-dir/nextAppDirCaller.d.ts.map +0 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.js +0 -94
- package/dist/adapters/next-app-dir/nextAppDirCaller.mjs +0 -92
- package/dist/adapters/next-app-dir/notFound.d.ts +0 -7
- package/dist/adapters/next-app-dir/notFound.d.ts.map +0 -1
- package/dist/adapters/next-app-dir/notFound.js +0 -18
- package/dist/adapters/next-app-dir/notFound.mjs +0 -16
- package/dist/adapters/next-app-dir/redirect.d.ts +0 -18
- package/dist/adapters/next-app-dir/redirect.d.ts.map +0 -1
- package/dist/adapters/next-app-dir/redirect.js +0 -49
- package/dist/adapters/next-app-dir/redirect.mjs +0 -46
- package/dist/adapters/next-app-dir/rethrowNextErrors.d.ts +0 -6
- package/dist/adapters/next-app-dir/rethrowNextErrors.d.ts.map +0 -1
- package/dist/adapters/next-app-dir/rethrowNextErrors.js +0 -70
- package/dist/adapters/next-app-dir/rethrowNextErrors.mjs +0 -49
- package/dist/adapters/next-app-dir.d.ts +0 -7
- package/dist/adapters/next-app-dir.d.ts.map +0 -1
- package/dist/adapters/next-app-dir.js +0 -13
- package/dist/adapters/next.d.ts +0 -19
- package/dist/adapters/next.d.ts.map +0 -1
- package/dist/adapters/next.js +0 -51
- package/dist/adapters/node-http/incomingMessageToRequest.d.ts +0 -12
- package/dist/adapters/node-http/incomingMessageToRequest.d.ts.map +0 -1
- package/dist/adapters/node-http/incomingMessageToRequest.js +0 -123
- package/dist/adapters/node-http/incomingMessageToRequest.mjs +0 -120
- package/dist/adapters/node-http/index.d.ts +0 -4
- package/dist/adapters/node-http/index.d.ts.map +0 -1
- package/dist/adapters/node-http/index.js +0 -11
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +0 -20
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +0 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.js +0 -96
- package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +0 -93
- package/dist/adapters/node-http/types.d.ts +0 -81
- package/dist/adapters/node-http/types.d.ts.map +0 -1
- package/dist/adapters/node-http/writeResponse.d.ts +0 -18
- package/dist/adapters/node-http/writeResponse.d.ts.map +0 -1
- package/dist/adapters/node-http/writeResponse.js +0 -83
- package/dist/adapters/node-http/writeResponse.mjs +0 -80
- package/dist/adapters/standalone.d.ts +0 -36
- package/dist/adapters/standalone.d.ts.map +0 -1
- package/dist/adapters/standalone.js +0 -49
- package/dist/adapters/ws.d.ts +0 -54
- package/dist/adapters/ws.d.ts.map +0 -1
- package/dist/adapters/ws.js +0 -544
- package/dist/http.d.ts +0 -2
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -19
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -35
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.34.8_tslib@2.8.1_typescript@5.8.2/node_modules/tslib/tslib.es6.js +0 -73
- package/dist/observable/behaviorSubject.d.ts +0 -15
- package/dist/observable/behaviorSubject.d.ts.map +0 -1
- package/dist/observable/behaviorSubject.js +0 -40
- package/dist/observable/behaviorSubject.mjs +0 -38
- package/dist/observable/index.d.ts +0 -5
- package/dist/observable/index.d.ts.map +0 -1
- package/dist/observable/index.js +0 -18
- package/dist/observable/observable.d.ts +0 -12
- package/dist/observable/observable.d.ts.map +0 -1
- package/dist/observable/observable.js +0 -180
- package/dist/observable/observable.mjs +0 -175
- package/dist/observable/operators.d.ts +0 -10
- package/dist/observable/operators.d.ts.map +0 -1
- package/dist/observable/operators.js +0 -134
- package/dist/observable/operators.mjs +0 -128
- package/dist/observable/types.d.ts +0 -26
- package/dist/observable/types.d.ts.map +0 -1
- package/dist/rpc.d.ts +0 -2
- package/dist/rpc.d.ts.map +0 -1
- package/dist/rpc.js +0 -13
- package/dist/shared.d.ts +0 -26
- package/dist/shared.d.ts.map +0 -1
- package/dist/shared.js +0 -13
- package/dist/unstable-core-do-not-import/clientish/inference.d.ts +0 -17
- package/dist/unstable-core-do-not-import/clientish/inference.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts +0 -36
- package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/clientish/serialize.d.ts +0 -69
- package/dist/unstable-core-do-not-import/clientish/serialize.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 -76
- package/dist/unstable-core-do-not-import/createProxy.mjs +0 -73
- 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 -76
- package/dist/unstable-core-do-not-import/error/TRPCError.mjs +0 -72
- package/dist/unstable-core-do-not-import/error/formatter.d.ts +0 -38
- 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/abortError.d.ts +0 -5
- package/dist/unstable-core-do-not-import/http/abortError.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/abortError.js +0 -13
- package/dist/unstable-core-do-not-import/http/abortError.mjs +0 -10
- package/dist/unstable-core-do-not-import/http/contentType.d.ts +0 -13
- 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 -229
- package/dist/unstable-core-do-not-import/http/contentType.mjs +0 -227
- package/dist/unstable-core-do-not-import/http/contentTypeParsers.d.ts +0 -14
- package/dist/unstable-core-do-not-import/http/contentTypeParsers.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/contentTypeParsers.js +0 -14
- package/dist/unstable-core-do-not-import/http/contentTypeParsers.mjs +0 -12
- package/dist/unstable-core-do-not-import/http/formDataToObject.d.ts +0 -2
- package/dist/unstable-core-do-not-import/http/formDataToObject.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/formDataToObject.js +0 -40
- package/dist/unstable-core-do-not-import/http/formDataToObject.mjs +0 -38
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +0 -10
- 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 -85
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +0 -78
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.d.ts +0 -4
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.js +0 -42
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.mjs +0 -39
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts +0 -15
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.js +0 -572
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +0 -570
- package/dist/unstable-core-do-not-import/http/types.d.ts +0 -138
- package/dist/unstable-core-do-not-import/http/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +0 -94
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/initTRPC.js +0 -82
- package/dist/unstable-core-do-not-import/initTRPC.mjs +0 -80
- package/dist/unstable-core-do-not-import/middleware.d.ts +0 -107
- package/dist/unstable-core-do-not-import/middleware.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/middleware.js +0 -96
- package/dist/unstable-core-do-not-import/middleware.mjs +0 -90
- package/dist/unstable-core-do-not-import/parser.d.ts +0 -44
- package/dist/unstable-core-do-not-import/parser.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/parser.js +0 -54
- package/dist/unstable-core-do-not-import/parser.mjs +0 -52
- package/dist/unstable-core-do-not-import/procedure.d.ts +0 -77
- 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 -161
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.js +0 -201
- package/dist/unstable-core-do-not-import/procedureBuilder.mjs +0 -199
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +0 -98
- 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 -98
- package/dist/unstable-core-do-not-import/router.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/router.js +0 -285
- package/dist/unstable-core-do-not-import/router.mjs +0 -278
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts +0 -45
- 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 -69
- package/dist/unstable-core-do-not-import/rpc/codes.mjs +0 -65
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +0 -109
- 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 -63
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.mjs +0 -61
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts +0 -119
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.js +0 -607
- package/dist/unstable-core-do-not-import/stream/jsonl.mjs +0 -603
- package/dist/unstable-core-do-not-import/stream/sse.d.ts +0 -108
- package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/sse.js +0 -373
- package/dist/unstable-core-do-not-import/stream/sse.mjs +0 -369
- package/dist/unstable-core-do-not-import/stream/sse.types.d.ts +0 -31
- package/dist/unstable-core-do-not-import/stream/sse.types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/tracked.d.ts +0 -31
- package/dist/unstable-core-do-not-import/stream/tracked.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/tracked.js +0 -29
- package/dist/unstable-core-do-not-import/stream/tracked.mjs +0 -25
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts +0 -17
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.js +0 -174
- package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.mjs +0 -170
- package/dist/unstable-core-do-not-import/stream/utils/createDeferred.d.ts +0 -7
- package/dist/unstable-core-do-not-import/stream/utils/createDeferred.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/createDeferred.js +0 -17
- package/dist/unstable-core-do-not-import/stream/utils/createDeferred.mjs +0 -15
- package/dist/unstable-core-do-not-import/stream/utils/disposable.d.ts +0 -17
- package/dist/unstable-core-do-not-import/stream/utils/disposable.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/disposable.js +0 -46
- package/dist/unstable-core-do-not-import/stream/utils/disposable.mjs +0 -43
- package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.d.ts +0 -17
- package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.js +0 -241
- package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.mjs +0 -239
- package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.d.ts +0 -8
- package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.js +0 -25
- package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.mjs +0 -23
- package/dist/unstable-core-do-not-import/stream/utils/timerResource.d.ts +0 -5
- package/dist/unstable-core-do-not-import/stream/utils/timerResource.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/timerResource.js +0 -26
- package/dist/unstable-core-do-not-import/stream/utils/timerResource.mjs +0 -23
- package/dist/unstable-core-do-not-import/stream/utils/withPing.d.ts +0 -7
- package/dist/unstable-core-do-not-import/stream/utils/withPing.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/stream/utils/withPing.js +0 -130
- package/dist/unstable-core-do-not-import/stream/utils/withPing.mjs +0 -127
- package/dist/unstable-core-do-not-import/transformer.d.ts +0 -99
- package/dist/unstable-core-do-not-import/transformer.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/transformer.js +0 -106
- package/dist/unstable-core-do-not-import/transformer.mjs +0 -101
- package/dist/unstable-core-do-not-import/types.d.ts +0 -127
- package/dist/unstable-core-do-not-import/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/utils.d.ts +0 -42
- package/dist/unstable-core-do-not-import/utils.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/utils.js +0 -96
- package/dist/unstable-core-do-not-import/utils.mjs +0 -83
- package/dist/unstable-core-do-not-import.d.ts +0 -47
- package/dist/unstable-core-do-not-import.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import.js +0 -109
- package/dist/vendor/cookie-es/set-cookie/split.d.ts +0 -18
- package/dist/vendor/cookie-es/set-cookie/split.d.ts.map +0 -1
- package/dist/vendor/cookie-es/set-cookie/split.js +0 -79
- package/dist/vendor/cookie-es/set-cookie/split.mjs +0 -77
- package/dist/vendor/standard-schema-v1/error.d.ts +0 -13
- package/dist/vendor/standard-schema-v1/error.d.ts.map +0 -1
- package/dist/vendor/standard-schema-v1/error.js +0 -28
- package/dist/vendor/standard-schema-v1/error.mjs +0 -26
- package/dist/vendor/standard-schema-v1/spec.d.ts +0 -60
- package/dist/vendor/standard-schema-v1/spec.d.ts.map +0 -1
- package/dist/vendor/unpromise/index.d.ts +0 -3
- package/dist/vendor/unpromise/index.d.ts.map +0 -1
- package/dist/vendor/unpromise/types.d.ts +0 -28
- package/dist/vendor/unpromise/types.d.ts.map +0 -1
- package/dist/vendor/unpromise/unpromise.d.ts +0 -121
- package/dist/vendor/unpromise/unpromise.d.ts.map +0 -1
- package/dist/vendor/unpromise/unpromise.js +0 -292
- package/dist/vendor/unpromise/unpromise.mjs +0 -289
- package/http/index.d.ts +0 -1
- package/http/index.js +0 -1
- package/observable/index.d.ts +0 -1
- package/observable/index.js +0 -1
- package/rpc/index.d.ts +0 -1
- package/rpc/index.js +0 -1
- package/shared/index.d.ts +0 -1
- package/shared/index.js +0 -1
- package/unstable-core-do-not-import/index.d.ts +0 -1
- package/unstable-core-do-not-import/index.js +0 -1
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
|
-
import { TRPCError, getTRPCErrorFromUnknown } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import { formDataToObject } from '../../unstable-core-do-not-import/http/formDataToObject.mjs';
|
|
4
|
-
import '../../vendor/unpromise/unpromise.mjs';
|
|
5
|
-
import '../../unstable-core-do-not-import/stream/utils/disposable.mjs';
|
|
6
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
7
|
-
import { TRPCRedirectError } from './redirect.mjs';
|
|
8
|
-
import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Create a caller that works with Next.js React Server Components & Server Actions
|
|
12
|
-
*/ function nextAppDirCaller(config) {
|
|
13
|
-
const { normalizeFormData = true } = config;
|
|
14
|
-
const createContext = async ()=>{
|
|
15
|
-
return config?.createContext?.() ?? {};
|
|
16
|
-
};
|
|
17
|
-
return async (opts)=>{
|
|
18
|
-
const path = config.pathExtractor?.({
|
|
19
|
-
meta: opts._def.meta
|
|
20
|
-
}) ?? '';
|
|
21
|
-
const ctx = await createContext().catch((cause)=>{
|
|
22
|
-
const error = new TRPCError({
|
|
23
|
-
code: 'INTERNAL_SERVER_ERROR',
|
|
24
|
-
message: 'Failed to create context',
|
|
25
|
-
cause
|
|
26
|
-
});
|
|
27
|
-
throw error;
|
|
28
|
-
});
|
|
29
|
-
const handleError = (cause)=>{
|
|
30
|
-
const error = getTRPCErrorFromUnknown(cause);
|
|
31
|
-
config.onError?.({
|
|
32
|
-
ctx,
|
|
33
|
-
error,
|
|
34
|
-
input: opts.args[0],
|
|
35
|
-
path,
|
|
36
|
-
type: opts._def.type
|
|
37
|
-
});
|
|
38
|
-
rethrowNextErrors(error);
|
|
39
|
-
throw error;
|
|
40
|
-
};
|
|
41
|
-
switch(opts._def.type){
|
|
42
|
-
case 'mutation':
|
|
43
|
-
{
|
|
44
|
-
/**
|
|
45
|
-
* When you wrap an action with useFormState, it gets an extra argument as its first argument.
|
|
46
|
-
* The submitted form data is therefore its second argument instead of its first as it would usually be.
|
|
47
|
-
* The new first argument that gets added is the current state of the form.
|
|
48
|
-
* @see https://react.dev/reference/react-dom/hooks/useFormState#my-action-can-no-longer-read-the-submitted-form-data
|
|
49
|
-
*/ let input = opts.args.length === 1 ? opts.args[0] : opts.args[1];
|
|
50
|
-
if (normalizeFormData && input instanceof FormData) {
|
|
51
|
-
input = formDataToObject(input);
|
|
52
|
-
}
|
|
53
|
-
return await opts.invoke({
|
|
54
|
-
type: opts._def.type,
|
|
55
|
-
ctx,
|
|
56
|
-
getRawInput: async ()=>input,
|
|
57
|
-
path,
|
|
58
|
-
input,
|
|
59
|
-
signal: undefined
|
|
60
|
-
}).then((data)=>{
|
|
61
|
-
if (data instanceof TRPCRedirectError) throw data;
|
|
62
|
-
return data;
|
|
63
|
-
}).catch(handleError);
|
|
64
|
-
}
|
|
65
|
-
case 'query':
|
|
66
|
-
{
|
|
67
|
-
const input = opts.args[0];
|
|
68
|
-
return await opts.invoke({
|
|
69
|
-
type: opts._def.type,
|
|
70
|
-
ctx,
|
|
71
|
-
getRawInput: async ()=>input,
|
|
72
|
-
path,
|
|
73
|
-
input,
|
|
74
|
-
signal: undefined
|
|
75
|
-
}).then((data)=>{
|
|
76
|
-
if (data instanceof TRPCRedirectError) throw data;
|
|
77
|
-
return data;
|
|
78
|
-
}).catch(handleError);
|
|
79
|
-
}
|
|
80
|
-
case 'subscription':
|
|
81
|
-
default:
|
|
82
|
-
{
|
|
83
|
-
throw new TRPCError({
|
|
84
|
-
code: 'NOT_IMPLEMENTED',
|
|
85
|
-
message: `Not implemented for type ${opts._def.type}`
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { nextAppDirCaller };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { notFound as __notFound } from 'next/navigation';
|
|
2
|
-
/**
|
|
3
|
-
* Like `next/navigation`'s `notFound()` but throws a `TRPCError` that later will be handled by Next.js
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export declare const notFound: typeof __notFound;
|
|
7
|
-
//# sourceMappingURL=notFound.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/notFound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,UAI7B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
|
-
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
-
require('../../unstable-core-do-not-import/stream/utils/disposable.js');
|
|
7
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Like `next/navigation`'s `notFound()` but throws a `TRPCError` that later will be handled by Next.js
|
|
11
|
-
* @public
|
|
12
|
-
*/ const notFound = ()=>{
|
|
13
|
-
throw new TRPCError.TRPCError({
|
|
14
|
-
code: 'NOT_FOUND'
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.notFound = notFound;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
|
-
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
-
import '../../unstable-core-do-not-import/stream/utils/disposable.mjs';
|
|
5
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Like `next/navigation`'s `notFound()` but throws a `TRPCError` that later will be handled by Next.js
|
|
9
|
-
* @public
|
|
10
|
-
*/ const notFound = ()=>{
|
|
11
|
-
throw new TRPCError({
|
|
12
|
-
code: 'NOT_FOUND'
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { notFound };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { RedirectType } from 'next/navigation';
|
|
2
|
-
import { TRPCError } from '../../@trpc/server';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export declare class TRPCRedirectError extends TRPCError {
|
|
7
|
-
readonly args: readonly [string, RedirectType | undefined];
|
|
8
|
-
constructor(url: URL | string, redirectType?: RedirectType);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Like `next/navigation`'s `redirect()` but throws a `TRPCError` that later will be handled by Next.js
|
|
12
|
-
* This provides better typesafety than the `next/navigation`'s `redirect()` since the action continues
|
|
13
|
-
* to execute on the frontend even if Next's `redirect()` has a return type of `never`.
|
|
14
|
-
* @public
|
|
15
|
-
* @remark You should only use this if you're also using `nextAppDirCaller`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const redirect: (url: URL | string, redirectType?: RedirectType) => undefined;
|
|
18
|
-
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;IAC9C,SAAgB,IAAI,8CAAC;gBACT,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY;CAS3D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,GAAG,GAAG,MAAM,EAAE,eAAe,YAAY,KAEP,SAC/D,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
|
-
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
-
require('../../unstable-core-do-not-import/stream/utils/disposable.js');
|
|
7
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
8
|
-
|
|
9
|
-
function _define_property(obj, key, value) {
|
|
10
|
-
if (key in obj) {
|
|
11
|
-
Object.defineProperty(obj, key, {
|
|
12
|
-
value: value,
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
obj[key] = value;
|
|
19
|
-
}
|
|
20
|
-
return obj;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
*/ class TRPCRedirectError extends TRPCError.TRPCError {
|
|
25
|
-
constructor(url, redirectType){
|
|
26
|
-
super({
|
|
27
|
-
// TODO(?): This should maybe a custom error code
|
|
28
|
-
code: 'UNPROCESSABLE_CONTENT',
|
|
29
|
-
message: `Redirect error to "${url}" that will be handled by Next.js`
|
|
30
|
-
}), _define_property(this, "args", void 0);
|
|
31
|
-
this.args = [
|
|
32
|
-
url.toString(),
|
|
33
|
-
redirectType
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Like `next/navigation`'s `redirect()` but throws a `TRPCError` that later will be handled by Next.js
|
|
39
|
-
* This provides better typesafety than the `next/navigation`'s `redirect()` since the action continues
|
|
40
|
-
* to execute on the frontend even if Next's `redirect()` has a return type of `never`.
|
|
41
|
-
* @public
|
|
42
|
-
* @remark You should only use this if you're also using `nextAppDirCaller`.
|
|
43
|
-
*/ const redirect = (url, redirectType)=>{
|
|
44
|
-
// We rethrow this internally so the returntype on the client is undefined.
|
|
45
|
-
return new TRPCRedirectError(url, redirectType);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
exports.TRPCRedirectError = TRPCRedirectError;
|
|
49
|
-
exports.redirect = redirect;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import '../../unstable-core-do-not-import/rpc/codes.mjs';
|
|
2
|
-
import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
|
|
3
|
-
import '../../vendor/unpromise/unpromise.mjs';
|
|
4
|
-
import '../../unstable-core-do-not-import/stream/utils/disposable.mjs';
|
|
5
|
-
import '../../unstable-core-do-not-import/rootConfig.mjs';
|
|
6
|
-
|
|
7
|
-
function _define_property(obj, key, value) {
|
|
8
|
-
if (key in obj) {
|
|
9
|
-
Object.defineProperty(obj, key, {
|
|
10
|
-
value: value,
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
obj[key] = value;
|
|
17
|
-
}
|
|
18
|
-
return obj;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/ class TRPCRedirectError extends TRPCError {
|
|
23
|
-
constructor(url, redirectType){
|
|
24
|
-
super({
|
|
25
|
-
// TODO(?): This should maybe a custom error code
|
|
26
|
-
code: 'UNPROCESSABLE_CONTENT',
|
|
27
|
-
message: `Redirect error to "${url}" that will be handled by Next.js`
|
|
28
|
-
}), _define_property(this, "args", void 0);
|
|
29
|
-
this.args = [
|
|
30
|
-
url.toString(),
|
|
31
|
-
redirectType
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Like `next/navigation`'s `redirect()` but throws a `TRPCError` that later will be handled by Next.js
|
|
37
|
-
* This provides better typesafety than the `next/navigation`'s `redirect()` since the action continues
|
|
38
|
-
* to execute on the frontend even if Next's `redirect()` has a return type of `never`.
|
|
39
|
-
* @public
|
|
40
|
-
* @remark You should only use this if you're also using `nextAppDirCaller`.
|
|
41
|
-
*/ const redirect = (url, redirectType)=>{
|
|
42
|
-
// We rethrow this internally so the returntype on the client is undefined.
|
|
43
|
-
return new TRPCRedirectError(url, redirectType);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export { TRPCRedirectError, redirect };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rethrowNextErrors.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/rethrowNextErrors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyCpD;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,SAAS,SAsBjD,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var nextNavigation = require('next/navigation');
|
|
4
|
-
var redirect = require('./redirect.js');
|
|
5
|
-
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return e[k]; }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var nextNavigation__namespace = /*#__PURE__*/_interopNamespaceDefault(nextNavigation);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @remarks The helpers from `next/dist/client/components/*` has been removed in Next.js 15.
|
|
27
|
-
* Inlining them here instead...
|
|
28
|
-
* @see https://github.com/vercel/next.js/blob/5ae286ffd664e5c76841ed64f6e2da85a0835922/packages/next/src/client/components/redirect.ts#L97-L123
|
|
29
|
-
*/ const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT';
|
|
30
|
-
function isRedirectError(error) {
|
|
31
|
-
if (typeof error !== 'object' || error === null || !('digest' in error) || typeof error.digest !== 'string') {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const [errorCode, type, destination, status] = error.digest.split(';', 4);
|
|
35
|
-
const statusCode = Number(status);
|
|
36
|
-
return errorCode === REDIRECT_ERROR_CODE && (type === 'replace' || type === 'push') && typeof destination === 'string' && !isNaN(statusCode);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @remarks The helpers from `next/dist/client/components/*` has been removed in Next.js 15.
|
|
40
|
-
* Inlining them here instead...
|
|
41
|
-
* @see https://github.com/vercel/next.js/blob/5ae286ffd664e5c76841ed64f6e2da85a0835922/packages/next/src/client/components/not-found.ts#L33-L39
|
|
42
|
-
*/ const NOT_FOUND_ERROR_CODE = 'NEXT_NOT_FOUND';
|
|
43
|
-
function isNotFoundError(error) {
|
|
44
|
-
if (typeof error !== 'object' || error === null || !('digest' in error)) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return error.digest === NOT_FOUND_ERROR_CODE;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Rethrow errors that should be handled by Next.js
|
|
51
|
-
*/ const rethrowNextErrors = (error)=>{
|
|
52
|
-
if (error.code === 'NOT_FOUND') {
|
|
53
|
-
nextNavigation__namespace.notFound();
|
|
54
|
-
}
|
|
55
|
-
if (error instanceof redirect.TRPCRedirectError) {
|
|
56
|
-
nextNavigation__namespace.redirect(...error.args);
|
|
57
|
-
}
|
|
58
|
-
const { cause } = error;
|
|
59
|
-
// Next.js 15 has `unstable_rethrow`. Use that if it exists.
|
|
60
|
-
if ('unstable_rethrow' in nextNavigation__namespace && typeof nextNavigation__namespace.unstable_rethrow === 'function') {
|
|
61
|
-
nextNavigation__namespace.unstable_rethrow(cause);
|
|
62
|
-
}
|
|
63
|
-
// Before Next.js 15, we have to check and rethrow the error manually.
|
|
64
|
-
if (isRedirectError(cause) || isNotFoundError(cause)) {
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
|
-
throw cause;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
exports.rethrowNextErrors = rethrowNextErrors;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as nextNavigation from 'next/navigation';
|
|
2
|
-
import { TRPCRedirectError } from './redirect.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @remarks The helpers from `next/dist/client/components/*` has been removed in Next.js 15.
|
|
6
|
-
* Inlining them here instead...
|
|
7
|
-
* @see https://github.com/vercel/next.js/blob/5ae286ffd664e5c76841ed64f6e2da85a0835922/packages/next/src/client/components/redirect.ts#L97-L123
|
|
8
|
-
*/ const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT';
|
|
9
|
-
function isRedirectError(error) {
|
|
10
|
-
if (typeof error !== 'object' || error === null || !('digest' in error) || typeof error.digest !== 'string') {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
const [errorCode, type, destination, status] = error.digest.split(';', 4);
|
|
14
|
-
const statusCode = Number(status);
|
|
15
|
-
return errorCode === REDIRECT_ERROR_CODE && (type === 'replace' || type === 'push') && typeof destination === 'string' && !isNaN(statusCode);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @remarks The helpers from `next/dist/client/components/*` has been removed in Next.js 15.
|
|
19
|
-
* Inlining them here instead...
|
|
20
|
-
* @see https://github.com/vercel/next.js/blob/5ae286ffd664e5c76841ed64f6e2da85a0835922/packages/next/src/client/components/not-found.ts#L33-L39
|
|
21
|
-
*/ const NOT_FOUND_ERROR_CODE = 'NEXT_NOT_FOUND';
|
|
22
|
-
function isNotFoundError(error) {
|
|
23
|
-
if (typeof error !== 'object' || error === null || !('digest' in error)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return error.digest === NOT_FOUND_ERROR_CODE;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Rethrow errors that should be handled by Next.js
|
|
30
|
-
*/ const rethrowNextErrors = (error)=>{
|
|
31
|
-
if (error.code === 'NOT_FOUND') {
|
|
32
|
-
nextNavigation.notFound();
|
|
33
|
-
}
|
|
34
|
-
if (error instanceof TRPCRedirectError) {
|
|
35
|
-
nextNavigation.redirect(...error.args);
|
|
36
|
-
}
|
|
37
|
-
const { cause } = error;
|
|
38
|
-
// Next.js 15 has `unstable_rethrow`. Use that if it exists.
|
|
39
|
-
if ('unstable_rethrow' in nextNavigation && typeof nextNavigation.unstable_rethrow === 'function') {
|
|
40
|
-
nextNavigation.unstable_rethrow(cause);
|
|
41
|
-
}
|
|
42
|
-
// Before Next.js 15, we have to check and rethrow the error manually.
|
|
43
|
-
if (isRedirectError(cause) || isNotFoundError(cause)) {
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
|
-
throw cause;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { rethrowNextErrors };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { nextAppDirCaller as experimental_nextAppDirCaller } from './next-app-dir/nextAppDirCaller';
|
|
2
|
-
export { redirect as experimental_redirect } from './next-app-dir/redirect';
|
|
3
|
-
export { notFound as experimental_notFound } from './next-app-dir/notFound';
|
|
4
|
-
export {
|
|
5
|
-
/** @internal */
|
|
6
|
-
rethrowNextErrors, } from './next-app-dir/rethrowNextErrors';
|
|
7
|
-
//# sourceMappingURL=next-app-dir.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-dir.d.ts","sourceRoot":"","sources":["../../src/adapters/next-app-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO;AACL,gBAAgB;AAChB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var nextAppDirCaller = require('./next-app-dir/nextAppDirCaller.js');
|
|
4
|
-
var redirect = require('./next-app-dir/redirect.js');
|
|
5
|
-
var notFound = require('./next-app-dir/notFound.js');
|
|
6
|
-
var rethrowNextErrors = require('./next-app-dir/rethrowNextErrors.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.experimental_nextAppDirCaller = nextAppDirCaller.nextAppDirCaller;
|
|
11
|
-
exports.experimental_redirect = redirect.redirect;
|
|
12
|
-
exports.experimental_notFound = notFound.notFound;
|
|
13
|
-
exports.rethrowNextErrors = rethrowNextErrors.rethrowNextErrors;
|
package/dist/adapters/next.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
7
|
-
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
11
|
-
import type { AnyRouter } from '../@trpc/server';
|
|
12
|
-
import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from './node-http';
|
|
13
|
-
export type CreateNextContextOptions = NodeHTTPCreateContextFnOptions<NextApiRequest, NextApiResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* Preventing "TypeScript where it's tough not to get "The inferred type of 'xxxx' cannot be named without a reference to [...]"
|
|
16
|
-
*/
|
|
17
|
-
export type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
18
|
-
export declare function createNextApiHandler<TRouter extends AnyRouter>(opts: NodeHTTPHandlerOptions<TRouter, NextApiRequest, NextApiResponse>): NextApiHandler;
|
|
19
|
-
//# sourceMappingURL=next.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/adapters/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CACnE,cAAc,EACd,eAAe,CAChB,CAAC;AAEF;;GAEG;AACH,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,CAkChB"}
|
package/dist/adapters/next.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('../unstable-core-do-not-import/rpc/codes.js');
|
|
4
|
-
var utils = require('../unstable-core-do-not-import/utils.js');
|
|
5
|
-
var TRPCError = require('../unstable-core-do-not-import/error/TRPCError.js');
|
|
6
|
-
require('../vendor/unpromise/unpromise.js');
|
|
7
|
-
require('../unstable-core-do-not-import/stream/utils/disposable.js');
|
|
8
|
-
require('../unstable-core-do-not-import/rootConfig.js');
|
|
9
|
-
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import type { AnyTRPCRouter } from '@trpc/server'
|
|
17
|
-
* import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
|
|
18
|
-
* ```
|
|
19
|
-
*/ // @trpc/server
|
|
20
|
-
function createNextApiHandler(opts) {
|
|
21
|
-
return async (req, res)=>{
|
|
22
|
-
let path = '';
|
|
23
|
-
await utils.run(async ()=>{
|
|
24
|
-
path = utils.run(()=>{
|
|
25
|
-
if (typeof req.query['trpc'] === 'string') {
|
|
26
|
-
return req.query['trpc'];
|
|
27
|
-
}
|
|
28
|
-
if (Array.isArray(req.query['trpc'])) {
|
|
29
|
-
return req.query['trpc'].join('/');
|
|
30
|
-
}
|
|
31
|
-
throw new TRPCError.TRPCError({
|
|
32
|
-
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
33
|
-
code: 'INTERNAL_SERVER_ERROR'
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
await nodeHTTPRequestHandler.nodeHTTPRequestHandler({
|
|
37
|
-
...opts,
|
|
38
|
-
req,
|
|
39
|
-
res,
|
|
40
|
-
path
|
|
41
|
-
});
|
|
42
|
-
}).catch(nodeHTTPRequestHandler.internal_exceptionHandler({
|
|
43
|
-
req,
|
|
44
|
-
res,
|
|
45
|
-
path,
|
|
46
|
-
...opts
|
|
47
|
-
}));
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
exports.createNextApiHandler = createNextApiHandler;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { NodeHTTPRequest, NodeHTTPResponse } from './types';
|
|
2
|
-
export declare function createURL(req: NodeHTTPRequest): URL;
|
|
3
|
-
/**
|
|
4
|
-
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
5
|
-
*/
|
|
6
|
-
export declare function incomingMessageToRequest(req: NodeHTTPRequest, res: NodeHTTPResponse, opts: {
|
|
7
|
-
/**
|
|
8
|
-
* Max body size in bytes. If the body is larger than this, the request will be aborted
|
|
9
|
-
*/
|
|
10
|
-
maxBodySize: number | null;
|
|
11
|
-
}): Request;
|
|
12
|
-
//# sourceMappingURL=incomingMessageToRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"incomingMessageToRequest.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/incomingMessageToRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAiEjE,wBAAgB,SAAS,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,CAqBnD;AAwBD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IACJ;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GACA,OAAO,CAqCT"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('../../unstable-core-do-not-import/rpc/codes.js');
|
|
4
|
-
var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
|
|
5
|
-
require('../../vendor/unpromise/unpromise.js');
|
|
6
|
-
require('../../unstable-core-do-not-import/stream/utils/disposable.js');
|
|
7
|
-
require('../../unstable-core-do-not-import/rootConfig.js');
|
|
8
|
-
|
|
9
|
-
function createBody(req, opts) {
|
|
10
|
-
// Some adapters will pre-parse the body and add it to the request object
|
|
11
|
-
if ('body' in req) {
|
|
12
|
-
if (req.body === undefined) {
|
|
13
|
-
// If body property exists but is undefined, return undefined
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
// If the body is already a string, return it directly
|
|
17
|
-
if (typeof req.body === 'string') {
|
|
18
|
-
return req.body;
|
|
19
|
-
}
|
|
20
|
-
// If body exists but isn't a string, stringify it as JSON
|
|
21
|
-
return JSON.stringify(req.body);
|
|
22
|
-
}
|
|
23
|
-
let size = 0;
|
|
24
|
-
let hasClosed = false;
|
|
25
|
-
return new ReadableStream({
|
|
26
|
-
start (controller) {
|
|
27
|
-
const onData = (chunk)=>{
|
|
28
|
-
size += chunk.length;
|
|
29
|
-
if (!opts.maxBodySize || size <= opts.maxBodySize) {
|
|
30
|
-
controller.enqueue(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
controller.error(new TRPCError.TRPCError({
|
|
34
|
-
code: 'PAYLOAD_TOO_LARGE'
|
|
35
|
-
}));
|
|
36
|
-
hasClosed = true;
|
|
37
|
-
req.off('data', onData);
|
|
38
|
-
req.off('end', onEnd);
|
|
39
|
-
};
|
|
40
|
-
const onEnd = ()=>{
|
|
41
|
-
if (hasClosed) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
hasClosed = true;
|
|
45
|
-
req.off('data', onData);
|
|
46
|
-
req.off('end', onEnd);
|
|
47
|
-
controller.close();
|
|
48
|
-
};
|
|
49
|
-
req.on('data', onData);
|
|
50
|
-
req.on('end', onEnd);
|
|
51
|
-
},
|
|
52
|
-
cancel () {
|
|
53
|
-
req.destroy();
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function createURL(req) {
|
|
58
|
-
try {
|
|
59
|
-
const protocol = // http2
|
|
60
|
-
req.headers[':scheme'] && req.headers[':scheme'] === 'https' || // http1
|
|
61
|
-
req.socket && 'encrypted' in req.socket && req.socket.encrypted ? 'https:' : 'http:';
|
|
62
|
-
const host = req.headers.host ?? req.headers[':authority'] ?? 'localhost';
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
64
|
-
return new URL(req.url, `${protocol}//${host}`);
|
|
65
|
-
} catch (cause) {
|
|
66
|
-
throw new TRPCError.TRPCError({
|
|
67
|
-
code: 'BAD_REQUEST',
|
|
68
|
-
message: 'Invalid URL',
|
|
69
|
-
cause
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function createHeaders(incoming) {
|
|
74
|
-
const headers = new Headers();
|
|
75
|
-
for(const key in incoming){
|
|
76
|
-
const value = incoming[key];
|
|
77
|
-
if (typeof key === 'string' && key.startsWith(':')) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(value)) {
|
|
81
|
-
for (const item of value){
|
|
82
|
-
headers.append(key, item);
|
|
83
|
-
}
|
|
84
|
-
} else if (value != null) {
|
|
85
|
-
headers.append(key, value);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return headers;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
92
|
-
*/ function incomingMessageToRequest(req, res, opts) {
|
|
93
|
-
const ac = new AbortController();
|
|
94
|
-
const onAbort = ()=>{
|
|
95
|
-
res.off('close', onAbort);
|
|
96
|
-
req.socket?.off?.('close', onAbort);
|
|
97
|
-
// abort the request
|
|
98
|
-
ac.abort();
|
|
99
|
-
};
|
|
100
|
-
res.once('close', onAbort);
|
|
101
|
-
req.socket?.once?.('close', onAbort);
|
|
102
|
-
// Get host from either regular header or HTTP/2 pseudo-header
|
|
103
|
-
const url = createURL(req);
|
|
104
|
-
const init = {
|
|
105
|
-
headers: createHeaders(req.headers),
|
|
106
|
-
method: req.method,
|
|
107
|
-
signal: ac.signal
|
|
108
|
-
};
|
|
109
|
-
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
110
|
-
init.body = createBody(req, opts);
|
|
111
|
-
// init.duplex = 'half' must be set when body is a ReadableStream, and Node follows the spec.
|
|
112
|
-
// However, this property is not defined in the TypeScript types for RequestInit, so we have
|
|
113
|
-
// to cast it here in order to set it without a type error.
|
|
114
|
-
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex
|
|
115
|
-
// @ts-expect-error this is fine
|
|
116
|
-
init.duplex = 'half';
|
|
117
|
-
}
|
|
118
|
-
const request = new Request(url, init);
|
|
119
|
-
return request;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
exports.createURL = createURL;
|
|
123
|
-
exports.incomingMessageToRequest = incomingMessageToRequest;
|