@orpc/client 2.0.0-beta.34 → 2.0.0-beta.35
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 +15 -14
- 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 +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.d.mts +1 -1
- package/dist/adapters/websocket/index.d.ts +1 -1
- package/dist/adapters/websocket/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/shared/{client.P-JKJSdc.mjs → client.BOUKaeVg.mjs} +15 -19
- package/dist/shared/{client.CJLNNSvk.d.mts → client.DPi5reJh.d.mts} +1 -1
- package/dist/shared/{client.CJLNNSvk.d.ts → client.DPi5reJh.d.ts} +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,20 +55,20 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
55
55
|
|
|
56
56
|
**Framework & ecosystem integrations**
|
|
57
57
|
|
|
58
|
-
| Package | Purpose
|
|
59
|
-
| ------------------------------------------------------------------------------------ |
|
|
60
|
-
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
61
|
-
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools.
|
|
62
|
-
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
63
|
-
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
64
|
-
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/).
|
|
65
|
-
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/).
|
|
66
|
-
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/).
|
|
67
|
-
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/).
|
|
68
|
-
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads.
|
|
69
|
-
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/).
|
|
70
|
-
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare
|
|
71
|
-
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC.
|
|
58
|
+
| Package | Purpose | Docs |
|
|
59
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
60
|
+
| [@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) |
|
|
61
|
+
| [@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) |
|
|
62
|
+
| [@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) |
|
|
63
|
+
| [@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) |
|
|
64
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
65
|
+
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
|
|
66
|
+
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
67
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
68
|
+
| [@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) |
|
|
69
|
+
| [@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) |
|
|
70
|
+
| [@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), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
|
|
71
|
+
| [@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) |
|
|
72
72
|
|
|
73
73
|
**Observability**
|
|
74
74
|
|
|
@@ -127,6 +127,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
127
127
|
<td align="center"><a href="https://github.com/ellis-driscoll?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&v=4" width="139" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
|
|
128
128
|
<td align="center"><a href="https://github.com/hoangbn?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&v=4" width="139" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
|
|
129
129
|
<td align="center"><a href="https://opencollective.com/guest-ac41de3b?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Orestis Ioannou"><img src="https://images.opencollective.com/guest-ac41de3b/avatar/460.png" width="139" alt="Orestis Ioannou"/><br />Orestis Ioannou</a></td>
|
|
130
|
+
<td align="center"><a href="https://automatio.ai/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Stefan Smiljkovic"><img src="https://avatars.githubusercontent.com/u/1984909?u=b7bf5bc40ed49df3c22f69d2da7b8d78709c49ed&v=4" width="139" alt="Stefan Smiljkovic"/><br />Stefan Smiljkovic</a></td>
|
|
130
131
|
</tr>
|
|
131
132
|
</table>
|
|
132
133
|
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { ToFetchBodyOptions } from '@standard-server/fetch';
|
|
5
5
|
import { StandardLinkTransport, StandardLinkPlugin, StandardLink, StandardLinkOptions } from '../standard/index.mjs';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.mjs';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DPi5reJh.mjs';
|
|
8
8
|
|
|
9
9
|
interface FetchLinkTransportFetchInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
|
|
10
10
|
path: string[];
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { ToFetchBodyOptions } from '@standard-server/fetch';
|
|
5
5
|
import { StandardLinkTransport, StandardLinkPlugin, StandardLink, StandardLinkOptions } from '../standard/index.js';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.js';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DPi5reJh.js';
|
|
8
8
|
|
|
9
9
|
interface FetchLinkTransportFetchInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
|
|
10
10
|
path: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sortPlugins, value, intercept, 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.BOUKaeVg.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '../../shared/client.Cik8dxOF.mjs';
|
|
6
6
|
import '../../shared/client.Dtv1JPkU.mjs';
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standard-server/peer';
|
|
5
5
|
import { StandardLinkTransport, StandardLink, StandardLinkOptions } from '../standard/index.mjs';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.mjs';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DPi5reJh.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The message port used by electron in main process
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standard-server/peer';
|
|
5
5
|
import { StandardLinkTransport, StandardLink, StandardLinkOptions } from '../standard/index.js';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.js';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DPi5reJh.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The message port used by electron in main process
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { value } 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.BOUKaeVg.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '@standard-server/fetch';
|
|
6
6
|
import '../../shared/client.Cik8dxOF.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.BWkR2vPU.mjs';
|
|
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.BWkR2vPU.mjs';
|
|
3
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
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';
|
|
6
6
|
import { RPCSerializer } from '../../index.mjs';
|
|
@@ -42,7 +42,7 @@ interface RPCLinkCodecOptions<T extends ClientContext> {
|
|
|
42
42
|
/**
|
|
43
43
|
* Override the default RPC serializer.
|
|
44
44
|
*/
|
|
45
|
-
serializer?:
|
|
45
|
+
serializer?: Public<RPCSerializer>;
|
|
46
46
|
}
|
|
47
47
|
declare class RPCLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
48
48
|
private readonly baseUrl;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.BnpRXnLi.js';
|
|
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.BnpRXnLi.js';
|
|
3
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
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';
|
|
6
6
|
import { RPCSerializer } from '../../index.js';
|
|
@@ -42,7 +42,7 @@ interface RPCLinkCodecOptions<T extends ClientContext> {
|
|
|
42
42
|
/**
|
|
43
43
|
* Override the default RPC serializer.
|
|
44
44
|
*/
|
|
45
|
-
serializer?:
|
|
45
|
+
serializer?: Public<RPCSerializer>;
|
|
46
46
|
}
|
|
47
47
|
declare class RPCLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
|
|
48
48
|
private readonly baseUrl;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.
|
|
1
|
+
export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.BOUKaeVg.mjs';
|
|
2
2
|
import '@orpc/shared';
|
|
3
3
|
import '@standard-server/core';
|
|
4
4
|
import '@standard-server/fetch';
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standard-server/peer';
|
|
5
5
|
import { StandardLinkTransport, StandardLink, StandardLinkOptions } from '../standard/index.mjs';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.mjs';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DPi5reJh.mjs';
|
|
8
8
|
|
|
9
9
|
type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
|
|
10
10
|
interface WebSocketLinkTransportAttemptInfo {
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standard-server/peer';
|
|
5
5
|
import { StandardLinkTransport, StandardLink, StandardLinkOptions } from '../standard/index.js';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.js';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DPi5reJh.js';
|
|
8
8
|
|
|
9
9
|
type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
|
|
10
10
|
interface WebSocketLinkTransportAttemptInfo {
|
|
@@ -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.BOUKaeVg.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '@standard-server/fetch';
|
|
6
6
|
import '../../shared/client.Cik8dxOF.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as Infe
|
|
|
4
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, p as MalformedResponseError, N as NestedClient, q as ORPCErrorOptions } from './shared/client.BoXZCzuS.mjs';
|
|
5
5
|
import { StandardResponse } from '@standard-server/core';
|
|
6
6
|
export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core';
|
|
7
|
-
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.
|
|
7
|
+
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.DPi5reJh.mjs';
|
|
8
8
|
|
|
9
9
|
declare function wrapAsyncIteratorPreservingEventMeta<TYield, TReturn, TMappedYield = TYield, TMappedReturn = TReturn>(iterator: AsyncIterator<TYield, TReturn>, { mapResult, mapError, ...rest }: WrapAsyncIteratorOptions<TYield, TReturn, TMappedYield, TMappedReturn>): AsyncIteratorClass<TMappedYield, TMappedReturn>;
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as Infe
|
|
|
4
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, p as MalformedResponseError, N as NestedClient, q as ORPCErrorOptions } from './shared/client.BoXZCzuS.js';
|
|
5
5
|
import { StandardResponse } from '@standard-server/core';
|
|
6
6
|
export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core';
|
|
7
|
-
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.
|
|
7
|
+
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.DPi5reJh.js';
|
|
8
8
|
|
|
9
9
|
declare function wrapAsyncIteratorPreservingEventMeta<TYield, TReturn, TMappedYield = TYield, TMappedReturn = TReturn>(iterator: AsyncIterator<TYield, TReturn>, { mapResult, mapError, ...rest }: WrapAsyncIteratorOptions<TYield, TReturn, TMappedYield, TMappedReturn>): AsyncIteratorClass<TMappedYield, TMappedReturn>;
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sortPlugins, runWithSpan, ORPC_NAME, isAsyncIteratorObject, override, traceAsyncIterator,
|
|
1
|
+
import { sortPlugins, runWithSpan, ORPC_NAME, getTracer, isAsyncIteratorObject, override, traceAsyncIterator, traceReadableStream, intercept, value, pathToHttpPath, stringifyJSON } from '@orpc/shared';
|
|
2
2
|
import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
|
|
3
3
|
import { toStandardHeaders } from '@standard-server/fetch';
|
|
4
4
|
import { R as RPCSerializer, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, a as createORPCErrorFromJson } from './client.Cik8dxOF.mjs';
|
|
@@ -36,50 +36,46 @@ class StandardLink {
|
|
|
36
36
|
return runWithSpan(`${ORPC_NAME}.${path.join("/")}`, (span) => {
|
|
37
37
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
38
38
|
span?.setAttribute("rpc.method", path.join("."));
|
|
39
|
-
if (isAsyncIteratorObject(input)) {
|
|
39
|
+
if (getTracer() && isAsyncIteratorObject(input)) {
|
|
40
40
|
input = override(input, traceAsyncIterator("consume_async_iterator_object_input", input));
|
|
41
|
+
} else if (getTracer() && input instanceof ReadableStream) {
|
|
42
|
+
input = override(input, traceReadableStream("consume_octet_stream_input", input));
|
|
41
43
|
}
|
|
42
44
|
return intercept(this.interceptors, { ...options, path, input }, async ({ path: path2, input: input2, ...options2 }) => {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const activeSpan = otel?.trace.getActiveSpan() ?? span;
|
|
46
|
-
if (activeSpan && otel) {
|
|
47
|
-
activeContext = otel.trace.setSpan(otel.context.active(), activeSpan);
|
|
48
|
-
}
|
|
45
|
+
const tracer = getTracer();
|
|
46
|
+
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
49
47
|
let request = await runWithSpan(
|
|
50
|
-
{ name: "encode_input",
|
|
48
|
+
{ name: "encode_input", parent: activeSpan },
|
|
51
49
|
() => this.codec.encodeInput(input2, path2, options2)
|
|
52
50
|
);
|
|
53
|
-
if (
|
|
51
|
+
if (activeSpan && tracer?.inject) {
|
|
54
52
|
const headers = { ...request.headers };
|
|
55
|
-
|
|
53
|
+
tracer.inject(activeSpan, headers);
|
|
56
54
|
request = { ...request, headers };
|
|
57
55
|
}
|
|
58
56
|
const response = await intercept(
|
|
59
57
|
this.transportInterceptors,
|
|
60
58
|
{ ...options2, path: path2, request },
|
|
61
59
|
({ path: path3, request: request2, ...options3 }) => {
|
|
62
|
-
|
|
63
|
-
const activeTransportSpan = otel?.trace.getActiveSpan() ?? activeSpan;
|
|
64
|
-
if (activeTransportSpan && otel) {
|
|
65
|
-
activeTransportContext = otel.trace.setSpan(otel.context.active(), activeTransportSpan);
|
|
66
|
-
}
|
|
60
|
+
const activeTransportSpan = tracer?.getActiveSpan() ?? activeSpan;
|
|
67
61
|
return runWithSpan(
|
|
68
|
-
{ name: "send_request",
|
|
62
|
+
{ name: "send_request", parent: activeTransportSpan },
|
|
69
63
|
() => this.transport.send(request2, path3, options3)
|
|
70
64
|
);
|
|
71
65
|
}
|
|
72
66
|
);
|
|
73
67
|
const decodedResult = await runWithSpan(
|
|
74
|
-
{ name: "decode_response",
|
|
68
|
+
{ name: "decode_response", parent: activeSpan },
|
|
75
69
|
() => this.codec.decodeResponse(response, path2, options2)
|
|
76
70
|
);
|
|
77
71
|
if (decodedResult.kind === "error") {
|
|
78
72
|
throw decodedResult.error;
|
|
79
73
|
}
|
|
80
74
|
const output = decodedResult.output;
|
|
81
|
-
if (isAsyncIteratorObject(output)) {
|
|
75
|
+
if (getTracer() && isAsyncIteratorObject(output)) {
|
|
82
76
|
return override(output, traceAsyncIterator("consume_async_iterator_object_output", output));
|
|
77
|
+
} else if (getTracer() && output instanceof ReadableStream) {
|
|
78
|
+
return override(output, traceReadableStream("consume_octet_stream_output", output));
|
|
83
79
|
}
|
|
84
80
|
return output;
|
|
85
81
|
});
|
|
@@ -77,7 +77,7 @@ interface RPCJsonSerializerOptions {
|
|
|
77
77
|
* Serializes and deserializes native types like Date, BigInt, Set, and Map
|
|
78
78
|
* into a JSON value plus separate metadata describing how to restore them.
|
|
79
79
|
*
|
|
80
|
-
* @see {@link https://orpc.dev/docs/
|
|
80
|
+
* @see {@link https://orpc.dev/docs/rpc/serializer#rpc-json-serializer | RPC Serializer - RPC JSON Serializer}
|
|
81
81
|
*/
|
|
82
82
|
declare class RPCJsonSerializer {
|
|
83
83
|
private readonly handlers;
|
|
@@ -77,7 +77,7 @@ interface RPCJsonSerializerOptions {
|
|
|
77
77
|
* Serializes and deserializes native types like Date, BigInt, Set, and Map
|
|
78
78
|
* into a JSON value plus separate metadata describing how to restore them.
|
|
79
79
|
*
|
|
80
|
-
* @see {@link https://orpc.dev/docs/
|
|
80
|
+
* @see {@link https://orpc.dev/docs/rpc/serializer#rpc-json-serializer | RPC Serializer - RPC JSON Serializer}
|
|
81
81
|
*/
|
|
82
82
|
declare class RPCJsonSerializer {
|
|
83
83
|
private readonly handlers;
|
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.35",
|
|
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.35",
|
|
67
67
|
"@standard-server/core": "~0.9.0",
|
|
68
68
|
"@standard-server/fetch": "~0.9.0",
|
|
69
69
|
"@standard-server/peer": "~0.9.0"
|