@orpc/client 2.0.0-beta.45 → 2.0.0-beta.46
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 +47 -16
- package/dist/adapters/fetch/index.mjs +1 -1
- package/dist/adapters/message-port/index.mjs +1 -1
- package/dist/adapters/standard/index.d.mts +2 -2
- package/dist/adapters/standard/index.d.ts +2 -2
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/adapters/websocket/index.mjs +1 -1
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +1 -1
- package/dist/plugins/index.mjs +2 -2
- package/dist/shared/{client.Bpyj1NM2.mjs → client.CKQeJJ2U.mjs} +1 -1
- package/dist/shared/{client.DBDKICdk.d.ts → client.JBJwBhR8.d.ts} +1 -7
- package/dist/shared/{client.CkwtFnrc.d.mts → client.euYjjcFz.d.mts} +1 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,9 +21,40 @@
|
|
|
21
21
|
</a>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
+
**oRPC** is a TypeScript framework for building end-to-end typesafe APIs. Write your API once as plain TypeScript functions, and oRPC gives you a fully typed client, a REST API with an OpenAPI document, and MCP tools for AI agents, with no code generation. It runs on Node.js, Bun, Deno, Cloudflare Workers, and more.
|
|
25
|
+
|
|
26
|
+
Define procedures on the server and serve them with an [RPC handler](https://orpc.dev/docs/rpc/handler):
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { os } from '@orpc/server'
|
|
30
|
+
import * as z from 'zod'
|
|
31
|
+
|
|
32
|
+
export const router = {
|
|
33
|
+
planet: {
|
|
34
|
+
find: os
|
|
35
|
+
.input(z.object({ id: z.number() }))
|
|
36
|
+
.handler(({ input }) => ({ id: input.id, name: 'Earth' })),
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then call them from a client that knows every input and output, without generating anything:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import type { RouterClient } from '@orpc/server'
|
|
45
|
+
import type { router } from './router'
|
|
46
|
+
import { createORPCClient } from '@orpc/client'
|
|
47
|
+
import { RPCLink } from '@orpc/client/fetch'
|
|
48
|
+
|
|
49
|
+
const link = new RPCLink({ origin: 'http://localhost:3000', url: '/rpc' })
|
|
50
|
+
const client: RouterClient<typeof router> = createORPCClient(link)
|
|
51
|
+
|
|
52
|
+
const planet = await client.planet.find({ id: 1 }) // { id: number, name: string }
|
|
53
|
+
```
|
|
54
|
+
|
|
24
55
|
## Documentation
|
|
25
56
|
|
|
26
|
-
|
|
57
|
+
Read the full documentation at [orpc.dev](https://orpc.dev), starting with the [Getting Started guide](https://orpc.dev/docs/getting-started).
|
|
27
58
|
|
|
28
59
|
## Packages
|
|
29
60
|
|
|
@@ -56,21 +87,21 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
56
87
|
|
|
57
88
|
**Framework & ecosystem integrations**
|
|
58
89
|
|
|
59
|
-
| Package
|
|
60
|
-
|
|
|
61
|
-
| [@orpc/next](https://www.npmjs.com/package/@orpc/next)
|
|
62
|
-
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk)
|
|
63
|
-
| [@orpc/mcp](https://www.npmjs.com/package/@orpc/mcp)
|
|
64
|
-
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query)
|
|
65
|
-
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada)
|
|
66
|
-
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr)
|
|
67
|
-
| [@orpc/msw](https://www.npmjs.com/package/@orpc/msw)
|
|
68
|
-
| [@orpc/
|
|
69
|
-
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest)
|
|
70
|
-
| [@orpc/node](https://www.npmjs.com/package/@orpc/node)
|
|
71
|
-
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun)
|
|
72
|
-
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare)
|
|
73
|
-
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc)
|
|
90
|
+
| Package | Purpose | Docs |
|
|
91
|
+
| -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
|
|
93
|
+
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
|
|
94
|
+
| [@orpc/mcp](https://www.npmjs.com/package/@orpc/mcp) | Expose procedures as [MCP](https://modelcontextprotocol.io/) tools. | [MCP](https://orpc.dev/docs/integrations/mcp) |
|
|
95
|
+
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
|
|
96
|
+
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
|
|
97
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
98
|
+
| [@orpc/msw](https://www.npmjs.com/package/@orpc/msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
|
|
99
|
+
| [@orpc/effect](https://www.npmjs.com/package/@orpc/effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
100
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
101
|
+
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
|
|
102
|
+
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock) |
|
|
103
|
+
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
|
|
104
|
+
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
|
|
74
105
|
|
|
75
106
|
**Observability**
|
|
76
107
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { value, once } from '@orpc/shared';
|
|
2
2
|
import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch';
|
|
3
|
-
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.CKQeJJ2U.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '../../shared/client.LF04eOvL.mjs';
|
|
6
6
|
import '../../shared/client._wG5INmC.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { value, AbortError } from '@orpc/shared';
|
|
2
2
|
import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage, isPeerMessage } from '@standard-server/peer';
|
|
3
|
-
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.CKQeJJ2U.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '@standard-server/fetch';
|
|
6
6
|
import '../../shared/client.LF04eOvL.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.
|
|
2
|
-
export {
|
|
1
|
+
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.euYjjcFz.mjs';
|
|
2
|
+
export { 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.euYjjcFz.mjs';
|
|
3
3
|
import { Value, Promisable, Public } from '@orpc/shared';
|
|
4
4
|
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
5
5
|
import { ClientContext, ClientOptions } from '../../index.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.
|
|
2
|
-
export {
|
|
1
|
+
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.JBJwBhR8.js';
|
|
2
|
+
export { 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.JBJwBhR8.js';
|
|
3
3
|
import { Value, Promisable, Public } from '@orpc/shared';
|
|
4
4
|
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
5
5
|
import { ClientContext, ClientOptions } from '../../index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { R as RPCLinkCodec, S as StandardLink } from '../../shared/client.CKQeJJ2U.mjs';
|
|
2
2
|
import '@orpc/shared';
|
|
3
3
|
import '@standard-server/core';
|
|
4
4
|
import '@standard-server/fetch';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { runWithSignal, AbortError, sleep, promiseWithResolvers, sequential, loadBytes, toStringOrBytes } from '@orpc/shared';
|
|
2
2
|
import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage } from '@standard-server/peer';
|
|
3
|
-
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.CKQeJJ2U.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '@standard-server/fetch';
|
|
6
6
|
import '../../shared/client.LF04eOvL.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithError, ThrowableError, Promisable } from '@orpc/shared';
|
|
2
2
|
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, PromiseWithError as ClientPromiseResult, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, consumeAsyncIterator, consumeAsyncIterator as consumeEventIterator, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject, streamToAsyncIteratorObject as streamToEventIterator } from '@orpc/shared';
|
|
3
|
-
import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as InferClientContext, d as InferClientError, e as Client, b as ClientLink, A as AnyORPCError, f as ClientRest,
|
|
4
|
-
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, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions, R as ResponseError, r as ResponseErrorOptions } from './shared/client.BoHJeq15.mjs';
|
|
3
|
+
import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as InferClientContext, d as InferClientError, e as Client, b as ClientLink, A as AnyORPCError, f as ClientRest, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError } from './shared/client.BoHJeq15.mjs';
|
|
4
|
+
export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, F as FriendlyClientOptions, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions, R as ResponseError, r as ResponseErrorOptions } from './shared/client.BoHJeq15.mjs';
|
|
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.DqIWeNhQ.mjs';
|
|
6
6
|
export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core';
|
|
7
7
|
|
|
@@ -46,7 +46,6 @@ interface ORPCClientOptions<T extends AnyNestedClient> {
|
|
|
46
46
|
*/
|
|
47
47
|
declare function createORPCClient<T extends AnyNestedClient>(link: ClientLink<InferClientContext<T>>, { path, ...options }?: NoInfer<ORPCClientOptions<T>>): T;
|
|
48
48
|
|
|
49
|
-
declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
|
|
50
49
|
declare function resolveClientRest<TClientContext extends ClientContext, TInput>(rest: ClientRest<TClientContext, TInput>): [input: TInput, options: ClientOptions<TClientContext>];
|
|
51
50
|
type SafeResult<TOutput, TError> = [error: null, data: TOutput, definedError: null, isSuccess: true] & {
|
|
52
51
|
error: null;
|
|
@@ -107,7 +106,7 @@ declare function createSafeClient<T extends AnyNestedClient>(client: T): SafeCli
|
|
|
107
106
|
* proxy for them can cause unexpected behavior, compatibility issues, or
|
|
108
107
|
* infinite proxy chains.
|
|
109
108
|
*/
|
|
110
|
-
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<
|
|
109
|
+
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<PropertyKey>;
|
|
111
110
|
|
|
112
111
|
/**
|
|
113
112
|
* DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
|
|
@@ -141,5 +140,5 @@ declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(jso
|
|
|
141
140
|
*/
|
|
142
141
|
declare function cloneORPCError<T extends AnyORPCError>(error: T): T;
|
|
143
142
|
|
|
144
|
-
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink,
|
|
143
|
+
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createSafeClient, isDefinedError, isORPCErrorJson, resolveClientRest, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
|
|
145
144
|
export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithError, ThrowableError, Promisable } from '@orpc/shared';
|
|
2
2
|
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, PromiseWithError as ClientPromiseResult, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, consumeAsyncIterator, consumeAsyncIterator as consumeEventIterator, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject, streamToAsyncIteratorObject as streamToEventIterator } from '@orpc/shared';
|
|
3
|
-
import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as InferClientContext, d as InferClientError, e as Client, b as ClientLink, A as AnyORPCError, f as ClientRest,
|
|
4
|
-
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, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions, R as ResponseError, r as ResponseErrorOptions } from './shared/client.BoHJeq15.js';
|
|
3
|
+
import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as InferClientContext, d as InferClientError, e as Client, b as ClientLink, A as AnyORPCError, f as ClientRest, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError } from './shared/client.BoHJeq15.js';
|
|
4
|
+
export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, F as FriendlyClientOptions, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions, R as ResponseError, r as ResponseErrorOptions } from './shared/client.BoHJeq15.js';
|
|
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.DqIWeNhQ.js';
|
|
6
6
|
export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core';
|
|
7
7
|
|
|
@@ -46,7 +46,6 @@ interface ORPCClientOptions<T extends AnyNestedClient> {
|
|
|
46
46
|
*/
|
|
47
47
|
declare function createORPCClient<T extends AnyNestedClient>(link: ClientLink<InferClientContext<T>>, { path, ...options }?: NoInfer<ORPCClientOptions<T>>): T;
|
|
48
48
|
|
|
49
|
-
declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
|
|
50
49
|
declare function resolveClientRest<TClientContext extends ClientContext, TInput>(rest: ClientRest<TClientContext, TInput>): [input: TInput, options: ClientOptions<TClientContext>];
|
|
51
50
|
type SafeResult<TOutput, TError> = [error: null, data: TOutput, definedError: null, isSuccess: true] & {
|
|
52
51
|
error: null;
|
|
@@ -107,7 +106,7 @@ declare function createSafeClient<T extends AnyNestedClient>(client: T): SafeCli
|
|
|
107
106
|
* proxy for them can cause unexpected behavior, compatibility issues, or
|
|
108
107
|
* infinite proxy chains.
|
|
109
108
|
*/
|
|
110
|
-
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<
|
|
109
|
+
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<PropertyKey>;
|
|
111
110
|
|
|
112
111
|
/**
|
|
113
112
|
* DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
|
|
@@ -141,5 +140,5 @@ declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(jso
|
|
|
141
140
|
*/
|
|
142
141
|
declare function cloneORPCError<T extends AnyORPCError>(error: T): T;
|
|
143
142
|
|
|
144
|
-
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink,
|
|
143
|
+
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createSafeClient, isDefinedError, isORPCErrorJson, resolveClientRest, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
|
|
145
144
|
export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
|
package/dist/index.mjs
CHANGED
|
@@ -144,4 +144,4 @@ class DynamicLink {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isDefinedError, resolveClientRest,
|
|
147
|
+
export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isDefinedError, resolveClientRest, safe };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toArray, value, splitInHalf, promiseWithResolvers, safeEncodeURIComponent, stringifyJSON, once, isAsyncIteratorObject, defer, captureAsyncContext, loadBytes, allAbortSignal, runWithSignal, replicateAsyncIterator, replicateReadableStream, wrapAsyncIterator, throwIfAborted, isCompressibleContentType, override, AsyncIteratorClass, sleep, AbortError, anyAbortSignal } from '@orpc/shared';
|
|
2
2
|
import { parseStandardUrl, flattenStandardHeader, generateContentDisposition, getEventMeta } from '@standard-server/core';
|
|
3
|
-
import { ClientPeer, isServerPeerSendMessage, decodePeerMessage } from '@standard-server/peer';
|
|
3
|
+
import { ClientPeer, isPeerMessage, isServerPeerSendMessage, decodePeerMessage } from '@standard-server/peer';
|
|
4
4
|
import { toFetchHeaders, toStandardBody } from '@standard-server/fetch';
|
|
5
5
|
import { O as ORPCError, R as ResponseError, C as COMMON_ERROR_STATUS_MAP } from '../shared/client.LF04eOvL.mjs';
|
|
6
6
|
|
|
@@ -224,7 +224,7 @@ class BatchLinkPlugin {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
const body = await batchResponse.resolveBody();
|
|
227
|
-
if (Array.isArray(body) && body.every((v) => isServerPeerSendMessage(v))) {
|
|
227
|
+
if (Array.isArray(body) && body.every((v) => isPeerMessage(v) && isServerPeerSendMessage(v))) {
|
|
228
228
|
for (const message of body) {
|
|
229
229
|
await peer.message(message);
|
|
230
230
|
}
|
|
@@ -37,12 +37,6 @@ interface StandardLinkPlugin<T extends ClientContext> extends OrderablePlugin {
|
|
|
37
37
|
*/
|
|
38
38
|
init?(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
39
39
|
}
|
|
40
|
-
declare class CompositeStandardLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
41
|
-
name: string;
|
|
42
|
-
protected readonly plugins: StandardLinkPlugin<T>[];
|
|
43
|
-
constructor(plugins?: StandardLinkPlugin<T>[]);
|
|
44
|
-
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
45
|
-
}
|
|
46
40
|
|
|
47
41
|
/**
|
|
48
42
|
* Handles the transport layer for sending requests and receiving responses.
|
|
@@ -92,5 +86,5 @@ declare class StandardLink<T extends ClientContext> implements ClientLink<T> {
|
|
|
92
86
|
call(path: string[], input: unknown, options: ClientOptions<T>): Promise<unknown>;
|
|
93
87
|
}
|
|
94
88
|
|
|
95
|
-
export {
|
|
89
|
+
export { StandardLink as a };
|
|
96
90
|
export type { StandardLinkTransport as S, StandardLinkOptions as b, StandardLinkPlugin as c, StandardLinkTransportInterceptorOptions as d, StandardLinkInterceptorOptions as e, StandardLinkCodec as f, StandardLinkCodecDecodedResponse as g, StandardLinkInterceptor as h, StandardLinkTransportInterceptor as i };
|
|
@@ -37,12 +37,6 @@ interface StandardLinkPlugin<T extends ClientContext> extends OrderablePlugin {
|
|
|
37
37
|
*/
|
|
38
38
|
init?(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
39
39
|
}
|
|
40
|
-
declare class CompositeStandardLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
41
|
-
name: string;
|
|
42
|
-
protected readonly plugins: StandardLinkPlugin<T>[];
|
|
43
|
-
constructor(plugins?: StandardLinkPlugin<T>[]);
|
|
44
|
-
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
45
|
-
}
|
|
46
40
|
|
|
47
41
|
/**
|
|
48
42
|
* Handles the transport layer for sending requests and receiving responses.
|
|
@@ -92,5 +86,5 @@ declare class StandardLink<T extends ClientContext> implements ClientLink<T> {
|
|
|
92
86
|
call(path: string[], input: unknown, options: ClientOptions<T>): Promise<unknown>;
|
|
93
87
|
}
|
|
94
88
|
|
|
95
|
-
export {
|
|
89
|
+
export { StandardLink as a };
|
|
96
90
|
export type { StandardLinkTransport as S, StandardLinkOptions as b, StandardLinkPlugin as c, StandardLinkTransportInterceptorOptions as d, StandardLinkInterceptorOptions as e, StandardLinkCodec as f, StandardLinkCodecDecodedResponse as g, StandardLinkInterceptor as h, StandardLinkTransportInterceptor as i };
|
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.46",
|
|
5
5
|
"description": "Consume oRPC and OpenAPI APIs with end-to-end type safety over HTTP, WebSocket, or message ports",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"dist"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@orpc/shared": "2.0.0-beta.
|
|
66
|
+
"@orpc/shared": "2.0.0-beta.46",
|
|
67
67
|
"@standard-server/core": "~0.11.0",
|
|
68
68
|
"@standard-server/fetch": "~0.11.0",
|
|
69
69
|
"@standard-server/peer": "~0.11.0"
|