@orpc/client 2.0.0-beta.2 → 2.0.0-beta.4
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/README.md +8 -7
- 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 +2 -2
package/README.md
CHANGED
|
@@ -37,18 +37,19 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
37
37
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): Integrate with [Valibot](https://valibot.dev/).
|
|
38
38
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): Integrate with [ArkType](https://arktype.io/).
|
|
39
39
|
|
|
40
|
-
**Framework & ecosystem integrations**
|
|
41
|
-
|
|
42
|
-
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
43
|
-
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
44
|
-
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
45
|
-
|
|
46
40
|
**Built-in features**
|
|
47
41
|
|
|
48
42
|
- [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher): Pub/Sub.
|
|
49
43
|
- [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting.
|
|
50
44
|
- [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
|
|
51
45
|
|
|
46
|
+
**Framework & ecosystem integrations**
|
|
47
|
+
|
|
48
|
+
- [@orpc/next](https://www.npmjs.com/package/@orpc/react): Use oRPC with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
49
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
50
|
+
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
51
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
52
|
+
|
|
52
53
|
**Observability**
|
|
53
54
|
|
|
54
55
|
- [@orpc/opentelemetry](https://www.npmjs.com/package/@orpc/opentelemetry): Instrument your API with [OpenTelemetry](https://opentelemetry.io/).
|
|
@@ -150,7 +151,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
150
151
|
<a href="https://github.com/theoludwig?ref=orpc" target="_blank" rel="noopener" title="Théo LUDWIG"><img src="https://avatars.githubusercontent.com/u/25207499?u=a6a9653725a2f574c07893748806668e0598cdbe&v=4" width="32" height="32" alt="Théo LUDWIG" /></a>
|
|
151
152
|
<a href="https://github.com/abhay-ramesh?ref=orpc" target="_blank" rel="noopener" title="Abhay Ramesh"><img src="https://avatars.githubusercontent.com/u/66196314?u=c5c2b0327b26606c2efcfaf17046ab18c3d25c57&v=4" width="32" height="32" alt="Abhay Ramesh" /></a>
|
|
152
153
|
<a href="https://github.com/shr-ink?ref=orpc" target="_blank" rel="noopener" title="shr.ink oü"><img src="https://avatars.githubusercontent.com/u/139700438?v=4" width="32" height="32" alt="shr.ink oü" /></a>
|
|
153
|
-
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=
|
|
154
|
+
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=505e54608466ab53754f702973687b04c6424c1f&v=4" width="32" height="32" alt="0x4e32" /></a>
|
|
154
155
|
<a href="https://github.com/yzuyr?ref=orpc" target="_blank" rel="noopener" title="Ryuz"><img src="https://avatars.githubusercontent.com/u/196539378?u=d38374588d219b6748b16406982f6559411466d4&v=4" width="32" height="32" alt="Ryuz" /></a>
|
|
155
156
|
<a href="https://github.com/happyboy2022?ref=orpc" target="_blank" rel="noopener" title="happyboy"><img src="https://avatars.githubusercontent.com/u/103669586?u=65b49c4b893ed3703909fbb3a7a22313f3f9c121&v=4" width="32" height="32" alt="happyboy" /></a>
|
|
156
157
|
<a href="https://github.com/YiCChi?ref=orpc" target="_blank" rel="noopener" title="yicchi"><img src="https://avatars.githubusercontent.com/u/86967274?u=6c2756f09fe15dd94d572f560e979cd157982852&v=4" width="32" height="32" alt="yicchi" /></a>
|
|
@@ -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.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@standardserver/core": "^0.0.25",
|
|
54
54
|
"@standardserver/fetch": "^0.0.25",
|
|
55
55
|
"@standardserver/peer": "^0.0.25",
|
|
56
|
-
"@orpc/shared": "2.0.0-beta.
|
|
56
|
+
"@orpc/shared": "2.0.0-beta.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"zod": "^4.4.3"
|