@orpc/shared 1.15.1 β 1.15.3
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 -80
- package/dist/index.d.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.mjs +78 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,86 +72,7 @@ Provides shared utilities for oRPC packages.
|
|
|
72
72
|
|
|
73
73
|
If you find oRPC valuable and would like to support its development, you can do so here: [GitHub Sponsors](https://github.com/sponsors/dinwwwh).
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<table>
|
|
78
|
-
<tr>
|
|
79
|
-
<td align="center"><a href="https://screenshotone.com/?ref=orpc" target="_blank" rel="sponsored noopener" title="ScreenshotOne.com"><img src="https://avatars.githubusercontent.com/u/97035603?v=4" width="279" alt="ScreenshotOne.com"/><br />ScreenshotOne.com</a></td>
|
|
80
|
-
</tr>
|
|
81
|
-
</table>
|
|
82
|
-
|
|
83
|
-
### π₯ Silver Sponsor
|
|
84
|
-
|
|
85
|
-
<table>
|
|
86
|
-
<tr>
|
|
87
|
-
<td align="center"><a href="https://misskey.io/?ref=orpc" target="_blank" rel="sponsored noopener" title="ζδΈγγ"><img src="https://avatars.githubusercontent.com/u/37681609?u=0dd4c7e4ba937cbb52b068c55914b1d8164dc0c7&v=4" width="209" alt="ζδΈγγ"/><br />ζδΈγγ</a></td>
|
|
88
|
-
</tr>
|
|
89
|
-
</table>
|
|
90
|
-
|
|
91
|
-
### Generous Sponsors
|
|
92
|
-
|
|
93
|
-
<table>
|
|
94
|
-
<tr>
|
|
95
|
-
<td align="center"><a href="https://github.com/ln-markets?ref=orpc" target="_blank" rel="sponsored noopener" title="LN Markets"><img src="https://avatars.githubusercontent.com/u/70597625?v=4" width="167" alt="LN Markets"/><br />LN Markets</a></td>
|
|
96
|
-
</tr>
|
|
97
|
-
</table>
|
|
98
|
-
|
|
99
|
-
### Sponsors
|
|
100
|
-
|
|
101
|
-
<table>
|
|
102
|
-
<tr>
|
|
103
|
-
<td align="center"><a href="https://github.com/hrmcdonald?ref=orpc" target="_blank" rel="sponsored noopener" title="Reece McDonald"><img src="https://avatars.githubusercontent.com/u/39349270?v=4" width="139" alt="Reece McDonald"/><br />Reece McDonald</a></td>
|
|
104
|
-
<td align="center"><a href="https://github.com/u1-liquid?ref=orpc" target="_blank" rel="sponsored noopener" title="γγγγγ¨γΌγ«γ
"><img src="https://avatars.githubusercontent.com/u/17376330?u=de3353804be889f009f7e0a1582daf04d0ab292d&v=4" width="139" alt="γγγγγ¨γΌγ«γ
"/><br />γγγγγ¨γΌγ«γ
</a></td>
|
|
105
|
-
<td align="center"><a href="https://github.com/nicognaW?ref=orpc" target="_blank" rel="sponsored noopener" title="nk"><img src="https://avatars.githubusercontent.com/u/66731869?u=4699bda3a9092d3ec34fbd959450767bcc8b8b6d&v=4" width="139" alt="nk"/><br />nk</a></td>
|
|
106
|
-
<td align="center"><a href="https://github.com/supastarter?ref=orpc" target="_blank" rel="sponsored noopener" title="supastarter"><img src="https://avatars.githubusercontent.com/u/110960143?v=4" width="139" alt="supastarter"/><br />supastarter</a></td>
|
|
107
|
-
<td align="center"><a href="https://github.com/divmgl?ref=orpc" target="_blank" rel="sponsored noopener" title="Dexter Miguel"><img src="https://avatars.githubusercontent.com/u/5452298?u=645993204be8696c085ecf0d228c3062efe2ed65&v=4" width="139" alt="Dexter Miguel"/><br />Dexter Miguel</a></td>
|
|
108
|
-
<td align="center"><a href="https://github.com/herrfugbaum?ref=orpc" target="_blank" rel="sponsored noopener" title="herrfugbaum"><img src="https://avatars.githubusercontent.com/u/12859776?u=644dc1666d0220bc0468eb0de3c56b919f635b16&v=4" width="139" alt="herrfugbaum"/><br />herrfugbaum</a></td>
|
|
109
|
-
</tr>
|
|
110
|
-
<tr>
|
|
111
|
-
<td align="center"><a href="https://github.com/ryota-murakami?ref=orpc" target="_blank" rel="sponsored noopener" title="Ryota Murakami"><img src="https://avatars.githubusercontent.com/u/5501268?u=599389e03340734325726ca3f8f423c021d47d7f&v=4" width="139" alt="Ryota Murakami"/><br />Ryota Murakami</a></td>
|
|
112
|
-
<td align="center"><a href="https://github.com/dcramer?ref=orpc" target="_blank" rel="sponsored noopener" title="David Cramer"><img src="https://avatars.githubusercontent.com/u/23610?v=4" width="139" alt="David Cramer"/><br />David Cramer</a></td>
|
|
113
|
-
<td align="center"><a href="https://github.com/valerii15298?ref=orpc" target="_blank" rel="sponsored noopener" title="Valerii Petryniak"><img src="https://avatars.githubusercontent.com/u/44531564?u=88ac74d9bacd20401518441907acad21063cd397&v=4" width="139" alt="Valerii Petryniak"/><br />Valerii Petryniak</a></td>
|
|
114
|
-
<td align="center"><a href="https://github.com/letstri?ref=orpc" target="_blank" rel="sponsored noopener" title="Valerii Strilets"><img src="https://avatars.githubusercontent.com/u/13253748?u=c7b10399ccc8f8081e24db94ec32cd9858e86ac3&v=4" width="139" alt="Valerii Strilets"/><br />Valerii Strilets</a></td>
|
|
115
|
-
<td align="center"><a href="https://github.com/K-Mistele?ref=orpc" target="_blank" rel="sponsored noopener" title="Kyle Mistele"><img src="https://avatars.githubusercontent.com/u/18430555?u=3afebeb81de666e35aaac3ed46f14159d7603ffb&v=4" width="139" alt="Kyle Mistele"/><br />Kyle Mistele</a></td>
|
|
116
|
-
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="sponsored noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
|
|
117
|
-
</tr>
|
|
118
|
-
<tr>
|
|
119
|
-
<td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="sponsored noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
120
|
-
<td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="sponsored noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&v=4" width="139" alt="shota"/><br />shota</a></td>
|
|
121
|
-
<td align="center"><a href="https://github.com/ellis-driscoll?ref=orpc" target="_blank" rel="sponsored noopener" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&v=4" width="139" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
|
|
122
|
-
<td align="center"><a href="https://github.com/hoangbn?ref=orpc" target="_blank" rel="sponsored noopener" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&v=4" width="139" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
|
|
123
|
-
</tr>
|
|
124
|
-
</table>
|
|
125
|
-
|
|
126
|
-
### Backers
|
|
127
|
-
|
|
128
|
-
<table>
|
|
129
|
-
<tr>
|
|
130
|
-
<td align="center"><a href="https://github.com/rhinodavid?ref=orpc" target="_blank" rel="sponsored noopener" title="David Walsh"><img src="https://avatars.githubusercontent.com/u/5778036?u=b5521f07d2f88c3db2a0dae62b5f2f8357214af0&v=4" width="119" alt="David Walsh"/><br />David Walsh</a></td>
|
|
131
|
-
<td align="center"><a href="https://github.com/Robbe95?ref=orpc" target="_blank" rel="sponsored noopener" title="Robbe Vaes"><img src="https://avatars.githubusercontent.com/u/44748019?u=e0232402c045ad4eac7cbd217f1f47e083103b89&v=4" width="119" alt="Robbe Vaes"/><br />Robbe Vaes</a></td>
|
|
132
|
-
<td align="center"><a href="https://github.com/aidansunbury?ref=orpc" target="_blank" rel="sponsored noopener" title="Aidan Sunbury"><img src="https://avatars.githubusercontent.com/u/64103161?v=4" width="119" alt="Aidan Sunbury"/><br />Aidan Sunbury</a></td>
|
|
133
|
-
<td align="center"><a href="https://github.com/soonoo?ref=orpc" target="_blank" rel="sponsored noopener" title="soonoo"><img src="https://avatars.githubusercontent.com/u/5436405?u=5d0b4aa955c87e30e6bda7f0cccae5402da99528&v=4" width="119" alt="soonoo"/><br />soonoo</a></td>
|
|
134
|
-
<td align="center"><a href="https://github.com/kporten?ref=orpc" target="_blank" rel="sponsored noopener" title="Kevin Porten"><img src="https://avatars.githubusercontent.com/u/1839345?u=dc2263d5cfe0d927ce1a0be04a1d55dd6b55405c&v=4" width="119" alt="Kevin Porten"/><br />Kevin Porten</a></td>
|
|
135
|
-
<td align="center"><a href="https://github.com/pumpkinlink?ref=orpc" target="_blank" rel="sponsored noopener" title="Denis"><img src="https://avatars.githubusercontent.com/u/11864620?u=5f47bbe6c65d0f6f5cf011021490238e4b0593d0&v=4" width="119" alt="Denis"/><br />Denis</a></td>
|
|
136
|
-
<td align="center"><a href="https://github.com/christopher-kapic?ref=orpc" target="_blank" rel="sponsored noopener" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
|
|
137
|
-
</tr>
|
|
138
|
-
<tr>
|
|
139
|
-
<td align="center"><a href="https://github.com/thomasballinger?ref=orpc" target="_blank" rel="sponsored noopener" title="Tom Ballinger"><img src="https://avatars.githubusercontent.com/u/458879?u=4b045ac75d721b6ac2b42a74d7d37f61f0414031&v=4" width="119" alt="Tom Ballinger"/><br />Tom Ballinger</a></td>
|
|
140
|
-
<td align="center"><a href="https://github.com/SSam0419?ref=orpc" target="_blank" rel="sponsored noopener" title="Sam"><img src="https://avatars.githubusercontent.com/u/102863520?u=3c89611f549d5070be232eb4532f690c8f2e7a65&v=4" width="119" alt="Sam"/><br />Sam</a></td>
|
|
141
|
-
<td align="center"><a href="https://github.com/Titoine?ref=orpc" target="_blank" rel="sponsored noopener" title="Titoine"><img src="https://avatars.githubusercontent.com/u/3514286?u=1bb1e86b0c99c8a1121372e56d51a177eea12191&v=4" width="119" alt="Titoine"/><br />Titoine</a></td>
|
|
142
|
-
<td align="center"><a href="https://github.com/Mnigos?ref=orpc" target="_blank" rel="sponsored noopener" title="Igor Makowski"><img src="https://avatars.githubusercontent.com/u/56691628?u=ee8c879478f7c151b9156aef6c74243fa3e247a8&v=4" width="119" alt="Igor Makowski"/><br />Igor Makowski</a></td>
|
|
143
|
-
<td align="center"><a href="https://github.com/hanayashiki?ref=orpc" target="_blank" rel="sponsored noopener" title="hanayashiki"><img src="https://avatars.githubusercontent.com/u/26056783?u=06c3b9205a16fd41a871e82da1cc2a09306d53f5&v=4" width="119" alt="hanayashiki"/><br />hanayashiki</a></td>
|
|
144
|
-
<td align="center"><a href="https://github.com/ldub?ref=orpc" target="_blank" rel="sponsored noopener" title="Lev Dubinets"><img src="https://avatars.githubusercontent.com/u/3114081?u=f547f5d5012cab54851f1b1ad72d10e537f78fc2&v=4" width="119" alt="Lev Dubinets"/><br />Lev Dubinets</a></td>
|
|
145
|
-
<td align="center"><a href="https://github.com/mr-kelly?ref=orpc" target="_blank" rel="sponsored noopener" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
|
|
146
|
-
</tr>
|
|
147
|
-
<tr>
|
|
148
|
-
<td align="center"><a href="https://github.com/guyariely?ref=orpc" target="_blank" rel="sponsored noopener" title="Guy Ariely"><img src="https://avatars.githubusercontent.com/u/42813496?u=edb6b7f563bf28e160a290832e7da57c0506f8ca&v=4" width="119" alt="Guy Ariely"/><br />Guy Ariely</a></td>
|
|
149
|
-
<td align="center"><a href="https://github.com/piscis?ref=orpc" target="_blank" rel="sponsored noopener" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&v=4" width="119" alt="Alex"/><br />Alex</a></td>
|
|
150
|
-
<td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="sponsored noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=c5f2daf7ebece498e85c83367bb37b4e10e2649d&v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
|
|
151
|
-
</tr>
|
|
152
|
-
</table>
|
|
153
|
-
|
|
154
|
-
With thanks to 37 past sponsors who helped get oRPC here.
|
|
75
|
+
[](https://htmlpreview.github.io/?https://github.com/middleapi/static/blob/main/sponsors.svg)
|
|
155
76
|
|
|
156
77
|
## License
|
|
157
78
|
|
package/dist/index.d.mts
CHANGED
|
@@ -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 = "1.15.
|
|
33
|
+
declare const ORPC_SHARED_PACKAGE_VERSION = "1.15.3";
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Error thrown when an operation is aborted.
|
|
@@ -288,6 +288,8 @@ declare function isObject(value: unknown): value is Record<PropertyKey, unknown>
|
|
|
288
288
|
declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>;
|
|
289
289
|
declare function clone<T>(value: T): T;
|
|
290
290
|
declare function get(object: unknown, path: readonly PropertyKey[]): unknown;
|
|
291
|
+
declare function setOwn(object: object, key: PropertyKey, value: unknown): void;
|
|
292
|
+
declare function copyOnWrite(parent: object, key: PropertyKey, original: unknown): unknown;
|
|
291
293
|
declare function isPropertyKey(value: unknown): value is PropertyKey;
|
|
292
294
|
declare const NullProtoObj: ({
|
|
293
295
|
new <T extends Record<PropertyKey, unknown>>(): T;
|
|
@@ -336,6 +338,31 @@ declare class AsyncIdQueue<T> {
|
|
|
336
338
|
assertOpen(id: string): void;
|
|
337
339
|
}
|
|
338
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Checks whether `flags` is a valid RegExp flags string without compiling a RegExp.
|
|
343
|
+
*/
|
|
344
|
+
declare function isValidRegExpFlags(flags: string): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Creates a RegExp that is only compiled on first use.
|
|
347
|
+
*
|
|
348
|
+
* Compiling a RegExp can be expensive (unicode property escapes cost milliseconds each),
|
|
349
|
+
* and the source comes from the wire. Deferring the compile means a request that is
|
|
350
|
+
* rejected before the value is touched, for example by an auth middleware, never pays for it.
|
|
351
|
+
*
|
|
352
|
+
* The returned value passes `instanceof RegExp` and forwards every property access and
|
|
353
|
+
* method call to the compiled RegExp. A syntax error in `pattern` is thrown on first use,
|
|
354
|
+
* not here.
|
|
355
|
+
*
|
|
356
|
+
* Reads that a fresh RegExp could answer without its pattern never compile: `lastIndex`
|
|
357
|
+
* (0 until written), and properties that do not exist on a RegExp such as `then`, `toJSON`
|
|
358
|
+
* or inspection symbols. So awaiting, `JSON.stringify` and logging the value are free.
|
|
359
|
+
*
|
|
360
|
+
* Known differences from a native RegExp: it has no own properties
|
|
361
|
+
* (`Object.hasOwn(value, 'lastIndex')` is false), `Object.freeze` is not supported,
|
|
362
|
+
* `structuredClone` rejects it, and Node's `util.types.isRegExp` returns false.
|
|
363
|
+
*/
|
|
364
|
+
declare function createLazyRegExp(pattern: string, flags: string): RegExp;
|
|
365
|
+
|
|
339
366
|
/**
|
|
340
367
|
* Converts a `ReadableStream` into an `AsyncIteratorClass`.
|
|
341
368
|
*/
|
|
@@ -352,5 +379,5 @@ declare function asyncIteratorToUnproxiedDataStream<T>(iterator: AsyncIterator<T
|
|
|
352
379
|
|
|
353
380
|
declare function tryDecodeURIComponent(value: string): string;
|
|
354
381
|
|
|
355
|
-
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
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 };
|
|
356
383
|
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
|
@@ -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 = "1.15.
|
|
33
|
+
declare const ORPC_SHARED_PACKAGE_VERSION = "1.15.3";
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Error thrown when an operation is aborted.
|
|
@@ -288,6 +288,8 @@ declare function isObject(value: unknown): value is Record<PropertyKey, unknown>
|
|
|
288
288
|
declare function isTypescriptObject(value: unknown): value is object & Record<PropertyKey, unknown>;
|
|
289
289
|
declare function clone<T>(value: T): T;
|
|
290
290
|
declare function get(object: unknown, path: readonly PropertyKey[]): unknown;
|
|
291
|
+
declare function setOwn(object: object, key: PropertyKey, value: unknown): void;
|
|
292
|
+
declare function copyOnWrite(parent: object, key: PropertyKey, original: unknown): unknown;
|
|
291
293
|
declare function isPropertyKey(value: unknown): value is PropertyKey;
|
|
292
294
|
declare const NullProtoObj: ({
|
|
293
295
|
new <T extends Record<PropertyKey, unknown>>(): T;
|
|
@@ -336,6 +338,31 @@ declare class AsyncIdQueue<T> {
|
|
|
336
338
|
assertOpen(id: string): void;
|
|
337
339
|
}
|
|
338
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Checks whether `flags` is a valid RegExp flags string without compiling a RegExp.
|
|
343
|
+
*/
|
|
344
|
+
declare function isValidRegExpFlags(flags: string): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Creates a RegExp that is only compiled on first use.
|
|
347
|
+
*
|
|
348
|
+
* Compiling a RegExp can be expensive (unicode property escapes cost milliseconds each),
|
|
349
|
+
* and the source comes from the wire. Deferring the compile means a request that is
|
|
350
|
+
* rejected before the value is touched, for example by an auth middleware, never pays for it.
|
|
351
|
+
*
|
|
352
|
+
* The returned value passes `instanceof RegExp` and forwards every property access and
|
|
353
|
+
* method call to the compiled RegExp. A syntax error in `pattern` is thrown on first use,
|
|
354
|
+
* not here.
|
|
355
|
+
*
|
|
356
|
+
* Reads that a fresh RegExp could answer without its pattern never compile: `lastIndex`
|
|
357
|
+
* (0 until written), and properties that do not exist on a RegExp such as `then`, `toJSON`
|
|
358
|
+
* or inspection symbols. So awaiting, `JSON.stringify` and logging the value are free.
|
|
359
|
+
*
|
|
360
|
+
* Known differences from a native RegExp: it has no own properties
|
|
361
|
+
* (`Object.hasOwn(value, 'lastIndex')` is false), `Object.freeze` is not supported,
|
|
362
|
+
* `structuredClone` rejects it, and Node's `util.types.isRegExp` returns false.
|
|
363
|
+
*/
|
|
364
|
+
declare function createLazyRegExp(pattern: string, flags: string): RegExp;
|
|
365
|
+
|
|
339
366
|
/**
|
|
340
367
|
* Converts a `ReadableStream` into an `AsyncIteratorClass`.
|
|
341
368
|
*/
|
|
@@ -352,5 +379,5 @@ declare function asyncIteratorToUnproxiedDataStream<T>(iterator: AsyncIterator<T
|
|
|
352
379
|
|
|
353
380
|
declare function tryDecodeURIComponent(value: string): string;
|
|
354
381
|
|
|
355
|
-
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
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 };
|
|
356
383
|
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
|
@@ -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 = "1.15.
|
|
24
|
+
const ORPC_SHARED_PACKAGE_VERSION = "1.15.3";
|
|
25
25
|
|
|
26
26
|
class AbortError extends Error {
|
|
27
27
|
constructor(...rest) {
|
|
@@ -596,6 +596,34 @@ function get(object, path) {
|
|
|
596
596
|
}
|
|
597
597
|
return current;
|
|
598
598
|
}
|
|
599
|
+
function setOwn(object, key, value) {
|
|
600
|
+
if (key === "__proto__") {
|
|
601
|
+
Object.defineProperty(object, key, {
|
|
602
|
+
value,
|
|
603
|
+
writable: true,
|
|
604
|
+
enumerable: true,
|
|
605
|
+
configurable: true
|
|
606
|
+
});
|
|
607
|
+
} else {
|
|
608
|
+
object[key] = value;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function copyOnWrite(parent, key, original) {
|
|
612
|
+
const value = parent[key];
|
|
613
|
+
if (value !== original) {
|
|
614
|
+
return value;
|
|
615
|
+
}
|
|
616
|
+
let copy;
|
|
617
|
+
if (Array.isArray(value)) {
|
|
618
|
+
copy = value.slice();
|
|
619
|
+
} else if (isObject(value)) {
|
|
620
|
+
copy = { ...value };
|
|
621
|
+
} else {
|
|
622
|
+
return value;
|
|
623
|
+
}
|
|
624
|
+
setOwn(parent, key, copy);
|
|
625
|
+
return copy;
|
|
626
|
+
}
|
|
599
627
|
function isPropertyKey(value) {
|
|
600
628
|
const type = typeof value;
|
|
601
629
|
return type === "string" || type === "number" || type === "symbol";
|
|
@@ -663,6 +691,54 @@ function overlayProxy(target, partial) {
|
|
|
663
691
|
return proxy;
|
|
664
692
|
}
|
|
665
693
|
|
|
694
|
+
const REGEXP_FLAGS = /^[dgimsuvy]*$/;
|
|
695
|
+
function isValidRegExpFlags(flags) {
|
|
696
|
+
return REGEXP_FLAGS.test(flags) && new Set(flags).size === flags.length && !(flags.includes("u") && flags.includes("v"));
|
|
697
|
+
}
|
|
698
|
+
function createLazyRegExp(pattern, flags) {
|
|
699
|
+
let compiled;
|
|
700
|
+
let lastIndex = 0;
|
|
701
|
+
const compile = () => {
|
|
702
|
+
if (compiled === void 0) {
|
|
703
|
+
compiled = new RegExp(pattern, flags);
|
|
704
|
+
compiled.lastIndex = lastIndex;
|
|
705
|
+
}
|
|
706
|
+
return compiled;
|
|
707
|
+
};
|
|
708
|
+
return new Proxy(Object.create(RegExp.prototype), {
|
|
709
|
+
get(_, prop) {
|
|
710
|
+
if (prop === Symbol.toStringTag) {
|
|
711
|
+
return "RegExp";
|
|
712
|
+
}
|
|
713
|
+
if (compiled === void 0) {
|
|
714
|
+
if (prop === "lastIndex") {
|
|
715
|
+
return lastIndex;
|
|
716
|
+
}
|
|
717
|
+
if (!(prop in RegExp.prototype)) {
|
|
718
|
+
return void 0;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const target = compile();
|
|
722
|
+
const value = Reflect.get(target, prop, target);
|
|
723
|
+
return typeof value === "function" && prop !== "constructor" ? value.bind(target) : value;
|
|
724
|
+
},
|
|
725
|
+
set(_, prop, value) {
|
|
726
|
+
if (compiled === void 0 && prop === "lastIndex") {
|
|
727
|
+
lastIndex = value;
|
|
728
|
+
return true;
|
|
729
|
+
}
|
|
730
|
+
const target = compile();
|
|
731
|
+
return Reflect.set(target, prop, value, target);
|
|
732
|
+
},
|
|
733
|
+
has(_, prop) {
|
|
734
|
+
if (compiled === void 0) {
|
|
735
|
+
return prop === "lastIndex" || prop in RegExp.prototype;
|
|
736
|
+
}
|
|
737
|
+
return Reflect.has(compiled, prop);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
|
|
666
742
|
function streamToAsyncIteratorClass(stream) {
|
|
667
743
|
const reader = stream.getReader();
|
|
668
744
|
return new AsyncIteratorClass(
|
|
@@ -714,4 +790,4 @@ function tryDecodeURIComponent(value) {
|
|
|
714
790
|
}
|
|
715
791
|
}
|
|
716
792
|
|
|
717
|
-
export { AbortError, AsyncIdQueue, AsyncIteratorClass, EventPublisher, NullProtoObj, ORPC_NAME, ORPC_SHARED_PACKAGE_NAME, ORPC_SHARED_PACKAGE_VERSION, SequentialIdGenerator, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorWithSpan, clone, compareSequentialIds, defer, fallback, findDeepMatches, get, getConstructor, getGlobalOtelConfig, intercept, isAsyncIteratorObject, isObject, isPropertyKey, isTypescriptObject, logError, onError, onFinish, onStart, onSuccess, once, overlayProxy, parseEmptyableJSON, preventNativeAwait, readAsBuffer, replicateAsyncIterator, resolveMaybeOptionalOptions, runInSpanContext, runWithSpan, sequential, setGlobalOtelConfig, setSpanAttribute, setSpanError, splitInHalf, startSpan, streamToAsyncIteratorClass, stringifyJSON, toArray, toOtelException, toSpanAttributeValue, tryDecodeURIComponent, value };
|
|
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 };
|