@orpc/shared 2.0.0-beta.42 → 2.0.0-beta.44

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 CHANGED
@@ -17,7 +17,7 @@
17
17
  <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
18
18
  </a>
19
19
  <a href="https://deepwiki.com/middleapi/orpc">
20
- <img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
20
+ <img alt="Ask DeepWiki" src="https://img.shields.io/badge/Ask-DeepWiki-blue" />
21
21
  </a>
22
22
  </div>
23
23
 
@@ -95,14 +95,6 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
95
95
  </tr>
96
96
  </table>
97
97
 
98
- ### Special Sponsors
99
-
100
- <table>
101
- <tr>
102
- <td align="center"><a href="http://twitter.com/rauchg?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Guillermo Rauch"><img src="https://avatars.githubusercontent.com/u/13041?u=1ee8d111657cdd02ff6d253df00978d17ee6d722&amp;v=4" width="279" alt="Guillermo Rauch"/><br />Guillermo Rauch</a></td>
103
- </tr>
104
- </table>
105
-
106
98
  ### Premium Sponsors
107
99
 
108
100
  <table>
@@ -178,7 +170,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
178
170
  </tr>
179
171
  </table>
180
172
 
181
- With thanks to [38 past sponsors](https://orpc.dev/sponsors#past-sponsors) who helped get oRPC here.
173
+ With thanks to [39 past sponsors](https://orpc.dev/sponsors#past-sponsors) who helped get oRPC here.
182
174
 
183
175
  ## References
184
176
 
package/dist/index.d.mts CHANGED
@@ -8,6 +8,16 @@ declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>):
8
8
 
9
9
  declare function splitInHalf<T>(arr: readonly T[]): [T[], T[]];
10
10
 
11
+ /**
12
+ * Default maximum digits, excluding a leading `-`, when parsing a `bigint` from a string.
13
+ */
14
+ declare const DEFAULT_MAX_BIGINT_DIGITS = 4300;
15
+ /**
16
+ * Parses a `bigint.toString()` string, or returns `undefined` if it is invalid or has more than `maxDigits` digits.
17
+ * The length is checked first, since `BigInt()` is super-linear in the digit count.
18
+ */
19
+ declare function parseBigIntString(value: string, maxDigits: number): bigint | undefined;
20
+
11
21
  /**
12
22
  * Load Request/Response/Blob/File/.. to a buffer (Uint8Array<ArrayBuffer>).
13
23
  *
@@ -473,5 +483,5 @@ declare function asyncIteratorToStream<T>(iterator: AsyncIterator<T>): ReadableS
473
483
  */
474
484
  declare function asyncIteratorToUnproxiedDataStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
475
485
 
476
- export { AsyncIdQueue, NullProtoObj, ORPC_NAME, allAbortSignal, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, findDeepMatches, get, getConstructor, getConstructors, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isCompressibleContentType, isDeepEqual, isNoTransformCacheControl, isPlainObject, isPropertyKey, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, set, setOwn, setSpanAttributeIfDefined, setTracer, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, toSpanAttributeValue, toStringOrBytes, toTracingException, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
486
+ export { AsyncIdQueue, DEFAULT_MAX_BIGINT_DIGITS, NullProtoObj, ORPC_NAME, allAbortSignal, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, findDeepMatches, get, getConstructor, getConstructors, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isCompressibleContentType, isDeepEqual, isNoTransformCacheControl, isPlainObject, isPropertyKey, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, parseBigIntString, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, set, setOwn, setSpanAttributeIfDefined, setTracer, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, toSpanAttributeValue, toStringOrBytes, toTracingException, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
477
487
  export type { AnyFunction, AsyncIdQueueCloseOptions, ConsumeAsyncIteratorOptions, DistributiveOmit, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, MaybeOptionalOptions, OnFinishState, OrderablePlugin, PromiseWithError, Public, ReadableStreamReadResult, Registry, Segment, StartSpanOptions, ThrowableError, Tracer, TracingAttributeValue, TracingException, TracingExceptionLevel, TracingHeaders, TracingSpan, Value, WrapAsyncIteratorOptions, WrapReadableStreamOptions };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,16 @@ declare function resolveMaybeOptionalOptions<T>(rest: MaybeOptionalOptions<T>):
8
8
 
9
9
  declare function splitInHalf<T>(arr: readonly T[]): [T[], T[]];
10
10
 
11
+ /**
12
+ * Default maximum digits, excluding a leading `-`, when parsing a `bigint` from a string.
13
+ */
14
+ declare const DEFAULT_MAX_BIGINT_DIGITS = 4300;
15
+ /**
16
+ * Parses a `bigint.toString()` string, or returns `undefined` if it is invalid or has more than `maxDigits` digits.
17
+ * The length is checked first, since `BigInt()` is super-linear in the digit count.
18
+ */
19
+ declare function parseBigIntString(value: string, maxDigits: number): bigint | undefined;
20
+
11
21
  /**
12
22
  * Load Request/Response/Blob/File/.. to a buffer (Uint8Array<ArrayBuffer>).
13
23
  *
@@ -473,5 +483,5 @@ declare function asyncIteratorToStream<T>(iterator: AsyncIterator<T>): ReadableS
473
483
  */
474
484
  declare function asyncIteratorToUnproxiedDataStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
475
485
 
476
- export { AsyncIdQueue, NullProtoObj, ORPC_NAME, allAbortSignal, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, findDeepMatches, get, getConstructor, getConstructors, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isCompressibleContentType, isDeepEqual, isNoTransformCacheControl, isPlainObject, isPropertyKey, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, set, setOwn, setSpanAttributeIfDefined, setTracer, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, toSpanAttributeValue, toStringOrBytes, toTracingException, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
486
+ export { AsyncIdQueue, DEFAULT_MAX_BIGINT_DIGITS, NullProtoObj, ORPC_NAME, allAbortSignal, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, findDeepMatches, get, getConstructor, getConstructors, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isCompressibleContentType, isDeepEqual, isNoTransformCacheControl, isPlainObject, isPropertyKey, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, parseBigIntString, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, set, setOwn, setSpanAttributeIfDefined, setTracer, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, toSpanAttributeValue, toStringOrBytes, toTracingException, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
477
487
  export type { AnyFunction, AsyncIdQueueCloseOptions, ConsumeAsyncIteratorOptions, DistributiveOmit, InterceptableOptions, Interceptor, InterceptorOptions, IntersectPick, MaybeOptionalOptions, OnFinishState, OrderablePlugin, PromiseWithError, Public, ReadableStreamReadResult, Registry, Segment, StartSpanOptions, ThrowableError, Tracer, TracingAttributeValue, TracingException, TracingExceptionLevel, TracingHeaders, TracingSpan, Value, WrapAsyncIteratorOptions, WrapReadableStreamOptions };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { safeDecodeURIComponent, safeEncodeURIComponent, AbortError, AsyncIteratorClass, getOrBind, isTypescriptObject, isAsyncIteratorObject, throwIfAborted } from '@standard-server/shared';
1
+ import { getOrBind, isTypescriptObject, safeDecodeURIComponent, safeEncodeURIComponent, AbortError, AsyncIteratorClass, isAsyncIteratorObject, throwIfAborted } from '@standard-server/shared';
2
2
  export { AbortError, AsyncIteratorClass, SequentialIdGenerator, getOrBind, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, safeDecodeURIComponent, safeEncodeURIComponent, sequential, sleep, stringifyJSON, throwIfAborted, toArray } from '@standard-server/shared';
3
3
 
4
4
  function resolveMaybeOptionalOptions(rest) {
@@ -10,6 +10,16 @@ function splitInHalf(arr) {
10
10
  return [arr.slice(0, half), arr.slice(half)];
11
11
  }
12
12
 
13
+ const DEFAULT_MAX_BIGINT_DIGITS = 4300;
14
+ const BIGINT_PATTERN = /^-?(?:0|[1-9]\d*)$/;
15
+ function parseBigIntString(value, maxDigits) {
16
+ const digits = value.startsWith("-") ? value.length - 1 : value.length;
17
+ if (digits > maxDigits || !BIGINT_PATTERN.test(value)) {
18
+ return void 0;
19
+ }
20
+ return BigInt(value);
21
+ }
22
+
13
23
  async function loadBytes(source) {
14
24
  if (typeof source.bytes === "function") {
15
25
  return source.bytes();
@@ -55,27 +65,219 @@ function concatBytes(items) {
55
65
  return result;
56
66
  }
57
67
 
58
- function isDeepEqual(a, b) {
59
- return isDeepEqualInternal(a, b, /* @__PURE__ */ new WeakMap());
68
+ function findDeepMatches(check, payload, segments = [], maps = [], values = []) {
69
+ if (check(payload)) {
70
+ maps.push(segments);
71
+ values.push(payload);
72
+ } else if (Array.isArray(payload)) {
73
+ payload.forEach((v, i) => {
74
+ findDeepMatches(check, v, [...segments, i], maps, values);
75
+ });
76
+ } else if (isPlainObject(payload)) {
77
+ for (const key of Object.keys(payload)) {
78
+ findDeepMatches(check, payload[key], [...segments, key], maps, values);
79
+ }
80
+ }
81
+ return { maps, values };
60
82
  }
61
- function isDeepEqualInternal(a, b, visited) {
62
- if (Object.is(a, b)) {
63
- return true;
83
+ function getConstructor(value) {
84
+ if (!isTypescriptObject(value)) {
85
+ return null;
64
86
  }
65
- if (typeof a !== typeof b) {
66
- return false;
87
+ return Object.getPrototypeOf(value)?.constructor;
88
+ }
89
+ function* getConstructors(value) {
90
+ if (!isTypescriptObject(value)) {
91
+ return;
67
92
  }
68
- if (a === null || typeof a !== "object") {
69
- return false;
93
+ let proto = Object.getPrototypeOf(value);
94
+ while (proto != null) {
95
+ if (proto.constructor) {
96
+ yield proto.constructor;
97
+ }
98
+ proto = Object.getPrototypeOf(proto);
70
99
  }
71
- if (b === null || typeof b !== "object") {
100
+ }
101
+ function isPlainObject(value) {
102
+ if (!value || typeof value !== "object") {
72
103
  return false;
73
104
  }
74
- const isArray = Array.isArray(a);
75
- if (isArray !== Array.isArray(b)) {
76
- return false;
105
+ const proto = Object.getPrototypeOf(value);
106
+ return proto === Object.prototype || !proto || !proto.constructor;
107
+ }
108
+ function getOwn(object, key) {
109
+ return Object.hasOwn(object, key) ? object[key] : void 0;
110
+ }
111
+ function get(object, path) {
112
+ let current = object;
113
+ for (const key of path) {
114
+ if (!isTypescriptObject(current)) {
115
+ return void 0;
116
+ }
117
+ current = getOwn(current, key);
118
+ }
119
+ return current;
120
+ }
121
+ function set(root, path, value) {
122
+ let current = root;
123
+ for (let i = 0; i < path.length - 1; i++) {
124
+ const key = path[i];
125
+ const next = getOwn(current, key);
126
+ if (!isTypescriptObject(next)) {
127
+ const child = {};
128
+ setOwn(current, key, child);
129
+ current = child;
130
+ } else {
131
+ current = next;
132
+ }
133
+ }
134
+ setOwn(current, path.at(-1), value);
135
+ }
136
+ function setOwn(object, key, value) {
137
+ if (key === "__proto__") {
138
+ Object.defineProperty(object, key, {
139
+ value,
140
+ writable: true,
141
+ enumerable: true,
142
+ configurable: true
143
+ });
144
+ } else {
145
+ object[key] = value;
146
+ }
147
+ }
148
+ function mergeTwoLevels(first, second) {
149
+ if (!isPlainObject(first) || !isPlainObject(second)) {
150
+ return second;
151
+ }
152
+ const result = { ...first, ...second };
153
+ for (const key of Object.keys(second)) {
154
+ if (!Object.hasOwn(first, key)) {
155
+ continue;
156
+ }
157
+ const firstValue = first[key];
158
+ const secondValue = second[key];
159
+ if (isPlainObject(firstValue) && isPlainObject(secondValue)) {
160
+ result[key] = { ...firstValue, ...secondValue };
161
+ }
162
+ }
163
+ return result;
164
+ }
165
+ function omit(obj, keys) {
166
+ const result = { ...obj };
167
+ for (const key of keys) {
168
+ delete result[key];
169
+ }
170
+ return result;
171
+ }
172
+ function pick(obj, keys) {
173
+ const result = {};
174
+ for (const key of keys) {
175
+ if (Object.hasOwn(obj, key)) {
176
+ result[key] = obj[key];
177
+ }
178
+ }
179
+ return result;
180
+ }
181
+ function clone(value) {
182
+ return cloneWithVisited(value, /* @__PURE__ */ new WeakMap());
183
+ }
184
+ function cloneWithVisited(value, visited) {
185
+ if (Array.isArray(value)) {
186
+ const existing = visited.get(value);
187
+ if (existing) {
188
+ return existing;
189
+ }
190
+ const result = [];
191
+ visited.set(value, result);
192
+ for (const item of value) {
193
+ result.push(cloneWithVisited(item, visited));
194
+ }
195
+ return result;
196
+ }
197
+ if (isPlainObject(value)) {
198
+ const existing = visited.get(value);
199
+ if (existing) {
200
+ return existing;
201
+ }
202
+ const result = {};
203
+ visited.set(value, result);
204
+ for (const key of Object.keys(value)) {
205
+ setOwn(result, key, cloneWithVisited(value[key], visited));
206
+ }
207
+ for (const sym of Object.getOwnPropertySymbols(value)) {
208
+ setOwn(result, sym, cloneWithVisited(value[sym], visited));
209
+ }
210
+ return result;
211
+ }
212
+ return value;
213
+ }
214
+ function copyOnWrite(parent, key, original) {
215
+ const value = parent[key];
216
+ if (value !== original) {
217
+ return value;
218
+ }
219
+ let copy;
220
+ if (Array.isArray(value)) {
221
+ copy = value.slice();
222
+ } else if (isPlainObject(value)) {
223
+ copy = { ...value };
224
+ } else {
225
+ return value;
226
+ }
227
+ setOwn(parent, key, copy);
228
+ return copy;
229
+ }
230
+ function isPropertyKey(value) {
231
+ const type = typeof value;
232
+ return type === "string" || type === "number" || type === "symbol";
233
+ }
234
+ const NullProtoObj = /* @__PURE__ */ (() => {
235
+ const e = function() {
236
+ };
237
+ e.prototype = /* @__PURE__ */ Object.create(null);
238
+ Object.freeze(e.prototype);
239
+ return e;
240
+ })();
241
+ function bindMethods(obj, options = {}) {
242
+ const unbound = new Set(options.unbound);
243
+ const methods = new NullProtoObj();
244
+ let current = obj;
245
+ while (current && current !== Object.prototype) {
246
+ for (const key of Object.getOwnPropertyNames(current)) {
247
+ if (key === "constructor" || key in methods) {
248
+ continue;
249
+ }
250
+ const val = getOrBind(obj, key, { bind: !unbound.has(key) });
251
+ if (typeof val === "function") {
252
+ methods[key] = val;
253
+ }
254
+ }
255
+ for (const sym of Object.getOwnPropertySymbols(current)) {
256
+ if (sym in methods) {
257
+ continue;
258
+ }
259
+ const val = getOrBind(obj, sym, { bind: !unbound.has(sym) });
260
+ if (typeof val === "function") {
261
+ methods[sym] = val;
262
+ }
263
+ }
264
+ current = Object.getPrototypeOf(current);
265
+ }
266
+ return methods;
267
+ }
268
+
269
+ function isDeepEqual(a, b) {
270
+ return isDeepEqualInternal(a, b, /* @__PURE__ */ new WeakMap());
271
+ }
272
+ function isDeepEqualInternal(a, b, visited) {
273
+ if (Object.is(a, b)) {
274
+ return true;
77
275
  }
78
- if (isArray && a.length !== b.length) {
276
+ if (Array.isArray(a)) {
277
+ if (!Array.isArray(b) || a.length !== b.length) {
278
+ return false;
279
+ }
280
+ } else if (!isPlainObject(a) || !isPlainObject(b)) {
79
281
  return false;
80
282
  }
81
283
  const aRecord = a;
@@ -534,207 +736,6 @@ function override(target, partial) {
534
736
  return proxy;
535
737
  }
536
738
 
537
- function findDeepMatches(check, payload, segments = [], maps = [], values = []) {
538
- if (check(payload)) {
539
- maps.push(segments);
540
- values.push(payload);
541
- } else if (Array.isArray(payload)) {
542
- payload.forEach((v, i) => {
543
- findDeepMatches(check, v, [...segments, i], maps, values);
544
- });
545
- } else if (isPlainObject(payload)) {
546
- for (const key of Object.keys(payload)) {
547
- findDeepMatches(check, payload[key], [...segments, key], maps, values);
548
- }
549
- }
550
- return { maps, values };
551
- }
552
- function getConstructor(value) {
553
- if (!isTypescriptObject(value)) {
554
- return null;
555
- }
556
- return Object.getPrototypeOf(value)?.constructor;
557
- }
558
- function* getConstructors(value) {
559
- if (!isTypescriptObject(value)) {
560
- return;
561
- }
562
- let proto = Object.getPrototypeOf(value);
563
- while (proto != null) {
564
- if (proto.constructor) {
565
- yield proto.constructor;
566
- }
567
- proto = Object.getPrototypeOf(proto);
568
- }
569
- }
570
- function isPlainObject(value) {
571
- if (!value || typeof value !== "object") {
572
- return false;
573
- }
574
- const proto = Object.getPrototypeOf(value);
575
- return proto === Object.prototype || !proto || !proto.constructor;
576
- }
577
- function getOwn(object, key) {
578
- return Object.hasOwn(object, key) ? object[key] : void 0;
579
- }
580
- function get(object, path) {
581
- let current = object;
582
- for (const key of path) {
583
- if (!isTypescriptObject(current)) {
584
- return void 0;
585
- }
586
- current = getOwn(current, key);
587
- }
588
- return current;
589
- }
590
- function set(root, path, value) {
591
- let current = root;
592
- for (let i = 0; i < path.length - 1; i++) {
593
- const key = path[i];
594
- const next = getOwn(current, key);
595
- if (!isTypescriptObject(next)) {
596
- const child = {};
597
- setOwn(current, key, child);
598
- current = child;
599
- } else {
600
- current = next;
601
- }
602
- }
603
- setOwn(current, path.at(-1), value);
604
- }
605
- function setOwn(object, key, value) {
606
- if (key === "__proto__") {
607
- Object.defineProperty(object, key, {
608
- value,
609
- writable: true,
610
- enumerable: true,
611
- configurable: true
612
- });
613
- } else {
614
- object[key] = value;
615
- }
616
- }
617
- function mergeTwoLevels(first, second) {
618
- if (!isPlainObject(first) || !isPlainObject(second)) {
619
- return second;
620
- }
621
- const result = { ...first, ...second };
622
- for (const key of Object.keys(second)) {
623
- if (!Object.hasOwn(first, key)) {
624
- continue;
625
- }
626
- const firstValue = first[key];
627
- const secondValue = second[key];
628
- if (isPlainObject(firstValue) && isPlainObject(secondValue)) {
629
- result[key] = { ...firstValue, ...secondValue };
630
- }
631
- }
632
- return result;
633
- }
634
- function omit(obj, keys) {
635
- const result = { ...obj };
636
- for (const key of keys) {
637
- delete result[key];
638
- }
639
- return result;
640
- }
641
- function pick(obj, keys) {
642
- const result = {};
643
- for (const key of keys) {
644
- if (Object.hasOwn(obj, key)) {
645
- result[key] = obj[key];
646
- }
647
- }
648
- return result;
649
- }
650
- function clone(value) {
651
- return cloneWithVisited(value, /* @__PURE__ */ new WeakMap());
652
- }
653
- function cloneWithVisited(value, visited) {
654
- if (Array.isArray(value)) {
655
- const existing = visited.get(value);
656
- if (existing) {
657
- return existing;
658
- }
659
- const result = [];
660
- visited.set(value, result);
661
- for (const item of value) {
662
- result.push(cloneWithVisited(item, visited));
663
- }
664
- return result;
665
- }
666
- if (isPlainObject(value)) {
667
- const existing = visited.get(value);
668
- if (existing) {
669
- return existing;
670
- }
671
- const result = {};
672
- visited.set(value, result);
673
- for (const key of Object.keys(value)) {
674
- setOwn(result, key, cloneWithVisited(value[key], visited));
675
- }
676
- for (const sym of Object.getOwnPropertySymbols(value)) {
677
- setOwn(result, sym, cloneWithVisited(value[sym], visited));
678
- }
679
- return result;
680
- }
681
- return value;
682
- }
683
- function copyOnWrite(parent, key, original) {
684
- const value = parent[key];
685
- if (value !== original) {
686
- return value;
687
- }
688
- let copy;
689
- if (Array.isArray(value)) {
690
- copy = value.slice();
691
- } else if (isPlainObject(value)) {
692
- copy = { ...value };
693
- } else {
694
- return value;
695
- }
696
- setOwn(parent, key, copy);
697
- return copy;
698
- }
699
- function isPropertyKey(value) {
700
- const type = typeof value;
701
- return type === "string" || type === "number" || type === "symbol";
702
- }
703
- const NullProtoObj = /* @__PURE__ */ (() => {
704
- const e = function() {
705
- };
706
- e.prototype = /* @__PURE__ */ Object.create(null);
707
- Object.freeze(e.prototype);
708
- return e;
709
- })();
710
- function bindMethods(obj, options = {}) {
711
- const unbound = new Set(options.unbound);
712
- const methods = new NullProtoObj();
713
- let current = obj;
714
- while (current && current !== Object.prototype) {
715
- for (const key of Object.getOwnPropertyNames(current)) {
716
- if (key === "constructor" || key in methods) {
717
- continue;
718
- }
719
- const val = getOrBind(obj, key, { bind: !unbound.has(key) });
720
- if (typeof val === "function") {
721
- methods[key] = val;
722
- }
723
- }
724
- for (const sym of Object.getOwnPropertySymbols(current)) {
725
- if (sym in methods) {
726
- continue;
727
- }
728
- const val = getOrBind(obj, sym, { bind: !unbound.has(sym) });
729
- if (typeof val === "function") {
730
- methods[sym] = val;
731
- }
732
- }
733
- current = Object.getPrototypeOf(current);
734
- }
735
- return methods;
736
- }
737
-
738
739
  function promiseWithResolvers() {
739
740
  const result = {};
740
741
  result.promise = new Promise((resolve, reject) => {
@@ -1097,4 +1098,4 @@ async function runWithSignal(signal, fn) {
1097
1098
  }
1098
1099
  }
1099
1100
 
1100
- export { AsyncIdQueue, NullProtoObj, ORPC_NAME, allAbortSignal, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, findDeepMatches, get, getConstructor, getConstructors, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isCompressibleContentType, isDeepEqual, isNoTransformCacheControl, isPlainObject, isPropertyKey, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, set, setOwn, setSpanAttributeIfDefined, setTracer, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, toSpanAttributeValue, toStringOrBytes, toTracingException, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
1101
+ export { AsyncIdQueue, DEFAULT_MAX_BIGINT_DIGITS, NullProtoObj, ORPC_NAME, allAbortSignal, anyAbortSignal, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, bindMethods, captureAsyncContext, clone, compareSequentialIds, consumeAsyncIterator, copyOnWrite, defer, findDeepMatches, get, getConstructor, getConstructors, getOwn, getTracer, intercept, isAbortError, isAcceptableEncoding, isAsyncGeneratorFunction, isCompressibleContentType, isDeepEqual, isNoTransformCacheControl, isPlainObject, isPropertyKey, loadBytes, matchesHttpPath, matchesHttpPathPrefix, mergeHttpPath, mergeTwoLevels, normalizeHttpPath, omit, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, once, override, parseAcceptEncodingQualities, parseBigIntString, pathToHttpPath, pick, promiseWithResolvers, recordSpanError, replicateAsyncIterator, replicateReadableStream, resolveMaybeOptionalOptions, runInSpanContext, runWithSignal, runWithSpan, set, setOwn, setSpanAttributeIfDefined, setTracer, sortPlugins, splitInHalf, startSpan, streamToAsyncIteratorObject, toSpanAttributeValue, toStringOrBytes, toTracingException, traceAsyncIterator, traceReadableStream, tryOrUndefined, value, varyByAcceptEncoding, wrapAsyncIterator, wrapReadableStream };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/shared",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.42",
4
+ "version": "2.0.0-beta.44",
5
5
  "description": "Internal utilities shared across oRPC packages",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -30,14 +30,14 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@standard-server/shared": "~0.10.1",
33
+ "@standard-server/shared": "~0.10.3",
34
34
  "radash": "^12.1.1",
35
- "type-fest": "^5.3.1"
35
+ "type-fest": "^5.10.0"
36
36
  },
37
37
  "devDependencies": {
38
- "arktype": "^2.2.1",
38
+ "arktype": "^2.2.8",
39
39
  "valibot": "^1.5.0",
40
- "zod": "^4.5.4"
40
+ "zod": "^4.6.5"
41
41
  },
42
42
  "scripts": {
43
43
  "type:check": "tsc -b"