@orpc/client 2.0.0-beta.33 → 2.0.0-beta.34

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.
Files changed (28) hide show
  1. package/dist/adapters/fetch/index.d.mts +3 -3
  2. package/dist/adapters/fetch/index.d.ts +3 -3
  3. package/dist/adapters/fetch/index.mjs +5 -5
  4. package/dist/adapters/message-port/index.d.mts +3 -3
  5. package/dist/adapters/message-port/index.d.ts +3 -3
  6. package/dist/adapters/message-port/index.mjs +6 -6
  7. package/dist/adapters/standard/index.d.mts +3 -3
  8. package/dist/adapters/standard/index.d.ts +3 -3
  9. package/dist/adapters/standard/index.mjs +5 -5
  10. package/dist/adapters/websocket/index.d.mts +3 -3
  11. package/dist/adapters/websocket/index.d.ts +3 -3
  12. package/dist/adapters/websocket/index.mjs +6 -6
  13. package/dist/index.d.mts +23 -23
  14. package/dist/index.d.ts +23 -23
  15. package/dist/index.mjs +9 -9
  16. package/dist/plugins/index.d.mts +1 -1
  17. package/dist/plugins/index.d.ts +1 -1
  18. package/dist/plugins/index.mjs +4 -4
  19. package/dist/shared/{client.BhTyskpV.d.ts → client.BWkR2vPU.d.mts} +2 -2
  20. package/dist/shared/{client.B0-4UDVl.d.mts → client.BnpRXnLi.d.ts} +2 -2
  21. package/dist/shared/{client.CFVTHyN6.d.ts → client.BoXZCzuS.d.mts} +3 -11
  22. package/dist/shared/{client.CFVTHyN6.d.mts → client.BoXZCzuS.d.ts} +3 -11
  23. package/dist/shared/{client.Qwo2aQOm.d.ts → client.CJLNNSvk.d.mts} +1 -1
  24. package/dist/shared/{client.Qwo2aQOm.d.mts → client.CJLNNSvk.d.ts} +1 -1
  25. package/dist/shared/{client.BnATe4Ob.mjs → client.Cik8dxOF.mjs} +7 -8
  26. package/dist/shared/{client.DcoDDrD4.mjs → client.Dtv1JPkU.mjs} +2 -7
  27. package/dist/shared/{client.vEM0O_Eg.mjs → client.P-JKJSdc.mjs} +3 -3
  28. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  import { ClientContext, ClientOptions } from '../../index.mjs';
2
2
  import { Value, Promisable, Interceptor } from '@orpc/shared';
3
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
- import { ToFetchBodyOptions } from '@standardserver/fetch';
3
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
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.Qwo2aQOm.mjs';
7
+ import '../../shared/client.CJLNNSvk.mjs';
8
8
 
9
9
  interface FetchLinkTransportFetchInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
10
10
  path: string[];
@@ -1,10 +1,10 @@
1
1
  import { ClientContext, ClientOptions } from '../../index.js';
2
2
  import { Value, Promisable, Interceptor } from '@orpc/shared';
3
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
- import { ToFetchBodyOptions } from '@standardserver/fetch';
3
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
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.Qwo2aQOm.js';
7
+ import '../../shared/client.CJLNNSvk.js';
8
8
 
9
9
  interface FetchLinkTransportFetchInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
10
10
  path: string[];
@@ -1,9 +1,9 @@
1
1
  import { sortPlugins, value, intercept, once } from '@orpc/shared';
2
- import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.vEM0O_Eg.mjs';
4
- import '@standardserver/core';
5
- import '../../shared/client.BnATe4Ob.mjs';
6
- import '../../shared/client.DcoDDrD4.mjs';
2
+ import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.P-JKJSdc.mjs';
4
+ import '@standard-server/core';
5
+ import '../../shared/client.Cik8dxOF.mjs';
6
+ import '../../shared/client.Dtv1JPkU.mjs';
7
7
 
8
8
  class CompositeFetchLinkTransportPlugin {
9
9
  constructor(plugins = []) {
@@ -1,10 +1,10 @@
1
1
  import { ClientContext, ClientOptions } from '../../index.mjs';
2
2
  import { Value, Promisable } from '@orpc/shared';
3
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
- import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
3
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
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.Qwo2aQOm.mjs';
7
+ import '../../shared/client.CJLNNSvk.mjs';
8
8
 
9
9
  /**
10
10
  * The message port used by electron in main process
@@ -1,10 +1,10 @@
1
1
  import { ClientContext, ClientOptions } from '../../index.js';
2
2
  import { Value, Promisable } from '@orpc/shared';
3
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
- import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
3
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
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.Qwo2aQOm.js';
7
+ import '../../shared/client.CJLNNSvk.js';
8
8
 
9
9
  /**
10
10
  * The message port used by electron in main process
@@ -1,10 +1,10 @@
1
1
  import { value } from '@orpc/shared';
2
- import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage, isPeerMessage } from '@standardserver/peer';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.vEM0O_Eg.mjs';
4
- import '@standardserver/core';
5
- import '@standardserver/fetch';
6
- import '../../shared/client.BnATe4Ob.mjs';
7
- import '../../shared/client.DcoDDrD4.mjs';
2
+ import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage, isPeerMessage } from '@standard-server/peer';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.P-JKJSdc.mjs';
4
+ import '@standard-server/core';
5
+ import '@standard-server/fetch';
6
+ import '../../shared/client.Cik8dxOF.mjs';
7
+ import '../../shared/client.Dtv1JPkU.mjs';
8
8
 
9
9
  function postMessagePortMessage(port, data, transfer) {
10
10
  if (transfer) {
@@ -1,7 +1,7 @@
1
- import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.B0-4UDVl.mjs';
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.B0-4UDVl.mjs';
1
+ import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.BWkR2vPU.mjs';
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
3
  import { Value, Promisable } from '@orpc/shared';
4
- import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
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';
7
7
 
@@ -1,7 +1,7 @@
1
- import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.BhTyskpV.js';
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.BhTyskpV.js';
1
+ import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.BnpRXnLi.js';
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
3
  import { Value, Promisable } from '@orpc/shared';
4
- import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
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';
7
7
 
@@ -1,6 +1,6 @@
1
- export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.vEM0O_Eg.mjs';
1
+ export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.P-JKJSdc.mjs';
2
2
  import '@orpc/shared';
3
- import '@standardserver/core';
4
- import '@standardserver/fetch';
5
- import '../../shared/client.BnATe4Ob.mjs';
6
- import '../../shared/client.DcoDDrD4.mjs';
3
+ import '@standard-server/core';
4
+ import '@standard-server/fetch';
5
+ import '../../shared/client.Cik8dxOF.mjs';
6
+ import '../../shared/client.Dtv1JPkU.mjs';
@@ -1,10 +1,10 @@
1
1
  import { ClientContext, ClientOptions } from '../../index.mjs';
2
2
  import { Promisable } from '@orpc/shared';
3
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
- import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
3
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
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.Qwo2aQOm.mjs';
7
+ import '../../shared/client.CJLNNSvk.mjs';
8
8
 
9
9
  type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
10
10
  interface WebSocketLinkTransportAttemptInfo {
@@ -1,10 +1,10 @@
1
1
  import { ClientContext, ClientOptions } from '../../index.js';
2
2
  import { Promisable } from '@orpc/shared';
3
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
- import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
3
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
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.Qwo2aQOm.js';
7
+ import '../../shared/client.CJLNNSvk.js';
8
8
 
9
9
  type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
10
10
  interface WebSocketLinkTransportAttemptInfo {
@@ -1,10 +1,10 @@
1
1
  import { runWithSignal, AbortError, sleep, promiseWithResolvers, sequential, loadBytes, toStringOrBytes } from '@orpc/shared';
2
- import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage } from '@standardserver/peer';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.vEM0O_Eg.mjs';
4
- import '@standardserver/core';
5
- import '@standardserver/fetch';
6
- import '../../shared/client.BnATe4Ob.mjs';
7
- import '../../shared/client.DcoDDrD4.mjs';
2
+ import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage } from '@standard-server/peer';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.P-JKJSdc.mjs';
4
+ import '@standard-server/core';
5
+ import '@standard-server/fetch';
6
+ import '../../shared/client.Cik8dxOF.mjs';
7
+ import '../../shared/client.Dtv1JPkU.mjs';
8
8
 
9
9
  const WEBSOCKET_CONNECTING = 0;
10
10
  const WEBSOCKET_OPEN = 1;
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
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, F as FriendlyClientOptions, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError, M as MalformedResponseErrorOptions } from './shared/client.CFVTHyN6.mjs';
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.CFVTHyN6.mjs';
5
- import { StandardResponse } from '@standardserver/core';
6
- export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/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.Qwo2aQOm.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, F as FriendlyClientOptions, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError, M as MalformedResponseErrorOptions } from './shared/client.BoXZCzuS.mjs';
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
+ import { StandardResponse } from '@standard-server/core';
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.CJLNNSvk.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
 
@@ -49,36 +49,36 @@ declare function createORPCClient<T extends AnyNestedClient>(link: ClientLink<In
49
49
 
50
50
  declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
51
51
  declare function resolveClientRest<TClientContext extends ClientContext, TInput>(rest: ClientRest<TClientContext, TInput>): [input: TInput, options: ClientOptions<TClientContext>];
52
- type SafeResult<TOutput, TError> = [error: null, data: TOutput, inferableError: null, isSuccess: true] & {
52
+ type SafeResult<TOutput, TError> = [error: null, data: TOutput, definedError: null, isSuccess: true] & {
53
53
  error: null;
54
54
  data: TOutput;
55
- inferableError: null;
55
+ definedError: null;
56
56
  isSuccess: true;
57
- } | [error: Exclude<TError, AnyORPCError>, data: undefined, inferableError: null, isSuccess: false] & {
57
+ } | [error: Exclude<TError, AnyORPCError>, data: undefined, definedError: null, isSuccess: false] & {
58
58
  error: Exclude<TError, AnyORPCError>;
59
59
  data: undefined;
60
- inferableError: null;
60
+ definedError: null;
61
61
  isSuccess: false;
62
- } | [error: Extract<TError, AnyORPCError>, data: undefined, inferableError: Extract<TError, AnyORPCError>, isSuccess: false] & {
62
+ } | [error: Extract<TError, AnyORPCError>, data: undefined, definedError: Extract<TError, AnyORPCError>, isSuccess: false] & {
63
63
  error: Extract<TError, AnyORPCError>;
64
64
  data: undefined;
65
- inferableError: Extract<TError, AnyORPCError>;
65
+ definedError: Extract<TError, AnyORPCError>;
66
66
  isSuccess: false;
67
67
  };
68
68
  /**
69
- * Works like try/catch, but help you infer the error type if it is inferable ORPCError.
69
+ * Works like try/catch, but help you infer the error type if it is a defined ORPCError.
70
70
  *
71
71
  * @example
72
72
  * ```ts
73
- * const [error, data, inferableError, isSuccess] = await safe(client(...))
74
- * // or const { error, data, inferableError, isSuccess } = await safe(client(...))
73
+ * const [error, data, definedError, isSuccess] = await safe(client(...))
74
+ * // or const { error, data, definedError, isSuccess } = await safe(client(...))
75
75
  *
76
- * if (inferableError) {
77
- * console.log(inferableError) // or error, both are well typed
76
+ * if (definedError) {
77
+ * console.log(definedError) // or error, both are well typed
78
78
  * }
79
79
  * ```
80
80
  *
81
- * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isinferableerror | Client Error Handling - Using safe and isInferableError}
81
+ * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isdefinederror | Client Error Handling - Using safe and isDefinedError}
82
82
  */
83
83
  declare function safe<TOutput, TError = ThrowableError>(promise: PromiseWithError<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
84
84
 
@@ -91,8 +91,8 @@ type SafeClient<T extends AnyNestedClient> = T extends Client<infer UContext, in
91
91
  * @example
92
92
  * ```ts
93
93
  * const safeClient = createSafeClient(client)
94
- * const { error, data, inferrableError, isSuccess } = await safeClient.doSomething({ id: '123' })
95
- * // or const [error, data, inferrableError, isSuccess] = await safeClient.doSomething({ id: '123' })
94
+ * const { error, data, definedError, isSuccess } = await safeClient.doSomething({ id: '123' })
95
+ * // or const [error, data, definedError, isSuccess] = await safeClient.doSomething({ id: '123' })
96
96
  * ```
97
97
  *
98
98
  * @see {@link https://orpc.dev/docs/client/error-handling#safe-client | Client Error Handling - Safe Client}
@@ -123,12 +123,12 @@ declare class DynamicLink<TClientContext extends ClientContext> implements Clien
123
123
  }
124
124
 
125
125
  /**
126
- * Checks if an error is an `ORPCError` whose type is inferable at the TypeScript level,
126
+ * Checks if an error is an `ORPCError` that matches a definition in the procedure's `.errors` map,
127
127
  * narrowing it so `code` and `data` are fully typed.
128
128
  *
129
- * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isinferableerror | Client Error Handling - Using safe and isInferableError}
129
+ * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isdefinederror | Client Error Handling - Using safe and isDefinedError}
130
130
  */
131
- declare function isInferableError<T>(error: T): error is Extract<T, AnyORPCError>;
131
+ declare function isDefinedError<T>(error: T): error is Extract<T, AnyORPCError>;
132
132
  declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
133
133
  declare function isORPCErrorJson(json: unknown): json is ORPCErrorJSON<ORPCErrorCode, unknown>;
134
134
  declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>, options?: ErrorOptions): ORPCError<TCode, TData>;
@@ -152,5 +152,5 @@ declare function createORPCErrorFromMalformedResponse(options: MalformedResponse
152
152
  */
153
153
  declare function cloneORPCError<T extends AnyORPCError>(error: T): T;
154
154
 
155
- export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, MalformedResponseErrorOptions, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createORPCErrorFromMalformedResponse, createSafeClient, isInferableError as isDefinedError, isInferableError, isORPCErrorJson, resolveClientRest, resolveFriendlyClientOptions, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
155
+ export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, MalformedResponseErrorOptions, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createORPCErrorFromMalformedResponse, createSafeClient, isDefinedError, isORPCErrorJson, resolveClientRest, resolveFriendlyClientOptions, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
156
156
  export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
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, F as FriendlyClientOptions, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError, M as MalformedResponseErrorOptions } from './shared/client.CFVTHyN6.js';
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.CFVTHyN6.js';
5
- import { StandardResponse } from '@standardserver/core';
6
- export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/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.Qwo2aQOm.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, F as FriendlyClientOptions, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError, M as MalformedResponseErrorOptions } from './shared/client.BoXZCzuS.js';
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
+ import { StandardResponse } from '@standard-server/core';
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.CJLNNSvk.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
 
@@ -49,36 +49,36 @@ declare function createORPCClient<T extends AnyNestedClient>(link: ClientLink<In
49
49
 
50
50
  declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
51
51
  declare function resolveClientRest<TClientContext extends ClientContext, TInput>(rest: ClientRest<TClientContext, TInput>): [input: TInput, options: ClientOptions<TClientContext>];
52
- type SafeResult<TOutput, TError> = [error: null, data: TOutput, inferableError: null, isSuccess: true] & {
52
+ type SafeResult<TOutput, TError> = [error: null, data: TOutput, definedError: null, isSuccess: true] & {
53
53
  error: null;
54
54
  data: TOutput;
55
- inferableError: null;
55
+ definedError: null;
56
56
  isSuccess: true;
57
- } | [error: Exclude<TError, AnyORPCError>, data: undefined, inferableError: null, isSuccess: false] & {
57
+ } | [error: Exclude<TError, AnyORPCError>, data: undefined, definedError: null, isSuccess: false] & {
58
58
  error: Exclude<TError, AnyORPCError>;
59
59
  data: undefined;
60
- inferableError: null;
60
+ definedError: null;
61
61
  isSuccess: false;
62
- } | [error: Extract<TError, AnyORPCError>, data: undefined, inferableError: Extract<TError, AnyORPCError>, isSuccess: false] & {
62
+ } | [error: Extract<TError, AnyORPCError>, data: undefined, definedError: Extract<TError, AnyORPCError>, isSuccess: false] & {
63
63
  error: Extract<TError, AnyORPCError>;
64
64
  data: undefined;
65
- inferableError: Extract<TError, AnyORPCError>;
65
+ definedError: Extract<TError, AnyORPCError>;
66
66
  isSuccess: false;
67
67
  };
68
68
  /**
69
- * Works like try/catch, but help you infer the error type if it is inferable ORPCError.
69
+ * Works like try/catch, but help you infer the error type if it is a defined ORPCError.
70
70
  *
71
71
  * @example
72
72
  * ```ts
73
- * const [error, data, inferableError, isSuccess] = await safe(client(...))
74
- * // or const { error, data, inferableError, isSuccess } = await safe(client(...))
73
+ * const [error, data, definedError, isSuccess] = await safe(client(...))
74
+ * // or const { error, data, definedError, isSuccess } = await safe(client(...))
75
75
  *
76
- * if (inferableError) {
77
- * console.log(inferableError) // or error, both are well typed
76
+ * if (definedError) {
77
+ * console.log(definedError) // or error, both are well typed
78
78
  * }
79
79
  * ```
80
80
  *
81
- * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isinferableerror | Client Error Handling - Using safe and isInferableError}
81
+ * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isdefinederror | Client Error Handling - Using safe and isDefinedError}
82
82
  */
83
83
  declare function safe<TOutput, TError = ThrowableError>(promise: PromiseWithError<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
84
84
 
@@ -91,8 +91,8 @@ type SafeClient<T extends AnyNestedClient> = T extends Client<infer UContext, in
91
91
  * @example
92
92
  * ```ts
93
93
  * const safeClient = createSafeClient(client)
94
- * const { error, data, inferrableError, isSuccess } = await safeClient.doSomething({ id: '123' })
95
- * // or const [error, data, inferrableError, isSuccess] = await safeClient.doSomething({ id: '123' })
94
+ * const { error, data, definedError, isSuccess } = await safeClient.doSomething({ id: '123' })
95
+ * // or const [error, data, definedError, isSuccess] = await safeClient.doSomething({ id: '123' })
96
96
  * ```
97
97
  *
98
98
  * @see {@link https://orpc.dev/docs/client/error-handling#safe-client | Client Error Handling - Safe Client}
@@ -123,12 +123,12 @@ declare class DynamicLink<TClientContext extends ClientContext> implements Clien
123
123
  }
124
124
 
125
125
  /**
126
- * Checks if an error is an `ORPCError` whose type is inferable at the TypeScript level,
126
+ * Checks if an error is an `ORPCError` that matches a definition in the procedure's `.errors` map,
127
127
  * narrowing it so `code` and `data` are fully typed.
128
128
  *
129
- * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isinferableerror | Client Error Handling - Using safe and isInferableError}
129
+ * @see {@link https://orpc.dev/docs/client/error-handling#using-safe-and-isdefinederror | Client Error Handling - Using safe and isDefinedError}
130
130
  */
131
- declare function isInferableError<T>(error: T): error is Extract<T, AnyORPCError>;
131
+ declare function isDefinedError<T>(error: T): error is Extract<T, AnyORPCError>;
132
132
  declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
133
133
  declare function isORPCErrorJson(json: unknown): json is ORPCErrorJSON<ORPCErrorCode, unknown>;
134
134
  declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>, options?: ErrorOptions): ORPCError<TCode, TData>;
@@ -152,5 +152,5 @@ declare function createORPCErrorFromMalformedResponse(options: MalformedResponse
152
152
  */
153
153
  declare function cloneORPCError<T extends AnyORPCError>(error: T): T;
154
154
 
155
- export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, MalformedResponseErrorOptions, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createORPCErrorFromMalformedResponse, createSafeClient, isInferableError as isDefinedError, isInferableError, isORPCErrorJson, resolveClientRest, resolveFriendlyClientOptions, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
155
+ export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, MalformedResponseErrorOptions, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createORPCErrorFromMalformedResponse, createSafeClient, isDefinedError, isORPCErrorJson, resolveClientRest, resolveFriendlyClientOptions, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
156
156
  export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { b as isInferableError } from './shared/client.BnATe4Ob.mjs';
2
- export { d as RPCJsonSerializer, R as RPCSerializer, e as cloneORPCError, a as createORPCErrorFromJson, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, t as toORPCError, w as wrapAsyncIteratorPreservingEventMeta } from './shared/client.BnATe4Ob.mjs';
1
+ import { b as isDefinedError } from './shared/client.Cik8dxOF.mjs';
2
+ export { d as RPCJsonSerializer, R as RPCSerializer, e as cloneORPCError, a as createORPCErrorFromJson, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, t as toORPCError, w as wrapAsyncIteratorPreservingEventMeta } from './shared/client.Cik8dxOF.mjs';
3
3
  import { toArray, intercept, isTypescriptObject } from '@orpc/shared';
4
4
  export { AsyncIteratorClass, 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';
5
- export { C as COMMON_ERROR_STATUS_MAP, M as MalformedResponseError, O as ORPCError } from './shared/client.DcoDDrD4.mjs';
6
- export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
5
+ export { C as COMMON_ERROR_STATUS_MAP, M as MalformedResponseError, O as ORPCError } from './shared/client.Dtv1JPkU.mjs';
6
+ export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core';
7
7
 
8
8
  const RECURSIVE_CLIENT_UNWRAP_KEYS = /* @__PURE__ */ new Set([
9
9
  /**
@@ -60,19 +60,19 @@ async function safe(promise) {
60
60
  const output = await promise;
61
61
  return Object.assign(
62
62
  [null, output, null, true],
63
- { error: null, data: output, inferableError: null, isSuccess: true }
63
+ { error: null, data: output, definedError: null, isSuccess: true }
64
64
  );
65
65
  } catch (e) {
66
66
  const error = e;
67
- if (isInferableError(error)) {
67
+ if (isDefinedError(error)) {
68
68
  return Object.assign(
69
69
  [error, void 0, error, false],
70
- { error, data: void 0, inferableError: error, isSuccess: false }
70
+ { error, data: void 0, definedError: error, isSuccess: false }
71
71
  );
72
72
  }
73
73
  return Object.assign(
74
74
  [error, void 0, null, false],
75
- { error, data: void 0, inferableError: null, isSuccess: false }
75
+ { error, data: void 0, definedError: null, isSuccess: false }
76
76
  );
77
77
  }
78
78
  }
@@ -144,4 +144,4 @@ class DynamicLink {
144
144
  }
145
145
  }
146
146
 
147
- export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isInferableError as isDefinedError, isInferableError, resolveClientRest, resolveFriendlyClientOptions, safe };
147
+ export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isDefinedError, resolveClientRest, resolveFriendlyClientOptions, safe };
@@ -1,5 +1,5 @@
1
1
  import { Value, Promisable } from '@orpc/shared';
2
- import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
2
+ import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standard-server/core';
3
3
  import { ClientContext } from '../index.mjs';
4
4
  import { StandardLinkPlugin, StandardLinkTransportInterceptorOptions, StandardLinkOptions, StandardLinkInterceptorOptions } from '../adapters/standard/index.mjs';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Value, Promisable } from '@orpc/shared';
2
- import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
2
+ import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standard-server/core';
3
3
  import { ClientContext } from '../index.js';
4
4
  import { StandardLinkPlugin, StandardLinkTransportInterceptorOptions, StandardLinkOptions, StandardLinkInterceptorOptions } from '../adapters/standard/index.js';
5
5
 
@@ -1,8 +1,8 @@
1
1
  import { toArray, value, splitInHalf, stringifyJSON, once, isAsyncIteratorObject, defer, loadBytes, allAbortSignal, replicateAsyncIterator, replicateReadableStream, isCompressibleContentType, override, AsyncIteratorClass, sleep, AbortError, anyAbortSignal } from '@orpc/shared';
2
- import { parseStandardUrl, flattenStandardHeader, generateContentDisposition, getEventMeta } from '@standardserver/core';
3
- import { ClientPeer, isServerPeerSendMessage, decodePeerMessage } from '@standardserver/peer';
4
- import { toFetchHeaders, toStandardBody } from '@standardserver/fetch';
5
- import { C as COMMON_ERROR_STATUS_MAP } from '../shared/client.DcoDDrD4.mjs';
2
+ import { parseStandardUrl, flattenStandardHeader, generateContentDisposition, getEventMeta } from '@standard-server/core';
3
+ import { ClientPeer, isServerPeerSendMessage, decodePeerMessage } from '@standard-server/peer';
4
+ import { toFetchHeaders, toStandardBody } from '@standard-server/fetch';
5
+ import { C as COMMON_ERROR_STATUS_MAP } from '../shared/client.Dtv1JPkU.mjs';
6
6
 
7
7
  class BatchLinkPlugin {
8
8
  name = "~batch";
@@ -1,6 +1,6 @@
1
1
  import { Promisable, OrderablePlugin, Interceptor } from '@orpc/shared';
2
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
3
- import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.CFVTHyN6.js';
2
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
3
+ import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.BoXZCzuS.mjs';
4
4
 
5
5
  type StandardLinkCodecDecodedResponse = {
6
6
  kind: 'output';
@@ -1,6 +1,6 @@
1
1
  import { Promisable, OrderablePlugin, Interceptor } from '@orpc/shared';
2
- import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
3
- import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.CFVTHyN6.mjs';
2
+ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
3
+ import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.BoXZCzuS.js';
4
4
 
5
5
  type StandardLinkCodecDecodedResponse = {
6
6
  kind: 'output';
@@ -1,5 +1,5 @@
1
1
  import { PromiseWithError, Registry, MaybeOptionalOptions } from '@orpc/shared';
2
- import { StandardResponse } from '@standardserver/core';
2
+ import { StandardResponse } from '@standard-server/core';
3
3
 
4
4
  interface ClientContext {
5
5
  [key: PropertyKey]: any;
@@ -155,14 +155,10 @@ declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error {
155
155
  __branch: "ORPCError";
156
156
  };
157
157
  /**
158
- * Indicates whether the error matches a definition in the procedure's `.errors` map.
158
+ * Indicates whether the error matches a definition in the procedure's `.errors` map,
159
+ * which makes its type inferable on the client.
159
160
  */
160
161
  readonly defined: boolean;
161
- /**
162
- * Indicates whether the error's type is inferable at the TypeScript level.
163
- * This is typically true when the error is explicitly defined or returned within a handler.
164
- */
165
- readonly inferable: boolean;
166
162
  code: TCode;
167
163
  data: TData;
168
164
  constructor(code: TCode, ...rest: MaybeOptionalOptions<ORPCErrorOptions<TData>>);
@@ -186,10 +182,6 @@ interface ORPCErrorJSON<TCode extends string, TData> extends Pick<ORPCError<TCod
186
182
  * remove readonly
187
183
  */
188
184
  defined: boolean;
189
- /**
190
- * remove readonly
191
- */
192
- inferable: boolean;
193
185
  }
194
186
  type AnyORPCError = ORPCError<any, any>;
195
187
  type AnyORPCErrorJSON = ORPCErrorJSON<any, any>;
@@ -1,5 +1,5 @@
1
1
  import { PromiseWithError, Registry, MaybeOptionalOptions } from '@orpc/shared';
2
- import { StandardResponse } from '@standardserver/core';
2
+ import { StandardResponse } from '@standard-server/core';
3
3
 
4
4
  interface ClientContext {
5
5
  [key: PropertyKey]: any;
@@ -155,14 +155,10 @@ declare class ORPCError<TCode extends ORPCErrorCode, TData> extends Error {
155
155
  __branch: "ORPCError";
156
156
  };
157
157
  /**
158
- * Indicates whether the error matches a definition in the procedure's `.errors` map.
158
+ * Indicates whether the error matches a definition in the procedure's `.errors` map,
159
+ * which makes its type inferable on the client.
159
160
  */
160
161
  readonly defined: boolean;
161
- /**
162
- * Indicates whether the error's type is inferable at the TypeScript level.
163
- * This is typically true when the error is explicitly defined or returned within a handler.
164
- */
165
- readonly inferable: boolean;
166
162
  code: TCode;
167
163
  data: TData;
168
164
  constructor(code: TCode, ...rest: MaybeOptionalOptions<ORPCErrorOptions<TData>>);
@@ -186,10 +182,6 @@ interface ORPCErrorJSON<TCode extends string, TData> extends Pick<ORPCError<TCod
186
182
  * remove readonly
187
183
  */
188
184
  defined: boolean;
189
- /**
190
- * remove readonly
191
- */
192
- inferable: boolean;
193
185
  }
194
186
  type AnyORPCError = ORPCError<any, any>;
195
187
  type AnyORPCErrorJSON = ORPCErrorJSON<any, any>;
@@ -1,4 +1,4 @@
1
- import { StandardBody } from '@standardserver/core';
1
+ import { StandardBody } from '@standard-server/core';
2
2
  import { Segment } from '@orpc/shared';
3
3
 
4
4
  type RPCJsonSerializationMeta = [type: string, ...path: Segment[]];
@@ -1,4 +1,4 @@
1
- import { StandardBody } from '@standardserver/core';
1
+ import { StandardBody } from '@standard-server/core';
2
2
  import { Segment } from '@orpc/shared';
3
3
 
4
4
  type RPCJsonSerializationMeta = [type: string, ...path: Segment[]];
@@ -1,9 +1,9 @@
1
1
  import { isPlainObject, wrapAsyncIterator, isTypescriptObject, NullProtoObj, isAsyncIteratorObject, stringifyJSON } from '@orpc/shared';
2
- import { getEventMeta, withEventMeta, ErrorEvent } from '@standardserver/core';
3
- import { O as ORPCError, M as MalformedResponseError, C as COMMON_ERROR_STATUS_MAP } from './client.DcoDDrD4.mjs';
2
+ import { getEventMeta, withEventMeta, ErrorEvent } from '@standard-server/core';
3
+ import { O as ORPCError, M as MalformedResponseError, C as COMMON_ERROR_STATUS_MAP } from './client.Dtv1JPkU.mjs';
4
4
 
5
- function isInferableError(error) {
6
- return error instanceof ORPCError && error.inferable;
5
+ function isDefinedError(error) {
6
+ return error instanceof ORPCError && error.defined;
7
7
  }
8
8
  function toORPCError(error) {
9
9
  return error instanceof ORPCError ? error : new ORPCError("INTERNAL_SERVER_ERROR", { cause: error });
@@ -12,11 +12,11 @@ function isORPCErrorJson(json) {
12
12
  if (!isPlainObject(json)) {
13
13
  return false;
14
14
  }
15
- const validKeys = ["defined", "inferable", "code", "message", "data"];
15
+ const validKeys = ["defined", "code", "message", "data"];
16
16
  if (Object.keys(json).some((k) => !validKeys.includes(k))) {
17
17
  return false;
18
18
  }
19
- return "defined" in json && typeof json.defined === "boolean" && "inferable" in json && typeof json.inferable === "boolean" && "code" in json && typeof json.code === "string" && "message" in json && typeof json.message === "string";
19
+ return "defined" in json && typeof json.defined === "boolean" && "code" in json && typeof json.code === "string" && "message" in json && typeof json.message === "string";
20
20
  }
21
21
  function createORPCErrorFromJson(json, options = {}) {
22
22
  const error = new ORPCError(json.code, {
@@ -24,7 +24,6 @@ function createORPCErrorFromJson(json, options = {}) {
24
24
  ...options
25
25
  });
26
26
  error.defined = json.defined;
27
- error.inferable = json.inferable;
28
27
  return error;
29
28
  }
30
29
  function createORPCErrorFromMalformedResponse(options) {
@@ -458,4 +457,4 @@ class RPCSerializer {
458
457
  }
459
458
  }
460
459
 
461
- export { RPCSerializer as R, createORPCErrorFromJson as a, isInferableError as b, createORPCErrorFromMalformedResponse as c, RPCJsonSerializer as d, cloneORPCError as e, isORPCErrorJson as i, toORPCError as t, wrapAsyncIteratorPreservingEventMeta as w };
460
+ export { RPCSerializer as R, createORPCErrorFromJson as a, isDefinedError as b, createORPCErrorFromMalformedResponse as c, RPCJsonSerializer as d, cloneORPCError as e, isORPCErrorJson as i, toORPCError as t, wrapAsyncIteratorPreservingEventMeta as w };
@@ -39,14 +39,10 @@ class ORPCError extends Error {
39
39
  */
40
40
  name = "ORPCError";
41
41
  /**
42
- * Indicates whether the error matches a definition in the procedure's `.errors` map.
42
+ * Indicates whether the error matches a definition in the procedure's `.errors` map,
43
+ * which makes its type inferable on the client.
43
44
  */
44
45
  defined = false;
45
- /**
46
- * Indicates whether the error's type is inferable at the TypeScript level.
47
- * This is typically true when the error is explicitly defined or returned within a handler.
48
- */
49
- inferable = false;
50
46
  code;
51
47
  data;
52
48
  constructor(code, ...rest) {
@@ -59,7 +55,6 @@ class ORPCError extends Error {
59
55
  toJSON() {
60
56
  return {
61
57
  defined: this.defined,
62
- inferable: this.inferable,
63
58
  code: this.code,
64
59
  message: this.message,
65
60
  data: this.data
@@ -1,7 +1,7 @@
1
1
  import { sortPlugins, runWithSpan, ORPC_NAME, isAsyncIteratorObject, override, traceAsyncIterator, intercept, getOpenTelemetryConfig, value, pathToHttpPath, stringifyJSON } from '@orpc/shared';
2
- import { mergeStandardHeaders, parseStandardUrl } from '@standardserver/core';
3
- import { toStandardHeaders } from '@standardserver/fetch';
4
- import { R as RPCSerializer, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, a as createORPCErrorFromJson } from './client.BnATe4Ob.mjs';
2
+ import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
3
+ import { toStandardHeaders } from '@standard-server/fetch';
4
+ import { R as RPCSerializer, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, a as createORPCErrorFromJson } from './client.Cik8dxOF.mjs';
5
5
 
6
6
  class CompositeStandardLinkPlugin {
7
7
  name = "~composite";
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.33",
4
+ "version": "2.0.0-beta.34",
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,10 +63,10 @@
63
63
  "dist"
64
64
  ],
65
65
  "dependencies": {
66
- "@orpc/shared": "2.0.0-beta.33",
67
- "@standardserver/core": "^0.8.3",
68
- "@standardserver/fetch": "^0.8.3",
69
- "@standardserver/peer": "^0.8.3"
66
+ "@orpc/shared": "2.0.0-beta.34",
67
+ "@standard-server/core": "~0.9.0",
68
+ "@standard-server/fetch": "~0.9.0",
69
+ "@standard-server/peer": "~0.9.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "zod": "^4.5.4"