@orpc/client 2.0.0-beta.1 → 2.0.0-beta.3
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 +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +1 -0
- package/dist/adapters/standard/index.d.ts +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +5 -5
|
@@ -21,9 +21,9 @@ interface FetchLinkTransportOptions<T extends ClientContext> {
|
|
|
21
21
|
*/
|
|
22
22
|
origin?: Value<Promisable<`https://${string}` | `http://${string}` | ({} & string) | undefined>, [options: ClientOptions<T>, path: string[]]>;
|
|
23
23
|
/**
|
|
24
|
-
* Options for how to convert the Standard Request
|
|
24
|
+
* Options for how to convert the Standard Request to a Fetch Request, like event iterator options, etc.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
toFetchRequest?: undefined | ToFetchBodyOptions;
|
|
27
27
|
/**
|
|
28
28
|
* Override the default fetch implementation.
|
|
29
29
|
*
|
|
@@ -39,7 +39,7 @@ interface FetchLinkTransportOptions<T extends ClientContext> {
|
|
|
39
39
|
declare class FetchLinkTransport<T extends ClientContext> implements StandardLinkTransport<T> {
|
|
40
40
|
private readonly origin;
|
|
41
41
|
private readonly fetch;
|
|
42
|
-
private readonly
|
|
42
|
+
private readonly toFetchRequestOptions;
|
|
43
43
|
private readonly fetchInterceptors;
|
|
44
44
|
constructor(options: FetchLinkTransportOptions<T>);
|
|
45
45
|
send(standardRequest: StandardRequest, path: string[], options: ClientOptions<T>): Promise<StandardLazyResponse>;
|
|
@@ -21,9 +21,9 @@ interface FetchLinkTransportOptions<T extends ClientContext> {
|
|
|
21
21
|
*/
|
|
22
22
|
origin?: Value<Promisable<`https://${string}` | `http://${string}` | ({} & string) | undefined>, [options: ClientOptions<T>, path: string[]]>;
|
|
23
23
|
/**
|
|
24
|
-
* Options for how to convert the Standard Request
|
|
24
|
+
* Options for how to convert the Standard Request to a Fetch Request, like event iterator options, etc.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
toFetchRequest?: undefined | ToFetchBodyOptions;
|
|
27
27
|
/**
|
|
28
28
|
* Override the default fetch implementation.
|
|
29
29
|
*
|
|
@@ -39,7 +39,7 @@ interface FetchLinkTransportOptions<T extends ClientContext> {
|
|
|
39
39
|
declare class FetchLinkTransport<T extends ClientContext> implements StandardLinkTransport<T> {
|
|
40
40
|
private readonly origin;
|
|
41
41
|
private readonly fetch;
|
|
42
|
-
private readonly
|
|
42
|
+
private readonly toFetchRequestOptions;
|
|
43
43
|
private readonly fetchInterceptors;
|
|
44
44
|
constructor(options: FetchLinkTransportOptions<T>);
|
|
45
45
|
send(standardRequest: StandardRequest, path: string[], options: ClientOptions<T>): Promise<StandardLazyResponse>;
|
|
@@ -24,13 +24,13 @@ class CompositeFetchLinkTransportPlugin {
|
|
|
24
24
|
class FetchLinkTransport {
|
|
25
25
|
origin;
|
|
26
26
|
fetch;
|
|
27
|
-
|
|
27
|
+
toFetchRequestOptions;
|
|
28
28
|
fetchInterceptors;
|
|
29
29
|
constructor(options) {
|
|
30
30
|
options = new CompositeFetchLinkTransportPlugin(options.plugins).initFetchLinkTransportOptions(options);
|
|
31
31
|
this.origin = options.origin;
|
|
32
32
|
this.fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
33
|
-
this.
|
|
33
|
+
this.toFetchRequestOptions = options.toFetchRequest;
|
|
34
34
|
this.fetchInterceptors = options.fetchInterceptors;
|
|
35
35
|
}
|
|
36
36
|
async send(standardRequest, path, options) {
|
|
@@ -39,7 +39,7 @@ class FetchLinkTransport {
|
|
|
39
39
|
origin = origin.slice(0, -1);
|
|
40
40
|
}
|
|
41
41
|
const url = `${origin ?? ""}${standardRequest.url}`;
|
|
42
|
-
const [body, standardHeaders] = toFetchBody(standardRequest.body, standardRequest.headers, this.
|
|
42
|
+
const [body, standardHeaders] = toFetchBody(standardRequest.body, standardRequest.headers, this.toFetchRequestOptions);
|
|
43
43
|
const init = {
|
|
44
44
|
body,
|
|
45
45
|
headers: toFetchHeaders(standardHeaders),
|
|
@@ -2,6 +2,7 @@ import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '.
|
|
|
2
2
|
export { C as CompositeStandardLinkPlugin, a as StandardLink, h as StandardLinkInterceptor, e as StandardLinkInterceptorOptions, b as StandardLinkOptions, c as StandardLinkPlugin, S as StandardLinkTransport, i as StandardLinkTransportInterceptor, d as StandardLinkTransportInterceptorOptions } from '../../shared/client.Cby_-GGh.mjs';
|
|
3
3
|
import { Value, Promisable } from '@orpc/shared';
|
|
4
4
|
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
5
|
+
export { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from '@standardserver/core';
|
|
5
6
|
import { C as ClientContext, a as ClientOptions } from '../../shared/client.8ug8I-zu.mjs';
|
|
6
7
|
import { e as RPCSerializer } from '../../shared/client.BdItY5DT.mjs';
|
|
7
8
|
|
|
@@ -2,6 +2,7 @@ import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '.
|
|
|
2
2
|
export { C as CompositeStandardLinkPlugin, a as StandardLink, h as StandardLinkInterceptor, e as StandardLinkInterceptorOptions, b as StandardLinkOptions, c as StandardLinkPlugin, S as StandardLinkTransport, i as StandardLinkTransportInterceptor, d as StandardLinkTransportInterceptorOptions } from '../../shared/client.CPF3hX6O.js';
|
|
3
3
|
import { Value, Promisable } from '@orpc/shared';
|
|
4
4
|
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
5
|
+
export { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from '@standardserver/core';
|
|
5
6
|
import { C as ClientContext, a as ClientOptions } from '../../shared/client.8ug8I-zu.js';
|
|
6
7
|
import { e as RPCSerializer } from '../../shared/client.BdItY5DT.js';
|
|
7
8
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { O as ORPCErrorCode, c as ORPCError, d as ORPCErrorJSON, A as AnyORPCError, C as ClientContext, a as ClientOptions, e as AnyNestedClient, I as InferClientContext, f as InferClientError, g as Client, b as ClientLink, h as ClientRest, F as FriendlyClientOptions } from './shared/client.8ug8I-zu.mjs';
|
|
2
2
|
export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, N as NestedClient, p as ORPCErrorOptions } from './shared/client.8ug8I-zu.mjs';
|
|
3
3
|
import { Interceptor, PromiseWithError, ThrowableError, Promisable, WrapAsyncIteratorOptions, AsyncIteratorClass } from '@orpc/shared';
|
|
4
|
-
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
4
|
+
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
5
5
|
export { R as RPCJsonSerialization, a as RPCJsonSerializationMeta, b as RPCJsonSerializer, c as RPCJsonSerializerHandler, d as RPCJsonSerializerOptions, e as RPCSerializer, f as RPCSerializerOptions, g as RPCSerializerSerializeOptions } from './shared/client.BdItY5DT.mjs';
|
|
6
|
-
export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
6
|
+
export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
7
7
|
|
|
8
8
|
declare function isInferableError<T>(error: T): error is Extract<T, AnyORPCError>;
|
|
9
9
|
declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { O as ORPCErrorCode, c as ORPCError, d as ORPCErrorJSON, A as AnyORPCError, C as ClientContext, a as ClientOptions, e as AnyNestedClient, I as InferClientContext, f as InferClientError, g as Client, b as ClientLink, h as ClientRest, F as FriendlyClientOptions } from './shared/client.8ug8I-zu.js';
|
|
2
2
|
export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, N as NestedClient, p as ORPCErrorOptions } from './shared/client.8ug8I-zu.js';
|
|
3
3
|
import { Interceptor, PromiseWithError, ThrowableError, Promisable, WrapAsyncIteratorOptions, AsyncIteratorClass } from '@orpc/shared';
|
|
4
|
-
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
4
|
+
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
|
|
5
5
|
export { R as RPCJsonSerialization, a as RPCJsonSerializationMeta, b as RPCJsonSerializer, c as RPCJsonSerializerHandler, d as RPCJsonSerializerOptions, e as RPCSerializer, f as RPCSerializerOptions, g as RPCSerializerSerializeOptions } from './shared/client.BdItY5DT.js';
|
|
6
|
-
export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
6
|
+
export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
7
7
|
|
|
8
8
|
declare function isInferableError<T>(error: T): error is Extract<T, AnyORPCError>;
|
|
9
9
|
declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"dist"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@standardserver/core": "^0.0.
|
|
54
|
-
"@standardserver/fetch": "^0.0.
|
|
55
|
-
"@standardserver/peer": "^0.0.
|
|
56
|
-
"@orpc/shared": "2.0.0-beta.
|
|
53
|
+
"@standardserver/core": "^0.0.25",
|
|
54
|
+
"@standardserver/fetch": "^0.0.25",
|
|
55
|
+
"@standardserver/peer": "^0.0.25",
|
|
56
|
+
"@orpc/shared": "2.0.0-beta.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"zod": "^4.4.3"
|