@orpc/client 1.8.4 → 1.8.6
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/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/fetch/index.mjs +1 -1
- package/dist/adapters/message-port/index.d.mts +1 -1
- package/dist/adapters/message-port/index.d.ts +1 -1
- package/dist/adapters/message-port/index.mjs +2 -1
- package/dist/adapters/standard/index.d.mts +4 -3
- package/dist/adapters/standard/index.d.ts +4 -3
- package/dist/adapters/standard/index.mjs +2 -1
- package/dist/adapters/websocket/index.d.mts +1 -1
- package/dist/adapters/websocket/index.d.ts +1 -1
- package/dist/adapters/websocket/index.mjs +2 -1
- package/dist/shared/{client.DKmRtVO2.mjs → client.Bp1jlnBk.mjs} +12 -5
- package/dist/shared/{client.C176log5.d.ts → client.CVVVqf1Y.d.ts} +1 -1
- package/dist/shared/{client.Ycwr4Tuo.d.mts → client._Y_enhib.d.mts} +1 -1
- package/package.json +6 -6
@@ -3,7 +3,7 @@ import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
3
3
|
import { ToFetchRequestOptions } from '@orpc/standard-server-fetch';
|
4
4
|
import { b as ClientContext, c as ClientOptions } from '../../shared/client.BOYsZIRq.mjs';
|
5
5
|
import { a as StandardLinkPlugin, f as StandardLinkClient } from '../../shared/client.Bwgm6dgk.mjs';
|
6
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
6
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client._Y_enhib.mjs';
|
7
7
|
|
8
8
|
interface LinkFetchPlugin<T extends ClientContext> extends StandardLinkPlugin<T> {
|
9
9
|
initRuntimeAdapter?(options: LinkFetchClientOptions<T>): void;
|
@@ -3,7 +3,7 @@ import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
3
3
|
import { ToFetchRequestOptions } from '@orpc/standard-server-fetch';
|
4
4
|
import { b as ClientContext, c as ClientOptions } from '../../shared/client.BOYsZIRq.js';
|
5
5
|
import { a as StandardLinkPlugin, f as StandardLinkClient } from '../../shared/client.BG98rYdO.js';
|
6
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
6
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.CVVVqf1Y.js';
|
7
7
|
|
8
8
|
interface LinkFetchPlugin<T extends ClientContext> extends StandardLinkPlugin<T> {
|
9
9
|
initRuntimeAdapter?(options: LinkFetchClientOptions<T>): void;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { toArray, intercept } from '@orpc/shared';
|
2
2
|
import { toFetchRequest, toStandardLazyResponse } from '@orpc/standard-server-fetch';
|
3
|
-
import { C as CompositeStandardLinkPlugin, c as StandardRPCLink } from '../../shared/client.
|
3
|
+
import { C as CompositeStandardLinkPlugin, c as StandardRPCLink } from '../../shared/client.Bp1jlnBk.mjs';
|
4
4
|
import '@orpc/standard-server';
|
5
5
|
import '../../shared/client.txdq_i5V.mjs';
|
6
6
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
2
2
|
import { b as ClientContext, c as ClientOptions } from '../../shared/client.BOYsZIRq.mjs';
|
3
3
|
import { f as StandardLinkClient } from '../../shared/client.Bwgm6dgk.mjs';
|
4
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
4
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client._Y_enhib.mjs';
|
5
5
|
import '@orpc/shared';
|
6
6
|
|
7
7
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
2
2
|
import { b as ClientContext, c as ClientOptions } from '../../shared/client.BOYsZIRq.js';
|
3
3
|
import { f as StandardLinkClient } from '../../shared/client.BG98rYdO.js';
|
4
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
4
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.CVVVqf1Y.js';
|
5
5
|
import '@orpc/shared';
|
6
6
|
|
7
7
|
/**
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { ClientPeer } from '@orpc/standard-server-peer';
|
2
2
|
import '@orpc/shared';
|
3
|
-
import { c as StandardRPCLink } from '../../shared/client.
|
3
|
+
import { c as StandardRPCLink } from '../../shared/client.Bp1jlnBk.mjs';
|
4
4
|
import '@orpc/standard-server';
|
5
|
+
import '@orpc/standard-server-fetch';
|
5
6
|
import '../../shared/client.txdq_i5V.mjs';
|
6
7
|
|
7
8
|
function postMessagePortMessage(port, data) {
|
@@ -1,10 +1,11 @@
|
|
1
1
|
export { C as CompositeStandardLinkPlugin, d as StandardLink, f as StandardLinkClient, S as StandardLinkClientInterceptorOptions, e as StandardLinkCodec, c as StandardLinkInterceptorOptions, b as StandardLinkOptions, a as StandardLinkPlugin } from '../../shared/client.Bwgm6dgk.mjs';
|
2
|
-
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.
|
2
|
+
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client._Y_enhib.mjs';
|
3
|
+
import { StandardHeaders } from '@orpc/standard-server';
|
3
4
|
import { H as HTTPPath } from '../../shared/client.BOYsZIRq.mjs';
|
4
5
|
import '@orpc/shared';
|
5
|
-
import '@orpc/standard-server';
|
6
6
|
|
7
7
|
declare function toHttpPath(path: readonly string[]): HTTPPath;
|
8
|
+
declare function toStandardHeaders(headers: Headers | StandardHeaders): StandardHeaders;
|
8
9
|
declare function getMalformedResponseErrorCode(status: number): string;
|
9
10
|
|
10
|
-
export { getMalformedResponseErrorCode, toHttpPath };
|
11
|
+
export { getMalformedResponseErrorCode, toHttpPath, toStandardHeaders };
|
@@ -1,10 +1,11 @@
|
|
1
1
|
export { C as CompositeStandardLinkPlugin, d as StandardLink, f as StandardLinkClient, S as StandardLinkClientInterceptorOptions, e as StandardLinkCodec, c as StandardLinkInterceptorOptions, b as StandardLinkOptions, a as StandardLinkPlugin } from '../../shared/client.BG98rYdO.js';
|
2
|
-
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.
|
2
|
+
export { S as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, c as StandardRPCCustomJsonSerializer, b as StandardRPCJsonSerialized, a as StandardRPCJsonSerializedMetaItem, e as StandardRPCJsonSerializer, d as StandardRPCJsonSerializerOptions, g as StandardRPCLink, i as StandardRPCLinkCodec, h as StandardRPCLinkCodecOptions, f as StandardRPCLinkOptions, j as StandardRPCSerializer } from '../../shared/client.CVVVqf1Y.js';
|
3
|
+
import { StandardHeaders } from '@orpc/standard-server';
|
3
4
|
import { H as HTTPPath } from '../../shared/client.BOYsZIRq.js';
|
4
5
|
import '@orpc/shared';
|
5
|
-
import '@orpc/standard-server';
|
6
6
|
|
7
7
|
declare function toHttpPath(path: readonly string[]): HTTPPath;
|
8
|
+
declare function toStandardHeaders(headers: Headers | StandardHeaders): StandardHeaders;
|
8
9
|
declare function getMalformedResponseErrorCode(status: number): string;
|
9
10
|
|
10
|
-
export { getMalformedResponseErrorCode, toHttpPath };
|
11
|
+
export { getMalformedResponseErrorCode, toHttpPath, toStandardHeaders };
|
@@ -1,4 +1,5 @@
|
|
1
|
-
export { C as CompositeStandardLinkPlugin, a as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, S as StandardLink, b as StandardRPCJsonSerializer, c as StandardRPCLink, d as StandardRPCLinkCodec, e as StandardRPCSerializer, g as getMalformedResponseErrorCode, t as toHttpPath } from '../../shared/client.
|
1
|
+
export { C as CompositeStandardLinkPlugin, a as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, S as StandardLink, b as StandardRPCJsonSerializer, c as StandardRPCLink, d as StandardRPCLinkCodec, e as StandardRPCSerializer, g as getMalformedResponseErrorCode, t as toHttpPath, f as toStandardHeaders } from '../../shared/client.Bp1jlnBk.mjs';
|
2
2
|
import '@orpc/shared';
|
3
3
|
import '@orpc/standard-server';
|
4
4
|
import '../../shared/client.txdq_i5V.mjs';
|
5
|
+
import '@orpc/standard-server-fetch';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
2
2
|
import { b as ClientContext, c as ClientOptions } from '../../shared/client.BOYsZIRq.mjs';
|
3
3
|
import { f as StandardLinkClient } from '../../shared/client.Bwgm6dgk.mjs';
|
4
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
4
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client._Y_enhib.mjs';
|
5
5
|
import '@orpc/shared';
|
6
6
|
|
7
7
|
interface LinkWebsocketClientOptions {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
2
2
|
import { b as ClientContext, c as ClientOptions } from '../../shared/client.BOYsZIRq.js';
|
3
3
|
import { f as StandardLinkClient } from '../../shared/client.BG98rYdO.js';
|
4
|
-
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.
|
4
|
+
import { f as StandardRPCLinkOptions, g as StandardRPCLink } from '../../shared/client.CVVVqf1Y.js';
|
5
5
|
import '@orpc/shared';
|
6
6
|
|
7
7
|
interface LinkWebsocketClientOptions {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { readAsBuffer } from '@orpc/shared';
|
2
2
|
import { ClientPeer } from '@orpc/standard-server-peer';
|
3
|
-
import { c as StandardRPCLink } from '../../shared/client.
|
3
|
+
import { c as StandardRPCLink } from '../../shared/client.Bp1jlnBk.mjs';
|
4
4
|
import '@orpc/standard-server';
|
5
|
+
import '@orpc/standard-server-fetch';
|
5
6
|
import '../../shared/client.txdq_i5V.mjs';
|
6
7
|
|
7
8
|
const WEBSOCKET_CONNECTING = 0;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { toArray, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, intercept, getGlobalOtelConfig, isObject, value, stringifyJSON } from '@orpc/shared';
|
2
2
|
import { mergeStandardHeaders, ErrorEvent } from '@orpc/standard-server';
|
3
3
|
import { C as COMMON_ORPC_ERROR_DEFS, b as isORPCErrorStatus, c as isORPCErrorJson, d as createORPCErrorFromJson, O as ORPCError, m as mapEventIterator, t as toORPCError } from './client.txdq_i5V.mjs';
|
4
|
+
import { toStandardHeaders as toStandardHeaders$1 } from '@orpc/standard-server-fetch';
|
4
5
|
|
5
6
|
class CompositeStandardLinkPlugin {
|
6
7
|
plugins;
|
@@ -224,6 +225,12 @@ class StandardRPCJsonSerializer {
|
|
224
225
|
function toHttpPath(path) {
|
225
226
|
return `/${path.map(encodeURIComponent).join("/")}`;
|
226
227
|
}
|
228
|
+
function toStandardHeaders(headers) {
|
229
|
+
if (typeof headers.forEach === "function") {
|
230
|
+
return toStandardHeaders$1(headers);
|
231
|
+
}
|
232
|
+
return headers;
|
233
|
+
}
|
227
234
|
function getMalformedResponseErrorCode(status) {
|
228
235
|
return Object.entries(COMMON_ORPC_ERROR_DEFS).find(([, def]) => def.status === status)?.[0] ?? "MALFORMED_ORPC_ERROR_RESPONSE";
|
229
236
|
}
|
@@ -243,14 +250,14 @@ class StandardRPCLinkCodec {
|
|
243
250
|
expectedMethod;
|
244
251
|
headers;
|
245
252
|
async encode(path, input, options) {
|
253
|
+
let headers = toStandardHeaders(await value(this.headers, options, path, input));
|
254
|
+
if (options.lastEventId !== void 0) {
|
255
|
+
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
256
|
+
}
|
246
257
|
const expectedMethod = await value(this.expectedMethod, options, path, input);
|
247
|
-
let headers = await value(this.headers, options, path, input);
|
248
258
|
const baseUrl = await value(this.baseUrl, options, path, input);
|
249
259
|
const url = new URL(baseUrl);
|
250
260
|
url.pathname = `${url.pathname.replace(/\/$/, "")}${toHttpPath(path)}`;
|
251
|
-
if (options.lastEventId !== void 0) {
|
252
|
-
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
253
|
-
}
|
254
261
|
const serialized = this.serializer.serialize(input);
|
255
262
|
if (expectedMethod === "GET" && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
256
263
|
const maxUrlLength = await value(this.maxUrlLength, options, path, input);
|
@@ -387,4 +394,4 @@ class StandardRPCLink extends StandardLink {
|
|
387
394
|
}
|
388
395
|
}
|
389
396
|
|
390
|
-
export { CompositeStandardLinkPlugin as C, StandardLink as S, STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES as a, StandardRPCJsonSerializer as b, StandardRPCLink as c, StandardRPCLinkCodec as d, StandardRPCSerializer as e, getMalformedResponseErrorCode as g, toHttpPath as t };
|
397
|
+
export { CompositeStandardLinkPlugin as C, StandardLink as S, STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES as a, StandardRPCJsonSerializer as b, StandardRPCLink as c, StandardRPCLinkCodec as d, StandardRPCSerializer as e, toStandardHeaders as f, getMalformedResponseErrorCode as g, toHttpPath as t };
|
@@ -67,7 +67,7 @@ interface StandardRPCLinkCodecOptions<T extends ClientContext> {
|
|
67
67
|
/**
|
68
68
|
* Inject headers to the request.
|
69
69
|
*/
|
70
|
-
headers?: Value<Promisable<StandardHeaders>, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
70
|
+
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
71
71
|
}
|
72
72
|
declare class StandardRPCLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
73
73
|
private readonly serializer;
|
@@ -67,7 +67,7 @@ interface StandardRPCLinkCodecOptions<T extends ClientContext> {
|
|
67
67
|
/**
|
68
68
|
* Inject headers to the request.
|
69
69
|
*/
|
70
|
-
headers?: Value<Promisable<StandardHeaders>, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
70
|
+
headers?: Value<Promisable<StandardHeaders | Headers>, [options: ClientOptions<T>, path: readonly string[], input: unknown]>;
|
71
71
|
}
|
72
72
|
declare class StandardRPCLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
73
73
|
private readonly serializer;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/client",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.8.
|
4
|
+
"version": "1.8.6",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -49,13 +49,13 @@
|
|
49
49
|
"dist"
|
50
50
|
],
|
51
51
|
"dependencies": {
|
52
|
-
"@orpc/shared": "1.8.
|
53
|
-
"@orpc/standard-server": "1.8.
|
54
|
-
"@orpc/standard-server-fetch": "1.8.
|
55
|
-
"@orpc/standard-server-peer": "1.8.
|
52
|
+
"@orpc/shared": "1.8.6",
|
53
|
+
"@orpc/standard-server": "1.8.6",
|
54
|
+
"@orpc/standard-server-fetch": "1.8.6",
|
55
|
+
"@orpc/standard-server-peer": "1.8.6"
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
|
-
"zod": "^4.
|
58
|
+
"zod": "^4.1.3"
|
59
59
|
},
|
60
60
|
"scripts": {
|
61
61
|
"build": "unbuild",
|