@orpc/shared 1.15.6 → 1.15.7
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/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.mjs +12 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,16 @@ declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>):
|
|
|
9
9
|
declare function toArray<T>(value: T): T extends readonly any[] ? T : Exclude<T, undefined | null>[];
|
|
10
10
|
declare function splitInHalf<T>(arr: readonly T[]): [T[], T[]];
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Default maximum digits, excluding a leading `-`, when parsing a `bigint` from a string.
|
|
14
|
+
*/
|
|
15
|
+
declare const DEFAULT_MAX_BIGINT_DIGITS = 4300;
|
|
16
|
+
/**
|
|
17
|
+
* Parses a `bigint.toString()` string, or returns `undefined` if it is invalid or has more than `maxDigits` digits.
|
|
18
|
+
* The length is checked first, since `BigInt()` is super-linear in the digit count.
|
|
19
|
+
*/
|
|
20
|
+
declare function parseBigIntString(value: string, maxDigits: number): bigint | undefined;
|
|
21
|
+
|
|
12
22
|
/**
|
|
13
23
|
* Converts Request/Response/Blob/File/.. to a buffer (ArrayBuffer or Uint8Array).
|
|
14
24
|
*
|
|
@@ -30,7 +40,7 @@ type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
|
30
40
|
|
|
31
41
|
declare const ORPC_NAME = "orpc";
|
|
32
42
|
declare const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
|
|
33
|
-
declare const ORPC_SHARED_PACKAGE_VERSION = "1.15.
|
|
43
|
+
declare const ORPC_SHARED_PACKAGE_VERSION = "1.15.7";
|
|
34
44
|
|
|
35
45
|
/**
|
|
36
46
|
* Error thrown when an operation is aborted.
|
|
@@ -379,5 +389,5 @@ declare function asyncIteratorToUnproxiedDataStream<T>(iterator: AsyncIterator<T
|
|
|
379
389
|
|
|
380
390
|
declare function tryDecodeURIComponent(value: string): string;
|
|
381
391
|
|
|
382
|
-
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, copyOnWrite, createLazyRegExp, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, isValidRegExpFlags, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setOwn, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
392
|
+
export { AbortError, AsyncIdQueue, AsyncIteratorClass, DEFAULT_MAX_BIGINT_DIGITS, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, copyOnWrite, createLazyRegExp, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, isValidRegExpFlags, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseBigIntString, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setOwn, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
383
393
|
export type { AnyFunction, AsyncIdQueueCloseOptions, AsyncIteratorClassCleanupFn, AsyncIteratorClassNextFn, AsyncIteratorWithSpanOptions, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, InferAsyncIterableYield, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, MaybeOptionalOptions, OmitChainMethodDeep, OnFinishState, OtelConfig, PromiseWithError, Registry, RunWithSpanOptions, Segment, SetOptional, SetSpanErrorOptions, ThrowableError, Value };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,16 @@ declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>):
|
|
|
9
9
|
declare function toArray<T>(value: T): T extends readonly any[] ? T : Exclude<T, undefined | null>[];
|
|
10
10
|
declare function splitInHalf<T>(arr: readonly T[]): [T[], T[]];
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Default maximum digits, excluding a leading `-`, when parsing a `bigint` from a string.
|
|
14
|
+
*/
|
|
15
|
+
declare const DEFAULT_MAX_BIGINT_DIGITS = 4300;
|
|
16
|
+
/**
|
|
17
|
+
* Parses a `bigint.toString()` string, or returns `undefined` if it is invalid or has more than `maxDigits` digits.
|
|
18
|
+
* The length is checked first, since `BigInt()` is super-linear in the digit count.
|
|
19
|
+
*/
|
|
20
|
+
declare function parseBigIntString(value: string, maxDigits: number): bigint | undefined;
|
|
21
|
+
|
|
12
22
|
/**
|
|
13
23
|
* Converts Request/Response/Blob/File/.. to a buffer (ArrayBuffer or Uint8Array).
|
|
14
24
|
*
|
|
@@ -30,7 +40,7 @@ type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
|
30
40
|
|
|
31
41
|
declare const ORPC_NAME = "orpc";
|
|
32
42
|
declare const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
|
|
33
|
-
declare const ORPC_SHARED_PACKAGE_VERSION = "1.15.
|
|
43
|
+
declare const ORPC_SHARED_PACKAGE_VERSION = "1.15.7";
|
|
34
44
|
|
|
35
45
|
/**
|
|
36
46
|
* Error thrown when an operation is aborted.
|
|
@@ -379,5 +389,5 @@ declare function asyncIteratorToUnproxiedDataStream<T>(iterator: AsyncIterator<T
|
|
|
379
389
|
|
|
380
390
|
declare function tryDecodeURIComponent(value: string): string;
|
|
381
391
|
|
|
382
|
-
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, copyOnWrite, createLazyRegExp, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, isValidRegExpFlags, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setOwn, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
392
|
+
export { AbortError, AsyncIdQueue, AsyncIteratorClass, DEFAULT_MAX_BIGINT_DIGITS, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, copyOnWrite, createLazyRegExp, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, isValidRegExpFlags, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseBigIntString, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setOwn, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
383
393
|
export type { AnyFunction, AsyncIdQueueCloseOptions, AsyncIteratorClassCleanupFn, AsyncIteratorClassNextFn, AsyncIteratorWithSpanOptions, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, InferAsyncIterableYield, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, MaybeOptionalOptions, OmitChainMethodDeep, OnFinishState, OtelConfig, PromiseWithError, Registry, RunWithSpanOptions, Segment, SetOptional, SetSpanErrorOptions, ThrowableError, Value };
|
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,16 @@ function splitInHalf(arr) {
|
|
|
12
12
|
return [arr.slice(0, half), arr.slice(half)];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
const DEFAULT_MAX_BIGINT_DIGITS = 4300;
|
|
16
|
+
const BIGINT_PATTERN = /^-?(?:0|[1-9]\d*)$/;
|
|
17
|
+
function parseBigIntString(value, maxDigits) {
|
|
18
|
+
const digits = value.startsWith("-") ? value.length - 1 : value.length;
|
|
19
|
+
if (digits > maxDigits || !BIGINT_PATTERN.test(value)) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
return BigInt(value);
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
function readAsBuffer(source) {
|
|
16
26
|
if (typeof source.bytes === "function") {
|
|
17
27
|
return source.bytes();
|
|
@@ -21,7 +31,7 @@ function readAsBuffer(source) {
|
|
|
21
31
|
|
|
22
32
|
const ORPC_NAME = "orpc";
|
|
23
33
|
const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
|
|
24
|
-
const ORPC_SHARED_PACKAGE_VERSION = "1.15.
|
|
34
|
+
const ORPC_SHARED_PACKAGE_VERSION = "1.15.7";
|
|
25
35
|
|
|
26
36
|
class AbortError extends Error {
|
|
27
37
|
constructor(...rest) {
|
|
@@ -790,4 +800,4 @@ function tryDecodeURIComponent(value) {
|
|
|
790
800
|
}
|
|
791
801
|
}
|
|
792
802
|
|
|
793
|
-
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, copyOnWrite, createLazyRegExp, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, isValidRegExpFlags, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setOwn, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
803
|
+
export { AbortError, AsyncIdQueue, AsyncIteratorClass, DEFAULT_MAX_BIGINT_DIGITS, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, copyOnWrite, createLazyRegExp, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, isValidRegExpFlags, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseBigIntString, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setOwn, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|