@orpc/client 2.0.0-beta.49 → 2.0.0-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/fetch/index.d.ts +3 -2
- package/dist/adapters/fetch/index.js +2 -2
- package/dist/adapters/fetch/rpc-link.d.ts +8 -8
- package/dist/adapters/fetch/rpc-link.js +16 -13
- package/dist/adapters/fetch/transport.d.ts +29 -31
- package/dist/adapters/fetch/transport.js +49 -63
- package/dist/adapters/message-port/index.d.ts +4 -3
- package/dist/adapters/message-port/index.js +3 -3
- package/dist/adapters/message-port/message-port.d.ts +13 -13
- package/dist/adapters/message-port/message-port.js +35 -53
- package/dist/adapters/message-port/rpc-link.d.ts +8 -8
- package/dist/adapters/message-port/rpc-link.js +17 -14
- package/dist/adapters/message-port/transport.d.ts +31 -34
- package/dist/adapters/message-port/transport.js +38 -52
- package/dist/adapters/standard/codec.d.ts +10 -10
- package/dist/adapters/standard/index.d.ts +6 -5
- package/dist/adapters/standard/index.js +2 -4
- package/dist/adapters/standard/link.d.ts +31 -31
- package/dist/adapters/standard/link.js +101 -85
- package/dist/adapters/standard/plugin.d.ts +25 -31
- package/dist/adapters/standard/plugin.js +14 -16
- package/dist/adapters/standard/rpc-link-codec.d.ts +53 -60
- package/dist/adapters/standard/rpc-link-codec.js +98 -102
- package/dist/adapters/standard/transport.d.ts +7 -7
- package/dist/adapters/websocket/index.d.ts +3 -2
- package/dist/adapters/websocket/index.js +2 -2
- package/dist/adapters/websocket/rpc-link.d.ts +8 -8
- package/dist/adapters/websocket/rpc-link.js +16 -13
- package/dist/adapters/websocket/transport.d.ts +101 -100
- package/dist/adapters/websocket/transport.js +102 -130
- package/dist/async-iterator-object.d.ts +2 -2
- package/dist/async-iterator-object.js +27 -28
- package/dist/client-safe.d.ts +4 -6
- package/dist/client-safe.js +29 -34
- package/dist/client.d.ts +24 -26
- package/dist/client.js +35 -37
- package/dist/consts.d.ts +1 -1
- package/dist/consts.js +18 -41
- package/dist/dynamic-link.d.ts +6 -6
- package/dist/dynamic-link.js +16 -16
- package/dist/error-utils.d.ts +3 -4
- package/dist/error-utils.js +47 -51
- package/dist/error.d.ts +79 -79
- package/dist/error.js +154 -166
- package/dist/index.d.ts +14 -53
- package/dist/index.js +12 -40
- package/dist/plugins/batch.d.ts +122 -155
- package/dist/plugins/batch.js +320 -391
- package/dist/plugins/cookie-jar.d.ts +64 -61
- package/dist/plugins/cookie-jar.js +208 -245
- package/dist/plugins/dedupe.d.ts +49 -53
- package/dist/plugins/dedupe.js +168 -211
- package/dist/plugins/index.d.ts +9 -28
- package/dist/plugins/index.js +8 -23
- package/dist/plugins/request-compression.d.ts +38 -35
- package/dist/plugins/request-compression.js +131 -177
- package/dist/plugins/response-compression.d.ts +21 -18
- package/dist/plugins/response-compression.js +64 -88
- package/dist/plugins/retry-after.d.ts +31 -38
- package/dist/plugins/retry-after.js +60 -85
- package/dist/plugins/retry.d.ts +55 -55
- package/dist/plugins/retry.js +118 -137
- package/dist/plugins/timeout.d.ts +19 -17
- package/dist/plugins/timeout.js +41 -36
- package/dist/rpc-json-serializer.d.ts +84 -84
- package/dist/rpc-json-serializer.js +338 -383
- package/dist/rpc-serializer.d.ts +20 -21
- package/dist/rpc-serializer.js +97 -125
- package/dist/types.d.ts +19 -31
- package/dist/utils.d.ts +18 -29
- package/dist/utils.js +63 -47
- package/package.json +5 -5
- package/dist/adapters/standard/codec.js +0 -1
- package/dist/adapters/standard/transport.js +0 -1
- package/dist/types.js +0 -1
package/dist/error.js
CHANGED
|
@@ -1,178 +1,166 @@
|
|
|
1
|
-
import { getConstructors, isPlainObject, resolveMaybeOptionalOptions } from
|
|
1
|
+
import { getConstructors, isPlainObject, resolveMaybeOptionalOptions } from "@orpc/shared";
|
|
2
|
+
// src/error.ts
|
|
2
3
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
4
|
+
* Default mapping between common oRPC error codes and HTTP status codes.
|
|
5
|
+
* Handlers use it to determine response status codes; spread it to build a custom `errorStatusMap`.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link https://orpc.dev/docs/rpc/handler#custom-error-response | RPC Handler - Custom Error Response}
|
|
8
|
+
* @see {@link https://orpc.dev/docs/openapi/handler#custom-error-response | OpenAPI Handler - Custom Error Response}
|
|
9
|
+
*/
|
|
10
|
+
const COMMON_ERROR_STATUS_MAP = {
|
|
11
|
+
BAD_REQUEST: 400,
|
|
12
|
+
UNAUTHORIZED: 401,
|
|
13
|
+
PAYMENT_REQUIRED: 402,
|
|
14
|
+
FORBIDDEN: 403,
|
|
15
|
+
NOT_FOUND: 404,
|
|
16
|
+
METHOD_NOT_SUPPORTED: 405,
|
|
17
|
+
NOT_ACCEPTABLE: 406,
|
|
18
|
+
TIMEOUT: 408,
|
|
19
|
+
CONFLICT: 409,
|
|
20
|
+
GONE: 410,
|
|
21
|
+
LENGTH_REQUIRED: 411,
|
|
22
|
+
PRECONDITION_FAILED: 412,
|
|
23
|
+
PAYLOAD_TOO_LARGE: 413,
|
|
24
|
+
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
25
|
+
UNPROCESSABLE_CONTENT: 422,
|
|
26
|
+
PRECONDITION_REQUIRED: 428,
|
|
27
|
+
TOO_MANY_REQUESTS: 429,
|
|
28
|
+
CLIENT_CLOSED_REQUEST: 499,
|
|
29
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
30
|
+
NOT_IMPLEMENTED: 501,
|
|
31
|
+
BAD_GATEWAY: 502,
|
|
32
|
+
SERVICE_UNAVAILABLE: 503,
|
|
33
|
+
GATEWAY_TIMEOUT: 504
|
|
33
34
|
};
|
|
34
35
|
let ORPCErrorConstructors;
|
|
35
36
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (ORPCErrorConstructors.has(constructor)) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
37
|
+
* Typed error carrying a `code`, a `message`, and optional `data`.
|
|
38
|
+
* Throw it from handlers or middleware to produce typed error responses on the client.
|
|
39
|
+
*
|
|
40
|
+
* @see {@link https://orpc.dev/docs/error-handling#orpcerror-class | Error Handling - ORPCError Class}
|
|
41
|
+
*/
|
|
42
|
+
var ORPCError = class ORPCError extends Error {
|
|
43
|
+
/**
|
|
44
|
+
* Placed inside a static block (rather than at module level) to ensure this
|
|
45
|
+
* registration is treated as part of the class definition by bundlers.
|
|
46
|
+
*
|
|
47
|
+
* With `"sideEffects": false` in package.json, bundlers like webpack/Rollup
|
|
48
|
+
* are allowed to tree-shake any module-level statements that appear to have
|
|
49
|
+
* no consumers. A free-floating `globalORPCErrorConstructors.add(ORPCError)`
|
|
50
|
+
* at module level could be dropped entirely if the bundler decides the module
|
|
51
|
+
* is only partially used.
|
|
52
|
+
*
|
|
53
|
+
* By placing this inside `static {}`, the registration becomes inseparable
|
|
54
|
+
* from the class body itself — a bundler cannot include `ORPCError` without
|
|
55
|
+
* executing this block.
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Static_initialization_blocks
|
|
58
|
+
*/
|
|
59
|
+
static {
|
|
60
|
+
/**
|
|
61
|
+
* Store all ORPCError constructors
|
|
62
|
+
* for workaround of instanceof check in case multiple dependency graphs exist
|
|
63
|
+
*/
|
|
64
|
+
const ORPC_ERROR_CONSTRUCTORS_SYMBOL = Symbol.for("ORPC_ERROR_CONSTRUCTORS");
|
|
65
|
+
globalThis[ORPC_ERROR_CONSTRUCTORS_SYMBOL] ??= /* @__PURE__ */ new WeakSet();
|
|
66
|
+
ORPCErrorConstructors = globalThis[ORPC_ERROR_CONSTRUCTORS_SYMBOL];
|
|
67
|
+
ORPCErrorConstructors.add(ORPCError);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @remarks
|
|
71
|
+
* **Note**: The `__branch` property is used for type branding, helping TypeScript distinguish
|
|
72
|
+
* an `ORPCError` instance from plain objects with a similar structure.
|
|
73
|
+
*/
|
|
74
|
+
name = "ORPCError";
|
|
75
|
+
/**
|
|
76
|
+
* Indicates whether the error matches a definition in the procedure's `.errors` map,
|
|
77
|
+
* which makes its type inferable on the client.
|
|
78
|
+
*/
|
|
79
|
+
defined = false;
|
|
80
|
+
code;
|
|
81
|
+
data;
|
|
82
|
+
constructor(code, ...rest) {
|
|
83
|
+
const options = resolveMaybeOptionalOptions(rest);
|
|
84
|
+
const message = options.message ?? codeToMessage(code);
|
|
85
|
+
super(message, options);
|
|
86
|
+
this.code = code;
|
|
87
|
+
this.data = options.data;
|
|
88
|
+
}
|
|
89
|
+
toJSON() {
|
|
90
|
+
return {
|
|
91
|
+
defined: this.defined,
|
|
92
|
+
code: this.code,
|
|
93
|
+
message: this.message,
|
|
94
|
+
data: this.data
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Workaround for Next.js where different contexts use separate
|
|
99
|
+
* dependency graphs, causing multiple ORPCError constructors existing and breaking
|
|
100
|
+
* `instanceof` checks across contexts.
|
|
101
|
+
*
|
|
102
|
+
* This is particularly problematic with "Optimized SSR", where orpc-client
|
|
103
|
+
* executes in one context but is invoked from another. When an error is thrown
|
|
104
|
+
* in the execution context, `instanceof ORPCError` checks fail in the
|
|
105
|
+
* invocation context due to separate class constructors.
|
|
106
|
+
*
|
|
107
|
+
* @todo Remove this and related code if Next.js resolves the multiple dependency graph issue.
|
|
108
|
+
*/
|
|
109
|
+
static [Symbol.hasInstance](instance) {
|
|
110
|
+
if (!ORPCErrorConstructors.has(this)) return super[Symbol.hasInstance](instance);
|
|
111
|
+
for (const constructor of getConstructors(instance)) if (ORPCErrorConstructors.has(constructor)) return true;
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
121
115
|
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
116
|
+
* Error carrying the resolved response a link received. Links set it as the `cause`
|
|
117
|
+
* of an `ORPCError` decoded from an error response, so details that are not part
|
|
118
|
+
* of the error itself, such as its status or headers, stay available.
|
|
119
|
+
*
|
|
120
|
+
* @see {@link https://orpc.dev/docs/rpc/link#error-responses | RPC Link - Error Responses}
|
|
121
|
+
* @see {@link https://orpc.dev/docs/openapi/link#error-responses | OpenAPI Link - Error Responses}
|
|
122
|
+
*/
|
|
123
|
+
var ResponseError = class extends Error {
|
|
124
|
+
name = "ResponseError";
|
|
125
|
+
response;
|
|
126
|
+
constructor(options) {
|
|
127
|
+
super(options.message ?? `Received a ${options.response.status} response.`, options);
|
|
128
|
+
this.response = options.response;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
137
131
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
132
|
+
* Error thrown by links when a response does not follow the expected oRPC format,
|
|
133
|
+
* for example when a proxy or gateway answers instead of your handler. Extends
|
|
134
|
+
* `ResponseError`, so it carries the resolved response. Unless overridden via
|
|
135
|
+
* `options.message`, the message is inferred from the response body or status.
|
|
136
|
+
*
|
|
137
|
+
* Unlike `ORPCError`, it reaches a handler's callers as a generic `INTERNAL_SERVER_ERROR`
|
|
138
|
+
* when thrown from the handler, so an upstream's response is not sent to them.
|
|
139
|
+
*
|
|
140
|
+
* @see {@link https://orpc.dev/docs/rpc/link#malformed-responses | RPC Link - Malformed Responses}
|
|
141
|
+
* @see {@link https://orpc.dev/docs/openapi/link#malformed-responses | OpenAPI Link - Malformed Responses}
|
|
142
|
+
*/
|
|
143
|
+
var MalformedResponseError = class extends ResponseError {
|
|
144
|
+
name = "MalformedResponseError";
|
|
145
|
+
constructor(options) {
|
|
146
|
+
super({
|
|
147
|
+
...options,
|
|
148
|
+
message: options.message ?? inferMalformedResponseMessage(options.response)
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
158
152
|
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
* Longer body strings are not used as the error message,
|
|
154
|
+
* e.g. full HTML error pages from a proxy or gateway.
|
|
155
|
+
*/
|
|
162
156
|
const INFERRED_MESSAGE_MAX_LENGTH = 256;
|
|
163
157
|
function inferMalformedResponseMessage(response) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return candidate;
|
|
169
|
-
}
|
|
170
|
-
const commonCode = Object.entries(COMMON_ERROR_STATUS_MAP).find(([, status]) => status === response.status)?.[0];
|
|
171
|
-
return commonCode ? codeToMessage(commonCode) : 'Malformed oRPC Response';
|
|
158
|
+
const candidate = isPlainObject(response.body) ? response.body.message : response.body;
|
|
159
|
+
if (typeof candidate === "string" && candidate.length > 0 && candidate.length <= INFERRED_MESSAGE_MAX_LENGTH) return candidate;
|
|
160
|
+
const commonCode = Object.entries(COMMON_ERROR_STATUS_MAP).find(([, status]) => status === response.status)?.[0];
|
|
161
|
+
return commonCode ? codeToMessage(commonCode) : "Malformed oRPC Response";
|
|
172
162
|
}
|
|
173
163
|
function codeToMessage(code) {
|
|
174
|
-
|
|
175
|
-
.split('_')
|
|
176
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
177
|
-
.join(' ');
|
|
164
|
+
return code.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
178
165
|
}
|
|
166
|
+
export { COMMON_ERROR_STATUS_MAP, MalformedResponseError, ORPCError, ResponseError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,53 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
InferClientError as InferClientErrorUnion, } from './types.ts';
|
|
16
|
-
export { resolveClientRest, safe } from './utils.ts';
|
|
17
|
-
export type { SafeResult } from './utils.ts';
|
|
18
|
-
export type { AsyncCleanupFn, AsyncIteratorClassNextFn, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, } from '@orpc/shared';
|
|
19
|
-
export { AsyncIteratorClass, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, consumeAsyncIterator,
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use `consumeAsyncIterator` instead.
|
|
22
|
-
*/
|
|
23
|
-
consumeAsyncIterator as consumeEventIterator,
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Use `asyncIteratorToStream` instead.
|
|
26
|
-
*/
|
|
27
|
-
asyncIteratorToStream as eventIteratorToStream,
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use `asyncIteratorToUnproxiedDataStream` instead.
|
|
30
|
-
*/
|
|
31
|
-
asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject,
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use `streamToAsyncIteratorObject` instead.
|
|
34
|
-
*/
|
|
35
|
-
streamToAsyncIteratorObject as streamToEventIterator, } from '@orpc/shared';
|
|
36
|
-
export type {
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated Use `PromiseWithError` instead.
|
|
39
|
-
*/
|
|
40
|
-
PromiseWithError as ClientPromiseResult, } from '@orpc/shared';
|
|
41
|
-
export type { EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, } from '@standard-server/core';
|
|
42
|
-
export {
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use `EventStreamErrorEvent` instead.
|
|
45
|
-
*/
|
|
46
|
-
EventStreamErrorEvent as ErrorEvent, EventStreamErrorEvent,
|
|
47
|
-
/**
|
|
48
|
-
* Retrieves event metadata (such as the event id and retry interval)
|
|
49
|
-
* attached to a single iterator event value.
|
|
50
|
-
*
|
|
51
|
-
* @see {@link https://orpc.dev/docs/client/async-iterator-object#event-metadata | AsyncIteratorObject in Client - Event Metadata}
|
|
52
|
-
*/
|
|
53
|
-
getEventMeta, unwrapEvent, withEventMeta, } from '@standard-server/core';
|
|
1
|
+
import { wrapAsyncIteratorPreservingEventMeta } from "./async-iterator-object.js";
|
|
2
|
+
import { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, createORPCClient } from "./client.js";
|
|
3
|
+
import { SafeClient, createSafeClient } from "./client-safe.js";
|
|
4
|
+
import { RECURSIVE_CLIENT_UNWRAP_KEYS } from "./consts.js";
|
|
5
|
+
import { DynamicLink } from "./dynamic-link.js";
|
|
6
|
+
import { AnyORPCError, AnyORPCErrorJSON, COMMON_ERROR_STATUS_MAP, MalformedResponseError, MalformedResponseErrorOptions, ORPCError, ORPCErrorCode, ORPCErrorJSON, ORPCErrorOptions, ResponseError, ResponseErrorOptions } from "./error.js";
|
|
7
|
+
import { cloneORPCError, createORPCErrorFromJson, isDefinedError, isORPCErrorJson, toORPCError } from "./error-utils.js";
|
|
8
|
+
import { RPCJsonSerialization, RPCJsonSerializationMeta, RPCJsonSerializer, RPCJsonSerializerHandler, RPCJsonSerializerOptions } from "./rpc-json-serializer.js";
|
|
9
|
+
import { RPCSerializer, RPCSerializerOptions, RPCSerializerSerializeOptions } from "./rpc-serializer.js";
|
|
10
|
+
import { AnyNestedClient, Client, ClientContext, ClientLink, ClientOptions, ClientRest, FriendlyClientOptions, InferClientBodyInputs, InferClientBodyOutputs, InferClientContext, InferClientError, InferClientErrors, InferClientInputs, InferClientOutputs, NestedClient } from "./types.js";
|
|
11
|
+
import { SafeResult, resolveClientRest, safe } from "./utils.js";
|
|
12
|
+
import { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, MaybeOptionalOptions, PromiseWithError, PromiseWithError as ClientPromiseResult, Registry, ThrowableError, asyncIteratorToStream, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, consumeAsyncIterator, consumeAsyncIterator as consumeEventIterator, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject, streamToAsyncIteratorObject as streamToEventIterator } from "@orpc/shared";
|
|
13
|
+
import { EventMeta, EventStreamErrorEvent, EventStreamErrorEvent as ErrorEvent, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from "@standard-server/core";
|
|
14
|
+
export { AnyNestedClient, AnyORPCError, AnyORPCErrorJSON, type AsyncCleanupFn, AsyncIteratorClass, type AsyncIteratorClassNextFn, COMMON_ERROR_STATUS_MAP, Client, ClientContext, ClientLink, ClientOptions, type ClientPromiseResult, ClientRest, DynamicLink, ErrorEvent, type EventMeta, EventStreamErrorEvent, FriendlyClientOptions, InferClientBodyInputs, InferClientBodyOutputs, InferClientContext, InferClientError, type InferClientError as InferClientErrorUnion, InferClientErrors, InferClientInputs, InferClientOutputs, MalformedResponseError, MalformedResponseErrorOptions, type MaybeOptionalOptions, NestedClient, ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, ORPCError, ORPCErrorCode, ORPCErrorJSON, ORPCErrorOptions, type PromiseWithError, RECURSIVE_CLIENT_UNWRAP_KEYS, RPCJsonSerialization, RPCJsonSerializationMeta, RPCJsonSerializer, RPCJsonSerializerHandler, RPCJsonSerializerOptions, RPCSerializer, RPCSerializerOptions, RPCSerializerSerializeOptions, type Registry, ResponseError, ResponseErrorOptions, SafeClient, type SafeResult, type StandardBody, type StandardBodyHint, type StandardHeaders, type StandardLazyRequest, type StandardLazyResponse, type StandardMethod, type StandardRequest, type StandardResponse, type StandardUrl, type ThrowableError, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, cloneORPCError, consumeAsyncIterator, consumeEventIterator, createORPCClient, createORPCErrorFromJson, createSafeClient, eventIteratorToStream, eventIteratorToUnproxiedDataStream, getEventMeta, isDefinedError, isORPCErrorJson, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, resolveClientRest, safe, streamToAsyncIteratorObject, streamToEventIterator, toORPCError, unwrapEvent, withEventMeta, wrapAsyncIteratorPreservingEventMeta };
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use `consumeAsyncIterator` instead.
|
|
15
|
-
*/
|
|
16
|
-
consumeAsyncIterator as consumeEventIterator,
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use `asyncIteratorToStream` instead.
|
|
19
|
-
*/
|
|
20
|
-
asyncIteratorToStream as eventIteratorToStream,
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use `asyncIteratorToUnproxiedDataStream` instead.
|
|
23
|
-
*/
|
|
24
|
-
asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject,
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Use `streamToAsyncIteratorObject` instead.
|
|
27
|
-
*/
|
|
28
|
-
streamToAsyncIteratorObject as streamToEventIterator, } from '@orpc/shared';
|
|
29
|
-
export {
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use `EventStreamErrorEvent` instead.
|
|
32
|
-
*/
|
|
33
|
-
EventStreamErrorEvent as ErrorEvent, EventStreamErrorEvent,
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves event metadata (such as the event id and retry interval)
|
|
36
|
-
* attached to a single iterator event value.
|
|
37
|
-
*
|
|
38
|
-
* @see {@link https://orpc.dev/docs/client/async-iterator-object#event-metadata | AsyncIteratorObject in Client - Event Metadata}
|
|
39
|
-
*/
|
|
40
|
-
getEventMeta, unwrapEvent, withEventMeta, } from '@standard-server/core';
|
|
1
|
+
export { wrapAsyncIteratorPreservingEventMeta } from "./async-iterator-object.js";
|
|
2
|
+
export { createORPCClient } from "./client.js";
|
|
3
|
+
export { createSafeClient } from "./client-safe.js";
|
|
4
|
+
export { RECURSIVE_CLIENT_UNWRAP_KEYS } from "./consts.js";
|
|
5
|
+
export { DynamicLink } from "./dynamic-link.js";
|
|
6
|
+
export { COMMON_ERROR_STATUS_MAP, MalformedResponseError, ORPCError, ResponseError } from "./error.js";
|
|
7
|
+
export { cloneORPCError, createORPCErrorFromJson, isDefinedError, isORPCErrorJson, toORPCError } from "./error-utils.js";
|
|
8
|
+
export { RPCJsonSerializer } from "./rpc-json-serializer.js";
|
|
9
|
+
export { RPCSerializer } from "./rpc-serializer.js";
|
|
10
|
+
export { resolveClientRest, safe } from "./utils.js";
|
|
11
|
+
export { AsyncIteratorClass, asyncIteratorToStream, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, consumeAsyncIterator, consumeAsyncIterator as consumeEventIterator, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject, streamToAsyncIteratorObject as streamToEventIterator } from "@orpc/shared";
|
|
12
|
+
export { EventStreamErrorEvent, EventStreamErrorEvent as ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from "@standard-server/core";
|