@trpc/server 11.0.0-rc.433 → 11.0.0-rc.435
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@trpc/server/http.d.ts +1 -2
- package/dist/@trpc/server/http.d.ts.map +1 -1
- package/dist/@trpc/server/rpc.d.ts +1 -1
- package/dist/@trpc/server/rpc.d.ts.map +1 -1
- package/dist/adapters/next.js +1 -1
- package/dist/adapters/next.mjs +1 -1
- package/dist/adapters/ws.d.ts +2 -2
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +76 -35
- package/dist/adapters/ws.mjs +77 -36
- package/dist/bundle-analysis.json +75 -55
- package/dist/http.js +3 -0
- package/dist/http.mjs +1 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/contentType.js +8 -3
- package/dist/unstable-core-do-not-import/http/contentType.mjs +8 -3
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.d.ts +4 -0
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.d.ts.map +1 -0
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.js +42 -0
- package/dist/unstable-core-do-not-import/http/parseConnectionParams.mjs +39 -0
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/types.d.ts +9 -14
- package/dist/unstable-core-do-not-import/http/types.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +7 -0
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/rpc/index.d.ts +1 -1
- package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import.d.ts +4 -3
- package/dist/unstable-core-do-not-import.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import.js +16 -13
- package/dist/unstable-core-do-not-import.mjs +4 -3
- package/package.json +2 -2
- package/src/@trpc/server/http.ts +7 -2
- package/src/@trpc/server/rpc.ts +1 -0
- package/src/adapters/ws.ts +95 -35
- package/src/unstable-core-do-not-import/http/contentType.ts +12 -7
- package/src/unstable-core-do-not-import/http/parseConnectionParams.ts +49 -0
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +8 -6
- package/src/unstable-core-do-not-import/http/types.ts +9 -17
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +9 -0
- package/src/unstable-core-do-not-import/rpc/index.ts +1 -0
- package/src/unstable-core-do-not-import.ts +4 -3
|
@@ -74,7 +74,11 @@ interface TRPCRequestInfoProcedureCall {
|
|
|
74
74
|
procedure: AnyProcedure | null;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Information about the incoming request
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export interface TRPCRequestInfo {
|
|
78
82
|
/**
|
|
79
83
|
* The `trpc-accept` header
|
|
80
84
|
*/
|
|
@@ -91,23 +95,11 @@ export interface TRPCRequestInfoBase {
|
|
|
91
95
|
* The calls being made
|
|
92
96
|
*/
|
|
93
97
|
calls: TRPCRequestInfoProcedureCall[];
|
|
98
|
+
/**
|
|
99
|
+
* Connection params when using `httpSubscriptionLink` or `createWSClient`
|
|
100
|
+
*/
|
|
101
|
+
connectionParams: Dict<string> | null;
|
|
94
102
|
}
|
|
95
|
-
interface TRPCRequestInfoBatchCall extends TRPCRequestInfoBase {
|
|
96
|
-
isBatchCall: true;
|
|
97
|
-
calls: TRPCRequestInfoProcedureCall[];
|
|
98
|
-
}
|
|
99
|
-
interface TRPCRequestInfoSingleCall extends TRPCRequestInfoBase {
|
|
100
|
-
isBatchCall: false;
|
|
101
|
-
calls: [TRPCRequestInfoProcedureCall];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Information about the incoming request
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
export type TRPCRequestInfo =
|
|
109
|
-
| TRPCRequestInfoBatchCall
|
|
110
|
-
| TRPCRequestInfoSingleCall;
|
|
111
103
|
|
|
112
104
|
/**
|
|
113
105
|
* Inner createContext function for `resolveResponse` used to forward `TRPCRequestInfo` to `createContext`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
import type { TRPCRequestInfo } from '../http/types';
|
|
2
3
|
import type { ProcedureType } from '../procedure';
|
|
3
4
|
import type { TRPC_ERROR_CODE_NUMBER } from './codes';
|
|
4
5
|
|
|
@@ -131,3 +132,11 @@ export type TRPCClientIncomingMessage<
|
|
|
131
132
|
TResult = unknown,
|
|
132
133
|
TError extends TRPCErrorShape = TRPCErrorShape,
|
|
133
134
|
> = TRPCClientIncomingRequest | TRPCResponseMessage<TResult, TError>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The client sends connection params - always sent as the first message
|
|
138
|
+
*/
|
|
139
|
+
export interface TRPCConnectionParamsMessage
|
|
140
|
+
extends JSONRPC2.BaseRequest<'connectionParams'> {
|
|
141
|
+
data: TRPCRequestInfo['connectionParams'];
|
|
142
|
+
}
|
|
@@ -12,10 +12,11 @@ export * from './unstable-core-do-not-import/clientish/inference';
|
|
|
12
12
|
export * from './unstable-core-do-not-import/clientish/inferrable';
|
|
13
13
|
export * from './unstable-core-do-not-import/clientish/serialize';
|
|
14
14
|
export * from './unstable-core-do-not-import/createProxy';
|
|
15
|
-
export * from './unstable-core-do-not-import/error/TRPCError';
|
|
16
15
|
export * from './unstable-core-do-not-import/error/formatter';
|
|
17
16
|
export * from './unstable-core-do-not-import/error/getErrorShape';
|
|
17
|
+
export * from './unstable-core-do-not-import/error/TRPCError';
|
|
18
18
|
export * from './unstable-core-do-not-import/http/batchStreamFormatter';
|
|
19
|
+
export * from './unstable-core-do-not-import/http/parseConnectionParams';
|
|
19
20
|
export * from './unstable-core-do-not-import/http/contentType';
|
|
20
21
|
export * from './unstable-core-do-not-import/http/contentTypeParsers';
|
|
21
22
|
export * from './unstable-core-do-not-import/http/getHTTPStatusCode';
|
|
@@ -30,8 +31,8 @@ export * from './unstable-core-do-not-import/procedureBuilder';
|
|
|
30
31
|
export * from './unstable-core-do-not-import/rootConfig';
|
|
31
32
|
export * from './unstable-core-do-not-import/router';
|
|
32
33
|
export * from './unstable-core-do-not-import/rpc';
|
|
34
|
+
export * from './unstable-core-do-not-import/stream/jsonl';
|
|
35
|
+
export * from './unstable-core-do-not-import/stream/sse';
|
|
33
36
|
export * from './unstable-core-do-not-import/transformer';
|
|
34
37
|
export * from './unstable-core-do-not-import/types';
|
|
35
38
|
export * from './unstable-core-do-not-import/utils';
|
|
36
|
-
export * from './unstable-core-do-not-import/stream/jsonl';
|
|
37
|
-
export * from './unstable-core-do-not-import/stream/sse';
|