@trpc/server 11.22.1 → 11.22.2-canary.6.9959a177b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/aws-lambda/index.d.cts +1 -1
- package/dist/adapters/aws-lambda/index.d.mts +1 -1
- package/dist/adapters/express.d.cts +2 -2
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/fastify/index.d.cts +3 -3
- package/dist/adapters/fastify/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.cts +1 -1
- package/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/next-app-dir.d.cts +2 -2
- package/dist/adapters/next-app-dir.d.mts +2 -2
- package/dist/adapters/next-app-dir.mjs.map +1 -1
- package/dist/adapters/next.d.cts +2 -2
- package/dist/adapters/next.d.mts +2 -2
- package/dist/adapters/node-http/index.d.cts +1 -1
- package/dist/adapters/node-http/index.d.mts +1 -1
- package/dist/adapters/standalone.d.cts +2 -2
- package/dist/adapters/standalone.d.mts +2 -2
- package/dist/adapters/ws.d.cts +2 -1
- package/dist/adapters/ws.d.mts +2 -1
- package/dist/http.d.cts +1 -1
- package/dist/http.d.mts +1 -1
- package/dist/{index-D7foMQMh.d.cts → index-D6v3zbh1.d.mts} +2 -2
- package/dist/{index-D7foMQMh.d.cts.map → index-D6v3zbh1.d.mts.map} +1 -1
- package/dist/{index-DPj2-I1U.d.mts → index-DaZHES8r.d.cts} +2 -2
- package/dist/{index-DPj2-I1U.d.mts.map → index-DaZHES8r.d.cts.map} +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/rpc.d.cts +1 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/shared.d.cts +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/{unstable-core-do-not-import-BkTO4Ekx.d.cts → unstable-core-do-not-import-COFs-Qzf.d.cts} +27 -2
- package/dist/unstable-core-do-not-import-COFs-Qzf.d.cts.map +1 -0
- package/dist/{unstable-core-do-not-import-DElJf3aU.d.mts → unstable-core-do-not-import-Dals6grN.d.mts} +27 -2
- package/dist/unstable-core-do-not-import-Dals6grN.d.mts.map +1 -0
- package/dist/unstable-core-do-not-import.d.cts +2 -2
- package/dist/unstable-core-do-not-import.d.mts +2 -2
- package/dist/{ws-BR3-CM6m.d.mts → ws-B5iD5Qn7.d.mts} +9 -34
- package/dist/ws-B5iD5Qn7.d.mts.map +1 -0
- package/dist/ws-DJ2SSChC.mjs.map +1 -1
- package/dist/{ws-CaI8wmsh.d.cts → ws-vKuedL9Z.d.cts} +9 -34
- package/dist/ws-vKuedL9Z.d.cts.map +1 -0
- package/package.json +24 -2
- package/src/adapters/next-app-dir/notFound.ts +1 -1
- package/src/adapters/next-app-dir/redirect.ts +1 -1
- package/src/adapters/ws.ts +5 -5
- package/src/unstable-core-do-not-import.ts +1 -0
- package/dist/unstable-core-do-not-import-BkTO4Ekx.d.cts.map +0 -1
- package/dist/unstable-core-do-not-import-DElJf3aU.d.mts.map +0 -1
- package/dist/ws-BR3-CM6m.d.mts.map +0 -1
- package/dist/ws-CaI8wmsh.d.cts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unstable-core-do-not-import-Dals6grN.d.mts","names":[],"sources":["../src/unstable-core-do-not-import/types.ts","../src/unstable-core-do-not-import/rpc/codes.ts","../src/unstable-core-do-not-import/error/TRPCError.ts","../src/vendor/standard-schema-v1/spec.ts","../src/unstable-core-do-not-import/parser.ts","../src/unstable-core-do-not-import/stream/jsonl.ts","../src/unstable-core-do-not-import/stream/sse.types.ts","../src/unstable-core-do-not-import/stream/tracked.ts","../src/unstable-core-do-not-import/stream/sse.ts","../src/unstable-core-do-not-import/rootConfig.ts","../src/unstable-core-do-not-import/router.ts","../src/unstable-core-do-not-import/http/types.ts","../src/unstable-core-do-not-import/rpc/envelopes.ts","../src/unstable-core-do-not-import/transformer.ts","../src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts","../src/unstable-core-do-not-import/error/formatter.ts","../src/unstable-core-do-not-import/middleware.ts","../src/unstable-core-do-not-import/utils.ts","../src/unstable-core-do-not-import/procedureBuilder.ts","../src/unstable-core-do-not-import/procedure.ts","../src/unstable-core-do-not-import/clientish/inferrable.ts","../src/unstable-core-do-not-import/clientish/serialize.ts","../src/unstable-core-do-not-import/clientish/inference.ts","../src/unstable-core-do-not-import/createProxy.ts","../src/unstable-core-do-not-import/error/getErrorShape.ts","../src/unstable-core-do-not-import/http/contentType.ts","../src/unstable-core-do-not-import/http/contentTypeParsers.ts","../src/unstable-core-do-not-import/http/formDataToObject.ts","../src/unstable-core-do-not-import/http/getHTTPStatusCode.ts","../src/unstable-core-do-not-import/http/abortError.ts","../src/unstable-core-do-not-import/http/parseConnectionParams.ts","../src/unstable-core-do-not-import/http/resolveResponse.ts","../src/unstable-core-do-not-import/initTRPC.ts","../src/unstable-core-do-not-import/stream/utils/createDeferred.ts","../src/unstable-core-do-not-import/stream/utils/disposable.ts","../src/unstable-core-do-not-import/stream/utils/asyncIterable.ts","../src/vendor/standard-schema-v1/error.ts","../src/vendor/unpromise/types.ts","../src/vendor/unpromise/unpromise.ts","../src/adapters/wsEncoder.ts"],"mappings":";;;;;;;;;;KASY,MAAM,SAAS;;;;;KAMf,SAAS,SAAS,sBAAsB,OAChD,WACG,WAAW,QAAQ,MAAM;;;;KAKpB,KAAK,SAAS,eAAe;;;;KAK7B,aAAa,SAAS,QAAQ,SAAS;KAEvC,WAAW,qBAAqB,cACzC,cAAc,OAAO,KAAK,cAAc,UAAU,sBAC7C;;;;KAKI,SAAO,OAAO;EACtB;EAAU,OAAO;;EAAY;EAAW,OAAO;;;;;KAKvC,OAAO,qBAAqB,WAAW,KACjD,MACA,WAAW,MAAM;;;;;KAOP,OAAO,SAAS,mBAAkB,sBAAsB,KAChE,QAAQ,KACR;;;;;KAMQ,YAAY,WAAW,4BAE5B,WAAW,WAAW,YAAY,QAAQ,SAE7C;;;;;KAMQ,iBAAiB,MAAM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A,iBACA,iBACA,kBACA,mBACA,gBACA,gBAEJ,yBACE,UACA,OACA,mBACA,kBAAkB,wBAGd,2BACE,SACE;;;;GAIG;KAGL;UAIG,iBACf,UACA,OACA,mBACA,UACA,WACA,WACA,YACA;;;;;;;AAOA;;;;;EAMA,MAAM,gBAAgB,QACpB,QAAQ,kBAAkB,cACtB,UACA,YAAY,wBAAwB,sCAClC,kBAAkB,wDACE,YAAY,oCACV,YAChB,UACA,oEACF,UACF,8DACF,8DACL,iBACD,UACA,OACA,mBACA,mBAAmB,UAAU,YAAY,iBACzC,mBAAmB,WAAW,YAAY,kBAC1C,WACA,YACA,SACA;;;;;EAMF,OAAO,gBAAgB,QACrB,QAAQ,UACP,iBACD,UACA,OACA,mBACA,UACA,WACA,mBAAmB,WAAW,YAAY,iBAC1C,mBAAmB,YAAY,YAAY,kBAC3C,SACA;;;;;EAMF,KACE,MAAM,QACL,iBACD,UACA,OACA,mBACA,UACA,WACA,WACA,YACA,SACA;;;;;;;;;EAUF,OAAO,eAAe,mCACpB,WAAW,wBAAwB,UAAU,mBAAmB,UAC/D,iBACD,UACA,OACA,mBACA,UACA,WACA,WACA,YACA,SACA,eAAe,aAAa;;;;;EAM9B,IAAI,sBACF,IACI,kBACE,UAAU,UAAU,oBACpB,OACA,sBACA,aAEF,mBACE,UACA,OACA,mBACA,sBACA,aAEL,iBACD,UACA,OACA,UAAU,mBAAmB,uBAC7B,UACA,WACA,WACA,YACA,SACA;;;;EAMF,gBACE,UACA,OACA,mBACA,UACA,WACA,WACA,YACA,aAEA,SAAS,UAAU,UAAU,2BAA2B,WACpD,cAAc,QACZ,iBACE,UACA,OACA,mBACA,UACA,WACA,WACA,YACA,SACA,eAEF,6BACF,gCACH,iBACD,UACA,OACA,UAAU,mBAAmB,oBAC7B,mBAAmB,UAAU,WAC7B,mBAAmB,WAAW,YAC9B,mBAAmB,WAAW,YAC9B,mBAAmB,YAAY,aAC/B,SACA,eAAe,aAAa;;;;EAM9B,OACE,UACA,OAC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iBACJ,eACM,gBAAgB,UAAU,YAAY,mBAG3C,kBAAkB,IAAI;EAQzB,QAAQ,kCAAoC,kBAAkB;;YAUpD,OAAO;;;;SAMV,MAAM,GAAG,SAAS,YAAY,KAAK,aAAa;;mBAQtC,0BAA0B,GAAG,SAAS,YAAY,KAAE,UAAA;;mBAQpD,uBAAuB,GAAG,SAAS,YAAY,KACrB,aAAa;;;;SAOjD,QAAQ,GAAG,OAAO,IAAI,YAAY,KAQQ,kBAC7C,QAAQ;;;;SAOC,IAAI,mCACf,QAAQ,IACP,QAAQ,QAAQ;;;;SAkBN,KAAK,mCAChB,QAAQ,IACP,QAAQ,QAAQ;;;;;;;;;;;;;SA2BN,eAAe,iBAAiB,kBAC3C,mBAAmB,aAAU,kBAAA;;;;;;;;;;;;;;;;UCjThB;;EAEf,OAAO,yBAAyB,WAAW;;EAE3C,OAAO,eAAe,cAAc;;;;;;cAOzB,aAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AnyClientTypes, AnyMiddlewareBuilder, AnyMiddlewareFunction, AnyMutationProcedure, AnyProcedure, AnyProcedureBuilder, AnyProcedureErrorFormatter, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, BaseHandlerOptions, BuiltRouter, CallerOverride, CombinedDataTransformer, CombinedDataTransformerClient, ConsumerOnError, CreateContextCallback, CreateRootTypes, CreateRouterOptions, DataTransformer, DataTransformerOptions, DecorateCreateRouterOptions, DecorateRouterRecord, DeepPartial, DefaultErrorData, DefaultErrorShape, Deferred, Dict, DistributiveOmit, ErrorFormatter, ErrorFormatterOptions, ErrorHandlerOptions, ErrorSymbol, EventSourceLike, FileLike, Filter, FilterKeys, GetInferenceHelpers, GetRawInputFn, HTTPBaseHandlerOptions, HTTPErrorHandler, HTTP_CODE_TO_JSONRPC2, InferrableClientTypes, IntersectionError, InvertKeyValue, JSONLConfig, JSONLContentType, JSONLProducerOptions, type JSONRPC2, JSONRPC2_TO_HTTP_CODE, KeyFromValue, Lazy, LegacyObservableSubscriptionProcedure, Maybe, MaybePromise, MergeRouters, MiddlewareBuilder, MiddlewareFunction, MiddlewareResult, MutationProcedure, NodeJSReadableStreamEsque, OctetInput, Overwrite, ParseFn, Parser, ParserArkTypeEsque, ParserCustomValidatorEsque, ParserMyZodEsque, ParserScaleEsque, ParserStandardSchemaEsque, ParserSuperstructEsque, ParserValibotEsque, ParserWithInputOutput, ParserWithoutInput, ParserYupEsque, ParserZodEsque, PickFirstDefined, Procedure, ProcedureBuilder, ProcedureCallOptions, ProcedureErrorFormatter, ProcedureResolverOptions, ProcedureType, ProducerOnError, type PromiseExecutor, type PromiseWithResolvers, ProtectedIntersection, type ProxyPromise, QueryProcedure, ResolveHTTPRequestOptionsContextFn, ResponseMeta, ResponseMetaFn, Result, RootConfig, RootTypes, Router, RouterBuilder, RouterCaller, RouterCallerErrorHandler, RouterCallerFactory, RouterDef, RouterRecord, RuntimeConfigOptions, SSEClientOptions, SSEPingOptions, SSEStreamConsumerOptions, SSEStreamProducerOptions, Serialize, SerializeObject, SerializeRecord, Simplify, StandardSchemaV1, StandardSchemaV1Error, type SubscribedPromise, SubscriptionProcedure, TRPCAcceptHeader, type TRPCBuilder, type TRPCClientIncomingMessage, type TRPCClientIncomingRequest, type TRPCClientOutgoingMessage, type TRPCClientOutgoingRequest, type TRPCConnectionParamsMessage, TRPCError, type TRPCErrorResponse, type TRPCErrorShape, type TRPCReconnectNotification, type TRPCRequest, TRPCRequestInfo, TRPCRequestInfoProcedureCall, type TRPCRequestMessage, type TRPCResponse, type TRPCResponseMessage, type TRPCResult, type TRPCResultMessage, TRPCRootObject, type TRPCSubscriptionStopNotification, type TRPCSuccessResponse, TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, TrackedData, TrackedEnvelope, TypeError, Unpromise, UnsetMarker, Unwrap, UtilityParser, ValidateShape, ValueOf, WebReadableStreamEsque, WithoutIndexSignature, abortSignalsAnyPonyfill, assert, assertNever, callProcedure, coerceAsyncIterableToArray, createBuilder, createCallerFactory, createDeferred, createErrorFormatterMiddleware, createFlatProxy, createInputMiddleware, createMiddlewareFactory, createOutputMiddleware, createRecursiveProxy, createRouterFactory, defaultFormatter, defaultTransformer, emptyObject, experimental_standaloneMiddleware, formDataToObject, getAcceptHeader, getCauseFromUnknown, getDataTransformer, getDefaultErrorShape, getErrorShape, getFormattedErrorShape, getHTTPStatusCode, getHTTPStatusCodeFromError, getLastEventId, getParseFn, getProcedureAtPath, getRequestInfo, getStatusCodeFromKey, getStatusKeyFromCode, getTRPCErrorFromUnknown, identity, inferAsyncIterableYield, inferClientTypes, inferParser, inferProcedureBuilderResolverOptions, inferProcedureErrorShape, inferProcedureInput, inferProcedureOutput, inferProcedureParams, inferRouterContext, inferRouterError, inferRouterInputs, inferRouterMeta, inferRouterOutputs, inferRouterRootTypes, inferSubscriptionInput, inferSubscriptionOutput, inferTrackedOutput, inferTransformedProcedureOutput, inferTransformedSubscriptionOutput, initTRPC, isAbortError, isAsyncIterable, isDevDefault, isFormattedErrorShape, isFunction, isObject, isPromise, isServerDefault, isTrackedEnvelope, iteratorResource, jsonlStreamConsumer, jsonlStreamProducer, lazy, makeAsyncResource, makeResource, mergeRouters, mergeWithoutOverrides, middlewareMarker, noop, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, parseTRPCMessage, procedureTypes, resolveResponse, retryableRpcCodes, run, setFormattedErrorShape, sleep, sse, sseHeaders, sseStreamConsumer, sseStreamProducer, takeWithGrace, throwAbortError, tracked, transformResult, transformTRPCResponse };
|
|
1
|
+
import { $ as AnyMutationProcedure, $n as callProcedure, $r as getParseFn, $t as defaultFormatter, A as formDataToObject, Ai as ValueOf, An as BaseHandlerOptions, Ar as tracked, At as isFunction, B as createRecursiveProxy, Bn as BuiltRouter, Br as ParseFn, Bt as MiddlewareResult, C as throwAbortError, Ci as PickFirstDefined, Cn as TRPCRequestMessage, Cr as sseStreamConsumer, Ct as UnsetMarker, D as getHTTPStatusCodeFromError, Di as TypeError, Dn as TRPCResultMessage, Dr as inferTrackedOutput, Dt as emptyObject, E as getHTTPStatusCode, Ei as Simplify, En as TRPCResult, Er as TrackedEnvelope, Et as assertNever, F as getAcceptHeader, Fn as ResponseMetaFn, Fr as ProducerOnError, Ft as sleep, G as inferTransformedProcedureOutput, Gn as MergeRouters, Gr as ParserScaleEsque, Gt as experimental_standaloneMiddleware, H as inferProcedureErrorShape, Hn as DecorateCreateRouterOptions, Hr as ParserArkTypeEsque, Ht as createInputMiddleware, I as getLastEventId, In as TRPCAcceptHeader, Ir as WebReadableStreamEsque, It as AnyMiddlewareBuilder, J as SerializeObject, Jn as RouterCaller, Jr as ParserValibotEsque, Jt as DefaultErrorData, K as inferTransformedSubscriptionOutput, Kn as Router, Kr as ParserStandardSchemaEsque, Kt as middlewareMarker, L as getRequestInfo, Ln as TRPCRequestInfo, Lr as isPromise, Lt as AnyMiddlewareFunction, M as OctetInput, Mi as coerceAsyncIterableToArray, Mn as HTTPErrorHandler, Mr as ConsumerOnError, Mt as mergeWithoutOverrides, N as UtilityParser, Ni as inferAsyncIterableYield, Nn as ResolveHTTPRequestOptionsContextFn, Nr as JSONLProducerOptions, Nt as noop, O as getStatusCodeFromKey, Oi as Unwrap, On as TRPCSubscriptionStopNotification, Or as isTrackedEnvelope, Ot as identity, P as octetInputParser, Pn as ResponseMeta, Pr as NodeJSReadableStreamEsque, Pt as run, Q as inferClientTypes, Qn as RouterRecord, Qr as ParserZodEsque, Qt as ProcedureErrorFormatter, R as getErrorShape, Rn as TRPCRequestInfoProcedureCall, Rr as jsonlStreamConsumer, Rt as MiddlewareBuilder, S as isAbortError, Si as Overwrite, Sn as TRPCRequest, Sr as sseHeaders, St as inferProcedureBuilderResolverOptions, T as JSONRPC2_TO_HTTP_CODE, Ti as Result, Tn as TRPCResponseMessage, Tr as TrackedData, Tt as assert, U as inferRouterInputs, Un as DecorateRouterRecord, Ur as ParserCustomValidatorEsque, Ut as createMiddlewareFactory, V as GetInferenceHelpers, Vn as CreateRouterOptions, Vr as Parser, Vt as createErrorFormatterMiddleware, W as inferRouterOutputs, Wn as Lazy, Wr as ParserMyZodEsque, Wt as createOutputMiddleware, X as AnyClientTypes, Xn as RouterCallerFactory, Xr as ParserWithoutInput, Xt as ErrorFormatter, Y as SerializeRecord, Yn as RouterCallerErrorHandler, Yr as ParserWithInputOutput, Yt as DefaultErrorShape, Z as InferrableClientTypes, Zn as RouterDef, Zr as ParserYupEsque, Zt as ErrorFormatterOptions, _ as TRPCRootObject, _i as IntersectionError, _n as TRPCClientOutgoingRequest, _r as isServerDefault, _t as CallerOverride, a as PromiseWithResolvers, ai as TRPC_ERROR_CODES_BY_KEY, an as CombinedDataTransformer, ar as inferRouterMeta, at as MutationProcedure, b as parseConnectionParamsFromString, bi as Maybe, bn as TRPCErrorShape, br as SSEStreamConsumerOptions, bt as ProcedureResolverOptions, c as StandardSchemaV1Error, ci as TRPC_ERROR_CODE_NUMBER, cn as DataTransformerOptions, cr as mergeRouters, ct as QueryProcedure, d as makeAsyncResource, di as Dict, dn as transformResult, dr as CreateRootTypes, dt as inferProcedureOutput, ei as inferParser, en as getDefaultErrorShape, er as createCallerFactory, et as AnyProcedure, f as makeResource, fi as DistributiveOmit, fn as transformTRPCResponse, fr as JSONLConfig, ft as inferProcedureParams, g as TRPCBuilder, gi as GetRawInputFn, gn as TRPCClientOutgoingMessage, gr as isDevDefault, gt as AnyProcedureBuilder, h as RuntimeConfigOptions, hi as FilterKeys, hn as TRPCClientIncomingRequest, hr as RootTypes, ht as procedureTypes, i as PromiseExecutor, ii as getTRPCErrorFromUnknown, in as parseTRPCMessage, ir as inferRouterError, it as LegacyObservableSubscriptionProcedure, j as FileLike, ji as WithoutIndexSignature, jn as HTTPBaseHandlerOptions, jr as EventSourceLike, jt as isObject, k as getStatusKeyFromCode, ki as ValidateShape, kn as TRPCSuccessResponse, kr as sse, kt as isAsyncIterable, l as iteratorResource, li as retryableRpcCodes, ln as defaultTransformer, lr as AnyRootTypes, lt as SubscriptionProcedure, m as createDeferred, mi as Filter, mn as TRPCClientIncomingMessage, mr as RootConfig, mt as inferSubscriptionOutput, ni as TRPCError, nn as isFormattedErrorShape, nr as getProcedureAtPath, nt as AnySubscriptionProcedure, o as ProxyPromise, oi as TRPC_ERROR_CODES_BY_NUMBER, on as CombinedDataTransformerClient, or as inferRouterRootTypes, ot as Procedure, p as Deferred, pi as ErrorSymbol, pn as JSONRPC2, pr as JSONLContentType, pt as inferSubscriptionInput, q as Serialize, qn as RouterBuilder, qr as ParserSuperstructEsque, qt as AnyProcedureErrorFormatter, r as Unpromise, ri as getCauseFromUnknown, rn as setFormattedErrorShape, rr as inferRouterContext, rt as ErrorHandlerOptions, s as SubscribedPromise, si as TRPC_ERROR_CODE_KEY, sn as DataTransformer, sr as lazy, st as ProcedureType, t as Encoder, ti as StandardSchemaV1, tn as getFormattedErrorShape, tr as createRouterFactory, tt as AnyQueryProcedure, u as takeWithGrace, ui as DeepPartial, un as getDataTransformer, ur as CreateContextCallback, ut as inferProcedureInput, v as initTRPC, vi as InvertKeyValue, vn as TRPCConnectionParamsMessage, vr as SSEClientOptions, vt as ProcedureBuilder, w as HTTP_CODE_TO_JSONRPC2, wi as ProtectedIntersection, wn as TRPCResponse, wr as sseStreamProducer, wt as abortSignalsAnyPonyfill, x as parseConnectionParamsFromUnknown, xi as MaybePromise, xn as TRPCReconnectNotification, xr as SSEStreamProducerOptions, xt as createBuilder, y as resolveResponse, yi as KeyFromValue, yn as TRPCErrorResponse, yr as SSEPingOptions, yt as ProcedureCallOptions, z as createFlatProxy, zn as AnyRouter, zr as jsonlStreamProducer, zt as MiddlewareFunction } from "./unstable-core-do-not-import-COFs-Qzf.cjs";
|
|
2
|
+
export { AnyClientTypes, AnyMiddlewareBuilder, AnyMiddlewareFunction, AnyMutationProcedure, AnyProcedure, AnyProcedureBuilder, AnyProcedureErrorFormatter, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, BaseHandlerOptions, BuiltRouter, CallerOverride, CombinedDataTransformer, CombinedDataTransformerClient, ConsumerOnError, CreateContextCallback, CreateRootTypes, CreateRouterOptions, DataTransformer, DataTransformerOptions, DecorateCreateRouterOptions, DecorateRouterRecord, DeepPartial, DefaultErrorData, DefaultErrorShape, Deferred, Dict, DistributiveOmit, type Encoder, ErrorFormatter, ErrorFormatterOptions, ErrorHandlerOptions, ErrorSymbol, EventSourceLike, FileLike, Filter, FilterKeys, GetInferenceHelpers, GetRawInputFn, HTTPBaseHandlerOptions, HTTPErrorHandler, HTTP_CODE_TO_JSONRPC2, InferrableClientTypes, IntersectionError, InvertKeyValue, JSONLConfig, JSONLContentType, JSONLProducerOptions, type JSONRPC2, JSONRPC2_TO_HTTP_CODE, KeyFromValue, Lazy, LegacyObservableSubscriptionProcedure, Maybe, MaybePromise, MergeRouters, MiddlewareBuilder, MiddlewareFunction, MiddlewareResult, MutationProcedure, NodeJSReadableStreamEsque, OctetInput, Overwrite, ParseFn, Parser, ParserArkTypeEsque, ParserCustomValidatorEsque, ParserMyZodEsque, ParserScaleEsque, ParserStandardSchemaEsque, ParserSuperstructEsque, ParserValibotEsque, ParserWithInputOutput, ParserWithoutInput, ParserYupEsque, ParserZodEsque, PickFirstDefined, Procedure, ProcedureBuilder, ProcedureCallOptions, ProcedureErrorFormatter, ProcedureResolverOptions, ProcedureType, ProducerOnError, type PromiseExecutor, type PromiseWithResolvers, ProtectedIntersection, type ProxyPromise, QueryProcedure, ResolveHTTPRequestOptionsContextFn, ResponseMeta, ResponseMetaFn, Result, RootConfig, RootTypes, Router, RouterBuilder, RouterCaller, RouterCallerErrorHandler, RouterCallerFactory, RouterDef, RouterRecord, RuntimeConfigOptions, SSEClientOptions, SSEPingOptions, SSEStreamConsumerOptions, SSEStreamProducerOptions, Serialize, SerializeObject, SerializeRecord, Simplify, StandardSchemaV1, StandardSchemaV1Error, type SubscribedPromise, SubscriptionProcedure, TRPCAcceptHeader, type TRPCBuilder, type TRPCClientIncomingMessage, type TRPCClientIncomingRequest, type TRPCClientOutgoingMessage, type TRPCClientOutgoingRequest, type TRPCConnectionParamsMessage, TRPCError, type TRPCErrorResponse, type TRPCErrorShape, type TRPCReconnectNotification, type TRPCRequest, TRPCRequestInfo, TRPCRequestInfoProcedureCall, type TRPCRequestMessage, type TRPCResponse, type TRPCResponseMessage, type TRPCResult, type TRPCResultMessage, TRPCRootObject, type TRPCSubscriptionStopNotification, type TRPCSuccessResponse, TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, TrackedData, TrackedEnvelope, TypeError, Unpromise, UnsetMarker, Unwrap, UtilityParser, ValidateShape, ValueOf, WebReadableStreamEsque, WithoutIndexSignature, abortSignalsAnyPonyfill, assert, assertNever, callProcedure, coerceAsyncIterableToArray, createBuilder, createCallerFactory, createDeferred, createErrorFormatterMiddleware, createFlatProxy, createInputMiddleware, createMiddlewareFactory, createOutputMiddleware, createRecursiveProxy, createRouterFactory, defaultFormatter, defaultTransformer, emptyObject, experimental_standaloneMiddleware, formDataToObject, getAcceptHeader, getCauseFromUnknown, getDataTransformer, getDefaultErrorShape, getErrorShape, getFormattedErrorShape, getHTTPStatusCode, getHTTPStatusCodeFromError, getLastEventId, getParseFn, getProcedureAtPath, getRequestInfo, getStatusCodeFromKey, getStatusKeyFromCode, getTRPCErrorFromUnknown, identity, inferAsyncIterableYield, inferClientTypes, inferParser, inferProcedureBuilderResolverOptions, inferProcedureErrorShape, inferProcedureInput, inferProcedureOutput, inferProcedureParams, inferRouterContext, inferRouterError, inferRouterInputs, inferRouterMeta, inferRouterOutputs, inferRouterRootTypes, inferSubscriptionInput, inferSubscriptionOutput, inferTrackedOutput, inferTransformedProcedureOutput, inferTransformedSubscriptionOutput, initTRPC, isAbortError, isAsyncIterable, isDevDefault, isFormattedErrorShape, isFunction, isObject, isPromise, isServerDefault, isTrackedEnvelope, iteratorResource, jsonlStreamConsumer, jsonlStreamProducer, lazy, makeAsyncResource, makeResource, mergeRouters, mergeWithoutOverrides, middlewareMarker, noop, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, parseTRPCMessage, procedureTypes, resolveResponse, retryableRpcCodes, run, setFormattedErrorShape, sleep, sse, sseHeaders, sseStreamConsumer, sseStreamProducer, takeWithGrace, throwAbortError, tracked, transformResult, transformTRPCResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AnyClientTypes, AnyMiddlewareBuilder, AnyMiddlewareFunction, AnyMutationProcedure, AnyProcedure, AnyProcedureBuilder, AnyProcedureErrorFormatter, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, BaseHandlerOptions, BuiltRouter, CallerOverride, CombinedDataTransformer, CombinedDataTransformerClient, ConsumerOnError, CreateContextCallback, CreateRootTypes, CreateRouterOptions, DataTransformer, DataTransformerOptions, DecorateCreateRouterOptions, DecorateRouterRecord, DeepPartial, DefaultErrorData, DefaultErrorShape, Deferred, Dict, DistributiveOmit, ErrorFormatter, ErrorFormatterOptions, ErrorHandlerOptions, ErrorSymbol, EventSourceLike, FileLike, Filter, FilterKeys, GetInferenceHelpers, GetRawInputFn, HTTPBaseHandlerOptions, HTTPErrorHandler, HTTP_CODE_TO_JSONRPC2, InferrableClientTypes, IntersectionError, InvertKeyValue, JSONLConfig, JSONLContentType, JSONLProducerOptions, type JSONRPC2, JSONRPC2_TO_HTTP_CODE, KeyFromValue, Lazy, LegacyObservableSubscriptionProcedure, Maybe, MaybePromise, MergeRouters, MiddlewareBuilder, MiddlewareFunction, MiddlewareResult, MutationProcedure, NodeJSReadableStreamEsque, OctetInput, Overwrite, ParseFn, Parser, ParserArkTypeEsque, ParserCustomValidatorEsque, ParserMyZodEsque, ParserScaleEsque, ParserStandardSchemaEsque, ParserSuperstructEsque, ParserValibotEsque, ParserWithInputOutput, ParserWithoutInput, ParserYupEsque, ParserZodEsque, PickFirstDefined, Procedure, ProcedureBuilder, ProcedureCallOptions, ProcedureErrorFormatter, ProcedureResolverOptions, ProcedureType, ProducerOnError, type PromiseExecutor, type PromiseWithResolvers, ProtectedIntersection, type ProxyPromise, QueryProcedure, ResolveHTTPRequestOptionsContextFn, ResponseMeta, ResponseMetaFn, Result, RootConfig, RootTypes, Router, RouterBuilder, RouterCaller, RouterCallerErrorHandler, RouterCallerFactory, RouterDef, RouterRecord, RuntimeConfigOptions, SSEClientOptions, SSEPingOptions, SSEStreamConsumerOptions, SSEStreamProducerOptions, Serialize, SerializeObject, SerializeRecord, Simplify, StandardSchemaV1, StandardSchemaV1Error, type SubscribedPromise, SubscriptionProcedure, TRPCAcceptHeader, type TRPCBuilder, type TRPCClientIncomingMessage, type TRPCClientIncomingRequest, type TRPCClientOutgoingMessage, type TRPCClientOutgoingRequest, type TRPCConnectionParamsMessage, TRPCError, type TRPCErrorResponse, type TRPCErrorShape, type TRPCReconnectNotification, type TRPCRequest, TRPCRequestInfo, TRPCRequestInfoProcedureCall, type TRPCRequestMessage, type TRPCResponse, type TRPCResponseMessage, type TRPCResult, type TRPCResultMessage, TRPCRootObject, type TRPCSubscriptionStopNotification, type TRPCSuccessResponse, TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, TrackedData, TrackedEnvelope, TypeError, Unpromise, UnsetMarker, Unwrap, UtilityParser, ValidateShape, ValueOf, WebReadableStreamEsque, WithoutIndexSignature, abortSignalsAnyPonyfill, assert, assertNever, callProcedure, coerceAsyncIterableToArray, createBuilder, createCallerFactory, createDeferred, createErrorFormatterMiddleware, createFlatProxy, createInputMiddleware, createMiddlewareFactory, createOutputMiddleware, createRecursiveProxy, createRouterFactory, defaultFormatter, defaultTransformer, emptyObject, experimental_standaloneMiddleware, formDataToObject, getAcceptHeader, getCauseFromUnknown, getDataTransformer, getDefaultErrorShape, getErrorShape, getFormattedErrorShape, getHTTPStatusCode, getHTTPStatusCodeFromError, getLastEventId, getParseFn, getProcedureAtPath, getRequestInfo, getStatusCodeFromKey, getStatusKeyFromCode, getTRPCErrorFromUnknown, identity, inferAsyncIterableYield, inferClientTypes, inferParser, inferProcedureBuilderResolverOptions, inferProcedureErrorShape, inferProcedureInput, inferProcedureOutput, inferProcedureParams, inferRouterContext, inferRouterError, inferRouterInputs, inferRouterMeta, inferRouterOutputs, inferRouterRootTypes, inferSubscriptionInput, inferSubscriptionOutput, inferTrackedOutput, inferTransformedProcedureOutput, inferTransformedSubscriptionOutput, initTRPC, isAbortError, isAsyncIterable, isDevDefault, isFormattedErrorShape, isFunction, isObject, isPromise, isServerDefault, isTrackedEnvelope, iteratorResource, jsonlStreamConsumer, jsonlStreamProducer, lazy, makeAsyncResource, makeResource, mergeRouters, mergeWithoutOverrides, middlewareMarker, noop, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, parseTRPCMessage, procedureTypes, resolveResponse, retryableRpcCodes, run, setFormattedErrorShape, sleep, sse, sseHeaders, sseStreamConsumer, sseStreamProducer, takeWithGrace, throwAbortError, tracked, transformResult, transformTRPCResponse };
|
|
1
|
+
import { $ as AnyMutationProcedure, $n as callProcedure, $r as getParseFn, $t as defaultFormatter, A as formDataToObject, Ai as ValueOf, An as BaseHandlerOptions, Ar as tracked, At as isFunction, B as createRecursiveProxy, Bn as BuiltRouter, Br as ParseFn, Bt as MiddlewareResult, C as throwAbortError, Ci as PickFirstDefined, Cn as TRPCRequestMessage, Cr as sseStreamConsumer, Ct as UnsetMarker, D as getHTTPStatusCodeFromError, Di as TypeError, Dn as TRPCResultMessage, Dr as inferTrackedOutput, Dt as emptyObject, E as getHTTPStatusCode, Ei as Simplify, En as TRPCResult, Er as TrackedEnvelope, Et as assertNever, F as getAcceptHeader, Fn as ResponseMetaFn, Fr as ProducerOnError, Ft as sleep, G as inferTransformedProcedureOutput, Gn as MergeRouters, Gr as ParserScaleEsque, Gt as experimental_standaloneMiddleware, H as inferProcedureErrorShape, Hn as DecorateCreateRouterOptions, Hr as ParserArkTypeEsque, Ht as createInputMiddleware, I as getLastEventId, In as TRPCAcceptHeader, Ir as WebReadableStreamEsque, It as AnyMiddlewareBuilder, J as SerializeObject, Jn as RouterCaller, Jr as ParserValibotEsque, Jt as DefaultErrorData, K as inferTransformedSubscriptionOutput, Kn as Router, Kr as ParserStandardSchemaEsque, Kt as middlewareMarker, L as getRequestInfo, Ln as TRPCRequestInfo, Lr as isPromise, Lt as AnyMiddlewareFunction, M as OctetInput, Mi as coerceAsyncIterableToArray, Mn as HTTPErrorHandler, Mr as ConsumerOnError, Mt as mergeWithoutOverrides, N as UtilityParser, Ni as inferAsyncIterableYield, Nn as ResolveHTTPRequestOptionsContextFn, Nr as JSONLProducerOptions, Nt as noop, O as getStatusCodeFromKey, Oi as Unwrap, On as TRPCSubscriptionStopNotification, Or as isTrackedEnvelope, Ot as identity, P as octetInputParser, Pn as ResponseMeta, Pr as NodeJSReadableStreamEsque, Pt as run, Q as inferClientTypes, Qn as RouterRecord, Qr as ParserZodEsque, Qt as ProcedureErrorFormatter, R as getErrorShape, Rn as TRPCRequestInfoProcedureCall, Rr as jsonlStreamConsumer, Rt as MiddlewareBuilder, S as isAbortError, Si as Overwrite, Sn as TRPCRequest, Sr as sseHeaders, St as inferProcedureBuilderResolverOptions, T as JSONRPC2_TO_HTTP_CODE, Ti as Result, Tn as TRPCResponseMessage, Tr as TrackedData, Tt as assert, U as inferRouterInputs, Un as DecorateRouterRecord, Ur as ParserCustomValidatorEsque, Ut as createMiddlewareFactory, V as GetInferenceHelpers, Vn as CreateRouterOptions, Vr as Parser, Vt as createErrorFormatterMiddleware, W as inferRouterOutputs, Wn as Lazy, Wr as ParserMyZodEsque, Wt as createOutputMiddleware, X as AnyClientTypes, Xn as RouterCallerFactory, Xr as ParserWithoutInput, Xt as ErrorFormatter, Y as SerializeRecord, Yn as RouterCallerErrorHandler, Yr as ParserWithInputOutput, Yt as DefaultErrorShape, Z as InferrableClientTypes, Zn as RouterDef, Zr as ParserYupEsque, Zt as ErrorFormatterOptions, _ as TRPCRootObject, _i as IntersectionError, _n as TRPCClientOutgoingRequest, _r as isServerDefault, _t as CallerOverride, a as PromiseWithResolvers, ai as TRPC_ERROR_CODES_BY_KEY, an as CombinedDataTransformer, ar as inferRouterMeta, at as MutationProcedure, b as parseConnectionParamsFromString, bi as Maybe, bn as TRPCErrorShape, br as SSEStreamConsumerOptions, bt as ProcedureResolverOptions, c as StandardSchemaV1Error, ci as TRPC_ERROR_CODE_NUMBER, cn as DataTransformerOptions, cr as mergeRouters, ct as QueryProcedure, d as makeAsyncResource, di as Dict, dn as transformResult, dr as CreateRootTypes, dt as inferProcedureOutput, ei as inferParser, en as getDefaultErrorShape, er as createCallerFactory, et as AnyProcedure, f as makeResource, fi as DistributiveOmit, fn as transformTRPCResponse, fr as JSONLConfig, ft as inferProcedureParams, g as TRPCBuilder, gi as GetRawInputFn, gn as TRPCClientOutgoingMessage, gr as isDevDefault, gt as AnyProcedureBuilder, h as RuntimeConfigOptions, hi as FilterKeys, hn as TRPCClientIncomingRequest, hr as RootTypes, ht as procedureTypes, i as PromiseExecutor, ii as getTRPCErrorFromUnknown, in as parseTRPCMessage, ir as inferRouterError, it as LegacyObservableSubscriptionProcedure, j as FileLike, ji as WithoutIndexSignature, jn as HTTPBaseHandlerOptions, jr as EventSourceLike, jt as isObject, k as getStatusKeyFromCode, ki as ValidateShape, kn as TRPCSuccessResponse, kr as sse, kt as isAsyncIterable, l as iteratorResource, li as retryableRpcCodes, ln as defaultTransformer, lr as AnyRootTypes, lt as SubscriptionProcedure, m as createDeferred, mi as Filter, mn as TRPCClientIncomingMessage, mr as RootConfig, mt as inferSubscriptionOutput, ni as TRPCError, nn as isFormattedErrorShape, nr as getProcedureAtPath, nt as AnySubscriptionProcedure, o as ProxyPromise, oi as TRPC_ERROR_CODES_BY_NUMBER, on as CombinedDataTransformerClient, or as inferRouterRootTypes, ot as Procedure, p as Deferred, pi as ErrorSymbol, pn as JSONRPC2, pr as JSONLContentType, pt as inferSubscriptionInput, q as Serialize, qn as RouterBuilder, qr as ParserSuperstructEsque, qt as AnyProcedureErrorFormatter, r as Unpromise, ri as getCauseFromUnknown, rn as setFormattedErrorShape, rr as inferRouterContext, rt as ErrorHandlerOptions, s as SubscribedPromise, si as TRPC_ERROR_CODE_KEY, sn as DataTransformer, sr as lazy, st as ProcedureType, t as Encoder, ti as StandardSchemaV1, tn as getFormattedErrorShape, tr as createRouterFactory, tt as AnyQueryProcedure, u as takeWithGrace, ui as DeepPartial, un as getDataTransformer, ur as CreateContextCallback, ut as inferProcedureInput, v as initTRPC, vi as InvertKeyValue, vn as TRPCConnectionParamsMessage, vr as SSEClientOptions, vt as ProcedureBuilder, w as HTTP_CODE_TO_JSONRPC2, wi as ProtectedIntersection, wn as TRPCResponse, wr as sseStreamProducer, wt as abortSignalsAnyPonyfill, x as parseConnectionParamsFromUnknown, xi as MaybePromise, xn as TRPCReconnectNotification, xr as SSEStreamProducerOptions, xt as createBuilder, y as resolveResponse, yi as KeyFromValue, yn as TRPCErrorResponse, yr as SSEPingOptions, yt as ProcedureCallOptions, z as createFlatProxy, zn as AnyRouter, zr as jsonlStreamProducer, zt as MiddlewareFunction } from "./unstable-core-do-not-import-Dals6grN.mjs";
|
|
2
|
+
export { AnyClientTypes, AnyMiddlewareBuilder, AnyMiddlewareFunction, AnyMutationProcedure, AnyProcedure, AnyProcedureBuilder, AnyProcedureErrorFormatter, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, BaseHandlerOptions, BuiltRouter, CallerOverride, CombinedDataTransformer, CombinedDataTransformerClient, ConsumerOnError, CreateContextCallback, CreateRootTypes, CreateRouterOptions, DataTransformer, DataTransformerOptions, DecorateCreateRouterOptions, DecorateRouterRecord, DeepPartial, DefaultErrorData, DefaultErrorShape, Deferred, Dict, DistributiveOmit, type Encoder, ErrorFormatter, ErrorFormatterOptions, ErrorHandlerOptions, ErrorSymbol, EventSourceLike, FileLike, Filter, FilterKeys, GetInferenceHelpers, GetRawInputFn, HTTPBaseHandlerOptions, HTTPErrorHandler, HTTP_CODE_TO_JSONRPC2, InferrableClientTypes, IntersectionError, InvertKeyValue, JSONLConfig, JSONLContentType, JSONLProducerOptions, type JSONRPC2, JSONRPC2_TO_HTTP_CODE, KeyFromValue, Lazy, LegacyObservableSubscriptionProcedure, Maybe, MaybePromise, MergeRouters, MiddlewareBuilder, MiddlewareFunction, MiddlewareResult, MutationProcedure, NodeJSReadableStreamEsque, OctetInput, Overwrite, ParseFn, Parser, ParserArkTypeEsque, ParserCustomValidatorEsque, ParserMyZodEsque, ParserScaleEsque, ParserStandardSchemaEsque, ParserSuperstructEsque, ParserValibotEsque, ParserWithInputOutput, ParserWithoutInput, ParserYupEsque, ParserZodEsque, PickFirstDefined, Procedure, ProcedureBuilder, ProcedureCallOptions, ProcedureErrorFormatter, ProcedureResolverOptions, ProcedureType, ProducerOnError, type PromiseExecutor, type PromiseWithResolvers, ProtectedIntersection, type ProxyPromise, QueryProcedure, ResolveHTTPRequestOptionsContextFn, ResponseMeta, ResponseMetaFn, Result, RootConfig, RootTypes, Router, RouterBuilder, RouterCaller, RouterCallerErrorHandler, RouterCallerFactory, RouterDef, RouterRecord, RuntimeConfigOptions, SSEClientOptions, SSEPingOptions, SSEStreamConsumerOptions, SSEStreamProducerOptions, Serialize, SerializeObject, SerializeRecord, Simplify, StandardSchemaV1, StandardSchemaV1Error, type SubscribedPromise, SubscriptionProcedure, TRPCAcceptHeader, type TRPCBuilder, type TRPCClientIncomingMessage, type TRPCClientIncomingRequest, type TRPCClientOutgoingMessage, type TRPCClientOutgoingRequest, type TRPCConnectionParamsMessage, TRPCError, type TRPCErrorResponse, type TRPCErrorShape, type TRPCReconnectNotification, type TRPCRequest, TRPCRequestInfo, TRPCRequestInfoProcedureCall, type TRPCRequestMessage, type TRPCResponse, type TRPCResponseMessage, type TRPCResult, type TRPCResultMessage, TRPCRootObject, type TRPCSubscriptionStopNotification, type TRPCSuccessResponse, TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, TrackedData, TrackedEnvelope, TypeError, Unpromise, UnsetMarker, Unwrap, UtilityParser, ValidateShape, ValueOf, WebReadableStreamEsque, WithoutIndexSignature, abortSignalsAnyPonyfill, assert, assertNever, callProcedure, coerceAsyncIterableToArray, createBuilder, createCallerFactory, createDeferred, createErrorFormatterMiddleware, createFlatProxy, createInputMiddleware, createMiddlewareFactory, createOutputMiddleware, createRecursiveProxy, createRouterFactory, defaultFormatter, defaultTransformer, emptyObject, experimental_standaloneMiddleware, formDataToObject, getAcceptHeader, getCauseFromUnknown, getDataTransformer, getDefaultErrorShape, getErrorShape, getFormattedErrorShape, getHTTPStatusCode, getHTTPStatusCodeFromError, getLastEventId, getParseFn, getProcedureAtPath, getRequestInfo, getStatusCodeFromKey, getStatusKeyFromCode, getTRPCErrorFromUnknown, identity, inferAsyncIterableYield, inferClientTypes, inferParser, inferProcedureBuilderResolverOptions, inferProcedureErrorShape, inferProcedureInput, inferProcedureOutput, inferProcedureParams, inferRouterContext, inferRouterError, inferRouterInputs, inferRouterMeta, inferRouterOutputs, inferRouterRootTypes, inferSubscriptionInput, inferSubscriptionOutput, inferTrackedOutput, inferTransformedProcedureOutput, inferTransformedSubscriptionOutput, initTRPC, isAbortError, isAsyncIterable, isDevDefault, isFormattedErrorShape, isFunction, isObject, isPromise, isServerDefault, isTrackedEnvelope, iteratorResource, jsonlStreamConsumer, jsonlStreamProducer, lazy, makeAsyncResource, makeResource, mergeRouters, mergeWithoutOverrides, middlewareMarker, noop, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, parseTRPCMessage, procedureTypes, resolveResponse, retryableRpcCodes, run, setFormattedErrorShape, sleep, sse, sseHeaders, sseStreamConsumer, sseStreamProducer, takeWithGrace, throwAbortError, tracked, transformResult, transformTRPCResponse };
|
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as NodeHTTPCreateContextFnOptions } from "./index-
|
|
1
|
+
import { An as BaseHandlerOptions, rr as inferRouterContext, t as Encoder, ur as CreateContextCallback, xi as MaybePromise, zn as AnyRouter } from "./unstable-core-do-not-import-Dals6grN.mjs";
|
|
2
|
+
import { o as NodeHTTPCreateContextFnOptions } from "./index-D6v3zbh1.mjs";
|
|
3
3
|
import { IncomingMessage } from "http";
|
|
4
|
-
import
|
|
5
|
-
//#region src/adapters/wsEncoder.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Encoder for WebSocket wire format.
|
|
8
|
-
* Encodes outgoing messages and decodes incoming messages.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const customEncoder: Encoder = {
|
|
13
|
-
* encode: (data) => myFormat.stringify(data),
|
|
14
|
-
* decode: (data) => myFormat.parse(data),
|
|
15
|
-
* };
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
interface Encoder {
|
|
19
|
-
/** Encode data for transmission over the wire */
|
|
20
|
-
encode(data: unknown): string | Uint8Array<ArrayBuffer>;
|
|
21
|
-
/** Decode data received from the wire */
|
|
22
|
-
decode(data: string | ArrayBuffer | Uint8Array): unknown;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Default JSON encoder - used when no encoder is specified.
|
|
26
|
-
* This maintains backwards compatibility with existing behavior.
|
|
27
|
-
*/
|
|
28
|
-
declare const jsonEncoder: Encoder;
|
|
29
|
-
//#endregion
|
|
4
|
+
import { WebSocket, WebSocketServer } from "ws";
|
|
30
5
|
//#region src/adapters/ws.d.ts
|
|
31
6
|
/**
|
|
32
7
|
* @public
|
|
33
8
|
*/
|
|
34
|
-
type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<IncomingMessage,
|
|
9
|
+
type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>;
|
|
35
10
|
/**
|
|
36
11
|
* @public
|
|
37
12
|
*/
|
|
@@ -41,7 +16,7 @@ type WSConnectionHandlerOptions<TRouter extends AnyRouter> = BaseHandlerOptions<
|
|
|
41
16
|
* Web socket server handler
|
|
42
17
|
*/
|
|
43
18
|
type WSSHandlerOptions<TRouter extends AnyRouter> = WSConnectionHandlerOptions<TRouter> & {
|
|
44
|
-
wss:
|
|
19
|
+
wss: WebSocketServer;
|
|
45
20
|
prefix?: string;
|
|
46
21
|
keepAlive?: {
|
|
47
22
|
/**
|
|
@@ -72,15 +47,15 @@ type WSSHandlerOptions<TRouter extends AnyRouter> = WSConnectionHandlerOptions<T
|
|
|
72
47
|
*/
|
|
73
48
|
experimental_encoder?: Encoder;
|
|
74
49
|
};
|
|
75
|
-
declare function getWSConnectionHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): (client:
|
|
50
|
+
declare function getWSConnectionHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): (client: WebSocket, req: IncomingMessage) => void;
|
|
76
51
|
/**
|
|
77
52
|
* Handle WebSocket keep-alive messages
|
|
78
53
|
*/
|
|
79
|
-
declare function handleKeepAlive(client:
|
|
54
|
+
declare function handleKeepAlive(client: WebSocket, pingMs?: number, pongWaitMs?: number): void;
|
|
80
55
|
declare function applyWSSHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): {
|
|
81
56
|
broadcastReconnectNotification: () => void;
|
|
82
57
|
};
|
|
83
58
|
//#endregion
|
|
84
|
-
export { applyWSSHandler as a,
|
|
59
|
+
export { applyWSSHandler as a, WSSHandlerOptions as i, CreateWSSContextFnOptions as n, getWSConnectionHandler as o, WSConnectionHandlerOptions as r, handleKeepAlive as s, CreateWSSContextFn as t };
|
|
85
60
|
|
|
86
|
-
//# sourceMappingURL=ws-
|
|
61
|
+
//# sourceMappingURL=ws-B5iD5Qn7.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-B5iD5Qn7.d.mts","names":[],"sources":["../src/adapters/ws.ts"],"mappings":";;;;;;;;KAqDY,4BAA4B,+BACtC,iBACA;;;;KAMU,mBAAmB,gBAAgB,cAC7C,MAAM,8BACH,aAAa,mBAAmB;KAEzB,2BAA2B,gBAAgB,aACrD,mBAAmB,SAAS,mBAC1B,sBACE,mBAAmB,UACnB,mBAAmB;;;;KAMb,kBAAkB,gBAAgB,aAC5C,2BAA2B;EACzB,KAAK;EACL;EACA;;;;;IAKE;;;;;IAKA;;;;;IAKA;;;;;;;EAOF;;;;;EAKA,uBAAuB;;iBAGX,uBAAuB,gBAAgB,WACrD,MAAM,kBAAkB,YAAQ,QAMhB,WAAW,KAAO;;;;iBA4cpB,gBACd,QAAQ,WACR,iBACA;iBAmCc,gBAAgB,gBAAgB,WAC9C,MAAM,kBAAkB;EAatB"}
|
package/dist/ws-DJ2SSChC.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-DJ2SSChC.mjs","names":["callTRPCProcedure"],"sources":["../src/adapters/wsEncoder.ts","../src/adapters/ws.ts"],"sourcesContent":["/**\n * Encoder for WebSocket wire format.\n * Encodes outgoing messages and decodes incoming messages.\n *\n * @example\n * ```ts\n * const customEncoder: Encoder = {\n * encode: (data) => myFormat.stringify(data),\n * decode: (data) => myFormat.parse(data),\n * };\n * ```\n */\nexport interface Encoder {\n /** Encode data for transmission over the wire */\n encode(data: unknown): string | Uint8Array<ArrayBuffer>;\n /** Decode data received from the wire */\n decode(data: string | ArrayBuffer | Uint8Array): unknown;\n}\n\n/**\n * Default JSON encoder - used when no encoder is specified.\n * This maintains backwards compatibility with existing behavior.\n */\nexport const jsonEncoder: Encoder = {\n encode: (data) => JSON.stringify(data),\n decode: (data) => {\n if (typeof data !== 'string') {\n throw new Error(\n 'jsonEncoder received binary data. JSON uses text frames. ' +\n 'Use a binary encoder for binary data.',\n );\n }\n return JSON.parse(data);\n },\n};\n","import type { IncomingMessage } from 'http';\nimport type ws from 'ws';\nimport type {\n AnyRouter,\n CreateContextCallback,\n inferRouterContext,\n} from '../@trpc/server';\nimport {\n callTRPCProcedure,\n getErrorShape,\n getTRPCErrorFromUnknown,\n transformTRPCResponse,\n TRPCError,\n} from '../@trpc/server';\nimport type { TRPCRequestInfo } from '../@trpc/server/http';\nimport { type BaseHandlerOptions } from '../@trpc/server/http';\nimport { parseTRPCMessage } from '../@trpc/server/rpc';\n// @trpc/server/rpc\nimport type {\n TRPCClientOutgoingMessage,\n TRPCConnectionParamsMessage,\n TRPCReconnectNotification,\n TRPCResponseMessage,\n TRPCResultMessage,\n} from '../@trpc/server/rpc';\nimport { parseConnectionParamsFromUnknown } from '../http';\nimport { isObservable, observableToAsyncIterable } from '../observable';\n// eslint-disable-next-line no-restricted-imports\nimport {\n isAsyncIterable,\n isObject,\n isTrackedEnvelope,\n run,\n type MaybePromise,\n} from '../unstable-core-do-not-import';\n// eslint-disable-next-line no-restricted-imports\nimport type { Result } from '../unstable-core-do-not-import';\n// eslint-disable-next-line no-restricted-imports\nimport { iteratorResource } from '../unstable-core-do-not-import/stream/utils/asyncIterable';\nimport { Unpromise } from '../vendor/unpromise';\nimport { createURL, type NodeHTTPCreateContextFnOptions } from './node-http';\nimport type { Encoder } from './wsEncoder';\nimport { jsonEncoder } from './wsEncoder';\n\n/**\n * Importing ws causes a build error\n * @see https://github.com/trpc/trpc/pull/5279\n */\nconst WEBSOCKET_OPEN = 1; /* ws.WebSocket.OPEN */\n\n/**\n * @public\n */\nexport type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<\n IncomingMessage,\n ws.WebSocket\n>;\n\n/**\n * @public\n */\nexport type CreateWSSContextFn<TRouter extends AnyRouter> = (\n opts: CreateWSSContextFnOptions,\n) => MaybePromise<inferRouterContext<TRouter>>;\n\nexport type WSConnectionHandlerOptions<TRouter extends AnyRouter> =\n BaseHandlerOptions<TRouter, IncomingMessage> &\n CreateContextCallback<\n inferRouterContext<TRouter>,\n CreateWSSContextFn<TRouter>\n >;\n\n/**\n * Web socket server handler\n */\nexport type WSSHandlerOptions<TRouter extends AnyRouter> =\n WSConnectionHandlerOptions<TRouter> & {\n wss: ws.WebSocketServer;\n prefix?: string;\n keepAlive?: {\n /**\n * Enable heartbeat messages\n * @default false\n */\n enabled: boolean;\n /**\n * Heartbeat interval in milliseconds\n * @default 30_000\n */\n pingMs?: number;\n /**\n * Terminate the WebSocket if no pong is received after this many milliseconds\n * @default 5_000\n */\n pongWaitMs?: number;\n };\n /**\n * Disable responding to ping messages from the client\n * **Not recommended** - this is mainly used for testing\n * @default false\n */\n dangerouslyDisablePong?: boolean;\n /**\n * Custom encoder for wire encoding (e.g. custom binary formats)\n * @default jsonEncoder\n */\n experimental_encoder?: Encoder;\n };\n\nexport function getWSConnectionHandler<TRouter extends AnyRouter>(\n opts: WSSHandlerOptions<TRouter>,\n) {\n const { createContext, router } = opts;\n const { transformer } = router._def._config;\n const encoder = opts.experimental_encoder ?? jsonEncoder;\n\n return (client: ws.WebSocket, req: IncomingMessage) => {\n type Context = inferRouterContext<TRouter>;\n type ContextResult = Result<Context>;\n\n const clientSubscriptions = new Map<number | string, AbortController>();\n const abortController = new AbortController();\n\n if (opts.keepAlive?.enabled) {\n const { pingMs, pongWaitMs } = opts.keepAlive;\n handleKeepAlive(client, pingMs, pongWaitMs);\n }\n\n function respond(untransformedJSON: TRPCResponseMessage) {\n client.send(\n encoder.encode(\n transformTRPCResponse(router._def._config, untransformedJSON),\n ),\n );\n }\n\n async function createCtxPromise(\n getConnectionParams: () => TRPCRequestInfo['connectionParams'],\n ): Promise<ContextResult> {\n try {\n return await run(async (): Promise<ContextResult> => {\n ctx = await createContext?.({\n req,\n res: client,\n info: {\n connectionParams: getConnectionParams(),\n calls: [],\n isBatchCall: false,\n accept: null,\n type: 'unknown',\n signal: abortController.signal,\n url: null,\n },\n });\n\n return {\n ok: true,\n value: ctx,\n };\n });\n } catch (cause) {\n const error = getTRPCErrorFromUnknown(cause);\n opts.onError?.({\n error,\n path: undefined,\n type: 'unknown',\n ctx,\n req,\n input: undefined,\n });\n respond({\n id: null,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n\n // close in next tick\n (globalThis.setImmediate ?? globalThis.setTimeout)(() => {\n client.close();\n });\n return {\n ok: false,\n error,\n };\n }\n }\n\n let ctx: Context | undefined = undefined;\n\n /**\n * promise for initializing the context\n *\n * - the context promise will be created immediately on connection if no connectionParams are expected\n * - if connection params are expected, they will be created once received\n */\n let ctxPromise =\n createURL(req).searchParams.get('connectionParams') === '1'\n ? null\n : createCtxPromise(() => null);\n\n function handleRequest(msg: TRPCClientOutgoingMessage, batchIndex: number) {\n const { id, jsonrpc } = msg;\n\n if (id === null) {\n const error = getTRPCErrorFromUnknown(\n new TRPCError({\n code: 'PARSE_ERROR',\n message: '`id` is required',\n }),\n );\n opts.onError?.({\n error,\n path: undefined,\n type: 'unknown',\n ctx,\n req,\n input: undefined,\n });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n return;\n }\n if (msg.method === 'subscription.stop') {\n clientSubscriptions.get(id)?.abort();\n return;\n }\n const { path, lastEventId } = msg.params;\n let { input } = msg.params;\n const type = msg.method;\n\n if (lastEventId !== undefined) {\n if (isObject(input)) {\n input = {\n ...input,\n lastEventId: lastEventId,\n };\n } else {\n input ??= {\n lastEventId: lastEventId,\n };\n }\n }\n run(async () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const res = await ctxPromise!; // asserts context has been set\n if (!res.ok) {\n throw res.error;\n }\n\n const abortController = new AbortController();\n const result = await callTRPCProcedure({\n router,\n path,\n getRawInput: async () => input,\n ctx,\n type,\n signal: abortController.signal,\n batchIndex,\n });\n\n const isIterableResult =\n isAsyncIterable(result) || isObservable(result);\n\n if (type !== 'subscription') {\n if (isIterableResult) {\n throw new TRPCError({\n code: 'UNSUPPORTED_MEDIA_TYPE',\n message: `Cannot return an async iterable or observable from a ${type} procedure with WebSockets`,\n });\n }\n // send the value as data if the method is not a subscription\n respond({\n id,\n jsonrpc,\n result: {\n type: 'data',\n data: result,\n },\n });\n return;\n }\n\n if (!isIterableResult) {\n throw new TRPCError({\n message: `Subscription ${path} did not return an observable or a AsyncGenerator`,\n code: 'INTERNAL_SERVER_ERROR',\n });\n }\n\n /* istanbul ignore next -- @preserve */\n if (client.readyState !== WEBSOCKET_OPEN) {\n // if the client got disconnected whilst initializing the subscription\n // no need to send stopped message if the client is disconnected\n\n return;\n }\n\n /* istanbul ignore next -- @preserve */\n if (clientSubscriptions.has(id)) {\n // duplicate request ids for client\n\n throw new TRPCError({\n message: `Duplicate id ${id}`,\n code: 'BAD_REQUEST',\n });\n }\n\n const iterable = isObservable(result)\n ? observableToAsyncIterable(result, abortController.signal)\n : result;\n\n run(async () => {\n await using iterator = iteratorResource(iterable);\n\n const abortPromise = new Promise<'abort'>((resolve) => {\n abortController.signal.onabort = () => resolve('abort');\n });\n // We need those declarations outside the loop for garbage collection reasons. If they\n // were declared inside, they would not be freed until the next value is present.\n let next:\n | null\n | TRPCError\n | Awaited<\n typeof abortPromise | ReturnType<(typeof iterator)['next']>\n >;\n let result: null | TRPCResultMessage<unknown>['result'];\n\n while (true) {\n next = await Unpromise.race([\n iterator.next().catch(getTRPCErrorFromUnknown),\n abortPromise,\n ]);\n\n if (next === 'abort') {\n await iterator.return?.();\n break;\n }\n if (next instanceof Error) {\n const error = getTRPCErrorFromUnknown(next);\n opts.onError?.({ error, path, type, ctx, req, input });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type,\n path,\n input,\n ctx,\n }),\n });\n break;\n }\n if (next.done) {\n break;\n }\n\n result = {\n type: 'data',\n data: next.value,\n };\n\n if (isTrackedEnvelope(next.value)) {\n const [id, data] = next.value;\n result.id = id;\n result.data = {\n id,\n data,\n };\n }\n\n respond({\n id,\n jsonrpc,\n result,\n });\n\n // free up references for garbage collection\n next = null;\n result = null;\n }\n\n respond({\n id,\n jsonrpc,\n result: {\n type: 'stopped',\n },\n });\n clientSubscriptions.delete(id);\n }).catch((cause) => {\n clientSubscriptions.delete(id);\n const error = getTRPCErrorFromUnknown(cause);\n opts.onError?.({ error, path, type, ctx, req, input });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type,\n path,\n input,\n ctx,\n }),\n });\n abortController.abort();\n });\n clientSubscriptions.set(id, abortController);\n\n respond({\n id,\n jsonrpc,\n result: {\n type: 'started',\n },\n });\n }).catch((cause) => {\n // procedure threw an error\n const error = getTRPCErrorFromUnknown(cause);\n opts.onError?.({ error, path, type, ctx, req, input });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type,\n path,\n input,\n ctx,\n }),\n });\n });\n }\n client.on('message', (rawData, isBinary) => {\n // Handle PING/PONG as text regardless of encoder\n if (!isBinary) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n const msgStr = rawData.toString();\n if (msgStr === 'PONG') {\n return;\n }\n if (msgStr === 'PING') {\n if (!opts.dangerouslyDisablePong) {\n client.send('PONG');\n }\n return;\n }\n }\n\n // Convert rawData to a format our encoder accepts\n // ws gives us Buffer for both text and binary frames\n if (!Buffer.isBuffer(rawData)) {\n const error = new TRPCError({\n code: 'UNPROCESSABLE_CONTENT',\n message: 'Unexpected WebSocket message format',\n });\n respond({\n id: null,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n return;\n }\n const data: string | Uint8Array = isBinary\n ? rawData\n : rawData.toString('utf8');\n\n if (!ctxPromise) {\n // If the ctxPromise wasn't created immediately, we're expecting the first message to be a TRPCConnectionParamsMessage\n ctxPromise = createCtxPromise(() => {\n let msg;\n try {\n msg = encoder.decode(data) as TRPCConnectionParamsMessage;\n\n if (!isObject(msg)) {\n throw new Error('Message was not an object');\n }\n } catch (cause) {\n throw new TRPCError({\n code: 'PARSE_ERROR',\n message: `Malformed TRPCConnectionParamsMessage`,\n cause,\n });\n }\n\n const connectionParams = parseConnectionParamsFromUnknown(msg.data);\n\n return connectionParams;\n });\n return;\n }\n\n const parsedMsgs = run(() => {\n try {\n const msgJSON: unknown = encoder.decode(data);\n const msgs: unknown[] = Array.isArray(msgJSON) ? msgJSON : [msgJSON];\n\n return msgs.map((raw) => parseTRPCMessage(raw, transformer));\n } catch (cause) {\n const error = new TRPCError({\n code: 'PARSE_ERROR',\n cause,\n });\n\n respond({\n id: null,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n\n return [];\n }\n });\n\n parsedMsgs.map((msg, index) => handleRequest(msg, index));\n });\n\n // WebSocket errors should be handled, as otherwise unhandled exceptions will crash Node.js.\n // This line was introduced after the following error brought down production systems:\n // \"RangeError: Invalid WebSocket frame: RSV2 and RSV3 must be clear\"\n // Here is the relevant discussion: https://github.com/websockets/ws/issues/1354#issuecomment-774616962\n client.on('error', (cause) => {\n opts.onError?.({\n ctx,\n error: getTRPCErrorFromUnknown(cause),\n input: undefined,\n path: undefined,\n type: 'unknown',\n req,\n });\n });\n\n client.once('close', () => {\n for (const sub of clientSubscriptions.values()) {\n sub.abort();\n }\n clientSubscriptions.clear();\n abortController.abort();\n });\n };\n}\n\n/**\n * Handle WebSocket keep-alive messages\n */\nexport function handleKeepAlive(\n client: ws.WebSocket,\n pingMs = 30_000,\n pongWaitMs = 5_000,\n) {\n let timeout: NodeJS.Timeout | undefined = undefined;\n let ping: NodeJS.Timeout | undefined = undefined;\n\n const schedulePing = () => {\n const scheduleTimeout = () => {\n timeout = setTimeout(() => {\n client.terminate();\n }, pongWaitMs);\n };\n ping = setTimeout(() => {\n client.send('PING');\n\n scheduleTimeout();\n }, pingMs);\n };\n\n const onMessage = () => {\n clearTimeout(ping);\n clearTimeout(timeout);\n\n schedulePing();\n };\n\n client.on('message', onMessage);\n\n client.on('close', () => {\n clearTimeout(ping);\n clearTimeout(timeout);\n });\n\n schedulePing();\n}\n\nexport function applyWSSHandler<TRouter extends AnyRouter>(\n opts: WSSHandlerOptions<TRouter>,\n) {\n const encoder = opts.experimental_encoder ?? jsonEncoder;\n const onConnection = getWSConnectionHandler(opts);\n opts.wss.on('connection', (client, req) => {\n if (opts.prefix && !req.url?.startsWith(opts.prefix)) {\n return;\n }\n\n onConnection(client, req);\n });\n\n return {\n broadcastReconnectNotification: () => {\n const response: TRPCReconnectNotification = {\n id: null,\n method: 'reconnect',\n };\n const data = encoder.encode(response);\n for (const client of opts.wss.clients) {\n if (client.readyState === WEBSOCKET_OPEN) {\n client.send(data);\n }\n }\n },\n };\n}\n\nexport type { Encoder } from './wsEncoder';\nexport { jsonEncoder } from './wsEncoder';\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAa,cAAuB;CAClC,SAAS,SAAS,KAAK,UAAU,IAAI;CACrC,SAAS,SAAS;EAChB,IAAI,OAAO,SAAS,UAClB,MAAM,IAAI,MACR,gGAEF;EAEF,OAAO,KAAK,MAAM,IAAI;CACxB;AACF;;;;;;;ACcA,MAAM,iBAAiB;AA6DvB,SAAgB,uBACd,MACA;;CACA,MAAM,EAAE,eAAe,WAAW;CAClC,MAAM,EAAE,gBAAgB,OAAO,KAAK;CACpC,MAAM,WAAA,wBAAU,KAAK,0BAAA,QAAA,0BAAA,KAAA,IAAA,wBAAwB;CAE7C,QAAQ,QAAsB,QAAyB;;EAIrD,MAAM,sCAAsB,IAAI,IAAsC;EACtE,MAAM,kBAAkB,IAAI,gBAAgB;EAE5C,KAAA,kBAAI,KAAK,eAAA,QAAA,oBAAA,KAAA,IAAA,KAAA,IAAA,gBAAW,SAAS;GAC3B,MAAM,EAAE,QAAQ,eAAe,KAAK;GACpC,gBAAgB,QAAQ,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src/adapters/ws.ts"],"sourcesContent":["/**\n * Encoder for WebSocket wire format.\n * Encodes outgoing messages and decodes incoming messages.\n *\n * @example\n * ```ts\n * const customEncoder: Encoder = {\n * encode: (data) => myFormat.stringify(data),\n * decode: (data) => myFormat.parse(data),\n * };\n * ```\n */\nexport interface Encoder {\n /** Encode data for transmission over the wire */\n encode(data: unknown): string | Uint8Array<ArrayBuffer>;\n /** Decode data received from the wire */\n decode(data: string | ArrayBuffer | Uint8Array): unknown;\n}\n\n/**\n * Default JSON encoder - used when no encoder is specified.\n * This maintains backwards compatibility with existing behavior.\n */\nexport const jsonEncoder: Encoder = {\n encode: (data) => JSON.stringify(data),\n decode: (data) => {\n if (typeof data !== 'string') {\n throw new Error(\n 'jsonEncoder received binary data. JSON uses text frames. ' +\n 'Use a binary encoder for binary data.',\n );\n }\n return JSON.parse(data);\n },\n};\n","import type { IncomingMessage } from 'http';\nimport type { WebSocketServer, WebSocket as WsWebSocket } from 'ws';\nimport type {\n AnyRouter,\n CreateContextCallback,\n inferRouterContext,\n} from '../@trpc/server';\nimport {\n callTRPCProcedure,\n getErrorShape,\n getTRPCErrorFromUnknown,\n transformTRPCResponse,\n TRPCError,\n} from '../@trpc/server';\nimport type { TRPCRequestInfo } from '../@trpc/server/http';\nimport { type BaseHandlerOptions } from '../@trpc/server/http';\nimport { parseTRPCMessage } from '../@trpc/server/rpc';\n// @trpc/server/rpc\nimport type {\n TRPCClientOutgoingMessage,\n TRPCConnectionParamsMessage,\n TRPCReconnectNotification,\n TRPCResponseMessage,\n TRPCResultMessage,\n} from '../@trpc/server/rpc';\nimport { parseConnectionParamsFromUnknown } from '../http';\nimport { isObservable, observableToAsyncIterable } from '../observable';\n// eslint-disable-next-line no-restricted-imports\nimport {\n isAsyncIterable,\n isObject,\n isTrackedEnvelope,\n run,\n type MaybePromise,\n} from '../unstable-core-do-not-import';\n// eslint-disable-next-line no-restricted-imports\nimport type { Result } from '../unstable-core-do-not-import';\n// eslint-disable-next-line no-restricted-imports\nimport { iteratorResource } from '../unstable-core-do-not-import/stream/utils/asyncIterable';\nimport { Unpromise } from '../vendor/unpromise';\nimport { createURL, type NodeHTTPCreateContextFnOptions } from './node-http';\nimport type { Encoder } from './wsEncoder';\nimport { jsonEncoder } from './wsEncoder';\n\n/**\n * Importing ws causes a build error\n * @see https://github.com/trpc/trpc/pull/5279\n */\nconst WEBSOCKET_OPEN = 1; /* ws.WebSocket.OPEN */\n\n/**\n * @public\n */\nexport type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<\n IncomingMessage,\n WsWebSocket\n>;\n\n/**\n * @public\n */\nexport type CreateWSSContextFn<TRouter extends AnyRouter> = (\n opts: CreateWSSContextFnOptions,\n) => MaybePromise<inferRouterContext<TRouter>>;\n\nexport type WSConnectionHandlerOptions<TRouter extends AnyRouter> =\n BaseHandlerOptions<TRouter, IncomingMessage> &\n CreateContextCallback<\n inferRouterContext<TRouter>,\n CreateWSSContextFn<TRouter>\n >;\n\n/**\n * Web socket server handler\n */\nexport type WSSHandlerOptions<TRouter extends AnyRouter> =\n WSConnectionHandlerOptions<TRouter> & {\n wss: WebSocketServer;\n prefix?: string;\n keepAlive?: {\n /**\n * Enable heartbeat messages\n * @default false\n */\n enabled: boolean;\n /**\n * Heartbeat interval in milliseconds\n * @default 30_000\n */\n pingMs?: number;\n /**\n * Terminate the WebSocket if no pong is received after this many milliseconds\n * @default 5_000\n */\n pongWaitMs?: number;\n };\n /**\n * Disable responding to ping messages from the client\n * **Not recommended** - this is mainly used for testing\n * @default false\n */\n dangerouslyDisablePong?: boolean;\n /**\n * Custom encoder for wire encoding (e.g. custom binary formats)\n * @default jsonEncoder\n */\n experimental_encoder?: Encoder;\n };\n\nexport function getWSConnectionHandler<TRouter extends AnyRouter>(\n opts: WSSHandlerOptions<TRouter>,\n) {\n const { createContext, router } = opts;\n const { transformer } = router._def._config;\n const encoder = opts.experimental_encoder ?? jsonEncoder;\n\n return (client: WsWebSocket, req: IncomingMessage) => {\n type Context = inferRouterContext<TRouter>;\n type ContextResult = Result<Context>;\n\n const clientSubscriptions = new Map<number | string, AbortController>();\n const abortController = new AbortController();\n\n if (opts.keepAlive?.enabled) {\n const { pingMs, pongWaitMs } = opts.keepAlive;\n handleKeepAlive(client, pingMs, pongWaitMs);\n }\n\n function respond(untransformedJSON: TRPCResponseMessage) {\n client.send(\n encoder.encode(\n transformTRPCResponse(router._def._config, untransformedJSON),\n ),\n );\n }\n\n async function createCtxPromise(\n getConnectionParams: () => TRPCRequestInfo['connectionParams'],\n ): Promise<ContextResult> {\n try {\n return await run(async (): Promise<ContextResult> => {\n ctx = await createContext?.({\n req,\n res: client,\n info: {\n connectionParams: getConnectionParams(),\n calls: [],\n isBatchCall: false,\n accept: null,\n type: 'unknown',\n signal: abortController.signal,\n url: null,\n },\n });\n\n return {\n ok: true,\n value: ctx,\n };\n });\n } catch (cause) {\n const error = getTRPCErrorFromUnknown(cause);\n opts.onError?.({\n error,\n path: undefined,\n type: 'unknown',\n ctx,\n req,\n input: undefined,\n });\n respond({\n id: null,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n\n // close in next tick\n (globalThis.setImmediate ?? globalThis.setTimeout)(() => {\n client.close();\n });\n return {\n ok: false,\n error,\n };\n }\n }\n\n let ctx: Context | undefined = undefined;\n\n /**\n * promise for initializing the context\n *\n * - the context promise will be created immediately on connection if no connectionParams are expected\n * - if connection params are expected, they will be created once received\n */\n let ctxPromise =\n createURL(req).searchParams.get('connectionParams') === '1'\n ? null\n : createCtxPromise(() => null);\n\n function handleRequest(msg: TRPCClientOutgoingMessage, batchIndex: number) {\n const { id, jsonrpc } = msg;\n\n if (id === null) {\n const error = getTRPCErrorFromUnknown(\n new TRPCError({\n code: 'PARSE_ERROR',\n message: '`id` is required',\n }),\n );\n opts.onError?.({\n error,\n path: undefined,\n type: 'unknown',\n ctx,\n req,\n input: undefined,\n });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n return;\n }\n if (msg.method === 'subscription.stop') {\n clientSubscriptions.get(id)?.abort();\n return;\n }\n const { path, lastEventId } = msg.params;\n let { input } = msg.params;\n const type = msg.method;\n\n if (lastEventId !== undefined) {\n if (isObject(input)) {\n input = {\n ...input,\n lastEventId: lastEventId,\n };\n } else {\n input ??= {\n lastEventId: lastEventId,\n };\n }\n }\n run(async () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const res = await ctxPromise!; // asserts context has been set\n if (!res.ok) {\n throw res.error;\n }\n\n const abortController = new AbortController();\n const result = await callTRPCProcedure({\n router,\n path,\n getRawInput: async () => input,\n ctx,\n type,\n signal: abortController.signal,\n batchIndex,\n });\n\n const isIterableResult =\n isAsyncIterable(result) || isObservable(result);\n\n if (type !== 'subscription') {\n if (isIterableResult) {\n throw new TRPCError({\n code: 'UNSUPPORTED_MEDIA_TYPE',\n message: `Cannot return an async iterable or observable from a ${type} procedure with WebSockets`,\n });\n }\n // send the value as data if the method is not a subscription\n respond({\n id,\n jsonrpc,\n result: {\n type: 'data',\n data: result,\n },\n });\n return;\n }\n\n if (!isIterableResult) {\n throw new TRPCError({\n message: `Subscription ${path} did not return an observable or a AsyncGenerator`,\n code: 'INTERNAL_SERVER_ERROR',\n });\n }\n\n /* istanbul ignore next -- @preserve */\n if (client.readyState !== WEBSOCKET_OPEN) {\n // if the client got disconnected whilst initializing the subscription\n // no need to send stopped message if the client is disconnected\n\n return;\n }\n\n /* istanbul ignore next -- @preserve */\n if (clientSubscriptions.has(id)) {\n // duplicate request ids for client\n\n throw new TRPCError({\n message: `Duplicate id ${id}`,\n code: 'BAD_REQUEST',\n });\n }\n\n const iterable = isObservable(result)\n ? observableToAsyncIterable(result, abortController.signal)\n : result;\n\n run(async () => {\n await using iterator = iteratorResource(iterable);\n\n const abortPromise = new Promise<'abort'>((resolve) => {\n abortController.signal.onabort = () => resolve('abort');\n });\n // We need those declarations outside the loop for garbage collection reasons. If they\n // were declared inside, they would not be freed until the next value is present.\n let next:\n | null\n | TRPCError\n | Awaited<\n typeof abortPromise | ReturnType<(typeof iterator)['next']>\n >;\n let result: null | TRPCResultMessage<unknown>['result'];\n\n while (true) {\n next = await Unpromise.race([\n iterator.next().catch(getTRPCErrorFromUnknown),\n abortPromise,\n ]);\n\n if (next === 'abort') {\n await iterator.return?.();\n break;\n }\n if (next instanceof Error) {\n const error = getTRPCErrorFromUnknown(next);\n opts.onError?.({ error, path, type, ctx, req, input });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type,\n path,\n input,\n ctx,\n }),\n });\n break;\n }\n if (next.done) {\n break;\n }\n\n result = {\n type: 'data',\n data: next.value,\n };\n\n if (isTrackedEnvelope(next.value)) {\n const [id, data] = next.value;\n result.id = id;\n result.data = {\n id,\n data,\n };\n }\n\n respond({\n id,\n jsonrpc,\n result,\n });\n\n // free up references for garbage collection\n next = null;\n result = null;\n }\n\n respond({\n id,\n jsonrpc,\n result: {\n type: 'stopped',\n },\n });\n clientSubscriptions.delete(id);\n }).catch((cause) => {\n clientSubscriptions.delete(id);\n const error = getTRPCErrorFromUnknown(cause);\n opts.onError?.({ error, path, type, ctx, req, input });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type,\n path,\n input,\n ctx,\n }),\n });\n abortController.abort();\n });\n clientSubscriptions.set(id, abortController);\n\n respond({\n id,\n jsonrpc,\n result: {\n type: 'started',\n },\n });\n }).catch((cause) => {\n // procedure threw an error\n const error = getTRPCErrorFromUnknown(cause);\n opts.onError?.({ error, path, type, ctx, req, input });\n respond({\n id,\n jsonrpc,\n error: getErrorShape({\n config: router._def._config,\n error,\n type,\n path,\n input,\n ctx,\n }),\n });\n });\n }\n client.on('message', (rawData, isBinary) => {\n // Handle PING/PONG as text regardless of encoder\n if (!isBinary) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n const msgStr = rawData.toString();\n if (msgStr === 'PONG') {\n return;\n }\n if (msgStr === 'PING') {\n if (!opts.dangerouslyDisablePong) {\n client.send('PONG');\n }\n return;\n }\n }\n\n // Convert rawData to a format our encoder accepts\n // ws gives us Buffer for both text and binary frames\n if (!Buffer.isBuffer(rawData)) {\n const error = new TRPCError({\n code: 'UNPROCESSABLE_CONTENT',\n message: 'Unexpected WebSocket message format',\n });\n respond({\n id: null,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n return;\n }\n const data: string | Uint8Array = isBinary\n ? rawData\n : rawData.toString('utf8');\n\n if (!ctxPromise) {\n // If the ctxPromise wasn't created immediately, we're expecting the first message to be a TRPCConnectionParamsMessage\n ctxPromise = createCtxPromise(() => {\n let msg;\n try {\n msg = encoder.decode(data) as TRPCConnectionParamsMessage;\n\n if (!isObject(msg)) {\n throw new Error('Message was not an object');\n }\n } catch (cause) {\n throw new TRPCError({\n code: 'PARSE_ERROR',\n message: `Malformed TRPCConnectionParamsMessage`,\n cause,\n });\n }\n\n const connectionParams = parseConnectionParamsFromUnknown(msg.data);\n\n return connectionParams;\n });\n return;\n }\n\n const parsedMsgs = run(() => {\n try {\n const msgJSON: unknown = encoder.decode(data);\n const msgs: unknown[] = Array.isArray(msgJSON) ? msgJSON : [msgJSON];\n\n return msgs.map((raw) => parseTRPCMessage(raw, transformer));\n } catch (cause) {\n const error = new TRPCError({\n code: 'PARSE_ERROR',\n cause,\n });\n\n respond({\n id: null,\n error: getErrorShape({\n config: router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx,\n }),\n });\n\n return [];\n }\n });\n\n parsedMsgs.map((msg, index) => handleRequest(msg, index));\n });\n\n // WebSocket errors should be handled, as otherwise unhandled exceptions will crash Node.js.\n // This line was introduced after the following error brought down production systems:\n // \"RangeError: Invalid WebSocket frame: RSV2 and RSV3 must be clear\"\n // Here is the relevant discussion: https://github.com/websockets/ws/issues/1354#issuecomment-774616962\n client.on('error', (cause) => {\n opts.onError?.({\n ctx,\n error: getTRPCErrorFromUnknown(cause),\n input: undefined,\n path: undefined,\n type: 'unknown',\n req,\n });\n });\n\n client.once('close', () => {\n for (const sub of clientSubscriptions.values()) {\n sub.abort();\n }\n clientSubscriptions.clear();\n abortController.abort();\n });\n };\n}\n\n/**\n * Handle WebSocket keep-alive messages\n */\nexport function handleKeepAlive(\n client: WsWebSocket,\n pingMs = 30_000,\n pongWaitMs = 5_000,\n) {\n let timeout: NodeJS.Timeout | undefined = undefined;\n let ping: NodeJS.Timeout | undefined = undefined;\n\n const schedulePing = () => {\n const scheduleTimeout = () => {\n timeout = setTimeout(() => {\n client.terminate();\n }, pongWaitMs);\n };\n ping = setTimeout(() => {\n client.send('PING');\n\n scheduleTimeout();\n }, pingMs);\n };\n\n const onMessage = () => {\n clearTimeout(ping);\n clearTimeout(timeout);\n\n schedulePing();\n };\n\n client.on('message', onMessage);\n\n client.on('close', () => {\n clearTimeout(ping);\n clearTimeout(timeout);\n });\n\n schedulePing();\n}\n\nexport function applyWSSHandler<TRouter extends AnyRouter>(\n opts: WSSHandlerOptions<TRouter>,\n) {\n const encoder = opts.experimental_encoder ?? jsonEncoder;\n const onConnection = getWSConnectionHandler(opts);\n opts.wss.on('connection', (client, req) => {\n if (opts.prefix && !req.url?.startsWith(opts.prefix)) {\n return;\n }\n\n onConnection(client, req);\n });\n\n return {\n broadcastReconnectNotification: () => {\n const response: TRPCReconnectNotification = {\n id: null,\n method: 'reconnect',\n };\n const data = encoder.encode(response);\n for (const client of opts.wss.clients) {\n if (client.readyState === WEBSOCKET_OPEN) {\n client.send(data);\n }\n }\n },\n };\n}\n\nexport type { Encoder } from './wsEncoder';\nexport { jsonEncoder } from './wsEncoder';\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAa,cAAuB;CAClC,SAAS,SAAS,KAAK,UAAU,IAAI;CACrC,SAAS,SAAS;EAChB,IAAI,OAAO,SAAS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,eAAe,uBAAuB,IAAI;CAChD,KAAK,IAAI,GAAG,eAAe,QAAQ,QAAQ;;EACzC,IAAI,KAAK,UAAU,GAAA,WAAC,IAAI,SAAA,QAAA,aAAA,KAAA,IAAA,KAAA,IAAA,SAAK,WAAW,KAAK,MAAM,IACjD;EAGF,aAAa,QAAQ,GAAG;CAC1B,CAAC;CAED,OAAO,EACL,sCAAsC;EAKpC,MAAM,OAAO,QAAQ,OAAO;GAH1B,IAAI;GACJ,QAAQ;EAEyB,CAAC;EACpC,KAAK,MAAM,UAAU,KAAK,IAAI,SAC5B,IAAI,OAAO,eAAe,gBACxB,OAAO,KAAK,IAAI;CAGtB,EACF;AACF"}
|
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as NodeHTTPCreateContextFnOptions } from "./index-
|
|
1
|
+
import { An as BaseHandlerOptions, rr as inferRouterContext, t as Encoder, ur as CreateContextCallback, xi as MaybePromise, zn as AnyRouter } from "./unstable-core-do-not-import-COFs-Qzf.cjs";
|
|
2
|
+
import { o as NodeHTTPCreateContextFnOptions } from "./index-DaZHES8r.cjs";
|
|
3
3
|
import { IncomingMessage } from "http";
|
|
4
|
-
import
|
|
5
|
-
//#region src/adapters/wsEncoder.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Encoder for WebSocket wire format.
|
|
8
|
-
* Encodes outgoing messages and decodes incoming messages.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const customEncoder: Encoder = {
|
|
13
|
-
* encode: (data) => myFormat.stringify(data),
|
|
14
|
-
* decode: (data) => myFormat.parse(data),
|
|
15
|
-
* };
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
interface Encoder {
|
|
19
|
-
/** Encode data for transmission over the wire */
|
|
20
|
-
encode(data: unknown): string | Uint8Array<ArrayBuffer>;
|
|
21
|
-
/** Decode data received from the wire */
|
|
22
|
-
decode(data: string | ArrayBuffer | Uint8Array): unknown;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Default JSON encoder - used when no encoder is specified.
|
|
26
|
-
* This maintains backwards compatibility with existing behavior.
|
|
27
|
-
*/
|
|
28
|
-
declare const jsonEncoder: Encoder;
|
|
29
|
-
//#endregion
|
|
4
|
+
import { WebSocket, WebSocketServer } from "ws";
|
|
30
5
|
//#region src/adapters/ws.d.ts
|
|
31
6
|
/**
|
|
32
7
|
* @public
|
|
33
8
|
*/
|
|
34
|
-
type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<IncomingMessage,
|
|
9
|
+
type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>;
|
|
35
10
|
/**
|
|
36
11
|
* @public
|
|
37
12
|
*/
|
|
@@ -41,7 +16,7 @@ type WSConnectionHandlerOptions<TRouter extends AnyRouter> = BaseHandlerOptions<
|
|
|
41
16
|
* Web socket server handler
|
|
42
17
|
*/
|
|
43
18
|
type WSSHandlerOptions<TRouter extends AnyRouter> = WSConnectionHandlerOptions<TRouter> & {
|
|
44
|
-
wss:
|
|
19
|
+
wss: WebSocketServer;
|
|
45
20
|
prefix?: string;
|
|
46
21
|
keepAlive?: {
|
|
47
22
|
/**
|
|
@@ -72,15 +47,15 @@ type WSSHandlerOptions<TRouter extends AnyRouter> = WSConnectionHandlerOptions<T
|
|
|
72
47
|
*/
|
|
73
48
|
experimental_encoder?: Encoder;
|
|
74
49
|
};
|
|
75
|
-
declare function getWSConnectionHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): (client:
|
|
50
|
+
declare function getWSConnectionHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): (client: WebSocket, req: IncomingMessage) => void;
|
|
76
51
|
/**
|
|
77
52
|
* Handle WebSocket keep-alive messages
|
|
78
53
|
*/
|
|
79
|
-
declare function handleKeepAlive(client:
|
|
54
|
+
declare function handleKeepAlive(client: WebSocket, pingMs?: number, pongWaitMs?: number): void;
|
|
80
55
|
declare function applyWSSHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): {
|
|
81
56
|
broadcastReconnectNotification: () => void;
|
|
82
57
|
};
|
|
83
58
|
//#endregion
|
|
84
|
-
export { applyWSSHandler as a,
|
|
59
|
+
export { applyWSSHandler as a, WSSHandlerOptions as i, CreateWSSContextFnOptions as n, getWSConnectionHandler as o, WSConnectionHandlerOptions as r, handleKeepAlive as s, CreateWSSContextFn as t };
|
|
85
60
|
|
|
86
|
-
//# sourceMappingURL=ws-
|
|
61
|
+
//# sourceMappingURL=ws-vKuedL9Z.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-vKuedL9Z.d.cts","names":[],"sources":["../src/adapters/ws.ts"],"mappings":";;;;;;;;KAqDY,4BAA4B,+BACtC,iBACA;;;;KAMU,mBAAmB,gBAAgB,cAC7C,MAAM,8BACH,aAAa,mBAAmB;KAEzB,2BAA2B,gBAAgB,aACrD,mBAAmB,SAAS,mBAC1B,sBACE,mBAAmB,UACnB,mBAAmB;;;;KAMb,kBAAkB,gBAAgB,aAC5C,2BAA2B;EACzB,KAAK;EACL;EACA;;;;;IAKE;;;;;IAKA;;;;;IAKA;;;;;;;EAOF;;;;;EAKA,uBAAuB;;iBAGX,uBAAuB,gBAAgB,WACrD,MAAM,kBAAkB,YAAQ,QAMhB,WAAW,KAAO;;;;iBA4cpB,gBACd,QAAQ,WACR,iBACA;iBAmCc,gBAAgB,gBAAgB,WAC9C,MAAM,kBAAkB;EAatB"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@trpc/server",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "11.22.
|
|
5
|
+
"version": "11.22.2-canary.6.9959a177b",
|
|
6
6
|
"description": "The tRPC server library",
|
|
7
7
|
"author": "KATT",
|
|
8
8
|
"license": "MIT",
|
|
@@ -230,13 +230,35 @@
|
|
|
230
230
|
"https://trpc.io/sponsor"
|
|
231
231
|
],
|
|
232
232
|
"peerDependencies": {
|
|
233
|
+
"@types/aws-lambda": "*",
|
|
234
|
+
"@types/express": "*",
|
|
235
|
+
"@types/ws": "*",
|
|
236
|
+
"fastify": "*",
|
|
237
|
+
"next": "*",
|
|
233
238
|
"typescript": ">=5.7.2"
|
|
234
239
|
},
|
|
240
|
+
"peerDependenciesMeta": {
|
|
241
|
+
"@types/aws-lambda": {
|
|
242
|
+
"optional": true
|
|
243
|
+
},
|
|
244
|
+
"@types/express": {
|
|
245
|
+
"optional": true
|
|
246
|
+
},
|
|
247
|
+
"@types/ws": {
|
|
248
|
+
"optional": true
|
|
249
|
+
},
|
|
250
|
+
"fastify": {
|
|
251
|
+
"optional": true
|
|
252
|
+
},
|
|
253
|
+
"next": {
|
|
254
|
+
"optional": true
|
|
255
|
+
}
|
|
256
|
+
},
|
|
235
257
|
"keywords": [
|
|
236
258
|
"tanstack-intent"
|
|
237
259
|
],
|
|
238
260
|
"bin": {
|
|
239
261
|
"intent": "./bin/intent.js"
|
|
240
262
|
},
|
|
241
|
-
"gitHead": "
|
|
263
|
+
"gitHead": "9959a177b324249335d224bca5ec5ef549636199"
|
|
242
264
|
}
|
package/src/adapters/ws.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'http';
|
|
2
|
-
import type
|
|
2
|
+
import type { WebSocketServer, WebSocket as WsWebSocket } from 'ws';
|
|
3
3
|
import type {
|
|
4
4
|
AnyRouter,
|
|
5
5
|
CreateContextCallback,
|
|
@@ -53,7 +53,7 @@ const WEBSOCKET_OPEN = 1; /* ws.WebSocket.OPEN */
|
|
|
53
53
|
*/
|
|
54
54
|
export type CreateWSSContextFnOptions = NodeHTTPCreateContextFnOptions<
|
|
55
55
|
IncomingMessage,
|
|
56
|
-
|
|
56
|
+
WsWebSocket
|
|
57
57
|
>;
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -75,7 +75,7 @@ export type WSConnectionHandlerOptions<TRouter extends AnyRouter> =
|
|
|
75
75
|
*/
|
|
76
76
|
export type WSSHandlerOptions<TRouter extends AnyRouter> =
|
|
77
77
|
WSConnectionHandlerOptions<TRouter> & {
|
|
78
|
-
wss:
|
|
78
|
+
wss: WebSocketServer;
|
|
79
79
|
prefix?: string;
|
|
80
80
|
keepAlive?: {
|
|
81
81
|
/**
|
|
@@ -114,7 +114,7 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
|
|
|
114
114
|
const { transformer } = router._def._config;
|
|
115
115
|
const encoder = opts.experimental_encoder ?? jsonEncoder;
|
|
116
116
|
|
|
117
|
-
return (client:
|
|
117
|
+
return (client: WsWebSocket, req: IncomingMessage) => {
|
|
118
118
|
type Context = inferRouterContext<TRouter>;
|
|
119
119
|
type ContextResult = Result<Context>;
|
|
120
120
|
|
|
@@ -575,7 +575,7 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
|
|
|
575
575
|
* Handle WebSocket keep-alive messages
|
|
576
576
|
*/
|
|
577
577
|
export function handleKeepAlive(
|
|
578
|
-
client:
|
|
578
|
+
client: WsWebSocket,
|
|
579
579
|
pingMs = 30_000,
|
|
580
580
|
pongWaitMs = 5_000,
|
|
581
581
|
) {
|