@trpc/client 11.18.1-canary.9 → 11.19.0
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/bin/intent.js +0 -0
- package/dist/TRPCClientError-CmHlBkPF.cjs +56 -0
- package/dist/{TRPCClientError-apv8gw59.mjs → TRPCClientError-CxFRO7Js.mjs} +11 -14
- package/dist/TRPCClientError-CxFRO7Js.mjs.map +1 -0
- package/dist/{httpBatchLink-LhidKAPw.mjs → httpBatchLink-BMtWxLJV.mjs} +25 -72
- package/dist/httpBatchLink-BMtWxLJV.mjs.map +1 -0
- package/dist/{httpBatchLink.d-7jyWtY5H.d.cts → httpBatchLink-Br-pzPXf.d.cts} +4 -8
- package/dist/httpBatchLink-Br-pzPXf.d.cts.map +1 -0
- package/dist/{httpBatchLink-BGZRsGNf.cjs → httpBatchLink-DO3WQoxu.cjs} +37 -104
- package/dist/{httpBatchLink.d-p8Y9QM8p.d.mts → httpBatchLink-nvc48L_N.d.mts} +4 -8
- package/dist/httpBatchLink-nvc48L_N.d.mts.map +1 -0
- package/dist/{httpLink.d-CjpPCq4q.d.mts → httpLink-D5FQijY2.d.cts} +4 -7
- package/dist/httpLink-D5FQijY2.d.cts.map +1 -0
- package/dist/{httpLink-B8Iv31Ee.cjs → httpLink-MDJTSlpi.cjs} +39 -38
- package/dist/{httpLink-lG_6juPY.mjs → httpLink-Tm93WWFA.mjs} +17 -14
- package/dist/httpLink-Tm93WWFA.mjs.map +1 -0
- package/dist/{httpLink.d-D5qR9haY.d.cts → httpLink-eSAq8J9S.d.mts} +4 -7
- package/dist/httpLink-eSAq8J9S.d.mts.map +1 -0
- package/dist/{httpUtils.d-BqmeKEGo.d.cts → httpUtils-C37jRVnj.d.mts} +4 -6
- package/dist/httpUtils-C37jRVnj.d.mts.map +1 -0
- package/dist/{httpUtils-pyf5RF99.mjs → httpUtils-CB_100ND.mjs} +51 -14
- package/dist/httpUtils-CB_100ND.mjs.map +1 -0
- package/dist/{httpUtils.d-C5t5to0D.d.mts → httpUtils-CUqAubVD.d.cts} +4 -6
- package/dist/httpUtils-CUqAubVD.d.cts.map +1 -0
- package/dist/{httpUtils-wv2o-njD.cjs → httpUtils-cggqcHz0.cjs} +102 -49
- package/dist/index.cjs +248 -309
- package/dist/index.d.cts +38 -41
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +38 -41
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +212 -272
- package/dist/index.mjs.map +1 -1
- package/dist/links/httpBatchLink.cjs +3 -7
- package/dist/links/httpBatchLink.d.cts +1 -5
- package/dist/links/httpBatchLink.d.mts +1 -5
- package/dist/links/httpBatchLink.mjs +2 -7
- package/dist/links/httpLink.cjs +3 -7
- package/dist/links/httpLink.d.cts +1 -5
- package/dist/links/httpLink.d.mts +1 -5
- package/dist/links/httpLink.mjs +2 -7
- package/dist/links/loggerLink.cjs +113 -4
- package/dist/links/loggerLink.d.cts +1 -3
- package/dist/links/loggerLink.d.mts +1 -3
- package/dist/links/loggerLink.mjs +113 -3
- package/dist/links/loggerLink.mjs.map +1 -0
- package/dist/links/splitLink.cjs +3 -3
- package/dist/links/splitLink.d.cts +1 -3
- package/dist/links/splitLink.d.mts +1 -3
- package/dist/links/splitLink.mjs +2 -3
- package/dist/links/wsLink/wsLink.cjs +3 -6
- package/dist/links/wsLink/wsLink.d.cts +2 -5
- package/dist/links/wsLink/wsLink.d.mts +2 -5
- package/dist/links/wsLink/wsLink.mjs +2 -6
- package/dist/{loggerLink.d-0ABgt7oh.d.mts → loggerLink-2o-uZ3r1.d.cts} +3 -4
- package/dist/loggerLink-2o-uZ3r1.d.cts.map +1 -0
- package/dist/{loggerLink.d-BxSIj5kx.d.cts → loggerLink-CFercTVc.d.mts} +3 -4
- package/dist/loggerLink-CFercTVc.d.mts.map +1 -0
- package/dist/objectSpread2-D-dJi1gK.cjs +73 -0
- package/dist/objectSpread2-weooBxVk.mjs +62 -0
- package/dist/{splitLink-B7Cuf2c_.mjs → splitLink-BZPioDdG.mjs} +6 -11
- package/dist/splitLink-BZPioDdG.mjs.map +1 -0
- package/dist/{splitLink.d-BBFK_mCw.d.cts → splitLink-CJdcmEmS.d.cts} +3 -6
- package/dist/splitLink-CJdcmEmS.d.cts.map +1 -0
- package/dist/{splitLink.d-CkHNg1Se.d.mts → splitLink-CixmF14P.d.mts} +3 -6
- package/dist/splitLink-CixmF14P.d.mts.map +1 -0
- package/dist/{splitLink-BMgxggng.cjs → splitLink-MXnaFlEb.cjs} +17 -24
- package/dist/{subscriptions.d-Ciljg_dH.d.cts → subscriptions-DcqRZc4h.d.cts} +2 -2
- package/dist/subscriptions-DcqRZc4h.d.cts.map +1 -0
- package/dist/{subscriptions.d-Dlr1nWGD.d.mts → subscriptions-DcqRZc4h.d.mts} +2 -2
- package/dist/subscriptions-DcqRZc4h.d.mts.map +1 -0
- package/dist/{types.d-CAr6snH0.d.mts → types-BxbMkv6C.d.cts} +4 -15
- package/dist/types-BxbMkv6C.d.cts.map +1 -0
- package/dist/{types.d-Dmmedc5G.d.cts → types-CAPs7vhA.d.mts} +4 -15
- package/dist/types-CAPs7vhA.d.mts.map +1 -0
- package/dist/{unstable-internals.d-BOmV7EK1.d.mts → unstable-internals-CE8gFBQ9.d.cts} +2 -4
- package/dist/unstable-internals-CE8gFBQ9.d.cts.map +1 -0
- package/dist/{unstable-internals.d-kWsZTlQq.d.cts → unstable-internals-CE8gFBQ9.d.mts} +2 -4
- package/dist/unstable-internals-CE8gFBQ9.d.mts.map +1 -0
- package/dist/unstable-internals.cjs +28 -3
- package/dist/unstable-internals.d.cts +2 -2
- package/dist/unstable-internals.d.mts +2 -2
- package/dist/unstable-internals.mjs +28 -2
- package/dist/unstable-internals.mjs.map +1 -0
- package/dist/{wsLink-DSf4KOdW.mjs → wsLink-Bm5LKL6z.mjs} +73 -94
- package/dist/wsLink-Bm5LKL6z.mjs.map +1 -0
- package/dist/{wsLink-CobRSm6C.cjs → wsLink-CKAsNP9P.cjs} +100 -123
- package/dist/{wsLink.d-pFN64NkG.d.mts → wsLink-DoiyfDgJ.d.cts} +11 -31
- package/dist/wsLink-DoiyfDgJ.d.cts.map +1 -0
- package/dist/{wsLink.d-DzZZZGZQ.d.cts → wsLink-U8pJ7LD2.d.mts} +11 -31
- package/dist/wsLink-U8pJ7LD2.d.mts.map +1 -0
- package/package.json +10 -10
- package/src/getFetch.ts +3 -2
- package/src/links/httpBatchLink.ts +12 -3
- package/src/links/httpBatchStreamLink.ts +7 -8
- package/src/links/httpLink.ts +9 -2
- package/src/links/httpSubscriptionLink.ts +1 -3
- package/src/links/internals/subscriptions.ts +3 -2
- package/src/links/types.ts +1 -2
- package/src/links/wsLink/wsClient/wsClient.ts +8 -1
- package/dist/TRPCClientError-CQrTQLrk.cjs +0 -61
- package/dist/TRPCClientError-apv8gw59.mjs.map +0 -1
- package/dist/chunk-DWy1uDak.cjs +0 -39
- package/dist/httpBatchLink-LhidKAPw.mjs.map +0 -1
- package/dist/httpBatchLink.d-7jyWtY5H.d.cts.map +0 -1
- package/dist/httpBatchLink.d-p8Y9QM8p.d.mts.map +0 -1
- package/dist/httpLink-lG_6juPY.mjs.map +0 -1
- package/dist/httpLink.d-CjpPCq4q.d.mts.map +0 -1
- package/dist/httpLink.d-D5qR9haY.d.cts.map +0 -1
- package/dist/httpUtils-pyf5RF99.mjs.map +0 -1
- package/dist/httpUtils.d-BqmeKEGo.d.cts.map +0 -1
- package/dist/httpUtils.d-C5t5to0D.d.mts.map +0 -1
- package/dist/loggerLink-CuYvRzyH.cjs +0 -123
- package/dist/loggerLink-ineCN1PO.mjs +0 -118
- package/dist/loggerLink-ineCN1PO.mjs.map +0 -1
- package/dist/loggerLink.d-0ABgt7oh.d.mts.map +0 -1
- package/dist/loggerLink.d-BxSIj5kx.d.cts.map +0 -1
- package/dist/objectSpread2-Bsvh_OqM.cjs +0 -100
- package/dist/objectSpread2-BvkFp-_Y.mjs +0 -114
- package/dist/objectSpread2-BvkFp-_Y.mjs.map +0 -1
- package/dist/splitLink-B7Cuf2c_.mjs.map +0 -1
- package/dist/splitLink.d-BBFK_mCw.d.cts.map +0 -1
- package/dist/splitLink.d-CkHNg1Se.d.mts.map +0 -1
- package/dist/subscriptions.d-Ciljg_dH.d.cts.map +0 -1
- package/dist/subscriptions.d-Dlr1nWGD.d.mts.map +0 -1
- package/dist/types.d-CAr6snH0.d.mts.map +0 -1
- package/dist/types.d-Dmmedc5G.d.cts.map +0 -1
- package/dist/unstable-internals-Bg7n9BBj.mjs +0 -29
- package/dist/unstable-internals-Bg7n9BBj.mjs.map +0 -1
- package/dist/unstable-internals-M84gUQCV.cjs +0 -34
- package/dist/unstable-internals.d-BOmV7EK1.d.mts.map +0 -1
- package/dist/unstable-internals.d-kWsZTlQq.d.cts.map +0 -1
- package/dist/wsLink-DSf4KOdW.mjs.map +0 -1
- package/dist/wsLink.d-DzZZZGZQ.d.cts.map +0 -1
- package/dist/wsLink.d-pFN64NkG.d.mts.map +0 -1
|
@@ -1,19 +1,56 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_unstable_internals = require('./unstable-internals-M84gUQCV.cjs');
|
|
4
|
-
|
|
1
|
+
const require_objectSpread2 = require("./objectSpread2-D-dJi1gK.cjs");
|
|
2
|
+
const require_unstable_internals = require("./unstable-internals.cjs");
|
|
5
3
|
//#region src/getFetch.ts
|
|
6
4
|
const isFunction = (fn) => typeof fn === "function";
|
|
7
5
|
function getFetch(customFetchImpl) {
|
|
8
6
|
if (customFetchImpl) return customFetchImpl;
|
|
9
|
-
if (typeof window !== "undefined" && isFunction(window.fetch)) return window.fetch;
|
|
7
|
+
if (typeof window !== "undefined" && isFunction(window.fetch)) return window.fetch.bind(window);
|
|
10
8
|
if (typeof globalThis !== "undefined" && isFunction(globalThis.fetch)) return globalThis.fetch;
|
|
11
9
|
throw new Error("No fetch implementation found");
|
|
12
10
|
}
|
|
13
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/internals/signals.ts
|
|
13
|
+
/**
|
|
14
|
+
* Like `Promise.all()` but for abort signals
|
|
15
|
+
* - When all signals have been aborted, the merged signal will be aborted
|
|
16
|
+
* - If one signal is `null`, no signal will be aborted
|
|
17
|
+
*/
|
|
18
|
+
function allAbortSignals(...signals) {
|
|
19
|
+
const ac = new AbortController();
|
|
20
|
+
const count = signals.length;
|
|
21
|
+
let abortedCount = 0;
|
|
22
|
+
const onAbort = () => {
|
|
23
|
+
if (++abortedCount === count) ac.abort();
|
|
24
|
+
};
|
|
25
|
+
for (const signal of signals) if (signal === null || signal === void 0 ? void 0 : signal.aborted) onAbort();
|
|
26
|
+
else signal === null || signal === void 0 || signal.addEventListener("abort", onAbort, { once: true });
|
|
27
|
+
return ac.signal;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Like `Promise.race` but for abort signals
|
|
31
|
+
*
|
|
32
|
+
* Basically, a ponyfill for
|
|
33
|
+
* [`AbortSignal.any`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static).
|
|
34
|
+
*/
|
|
35
|
+
function raceAbortSignals(...signals) {
|
|
36
|
+
const ac = new AbortController();
|
|
37
|
+
for (const signal of signals) if (signal === null || signal === void 0 ? void 0 : signal.aborted) ac.abort();
|
|
38
|
+
else signal === null || signal === void 0 || signal.addEventListener("abort", () => ac.abort(), { once: true });
|
|
39
|
+
return ac.signal;
|
|
40
|
+
}
|
|
41
|
+
function abortSignalToPromise(signal) {
|
|
42
|
+
return new Promise((_, reject) => {
|
|
43
|
+
if (signal.aborted) {
|
|
44
|
+
reject(signal.reason);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
signal.addEventListener("abort", () => {
|
|
48
|
+
reject(signal.reason);
|
|
49
|
+
}, { once: true });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
14
52
|
//#endregion
|
|
15
53
|
//#region src/links/internals/httpUtils.ts
|
|
16
|
-
var import_objectSpread2 = require_chunk.__toESM(require_objectSpread2$1.require_objectSpread2(), 1);
|
|
17
54
|
function resolveHTTPLinkOptions(opts) {
|
|
18
55
|
return {
|
|
19
56
|
url: opts.url.toString(),
|
|
@@ -40,8 +77,7 @@ function getInput(opts) {
|
|
|
40
77
|
}
|
|
41
78
|
const getUrl = (opts) => {
|
|
42
79
|
const parts = opts.url.split("?");
|
|
43
|
-
|
|
44
|
-
let url = base + "/" + opts.path;
|
|
80
|
+
let url = parts[0].replace(/\/$/, "") + "/" + opts.path;
|
|
45
81
|
const queryParts = [];
|
|
46
82
|
if (parts[1]) queryParts.push(parts[1]);
|
|
47
83
|
if ("inputs" in opts) queryParts.push("batch=1");
|
|
@@ -53,12 +89,12 @@ const getUrl = (opts) => {
|
|
|
53
89
|
return url;
|
|
54
90
|
};
|
|
55
91
|
const getBody = (opts) => {
|
|
56
|
-
if (opts.type === "query" && opts.methodOverride !== "POST") return
|
|
92
|
+
if (opts.type === "query" && opts.methodOverride !== "POST") return;
|
|
57
93
|
const input = getInput(opts);
|
|
58
94
|
return input !== void 0 ? JSON.stringify(input) : void 0;
|
|
59
95
|
};
|
|
60
96
|
const jsonHttpRequester = (opts) => {
|
|
61
|
-
return httpRequest(
|
|
97
|
+
return httpRequest(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, opts), {}, {
|
|
62
98
|
contentTypeHeader: "application/json",
|
|
63
99
|
getUrl,
|
|
64
100
|
getBody
|
|
@@ -98,7 +134,7 @@ async function fetchHTTPResponse(opts) {
|
|
|
98
134
|
if (Symbol.iterator in heads) return Object.fromEntries(heads);
|
|
99
135
|
return heads;
|
|
100
136
|
})();
|
|
101
|
-
const headers =
|
|
137
|
+
const headers = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, opts.contentTypeHeader && method !== "GET" ? { "content-type": opts.contentTypeHeader } : {}), opts.trpcAcceptHeader ? { [(_opts$trpcAcceptHeade = opts.trpcAcceptHeaderKey) !== null && _opts$trpcAcceptHeade !== void 0 ? _opts$trpcAcceptHeade : "trpc-accept"]: opts.trpcAcceptHeader } : void 0), resolvedHeaders);
|
|
102
138
|
return getFetch(opts.fetch)(url, {
|
|
103
139
|
method,
|
|
104
140
|
signal: opts.signal,
|
|
@@ -117,47 +153,64 @@ async function httpRequest(opts) {
|
|
|
117
153
|
meta
|
|
118
154
|
};
|
|
119
155
|
}
|
|
120
|
-
|
|
121
156
|
//#endregion
|
|
122
|
-
Object.defineProperty(exports,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
157
|
+
Object.defineProperty(exports, "abortSignalToPromise", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
get: function() {
|
|
160
|
+
return abortSignalToPromise;
|
|
161
|
+
}
|
|
127
162
|
});
|
|
128
|
-
Object.defineProperty(exports,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
163
|
+
Object.defineProperty(exports, "allAbortSignals", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function() {
|
|
166
|
+
return allAbortSignals;
|
|
167
|
+
}
|
|
133
168
|
});
|
|
134
|
-
Object.defineProperty(exports,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
Object.defineProperty(exports, "fetchHTTPResponse", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
get: function() {
|
|
172
|
+
return fetchHTTPResponse;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(exports, "getBody", {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function() {
|
|
178
|
+
return getBody;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(exports, "getFetch", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function() {
|
|
184
|
+
return getFetch;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, "getUrl", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function() {
|
|
190
|
+
return getUrl;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(exports, "httpRequest", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function() {
|
|
196
|
+
return httpRequest;
|
|
197
|
+
}
|
|
139
198
|
});
|
|
140
|
-
Object.defineProperty(exports,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
199
|
+
Object.defineProperty(exports, "jsonHttpRequester", {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
get: function() {
|
|
202
|
+
return jsonHttpRequester;
|
|
203
|
+
}
|
|
145
204
|
});
|
|
146
|
-
Object.defineProperty(exports,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
205
|
+
Object.defineProperty(exports, "raceAbortSignals", {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function() {
|
|
208
|
+
return raceAbortSignals;
|
|
209
|
+
}
|
|
151
210
|
});
|
|
152
|
-
Object.defineProperty(exports,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
211
|
+
Object.defineProperty(exports, "resolveHTTPLinkOptions", {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function() {
|
|
214
|
+
return resolveHTTPLinkOptions;
|
|
215
|
+
}
|
|
157
216
|
});
|
|
158
|
-
Object.defineProperty(exports, 'resolveHTTPLinkOptions', {
|
|
159
|
-
enumerable: true,
|
|
160
|
-
get: function () {
|
|
161
|
-
return resolveHTTPLinkOptions;
|
|
162
|
-
}
|
|
163
|
-
});
|