@orpc/shared 0.0.0-next.03cefb3 → 0.0.0-next.057d007
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 +6 -20
- package/dist/index.d.ts +6 -20
- package/dist/index.mjs +14 -30
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Promisable } from 'type-fest';
|
|
2
2
|
export { IsEqual, IsNever, JsonValue, PartialDeep, Promisable } from 'type-fest';
|
|
3
3
|
import { Tracer, TraceAPI, ContextAPI, PropagationAPI, SpanOptions, Context, Span, AttributeValue, Exception } from '@opentelemetry/api';
|
|
4
|
-
export { group, guard, mapEntries, mapValues, omit
|
|
4
|
+
export { group, guard, mapEntries, mapValues, omit } from 'radash';
|
|
5
5
|
|
|
6
6
|
type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
|
|
7
7
|
declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>): T;
|
|
@@ -30,7 +30,7 @@ type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
|
30
30
|
|
|
31
31
|
declare const ORPC_NAME = "orpc";
|
|
32
32
|
declare const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
|
|
33
|
-
declare const ORPC_SHARED_PACKAGE_VERSION = "0.0.0-next.
|
|
33
|
+
declare const ORPC_SHARED_PACKAGE_VERSION = "0.0.0-next.057d007";
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Error thrown when an operation is aborted.
|
|
@@ -283,29 +283,12 @@ declare const NullProtoObj: ({
|
|
|
283
283
|
new <T extends Record<PropertyKey, unknown>>(): T;
|
|
284
284
|
});
|
|
285
285
|
|
|
286
|
-
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
|
|
287
|
-
declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): T extends Value<infer U, any> ? U : never;
|
|
288
|
-
/**
|
|
289
|
-
* Returns the value if it is defined, otherwise returns the fallback
|
|
290
|
-
*/
|
|
291
|
-
declare function fallback<T>(value: T | undefined, fallback: T): T;
|
|
292
|
-
|
|
293
286
|
/**
|
|
294
287
|
* Prevents objects from being awaitable by intercepting the `then` method
|
|
295
288
|
* when called by the native await mechanism. This is useful for preventing
|
|
296
289
|
* accidental awaiting of objects that aren't meant to be promises.
|
|
297
290
|
*/
|
|
298
291
|
declare function preventNativeAwait<T extends object>(target: T): T;
|
|
299
|
-
/**
|
|
300
|
-
* Create a proxy that overlays one object (`overlay`) on top of another (`target`).
|
|
301
|
-
*
|
|
302
|
-
* - Properties from `overlay` take precedence.
|
|
303
|
-
* - Properties not in `overlay` fall back to `target`.
|
|
304
|
-
* - Methods from either object are bound to `overlay` so `this` is consistent.
|
|
305
|
-
*
|
|
306
|
-
* Useful when you want to override or extend behavior without fully copying/merging objects.
|
|
307
|
-
*/
|
|
308
|
-
declare function overlayProxy<T extends object, U extends object>(target: Value<T>, partial: U): U & Omit<T, keyof U>;
|
|
309
292
|
|
|
310
293
|
interface AsyncIdQueueCloseOptions {
|
|
311
294
|
id?: string;
|
|
@@ -331,5 +314,8 @@ declare function asyncIteratorToStream<T>(iterator: AsyncIterator<T>): ReadableS
|
|
|
331
314
|
|
|
332
315
|
declare function tryDecodeURIComponent(value: string): string;
|
|
333
316
|
|
|
334
|
-
|
|
317
|
+
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
|
|
318
|
+
declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): T extends Value<infer U, any> ? U : never;
|
|
319
|
+
|
|
320
|
+
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorWithSpan, clone, defer, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
335
321
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Promisable } from 'type-fest';
|
|
2
2
|
export { IsEqual, IsNever, JsonValue, PartialDeep, Promisable } from 'type-fest';
|
|
3
3
|
import { Tracer, TraceAPI, ContextAPI, PropagationAPI, SpanOptions, Context, Span, AttributeValue, Exception } from '@opentelemetry/api';
|
|
4
|
-
export { group, guard, mapEntries, mapValues, omit
|
|
4
|
+
export { group, guard, mapEntries, mapValues, omit } from 'radash';
|
|
5
5
|
|
|
6
6
|
type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
|
|
7
7
|
declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>): T;
|
|
@@ -30,7 +30,7 @@ type OmitChainMethodDeep<T extends object, K extends keyof any> = {
|
|
|
30
30
|
|
|
31
31
|
declare const ORPC_NAME = "orpc";
|
|
32
32
|
declare const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
|
|
33
|
-
declare const ORPC_SHARED_PACKAGE_VERSION = "0.0.0-next.
|
|
33
|
+
declare const ORPC_SHARED_PACKAGE_VERSION = "0.0.0-next.057d007";
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Error thrown when an operation is aborted.
|
|
@@ -283,29 +283,12 @@ declare const NullProtoObj: ({
|
|
|
283
283
|
new <T extends Record<PropertyKey, unknown>>(): T;
|
|
284
284
|
});
|
|
285
285
|
|
|
286
|
-
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
|
|
287
|
-
declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): T extends Value<infer U, any> ? U : never;
|
|
288
|
-
/**
|
|
289
|
-
* Returns the value if it is defined, otherwise returns the fallback
|
|
290
|
-
*/
|
|
291
|
-
declare function fallback<T>(value: T | undefined, fallback: T): T;
|
|
292
|
-
|
|
293
286
|
/**
|
|
294
287
|
* Prevents objects from being awaitable by intercepting the `then` method
|
|
295
288
|
* when called by the native await mechanism. This is useful for preventing
|
|
296
289
|
* accidental awaiting of objects that aren't meant to be promises.
|
|
297
290
|
*/
|
|
298
291
|
declare function preventNativeAwait<T extends object>(target: T): T;
|
|
299
|
-
/**
|
|
300
|
-
* Create a proxy that overlays one object (`overlay`) on top of another (`target`).
|
|
301
|
-
*
|
|
302
|
-
* - Properties from `overlay` take precedence.
|
|
303
|
-
* - Properties not in `overlay` fall back to `target`.
|
|
304
|
-
* - Methods from either object are bound to `overlay` so `this` is consistent.
|
|
305
|
-
*
|
|
306
|
-
* Useful when you want to override or extend behavior without fully copying/merging objects.
|
|
307
|
-
*/
|
|
308
|
-
declare function overlayProxy<T extends object, U extends object>(target: Value<T>, partial: U): U & Omit<T, keyof U>;
|
|
309
292
|
|
|
310
293
|
interface AsyncIdQueueCloseOptions {
|
|
311
294
|
id?: string;
|
|
@@ -331,5 +314,8 @@ declare function asyncIteratorToStream<T>(iterator: AsyncIterator<T>): ReadableS
|
|
|
331
314
|
|
|
332
315
|
declare function tryDecodeURIComponent(value: string): string;
|
|
333
316
|
|
|
334
|
-
|
|
317
|
+
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
|
|
318
|
+
declare function value<T, TArgs extends any[]>(value: Value<T, TArgs>, ...args: NoInfer<TArgs>): T extends Value<infer U, any> ? U : never;
|
|
319
|
+
|
|
320
|
+
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorWithSpan, clone, defer, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
335
321
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { group, guard, mapEntries, mapValues, omit
|
|
1
|
+
export { group, guard, mapEntries, mapValues, omit } from 'radash';
|
|
2
2
|
|
|
3
3
|
function resolveMaybeOptionalOptions(rest) {
|
|
4
4
|
return rest[0] ?? {};
|
|
@@ -21,7 +21,7 @@ function readAsBuffer(source) {
|
|
|
21
21
|
|
|
22
22
|
const ORPC_NAME = "orpc";
|
|
23
23
|
const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
|
|
24
|
-
const ORPC_SHARED_PACKAGE_VERSION = "0.0.0-next.
|
|
24
|
+
const ORPC_SHARED_PACKAGE_VERSION = "0.0.0-next.057d007";
|
|
25
25
|
|
|
26
26
|
class AbortError extends Error {
|
|
27
27
|
constructor(...rest) {
|
|
@@ -593,24 +593,14 @@ const NullProtoObj = /* @__PURE__ */ (() => {
|
|
|
593
593
|
return e;
|
|
594
594
|
})();
|
|
595
595
|
|
|
596
|
-
function value(value2, ...args) {
|
|
597
|
-
if (typeof value2 === "function") {
|
|
598
|
-
return value2(...args);
|
|
599
|
-
}
|
|
600
|
-
return value2;
|
|
601
|
-
}
|
|
602
|
-
function fallback(value2, fallback2) {
|
|
603
|
-
return value2 === void 0 ? fallback2 : value2;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
596
|
function preventNativeAwait(target) {
|
|
607
597
|
return new Proxy(target, {
|
|
608
598
|
get(target2, prop, receiver) {
|
|
609
|
-
const
|
|
610
|
-
if (prop !== "then" || typeof
|
|
611
|
-
return
|
|
599
|
+
const value = Reflect.get(target2, prop, receiver);
|
|
600
|
+
if (prop !== "then" || typeof value !== "function") {
|
|
601
|
+
return value;
|
|
612
602
|
}
|
|
613
|
-
return new Proxy(
|
|
603
|
+
return new Proxy(value, {
|
|
614
604
|
apply(targetFn, thisArg, args) {
|
|
615
605
|
if (args.length !== 2 || args.some((arg) => !isNativeFunction(arg))) {
|
|
616
606
|
return Reflect.apply(targetFn, thisArg, args);
|
|
@@ -634,19 +624,6 @@ const NATIVE_FUNCTION_REGEX = /^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s
|
|
|
634
624
|
function isNativeFunction(fn) {
|
|
635
625
|
return typeof fn === "function" && NATIVE_FUNCTION_REGEX.test(fn.toString());
|
|
636
626
|
}
|
|
637
|
-
function overlayProxy(target, partial) {
|
|
638
|
-
const proxy = new Proxy(typeof target === "function" ? partial : target, {
|
|
639
|
-
get(_, prop) {
|
|
640
|
-
const targetValue = prop in partial ? partial : value(target);
|
|
641
|
-
const v = Reflect.get(targetValue, prop);
|
|
642
|
-
return typeof v === "function" ? v.bind(targetValue) : v;
|
|
643
|
-
},
|
|
644
|
-
has(_, prop) {
|
|
645
|
-
return Reflect.has(partial, prop) || Reflect.has(value(target), prop);
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
return proxy;
|
|
649
|
-
}
|
|
650
627
|
|
|
651
628
|
function streamToAsyncIteratorClass(stream) {
|
|
652
629
|
const reader = stream.getReader();
|
|
@@ -683,4 +660,11 @@ function tryDecodeURIComponent(value) {
|
|
|
683
660
|
}
|
|
684
661
|
}
|
|
685
662
|
|
|
686
|
-
|
|
663
|
+
function value(value2, ...args) {
|
|
664
|
+
if (typeof value2 === "function") {
|
|
665
|
+
return value2(...args);
|
|
666
|
+
}
|
|
667
|
+
return value2;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorWithSpan, clone, defer, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, onError, onFinish, onStart, onSuccess, once, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.057d007",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@opentelemetry/api": "^1.9.0",
|
|
40
|
-
"arktype": "2.1.
|
|
40
|
+
"arktype": "2.1.21",
|
|
41
41
|
"valibot": "^1.1.0",
|
|
42
|
-
"zod": "^4.1.
|
|
42
|
+
"zod": "^4.1.5"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "unbuild",
|