@orpc/shared 2.0.0-beta.52 → 2.0.0-beta.53
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 +1 -1
- package/dist/error.d.ts +9 -0
- package/dist/error.js +10 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/plugin.d.ts +20 -8
- package/dist/plugin.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Read the full documentation at [orpc.dev](https://orpc.dev), starting with the [
|
|
|
63
63
|
|
|
64
64
|
| Package | Purpose | Docs |
|
|
65
65
|
| -------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
66
|
-
| [@orpc/contract](https://www.npmjs.com/package/@orpc/contract) | Define API contract as the single source of truth. | [Procedure Contract](https://orpc.dev/docs/contract/procedure), [Contract
|
|
66
|
+
| [@orpc/contract](https://www.npmjs.com/package/@orpc/contract) | Define API contract as the single source of truth. | [Procedure Contract](https://orpc.dev/docs/contract/procedure), [Router Contract](https://orpc.dev/docs/contract/router), [Implementation](https://orpc.dev/docs/contract/implementation), [Generate from OpenAPI](https://orpc.dev/docs/contract/generate-from-openapi) |
|
|
67
67
|
| [@orpc/server](https://www.npmjs.com/package/@orpc/server) | Build APIs or implement contracts. | [Procedure](https://orpc.dev/docs/procedure), [Router](https://orpc.dev/docs/router), [Middleware](https://orpc.dev/docs/middleware), [Context](https://orpc.dev/docs/context), [RPC Handler](https://orpc.dev/docs/rpc/handler) |
|
|
68
68
|
| [@orpc/client](https://www.npmjs.com/package/@orpc/client) | Consume APIs with end-to-end type safety. | [Client-Side Clients](https://orpc.dev/docs/client/client-side), [Server-Side Clients](https://orpc.dev/docs/client/server-side), [RPC Link](https://orpc.dev/docs/rpc/link), [Error Handling](https://orpc.dev/docs/client/error-handling) |
|
|
69
69
|
| [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi) | Add OpenAPI compatibility to APIs. | [OpenAPI Handler](https://orpc.dev/docs/openapi/handler), [OpenAPI Link](https://orpc.dev/docs/openapi/link), [Specification](https://orpc.dev/docs/openapi/specification), [Scalar](https://orpc.dev/docs/openapi/scalar) |
|
package/dist/error.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error for an operation that exceeded its time limit.
|
|
3
|
+
* Named like the error of `AbortSignal.timeout()`.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://orpc.dev/docs/plugins/timeout | Timeout Plugin}
|
|
6
|
+
*/
|
|
7
|
+
export declare class TimeoutError extends Error {
|
|
8
|
+
override readonly name = "TimeoutError";
|
|
9
|
+
}
|
|
1
10
|
export declare function isAbortError(error: unknown): error is Error;
|
package/dist/error.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
// src/error.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error for an operation that exceeded its time limit.
|
|
4
|
+
* Named like the error of `AbortSignal.timeout()`.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://orpc.dev/docs/plugins/timeout | Timeout Plugin}
|
|
7
|
+
*/
|
|
8
|
+
var TimeoutError = class extends Error {
|
|
9
|
+
name = "TimeoutError";
|
|
10
|
+
};
|
|
2
11
|
function isAbortError(error) {
|
|
3
12
|
return error instanceof Error && error.name.includes("Abort");
|
|
4
13
|
}
|
|
5
|
-
export { isAbortError };
|
|
14
|
+
export { TimeoutError, isAbortError };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DEFAULT_MAX_BIGINT_DIGITS, parseBigIntString } from "./bigint.js";
|
|
|
4
4
|
import { encodeBase64, loadBytes, toStringOrBytes } from "./buffer.js";
|
|
5
5
|
import { isDeepEqual } from "./compare.js";
|
|
6
6
|
import { ORPC_NAME } from "./consts.js";
|
|
7
|
-
import { isAbortError } from "./error.js";
|
|
7
|
+
import { TimeoutError, isAbortError } from "./error.js";
|
|
8
8
|
import { AnyFunction, defer, isAsyncGeneratorFunction, once, tryOrUndefined } from "./function.js";
|
|
9
9
|
import { CompressionEncoding, estimateCompressibleFormDataSize, estimateUtf8ByteLength, isAcceptableEncoding, isCompressibleContentType, isCompressionEncoding, isNoTransformCacheControl, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, normalizeHttpPath, parseAcceptEncodingQualities, parseContentEncodings, pathToHttpPath, stripHttpPathPrefix, varyByAcceptEncoding } from "./http.js";
|
|
10
10
|
import { compareSequentialIds } from "./id.js";
|
|
@@ -23,4 +23,4 @@ import { DistributiveOmit, IntersectPick, Promisable, PromiseWithError, Public,
|
|
|
23
23
|
import { Value, value } from "./value.js";
|
|
24
24
|
import { AbortError, AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isNonPrimitive, isNonPrimitive as isTypescriptObject, parseEmptyableJSON, safeDecodeURIComponent, safeEncodeURIComponent, sequential, sleep, stringifyJSON, throwIfAborted, toArray } from "@standard-server/shared";
|
|
25
25
|
import { Arrayable, IsEqual, PartialDeep, Writable } from "type-fest";
|
|
26
|
-
export { AbortError, AnyFunction, type Arrayable, type AsyncCleanupFn, AsyncIdQueue, AsyncIdQueueCloseOptions, AsyncIteratorClass, type AsyncIteratorClassNextFn, CompressionEncoding, ConsumeAsyncIteratorOptions, DEFAULT_MAX_BIGINT_DIGITS, DisposableAllAbortSignal, DistributiveOmit, INTEGER_REGEX, InferNextError, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, type IsEqual, MaybeOptionalOptions, NON_NEGATIVE_INTEGER_REGEX, NullProtoObj, ORPC_NAME, OnFinishState, OrderablePlugin, type PartialDeep, Promisable, PromiseWithError, Public, ReadableStreamReadResult, Registry, Segment, SequentialIdGenerator, StartSpanOptions, ThrowableError, Tracer, TracingAttributeValue, TracingExceptionLevel, TracingHeaders, TracingSpan, Value, WrapAsyncIteratorOptions, WrapReadableStreamOptions, type Writable, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, disposableAllAbortSignal, encodeBase64, estimateCompressibleFormDataSize, estimateUtf8ByteLength, findDeepMatches, get, getConstructor, getConstructors, getOrBind, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isAsyncIteratorObject, isCompressibleContentType, isCompressionEncoding, isDeepEqual, isNoTransformCacheControl, isNonPrimitive, isPlainObject as isObject, isPlainObject, isPlainObjectOrArray, isPropertyKey, isTypescriptObject, listenAbort, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, parseBigIntString, parseContentEncodings, parseEmptyableJSON, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, safeDecodeURIComponent, safeEncodeURIComponent, sequential, set, setOwn, setSpanAttributeIfDefined, setTracer, sleep, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, stringifyJSON, stripHttpPathPrefix, takeLast, throwIfAborted, toArray, toSpanAttributeValue, toStringOrBytes, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
|
|
26
|
+
export { AbortError, AnyFunction, type Arrayable, type AsyncCleanupFn, AsyncIdQueue, AsyncIdQueueCloseOptions, AsyncIteratorClass, type AsyncIteratorClassNextFn, CompressionEncoding, ConsumeAsyncIteratorOptions, DEFAULT_MAX_BIGINT_DIGITS, DisposableAllAbortSignal, DistributiveOmit, INTEGER_REGEX, InferNextError, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, type IsEqual, MaybeOptionalOptions, NON_NEGATIVE_INTEGER_REGEX, NullProtoObj, ORPC_NAME, OnFinishState, OrderablePlugin, type PartialDeep, Promisable, PromiseWithError, Public, ReadableStreamReadResult, Registry, Segment, SequentialIdGenerator, StartSpanOptions, ThrowableError, TimeoutError, Tracer, TracingAttributeValue, TracingExceptionLevel, TracingHeaders, TracingSpan, Value, WrapAsyncIteratorOptions, WrapReadableStreamOptions, type Writable, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, disposableAllAbortSignal, encodeBase64, estimateCompressibleFormDataSize, estimateUtf8ByteLength, findDeepMatches, get, getConstructor, getConstructors, getOrBind, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isAsyncIteratorObject, isCompressibleContentType, isCompressionEncoding, isDeepEqual, isNoTransformCacheControl, isNonPrimitive, isPlainObject as isObject, isPlainObject, isPlainObjectOrArray, isPropertyKey, isTypescriptObject, listenAbort, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, parseBigIntString, parseContentEncodings, parseEmptyableJSON, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, safeDecodeURIComponent, safeEncodeURIComponent, sequential, set, setOwn, setSpanAttributeIfDefined, setTracer, sleep, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, stringifyJSON, stripHttpPathPrefix, takeLast, throwIfAborted, toArray, toSpanAttributeValue, toStringOrBytes, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { DEFAULT_MAX_BIGINT_DIGITS, parseBigIntString } from "./bigint.js";
|
|
|
4
4
|
export { encodeBase64, loadBytes, toStringOrBytes } from "./buffer.js";
|
|
5
5
|
export { isDeepEqual } from "./compare.js";
|
|
6
6
|
export { ORPC_NAME } from "./consts.js";
|
|
7
|
-
export { isAbortError } from "./error.js";
|
|
7
|
+
export { TimeoutError, isAbortError } from "./error.js";
|
|
8
8
|
export { defer, isAsyncGeneratorFunction, once, tryOrUndefined } from "./function.js";
|
|
9
9
|
export { estimateCompressibleFormDataSize, estimateUtf8ByteLength, isAcceptableEncoding, isCompressibleContentType, isCompressionEncoding, isNoTransformCacheControl, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, normalizeHttpPath, parseAcceptEncodingQualities, parseContentEncodings, pathToHttpPath, stripHttpPathPrefix, varyByAcceptEncoding } from "./http.js";
|
|
10
10
|
export { compareSequentialIds } from "./id.js";
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plugin ordered relative to others by name.
|
|
3
|
+
*
|
|
4
|
+
* `before` and `after` order the `init()` calls, not the interceptors:
|
|
5
|
+
* - A plugin that prepends its interceptor and is initialized later wraps the earlier ones.
|
|
6
|
+
* - A plugin that appends its interceptor and is initialized later runs inside the earlier ones.
|
|
7
|
+
* - A prepended interceptor always wraps an appended one, whatever the init order.
|
|
8
|
+
*/
|
|
1
9
|
export interface OrderablePlugin {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
after
|
|
10
|
+
/**
|
|
11
|
+
* Name other plugins refer to in `before` and `after`.
|
|
12
|
+
* The `~` prefix is reserved for built-in plugins.
|
|
13
|
+
*/
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** Plugins to initialize after this one. Unknown names are ignored. */
|
|
16
|
+
readonly before?: readonly string[] | undefined;
|
|
17
|
+
/** Plugins to initialize before this one. Unknown names are ignored. */
|
|
18
|
+
readonly after?: readonly string[] | undefined;
|
|
8
19
|
}
|
|
9
20
|
/**
|
|
10
|
-
* Sorts plugins
|
|
21
|
+
* Sorts plugins into init order by their `before` and `after`.
|
|
22
|
+
* Throws on a circular dependency.
|
|
11
23
|
*/
|
|
12
|
-
export declare function sortPlugins<T extends OrderablePlugin>(plugins: T[]): T[];
|
|
24
|
+
export declare function sortPlugins<T extends OrderablePlugin>(plugins: readonly T[]): T[];
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/plugin.ts
|
|
2
2
|
/**
|
|
3
|
-
* Sorts plugins
|
|
3
|
+
* Sorts plugins into init order by their `before` and `after`.
|
|
4
|
+
* Throws on a circular dependency.
|
|
4
5
|
*/
|
|
5
6
|
function sortPlugins(plugins) {
|
|
6
7
|
const pluginCount = plugins.length;
|