@trpc/server 11.3.1 → 11.3.2-canary.2
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
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
const require_getErrorShape = require('./getErrorShape-CsikfkAc.cjs');
|
|
2
|
+
const require_utils = require('./utils-DVO6HZiR.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/unstable-core-do-not-import/error/formatter.ts
|
|
5
|
+
const defaultFormatter = ({ shape }) => {
|
|
6
|
+
return shape;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/unstable-core-do-not-import/error/TRPCError.ts
|
|
11
|
+
var UnknownCauseError = class extends Error {};
|
|
12
|
+
function getCauseFromUnknown(cause) {
|
|
13
|
+
if (cause instanceof Error) return cause;
|
|
14
|
+
const type = typeof cause;
|
|
15
|
+
if (type === "undefined" || type === "function" || cause === null) return void 0;
|
|
16
|
+
if (type !== "object") return new Error(String(cause));
|
|
17
|
+
if (require_utils.isObject(cause)) return Object.assign(new UnknownCauseError(), cause);
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
function getTRPCErrorFromUnknown(cause) {
|
|
21
|
+
if (cause instanceof TRPCError) return cause;
|
|
22
|
+
if (cause instanceof Error && cause.name === "TRPCError") return cause;
|
|
23
|
+
const trpcError = new TRPCError({
|
|
24
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
25
|
+
cause
|
|
26
|
+
});
|
|
27
|
+
if (cause instanceof Error && cause.stack) trpcError.stack = cause.stack;
|
|
28
|
+
return trpcError;
|
|
29
|
+
}
|
|
30
|
+
var TRPCError = class extends Error {
|
|
31
|
+
cause;
|
|
32
|
+
code;
|
|
33
|
+
constructor(opts) {
|
|
34
|
+
const cause = getCauseFromUnknown(opts.cause);
|
|
35
|
+
const message = opts.message ?? cause?.message ?? opts.code;
|
|
36
|
+
super(message, { cause });
|
|
37
|
+
this.code = opts.code;
|
|
38
|
+
this.name = "TRPCError";
|
|
39
|
+
this.cause ??= cause;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/unstable-core-do-not-import/transformer.ts
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
function getDataTransformer(transformer) {
|
|
49
|
+
if ("input" in transformer) return transformer;
|
|
50
|
+
return {
|
|
51
|
+
input: transformer,
|
|
52
|
+
output: transformer
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
const defaultTransformer = {
|
|
59
|
+
input: {
|
|
60
|
+
serialize: (obj) => obj,
|
|
61
|
+
deserialize: (obj) => obj
|
|
62
|
+
},
|
|
63
|
+
output: {
|
|
64
|
+
serialize: (obj) => obj,
|
|
65
|
+
deserialize: (obj) => obj
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
function transformTRPCResponseItem(config, item) {
|
|
69
|
+
if ("error" in item) return {
|
|
70
|
+
...item,
|
|
71
|
+
error: config.transformer.output.serialize(item.error)
|
|
72
|
+
};
|
|
73
|
+
if ("data" in item.result) return {
|
|
74
|
+
...item,
|
|
75
|
+
result: {
|
|
76
|
+
...item.result,
|
|
77
|
+
data: config.transformer.output.serialize(item.result.data)
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return item;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Takes a unserialized `TRPCResponse` and serializes it with the router's transformers
|
|
84
|
+
**/
|
|
85
|
+
function transformTRPCResponse(config, itemOrItems) {
|
|
86
|
+
return Array.isArray(itemOrItems) ? itemOrItems.map((item) => transformTRPCResponseItem(config, item)) : transformTRPCResponseItem(config, itemOrItems);
|
|
87
|
+
}
|
|
88
|
+
/** @internal */
|
|
89
|
+
function transformResultInner(response, transformer) {
|
|
90
|
+
if ("error" in response) {
|
|
91
|
+
const error = transformer.deserialize(response.error);
|
|
92
|
+
return {
|
|
93
|
+
ok: false,
|
|
94
|
+
error: {
|
|
95
|
+
...response,
|
|
96
|
+
error
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const result = {
|
|
101
|
+
...response.result,
|
|
102
|
+
...(!response.result.type || response.result.type === "data") && {
|
|
103
|
+
type: "data",
|
|
104
|
+
data: transformer.deserialize(response.result.data)
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
ok: true,
|
|
109
|
+
result
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
var TransformResultError = class extends Error {
|
|
113
|
+
constructor() {
|
|
114
|
+
super("Unable to transform response from server");
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Transforms and validates that the result is a valid TRPCResponse
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
function transformResult(response, transformer) {
|
|
122
|
+
let result;
|
|
123
|
+
try {
|
|
124
|
+
result = transformResultInner(response, transformer);
|
|
125
|
+
} catch {
|
|
126
|
+
throw new TransformResultError();
|
|
127
|
+
}
|
|
128
|
+
if (!result.ok && (!require_utils.isObject(result.error.error) || typeof result.error.error["code"] !== "number")) throw new TransformResultError();
|
|
129
|
+
if (result.ok && !require_utils.isObject(result.result)) throw new TransformResultError();
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/unstable-core-do-not-import/router.ts
|
|
135
|
+
const lazySymbol = Symbol("lazy");
|
|
136
|
+
function once(fn) {
|
|
137
|
+
const uncalled = Symbol();
|
|
138
|
+
let result = uncalled;
|
|
139
|
+
return () => {
|
|
140
|
+
if (result === uncalled) result = fn();
|
|
141
|
+
return result;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Lazy load a router
|
|
146
|
+
* @see https://trpc.io/docs/server/merging-routers#lazy-load
|
|
147
|
+
*/
|
|
148
|
+
function lazy(importRouter) {
|
|
149
|
+
async function resolve() {
|
|
150
|
+
const mod = await importRouter();
|
|
151
|
+
if (isRouter(mod)) return mod;
|
|
152
|
+
const routers = Object.values(mod);
|
|
153
|
+
if (routers.length !== 1 || !isRouter(routers[0])) throw new Error("Invalid router module - either define exactly 1 export or return the router directly.\nExample: `lazy(() => import('./slow.js').then((m) => m.slowRouter))`");
|
|
154
|
+
return routers[0];
|
|
155
|
+
}
|
|
156
|
+
resolve[lazySymbol] = true;
|
|
157
|
+
return resolve;
|
|
158
|
+
}
|
|
159
|
+
function isLazy(input) {
|
|
160
|
+
return typeof input === "function" && lazySymbol in input;
|
|
161
|
+
}
|
|
162
|
+
function isRouter(value) {
|
|
163
|
+
return require_utils.isObject(value) && require_utils.isObject(value["_def"]) && "router" in value["_def"];
|
|
164
|
+
}
|
|
165
|
+
const emptyRouter = {
|
|
166
|
+
_ctx: null,
|
|
167
|
+
_errorShape: null,
|
|
168
|
+
_meta: null,
|
|
169
|
+
queries: {},
|
|
170
|
+
mutations: {},
|
|
171
|
+
subscriptions: {},
|
|
172
|
+
errorFormatter: defaultFormatter,
|
|
173
|
+
transformer: defaultTransformer
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Reserved words that can't be used as router or procedure names
|
|
177
|
+
*/
|
|
178
|
+
const reservedWords = [
|
|
179
|
+
"then",
|
|
180
|
+
"call",
|
|
181
|
+
"apply"
|
|
182
|
+
];
|
|
183
|
+
/**
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
186
|
+
function createRouterFactory(config) {
|
|
187
|
+
function createRouterInner(input) {
|
|
188
|
+
const reservedWordsUsed = new Set(Object.keys(input).filter((v) => reservedWords.includes(v)));
|
|
189
|
+
if (reservedWordsUsed.size > 0) throw new Error("Reserved words used in `router({})` call: " + Array.from(reservedWordsUsed).join(", "));
|
|
190
|
+
const procedures = require_utils.omitPrototype({});
|
|
191
|
+
const lazy$1 = require_utils.omitPrototype({});
|
|
192
|
+
function createLazyLoader(opts) {
|
|
193
|
+
return {
|
|
194
|
+
ref: opts.ref,
|
|
195
|
+
load: once(async () => {
|
|
196
|
+
const router$1 = await opts.ref();
|
|
197
|
+
const lazyPath = [...opts.path, opts.key];
|
|
198
|
+
const lazyKey = lazyPath.join(".");
|
|
199
|
+
opts.aggregate[opts.key] = step(router$1._def.record, lazyPath);
|
|
200
|
+
delete lazy$1[lazyKey];
|
|
201
|
+
for (const [nestedKey, nestedItem] of Object.entries(router$1._def.lazy)) {
|
|
202
|
+
const nestedRouterKey = [...lazyPath, nestedKey].join(".");
|
|
203
|
+
lazy$1[nestedRouterKey] = createLazyLoader({
|
|
204
|
+
ref: nestedItem.ref,
|
|
205
|
+
path: lazyPath,
|
|
206
|
+
key: nestedKey,
|
|
207
|
+
aggregate: opts.aggregate[opts.key]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function step(from, path = []) {
|
|
214
|
+
const aggregate = require_utils.omitPrototype({});
|
|
215
|
+
for (const [key, item] of Object.entries(from ?? {})) {
|
|
216
|
+
if (isLazy(item)) {
|
|
217
|
+
lazy$1[[...path, key].join(".")] = createLazyLoader({
|
|
218
|
+
path,
|
|
219
|
+
ref: item,
|
|
220
|
+
key,
|
|
221
|
+
aggregate
|
|
222
|
+
});
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (isRouter(item)) {
|
|
226
|
+
aggregate[key] = step(item._def.record, [...path, key]);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (!isProcedure(item)) {
|
|
230
|
+
aggregate[key] = step(item, [...path, key]);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const newPath = [...path, key].join(".");
|
|
234
|
+
if (procedures[newPath]) throw new Error(`Duplicate key: ${newPath}`);
|
|
235
|
+
procedures[newPath] = item;
|
|
236
|
+
aggregate[key] = item;
|
|
237
|
+
}
|
|
238
|
+
return aggregate;
|
|
239
|
+
}
|
|
240
|
+
const record = step(input);
|
|
241
|
+
const _def = {
|
|
242
|
+
_config: config,
|
|
243
|
+
router: true,
|
|
244
|
+
procedures,
|
|
245
|
+
lazy: lazy$1,
|
|
246
|
+
...emptyRouter,
|
|
247
|
+
record
|
|
248
|
+
};
|
|
249
|
+
const router = {
|
|
250
|
+
...record,
|
|
251
|
+
_def,
|
|
252
|
+
createCaller: createCallerFactory()({ _def })
|
|
253
|
+
};
|
|
254
|
+
return router;
|
|
255
|
+
}
|
|
256
|
+
return createRouterInner;
|
|
257
|
+
}
|
|
258
|
+
function isProcedure(procedureOrRouter) {
|
|
259
|
+
return typeof procedureOrRouter === "function";
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* @internal
|
|
263
|
+
*/
|
|
264
|
+
async function getProcedureAtPath(router, path) {
|
|
265
|
+
const { _def } = router;
|
|
266
|
+
let procedure = _def.procedures[path];
|
|
267
|
+
while (!procedure) {
|
|
268
|
+
const key = Object.keys(_def.lazy).find((key$1) => path.startsWith(key$1));
|
|
269
|
+
if (!key) return null;
|
|
270
|
+
const lazyRouter = _def.lazy[key];
|
|
271
|
+
await lazyRouter.load();
|
|
272
|
+
procedure = _def.procedures[path];
|
|
273
|
+
}
|
|
274
|
+
return procedure;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @internal
|
|
278
|
+
*/
|
|
279
|
+
async function callProcedure(opts) {
|
|
280
|
+
const { type, path } = opts;
|
|
281
|
+
const proc = await getProcedureAtPath(opts.router, path);
|
|
282
|
+
if (!proc || !isProcedure(proc) || proc._def.type !== type && !opts.allowMethodOverride) throw new TRPCError({
|
|
283
|
+
code: "NOT_FOUND",
|
|
284
|
+
message: `No "${type}"-procedure on path "${path}"`
|
|
285
|
+
});
|
|
286
|
+
/* istanbul ignore if -- @preserve */
|
|
287
|
+
if (proc._def.type !== type && opts.allowMethodOverride && proc._def.type === "subscription") throw new TRPCError({
|
|
288
|
+
code: "METHOD_NOT_SUPPORTED",
|
|
289
|
+
message: `Method override is not supported for subscriptions`
|
|
290
|
+
});
|
|
291
|
+
return proc(opts);
|
|
292
|
+
}
|
|
293
|
+
function createCallerFactory() {
|
|
294
|
+
return function createCallerInner(router) {
|
|
295
|
+
const { _def } = router;
|
|
296
|
+
return function createCaller(ctxOrCallback, opts) {
|
|
297
|
+
return require_getErrorShape.createRecursiveProxy(async ({ path, args }) => {
|
|
298
|
+
const fullPath = path.join(".");
|
|
299
|
+
if (path.length === 1 && path[0] === "_def") return _def;
|
|
300
|
+
const procedure = await getProcedureAtPath(router, fullPath);
|
|
301
|
+
let ctx = void 0;
|
|
302
|
+
try {
|
|
303
|
+
if (!procedure) throw new TRPCError({
|
|
304
|
+
code: "NOT_FOUND",
|
|
305
|
+
message: `No procedure found on path "${path}"`
|
|
306
|
+
});
|
|
307
|
+
ctx = require_utils.isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
|
|
308
|
+
return await procedure({
|
|
309
|
+
path: fullPath,
|
|
310
|
+
getRawInput: async () => args[0],
|
|
311
|
+
ctx,
|
|
312
|
+
type: procedure._def.type,
|
|
313
|
+
signal: opts?.signal
|
|
314
|
+
});
|
|
315
|
+
} catch (cause) {
|
|
316
|
+
opts?.onError?.({
|
|
317
|
+
ctx,
|
|
318
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
319
|
+
input: args[0],
|
|
320
|
+
path: fullPath,
|
|
321
|
+
type: procedure?._def.type ?? "unknown"
|
|
322
|
+
});
|
|
323
|
+
throw cause;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function mergeRouters(...routerList) {
|
|
330
|
+
const record = require_utils.mergeWithoutOverrides({}, ...routerList.map((r) => r._def.record));
|
|
331
|
+
const errorFormatter = routerList.reduce((currentErrorFormatter, nextRouter) => {
|
|
332
|
+
if (nextRouter._def._config.errorFormatter && nextRouter._def._config.errorFormatter !== defaultFormatter) {
|
|
333
|
+
if (currentErrorFormatter !== defaultFormatter && currentErrorFormatter !== nextRouter._def._config.errorFormatter) throw new Error("You seem to have several error formatters");
|
|
334
|
+
return nextRouter._def._config.errorFormatter;
|
|
335
|
+
}
|
|
336
|
+
return currentErrorFormatter;
|
|
337
|
+
}, defaultFormatter);
|
|
338
|
+
const transformer = routerList.reduce((prev, current) => {
|
|
339
|
+
if (current._def._config.transformer && current._def._config.transformer !== defaultTransformer) {
|
|
340
|
+
if (prev !== defaultTransformer && prev !== current._def._config.transformer) throw new Error("You seem to have several transformers");
|
|
341
|
+
return current._def._config.transformer;
|
|
342
|
+
}
|
|
343
|
+
return prev;
|
|
344
|
+
}, defaultTransformer);
|
|
345
|
+
const router = createRouterFactory({
|
|
346
|
+
errorFormatter,
|
|
347
|
+
transformer,
|
|
348
|
+
isDev: routerList.every((r) => r._def._config.isDev),
|
|
349
|
+
allowOutsideOfServer: routerList.every((r) => r._def._config.allowOutsideOfServer),
|
|
350
|
+
isServer: routerList.every((r) => r._def._config.isServer),
|
|
351
|
+
$types: routerList[0]?._def._config.$types
|
|
352
|
+
})(record);
|
|
353
|
+
return router;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/unstable-core-do-not-import/stream/tracked.ts
|
|
358
|
+
const trackedSymbol = Symbol();
|
|
359
|
+
/**
|
|
360
|
+
* Produce a typed server-sent event message
|
|
361
|
+
* @deprecated use `tracked(id, data)` instead
|
|
362
|
+
*/
|
|
363
|
+
function sse(event) {
|
|
364
|
+
return tracked(event.id, event.data);
|
|
365
|
+
}
|
|
366
|
+
function isTrackedEnvelope(value) {
|
|
367
|
+
return Array.isArray(value) && value[2] === trackedSymbol;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Automatically track an event so that it can be resumed from a given id if the connection is lost
|
|
371
|
+
*/
|
|
372
|
+
function tracked(id, data) {
|
|
373
|
+
if (id === "") throw new Error("`id` must not be an empty string as empty string is the same as not setting the id at all");
|
|
374
|
+
return [
|
|
375
|
+
id,
|
|
376
|
+
data,
|
|
377
|
+
trackedSymbol
|
|
378
|
+
];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
//#endregion
|
|
382
|
+
Object.defineProperty(exports, 'TRPCError', {
|
|
383
|
+
enumerable: true,
|
|
384
|
+
get: function () {
|
|
385
|
+
return TRPCError;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
Object.defineProperty(exports, 'callProcedure', {
|
|
389
|
+
enumerable: true,
|
|
390
|
+
get: function () {
|
|
391
|
+
return callProcedure;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
Object.defineProperty(exports, 'createCallerFactory', {
|
|
395
|
+
enumerable: true,
|
|
396
|
+
get: function () {
|
|
397
|
+
return createCallerFactory;
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
Object.defineProperty(exports, 'createRouterFactory', {
|
|
401
|
+
enumerable: true,
|
|
402
|
+
get: function () {
|
|
403
|
+
return createRouterFactory;
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
Object.defineProperty(exports, 'defaultFormatter', {
|
|
407
|
+
enumerable: true,
|
|
408
|
+
get: function () {
|
|
409
|
+
return defaultFormatter;
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
Object.defineProperty(exports, 'defaultTransformer', {
|
|
413
|
+
enumerable: true,
|
|
414
|
+
get: function () {
|
|
415
|
+
return defaultTransformer;
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
Object.defineProperty(exports, 'getCauseFromUnknown', {
|
|
419
|
+
enumerable: true,
|
|
420
|
+
get: function () {
|
|
421
|
+
return getCauseFromUnknown;
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
Object.defineProperty(exports, 'getDataTransformer', {
|
|
425
|
+
enumerable: true,
|
|
426
|
+
get: function () {
|
|
427
|
+
return getDataTransformer;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
Object.defineProperty(exports, 'getProcedureAtPath', {
|
|
431
|
+
enumerable: true,
|
|
432
|
+
get: function () {
|
|
433
|
+
return getProcedureAtPath;
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
Object.defineProperty(exports, 'getTRPCErrorFromUnknown', {
|
|
437
|
+
enumerable: true,
|
|
438
|
+
get: function () {
|
|
439
|
+
return getTRPCErrorFromUnknown;
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
Object.defineProperty(exports, 'isTrackedEnvelope', {
|
|
443
|
+
enumerable: true,
|
|
444
|
+
get: function () {
|
|
445
|
+
return isTrackedEnvelope;
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
Object.defineProperty(exports, 'lazy', {
|
|
449
|
+
enumerable: true,
|
|
450
|
+
get: function () {
|
|
451
|
+
return lazy;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
Object.defineProperty(exports, 'mergeRouters', {
|
|
455
|
+
enumerable: true,
|
|
456
|
+
get: function () {
|
|
457
|
+
return mergeRouters;
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
Object.defineProperty(exports, 'sse', {
|
|
461
|
+
enumerable: true,
|
|
462
|
+
get: function () {
|
|
463
|
+
return sse;
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
Object.defineProperty(exports, 'tracked', {
|
|
467
|
+
enumerable: true,
|
|
468
|
+
get: function () {
|
|
469
|
+
return tracked;
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
Object.defineProperty(exports, 'transformResult', {
|
|
473
|
+
enumerable: true,
|
|
474
|
+
get: function () {
|
|
475
|
+
return transformResult;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
Object.defineProperty(exports, 'transformTRPCResponse', {
|
|
479
|
+
enumerable: true,
|
|
480
|
+
get: function () {
|
|
481
|
+
return transformTRPCResponse;
|
|
482
|
+
}
|
|
483
|
+
});
|