@orpc/shared 0.0.0-next.865fe1f → 0.0.0-next.8719bd7
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/index.d.mts +10 -12
- package/dist/index.d.ts +10 -12
- package/dist/index.mjs +13 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
|
36
36
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
37
37
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
38
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte
|
|
38
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
|
39
39
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
40
40
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
41
41
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Promisable } from 'type-fest';
|
|
2
|
-
export { IsEqual, IsNever,
|
|
2
|
+
export { IsEqual, IsNever, PartialDeep, Promisable } from 'type-fest';
|
|
3
3
|
export { group, guard, mapEntries, mapValues, omit } from 'radash';
|
|
4
4
|
|
|
5
5
|
type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
|
|
@@ -80,8 +80,8 @@ declare class EventPublisher<T extends Record<PropertyKey, any>> {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
declare class SequentialIdGenerator {
|
|
83
|
-
private
|
|
84
|
-
generate():
|
|
83
|
+
private nextId;
|
|
84
|
+
generate(): number;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
@@ -160,9 +160,7 @@ declare class AsyncIteratorClass<T, TReturn = unknown, TNext = unknown> implemen
|
|
|
160
160
|
declare function replicateAsyncIterator<T, TReturn, TNext>(source: AsyncIterator<T, TReturn, TNext>, count: number): (AsyncIteratorClass<T, TReturn, TNext>)[];
|
|
161
161
|
|
|
162
162
|
declare function parseEmptyableJSON(text: string | null | undefined): unknown;
|
|
163
|
-
declare function stringifyJSON<T>(value: T |
|
|
164
|
-
toJSON(): T;
|
|
165
|
-
}): undefined extends T ? undefined | string : string;
|
|
163
|
+
declare function stringifyJSON<T>(value: T): undefined extends T ? undefined | string : string;
|
|
166
164
|
|
|
167
165
|
type Segment = string | number;
|
|
168
166
|
declare function findDeepMatches(check: (value: unknown) => boolean, payload: unknown, segments?: Segment[], maps?: Segment[][], values?: unknown[]): {
|
|
@@ -185,7 +183,7 @@ declare const NullProtoObj: ({
|
|
|
185
183
|
});
|
|
186
184
|
|
|
187
185
|
interface AsyncIdQueueCloseOptions {
|
|
188
|
-
id?:
|
|
186
|
+
id?: number;
|
|
189
187
|
reason?: unknown;
|
|
190
188
|
}
|
|
191
189
|
declare class AsyncIdQueue<T> {
|
|
@@ -193,12 +191,12 @@ declare class AsyncIdQueue<T> {
|
|
|
193
191
|
private readonly items;
|
|
194
192
|
private readonly pendingPulls;
|
|
195
193
|
get length(): number;
|
|
196
|
-
open(id:
|
|
197
|
-
isOpen(id:
|
|
198
|
-
push(id:
|
|
199
|
-
pull(id:
|
|
194
|
+
open(id: number): void;
|
|
195
|
+
isOpen(id: number): boolean;
|
|
196
|
+
push(id: number, item: T): void;
|
|
197
|
+
pull(id: number): Promise<T>;
|
|
200
198
|
close({ id, reason }?: AsyncIdQueueCloseOptions): void;
|
|
201
|
-
assertOpen(id:
|
|
199
|
+
assertOpen(id: number): void;
|
|
202
200
|
}
|
|
203
201
|
|
|
204
202
|
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Promisable } from 'type-fest';
|
|
2
|
-
export { IsEqual, IsNever,
|
|
2
|
+
export { IsEqual, IsNever, PartialDeep, Promisable } from 'type-fest';
|
|
3
3
|
export { group, guard, mapEntries, mapValues, omit } from 'radash';
|
|
4
4
|
|
|
5
5
|
type MaybeOptionalOptions<TOptions> = Record<never, never> extends TOptions ? [options?: TOptions] : [options: TOptions];
|
|
@@ -80,8 +80,8 @@ declare class EventPublisher<T extends Record<PropertyKey, any>> {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
declare class SequentialIdGenerator {
|
|
83
|
-
private
|
|
84
|
-
generate():
|
|
83
|
+
private nextId;
|
|
84
|
+
generate(): number;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
@@ -160,9 +160,7 @@ declare class AsyncIteratorClass<T, TReturn = unknown, TNext = unknown> implemen
|
|
|
160
160
|
declare function replicateAsyncIterator<T, TReturn, TNext>(source: AsyncIterator<T, TReturn, TNext>, count: number): (AsyncIteratorClass<T, TReturn, TNext>)[];
|
|
161
161
|
|
|
162
162
|
declare function parseEmptyableJSON(text: string | null | undefined): unknown;
|
|
163
|
-
declare function stringifyJSON<T>(value: T |
|
|
164
|
-
toJSON(): T;
|
|
165
|
-
}): undefined extends T ? undefined | string : string;
|
|
163
|
+
declare function stringifyJSON<T>(value: T): undefined extends T ? undefined | string : string;
|
|
166
164
|
|
|
167
165
|
type Segment = string | number;
|
|
168
166
|
declare function findDeepMatches(check: (value: unknown) => boolean, payload: unknown, segments?: Segment[], maps?: Segment[][], values?: unknown[]): {
|
|
@@ -185,7 +183,7 @@ declare const NullProtoObj: ({
|
|
|
185
183
|
});
|
|
186
184
|
|
|
187
185
|
interface AsyncIdQueueCloseOptions {
|
|
188
|
-
id?:
|
|
186
|
+
id?: number;
|
|
189
187
|
reason?: unknown;
|
|
190
188
|
}
|
|
191
189
|
declare class AsyncIdQueue<T> {
|
|
@@ -193,12 +191,12 @@ declare class AsyncIdQueue<T> {
|
|
|
193
191
|
private readonly items;
|
|
194
192
|
private readonly pendingPulls;
|
|
195
193
|
get length(): number;
|
|
196
|
-
open(id:
|
|
197
|
-
isOpen(id:
|
|
198
|
-
push(id:
|
|
199
|
-
pull(id:
|
|
194
|
+
open(id: number): void;
|
|
195
|
+
isOpen(id: number): boolean;
|
|
196
|
+
push(id: number, item: T): void;
|
|
197
|
+
pull(id: number): Promise<T>;
|
|
200
198
|
close({ id, reason }?: AsyncIdQueueCloseOptions): void;
|
|
201
|
-
assertOpen(id:
|
|
199
|
+
assertOpen(id: number): void;
|
|
202
200
|
}
|
|
203
201
|
|
|
204
202
|
type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
|
package/dist/index.mjs
CHANGED
|
@@ -120,7 +120,7 @@ function isAsyncIteratorObject(maybe) {
|
|
|
120
120
|
if (!maybe || typeof maybe !== "object") {
|
|
121
121
|
return false;
|
|
122
122
|
}
|
|
123
|
-
return
|
|
123
|
+
return Symbol.asyncIterator in maybe && typeof maybe[Symbol.asyncIterator] === "function";
|
|
124
124
|
}
|
|
125
125
|
const fallbackAsyncDisposeSymbol = Symbol.for("asyncDispose");
|
|
126
126
|
const asyncDisposeSymbol = Symbol.asyncDispose ?? fallbackAsyncDisposeSymbol;
|
|
@@ -194,8 +194,8 @@ function replicateAsyncIterator(source, count) {
|
|
|
194
194
|
while (true) {
|
|
195
195
|
const item = await source.next();
|
|
196
196
|
for (let id = 0; id < count; id++) {
|
|
197
|
-
if (queue.isOpen(id
|
|
198
|
-
queue.push(id
|
|
197
|
+
if (queue.isOpen(id)) {
|
|
198
|
+
queue.push(id, item);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
if (item.done) {
|
|
@@ -207,12 +207,12 @@ function replicateAsyncIterator(source, count) {
|
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
209
|
for (let id = 0; id < count; id++) {
|
|
210
|
-
queue.open(id
|
|
210
|
+
queue.open(id);
|
|
211
211
|
replicated.push(new AsyncIteratorClass(
|
|
212
212
|
() => {
|
|
213
213
|
start();
|
|
214
214
|
return new Promise((resolve, reject) => {
|
|
215
|
-
queue.pull(id
|
|
215
|
+
queue.pull(id).then(resolve).catch(reject);
|
|
216
216
|
defer(() => {
|
|
217
217
|
if (error) {
|
|
218
218
|
reject(error.value);
|
|
@@ -221,9 +221,9 @@ function replicateAsyncIterator(source, count) {
|
|
|
221
221
|
});
|
|
222
222
|
},
|
|
223
223
|
async (reason) => {
|
|
224
|
-
queue.close({ id
|
|
224
|
+
queue.close({ id });
|
|
225
225
|
if (reason !== "next") {
|
|
226
|
-
if (replicated.every((_, id2) => !queue.isOpen(id2
|
|
226
|
+
if (replicated.every((_, id2) => !queue.isOpen(id2))) {
|
|
227
227
|
await source?.return?.();
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -312,11 +312,13 @@ class EventPublisher {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
class SequentialIdGenerator {
|
|
315
|
-
|
|
315
|
+
nextId = 0;
|
|
316
316
|
generate() {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
if (this.nextId === Number.MAX_SAFE_INTEGER) {
|
|
318
|
+
this.nextId = 0;
|
|
319
|
+
return Number.MAX_SAFE_INTEGER;
|
|
320
|
+
}
|
|
321
|
+
return this.nextId++;
|
|
320
322
|
}
|
|
321
323
|
}
|
|
322
324
|
|
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.8719bd7",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"radash": "^12.1.
|
|
27
|
+
"radash": "^12.1.0",
|
|
28
28
|
"type-fest": "^4.39.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"arktype": "2.1.20",
|
|
32
32
|
"valibot": "^1.1.0",
|
|
33
|
-
"zod": "^3.25.
|
|
33
|
+
"zod": "^3.25.61"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "unbuild",
|