@orpc/shared 1.5.2 → 1.6.0

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
@@ -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), Pinia Colada, and more.
38
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), 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, PartialDeep, Promisable } from 'type-fest';
2
+ export { IsEqual, IsNever, JsonValue, 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 nextId;
84
- generate(): number;
83
+ private index;
84
+ generate(): string;
85
85
  }
86
86
 
87
87
  type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -185,7 +185,7 @@ declare const NullProtoObj: ({
185
185
  });
186
186
 
187
187
  interface AsyncIdQueueCloseOptions {
188
- id?: number;
188
+ id?: string;
189
189
  reason?: unknown;
190
190
  }
191
191
  declare class AsyncIdQueue<T> {
@@ -193,12 +193,12 @@ declare class AsyncIdQueue<T> {
193
193
  private readonly items;
194
194
  private readonly pendingPulls;
195
195
  get length(): number;
196
- open(id: number): void;
197
- isOpen(id: number): boolean;
198
- push(id: number, item: T): void;
199
- pull(id: number): Promise<T>;
196
+ open(id: string): void;
197
+ isOpen(id: string): boolean;
198
+ push(id: string, item: T): void;
199
+ pull(id: string): Promise<T>;
200
200
  close({ id, reason }?: AsyncIdQueueCloseOptions): void;
201
- assertOpen(id: number): void;
201
+ assertOpen(id: string): void;
202
202
  }
203
203
 
204
204
  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, PartialDeep, Promisable } from 'type-fest';
2
+ export { IsEqual, IsNever, JsonValue, 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 nextId;
84
- generate(): number;
83
+ private index;
84
+ generate(): string;
85
85
  }
86
86
 
87
87
  type SetOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -185,7 +185,7 @@ declare const NullProtoObj: ({
185
185
  });
186
186
 
187
187
  interface AsyncIdQueueCloseOptions {
188
- id?: number;
188
+ id?: string;
189
189
  reason?: unknown;
190
190
  }
191
191
  declare class AsyncIdQueue<T> {
@@ -193,12 +193,12 @@ declare class AsyncIdQueue<T> {
193
193
  private readonly items;
194
194
  private readonly pendingPulls;
195
195
  get length(): number;
196
- open(id: number): void;
197
- isOpen(id: number): boolean;
198
- push(id: number, item: T): void;
199
- pull(id: number): Promise<T>;
196
+ open(id: string): void;
197
+ isOpen(id: string): boolean;
198
+ push(id: string, item: T): void;
199
+ pull(id: string): Promise<T>;
200
200
  close({ id, reason }?: AsyncIdQueueCloseOptions): void;
201
- assertOpen(id: number): void;
201
+ assertOpen(id: string): void;
202
202
  }
203
203
 
204
204
  type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T);
package/dist/index.mjs CHANGED
@@ -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, item);
197
+ if (queue.isOpen(id.toString())) {
198
+ queue.push(id.toString(), 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.toString());
211
211
  replicated.push(new AsyncIteratorClass(
212
212
  () => {
213
213
  start();
214
214
  return new Promise((resolve, reject) => {
215
- queue.pull(id).then(resolve).catch(reject);
215
+ queue.pull(id.toString()).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: id.toString() });
225
225
  if (reason !== "next") {
226
- if (replicated.every((_, id2) => !queue.isOpen(id2))) {
226
+ if (replicated.every((_, id2) => !queue.isOpen(id2.toString()))) {
227
227
  await source?.return?.();
228
228
  }
229
229
  }
@@ -312,13 +312,11 @@ class EventPublisher {
312
312
  }
313
313
 
314
314
  class SequentialIdGenerator {
315
- nextId = 0;
315
+ index = BigInt(0);
316
316
  generate() {
317
- if (this.nextId === Number.MAX_SAFE_INTEGER) {
318
- this.nextId = 0;
319
- return Number.MAX_SAFE_INTEGER;
320
- }
321
- return this.nextId++;
317
+ const id = this.index.toString(32);
318
+ this.index++;
319
+ return id;
322
320
  }
323
321
  }
324
322
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/shared",
3
3
  "type": "module",
4
- "version": "1.5.2",
4
+ "version": "1.6.0",
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.0",
27
+ "radash": "^12.1.1",
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.64"
33
+ "zod": "^3.25.67"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "unbuild",