@orpc/client 0.0.0-next.32f3296 → 0.0.0-next.33ca37d

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.
@@ -1,5 +1,5 @@
1
1
  import { toFetchRequest, toStandardLazyResponse } from '@orpc/standard-server-fetch';
2
- import { b as StandardRPCJsonSerializer, c as StandardRPCLinkCodec, d as StandardRPCSerializer, S as StandardLink } from '../../shared/client.d_qAa5GQ.mjs';
2
+ import { b as StandardRPCJsonSerializer, c as StandardRPCLinkCodec, d as StandardRPCSerializer, S as StandardLink } from '../../shared/client.CPmBUYbj.mjs';
3
3
  import '@orpc/shared';
4
4
  import '../../shared/client.XAn8cDTM.mjs';
5
5
  import '@orpc/standard-server';
@@ -78,8 +78,8 @@ declare const STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES: {
78
78
  readonly SET: 6;
79
79
  readonly MAP: 7;
80
80
  };
81
- type StandardRPCJsonSerializedMeta = [number, Segment[]][];
82
- type StandardRPCJsonSerialized = [json: unknown, meta: StandardRPCJsonSerializedMeta, maps: Segment[][], blobs: Blob[]];
81
+ type StandardRPCJsonSerializedMetaItem = readonly [type: number, ...path: Segment[]];
82
+ type StandardRPCJsonSerialized = [json: unknown, meta: StandardRPCJsonSerializedMetaItem[], maps: Segment[][], blobs: Blob[]];
83
83
  interface StandardRPCCustomJsonSerializer {
84
84
  type: number;
85
85
  condition(data: unknown): boolean;
@@ -92,9 +92,9 @@ interface StandardRPCJsonSerializerOptions {
92
92
  declare class StandardRPCJsonSerializer {
93
93
  private readonly customSerializers;
94
94
  constructor(options?: StandardRPCJsonSerializerOptions);
95
- serialize(data: unknown, segments?: Segment[], meta?: StandardRPCJsonSerializedMeta, maps?: Segment[][], blobs?: Blob[]): StandardRPCJsonSerialized;
96
- deserialize(json: unknown, meta: StandardRPCJsonSerializedMeta): unknown;
97
- deserialize(json: unknown, meta: StandardRPCJsonSerializedMeta, maps: Segment[][], getBlob: (index: number) => Blob): unknown;
95
+ serialize(data: unknown, segments?: Segment[], meta?: StandardRPCJsonSerializedMetaItem[], maps?: Segment[][], blobs?: Blob[]): StandardRPCJsonSerialized;
96
+ deserialize(json: unknown, meta: readonly StandardRPCJsonSerializedMetaItem[]): unknown;
97
+ deserialize(json: unknown, meta: readonly StandardRPCJsonSerializedMetaItem[], maps: readonly Segment[][], getBlob: (index: number) => Blob): unknown;
98
98
  }
99
99
 
100
100
  declare class StandardRPCSerializer {
@@ -166,4 +166,4 @@ declare class StandardRPCLinkCodec<T extends ClientContext> implements StandardL
166
166
  interface StandardRPCLinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardRPCLinkCodecOptions<T>, StandardRPCJsonSerializerOptions {
167
167
  }
168
168
 
169
- export { InvalidEventIteratorRetryResponse, STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, StandardLink, type StandardLinkClient, type StandardLinkCodec, type StandardLinkOptions, type StandardRPCCustomJsonSerializer, type StandardRPCJsonSerialized, type StandardRPCJsonSerializedMeta, StandardRPCJsonSerializer, type StandardRPCJsonSerializerOptions, StandardRPCLinkCodec, type StandardRPCLinkCodecOptions, type StandardRPCLinkOptions, StandardRPCSerializer };
169
+ export { InvalidEventIteratorRetryResponse, STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, StandardLink, type StandardLinkClient, type StandardLinkCodec, type StandardLinkOptions, type StandardRPCCustomJsonSerializer, type StandardRPCJsonSerialized, type StandardRPCJsonSerializedMetaItem, StandardRPCJsonSerializer, type StandardRPCJsonSerializerOptions, StandardRPCLinkCodec, type StandardRPCLinkCodecOptions, type StandardRPCLinkOptions, StandardRPCSerializer };
@@ -78,8 +78,8 @@ declare const STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES: {
78
78
  readonly SET: 6;
79
79
  readonly MAP: 7;
80
80
  };
81
- type StandardRPCJsonSerializedMeta = [number, Segment[]][];
82
- type StandardRPCJsonSerialized = [json: unknown, meta: StandardRPCJsonSerializedMeta, maps: Segment[][], blobs: Blob[]];
81
+ type StandardRPCJsonSerializedMetaItem = readonly [type: number, ...path: Segment[]];
82
+ type StandardRPCJsonSerialized = [json: unknown, meta: StandardRPCJsonSerializedMetaItem[], maps: Segment[][], blobs: Blob[]];
83
83
  interface StandardRPCCustomJsonSerializer {
84
84
  type: number;
85
85
  condition(data: unknown): boolean;
@@ -92,9 +92,9 @@ interface StandardRPCJsonSerializerOptions {
92
92
  declare class StandardRPCJsonSerializer {
93
93
  private readonly customSerializers;
94
94
  constructor(options?: StandardRPCJsonSerializerOptions);
95
- serialize(data: unknown, segments?: Segment[], meta?: StandardRPCJsonSerializedMeta, maps?: Segment[][], blobs?: Blob[]): StandardRPCJsonSerialized;
96
- deserialize(json: unknown, meta: StandardRPCJsonSerializedMeta): unknown;
97
- deserialize(json: unknown, meta: StandardRPCJsonSerializedMeta, maps: Segment[][], getBlob: (index: number) => Blob): unknown;
95
+ serialize(data: unknown, segments?: Segment[], meta?: StandardRPCJsonSerializedMetaItem[], maps?: Segment[][], blobs?: Blob[]): StandardRPCJsonSerialized;
96
+ deserialize(json: unknown, meta: readonly StandardRPCJsonSerializedMetaItem[]): unknown;
97
+ deserialize(json: unknown, meta: readonly StandardRPCJsonSerializedMetaItem[], maps: readonly Segment[][], getBlob: (index: number) => Blob): unknown;
98
98
  }
99
99
 
100
100
  declare class StandardRPCSerializer {
@@ -166,4 +166,4 @@ declare class StandardRPCLinkCodec<T extends ClientContext> implements StandardL
166
166
  interface StandardRPCLinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardRPCLinkCodecOptions<T>, StandardRPCJsonSerializerOptions {
167
167
  }
168
168
 
169
- export { InvalidEventIteratorRetryResponse, STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, StandardLink, type StandardLinkClient, type StandardLinkCodec, type StandardLinkOptions, type StandardRPCCustomJsonSerializer, type StandardRPCJsonSerialized, type StandardRPCJsonSerializedMeta, StandardRPCJsonSerializer, type StandardRPCJsonSerializerOptions, StandardRPCLinkCodec, type StandardRPCLinkCodecOptions, type StandardRPCLinkOptions, StandardRPCSerializer };
169
+ export { InvalidEventIteratorRetryResponse, STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, StandardLink, type StandardLinkClient, type StandardLinkCodec, type StandardLinkOptions, type StandardRPCCustomJsonSerializer, type StandardRPCJsonSerialized, type StandardRPCJsonSerializedMetaItem, StandardRPCJsonSerializer, type StandardRPCJsonSerializerOptions, StandardRPCLinkCodec, type StandardRPCLinkCodecOptions, type StandardRPCLinkOptions, StandardRPCSerializer };
@@ -1,4 +1,4 @@
1
- export { I as InvalidEventIteratorRetryResponse, a as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, S as StandardLink, b as StandardRPCJsonSerializer, c as StandardRPCLinkCodec, d as StandardRPCSerializer } from '../../shared/client.d_qAa5GQ.mjs';
1
+ export { I as InvalidEventIteratorRetryResponse, a as STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES, S as StandardLink, b as StandardRPCJsonSerializer, c as StandardRPCLinkCodec, d as StandardRPCSerializer } from '../../shared/client.CPmBUYbj.mjs';
2
2
  import '@orpc/shared';
3
3
  import '../../shared/client.XAn8cDTM.mjs';
4
4
  import '@orpc/standard-server';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { N as NestedClient, b as ClientLink, I as InferClientContext, C as ClientContext, a as ClientOptionsOut, c as ClientPromiseResult } from './shared/client.D_CzLDyB.mjs';
2
2
  export { g as Client, e as ClientOptions, f as ClientRest, E as EventIteratorReconnectOptions, d as createAutoRetryEventIterator, m as mapEventIterator } from './shared/client.D_CzLDyB.mjs';
3
3
  import { Promisable, MaybeOptionalOptions } from '@orpc/shared';
4
+ export { onError, onFinish, onStart, onSuccess } from '@orpc/shared';
4
5
  export { ErrorEvent } from '@orpc/standard-server';
5
6
 
6
7
  interface createORPCClientOptions {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { N as NestedClient, b as ClientLink, I as InferClientContext, C as ClientContext, a as ClientOptionsOut, c as ClientPromiseResult } from './shared/client.D_CzLDyB.js';
2
2
  export { g as Client, e as ClientOptions, f as ClientRest, E as EventIteratorReconnectOptions, d as createAutoRetryEventIterator, m as mapEventIterator } from './shared/client.D_CzLDyB.js';
3
3
  import { Promisable, MaybeOptionalOptions } from '@orpc/shared';
4
+ export { onError, onFinish, onStart, onSuccess } from '@orpc/shared';
4
5
  export { ErrorEvent } from '@orpc/standard-server';
5
6
 
6
7
  interface createORPCClientOptions {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { i as isDefinedError } from './shared/client.XAn8cDTM.mjs';
2
2
  export { C as COMMON_ORPC_ERROR_DEFS, O as ORPCError, c as createAutoRetryEventIterator, a as fallbackORPCErrorMessage, f as fallbackORPCErrorStatus, m as mapEventIterator, o as onEventIteratorStatusChange, r as registerEventIteratorState, t as toORPCError, u as updateEventIteratorStatus } from './shared/client.XAn8cDTM.mjs';
3
+ export { onError, onFinish, onStart, onSuccess } from '@orpc/shared';
3
4
  export { ErrorEvent } from '@orpc/standard-server';
4
- import '@orpc/shared';
5
5
 
6
6
  function createORPCClient(link, options) {
7
7
  const path = options?.path ?? [];
@@ -79,7 +79,7 @@ class StandardRPCJsonSerializer {
79
79
  for (const custom of this.customSerializers) {
80
80
  if (custom.condition(data)) {
81
81
  const result = this.serialize(custom.serialize(data), segments, meta, maps, blobs);
82
- meta.push([custom.type, segments]);
82
+ meta.push([custom.type, ...segments]);
83
83
  return result;
84
84
  }
85
85
  }
@@ -89,42 +89,42 @@ class StandardRPCJsonSerializer {
89
89
  return [data, meta, maps, blobs];
90
90
  }
91
91
  if (typeof data === "bigint") {
92
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.BIGINT, segments]);
92
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.BIGINT, ...segments]);
93
93
  return [data.toString(), meta, maps, blobs];
94
94
  }
95
95
  if (data instanceof Date) {
96
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.DATE, segments]);
96
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.DATE, ...segments]);
97
97
  if (Number.isNaN(data.getTime())) {
98
98
  return [null, meta, maps, blobs];
99
99
  }
100
100
  return [data.toISOString(), meta, maps, blobs];
101
101
  }
102
102
  if (Number.isNaN(data)) {
103
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.NAN, segments]);
103
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.NAN, ...segments]);
104
104
  return [null, meta, maps, blobs];
105
105
  }
106
106
  if (data instanceof URL) {
107
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.URL, segments]);
107
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.URL, ...segments]);
108
108
  return [data.toString(), meta, maps, blobs];
109
109
  }
110
110
  if (data instanceof RegExp) {
111
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.REGEXP, segments]);
111
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.REGEXP, ...segments]);
112
112
  return [data.toString(), meta, maps, blobs];
113
113
  }
114
114
  if (data instanceof Set) {
115
115
  const result = this.serialize(Array.from(data), segments, meta, maps, blobs);
116
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.SET, segments]);
116
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.SET, ...segments]);
117
117
  return result;
118
118
  }
119
119
  if (data instanceof Map) {
120
120
  const result = this.serialize(Array.from(data.entries()), segments, meta, maps, blobs);
121
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.MAP, segments]);
121
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.MAP, ...segments]);
122
122
  return result;
123
123
  }
124
124
  if (Array.isArray(data)) {
125
125
  const json = data.map((v, i) => {
126
126
  if (v === void 0) {
127
- meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.UNDEFINED, [...segments, i]]);
127
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.UNDEFINED, ...segments, i]);
128
128
  return v;
129
129
  }
130
130
  return this.serialize(v, [...segments, i], meta, maps, blobs)[0];
@@ -153,13 +153,14 @@ class StandardRPCJsonSerializer {
153
153
  currentRef[preSegment] = getBlob(i);
154
154
  });
155
155
  }
156
- for (const [type, segments] of meta) {
156
+ for (const item of meta) {
157
+ const type = item[0];
157
158
  let currentRef = ref;
158
159
  let preSegment = "data";
159
- segments.forEach((segment) => {
160
+ for (let i = 1; i < item.length; i++) {
160
161
  currentRef = currentRef[preSegment];
161
- preSegment = segment;
162
- });
162
+ preSegment = item[i];
163
+ }
163
164
  for (const custom of this.customSerializers) {
164
165
  if (custom.type === type) {
165
166
  currentRef[preSegment] = custom.deserialize(currentRef[preSegment]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/client",
3
3
  "type": "module",
4
- "version": "0.0.0-next.32f3296",
4
+ "version": "0.0.0-next.33ca37d",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,9 +34,9 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@orpc/standard-server-fetch": "0.0.0-next.32f3296",
38
- "@orpc/standard-server": "0.0.0-next.32f3296",
39
- "@orpc/shared": "0.0.0-next.32f3296"
37
+ "@orpc/shared": "0.0.0-next.33ca37d",
38
+ "@orpc/standard-server": "0.0.0-next.33ca37d",
39
+ "@orpc/standard-server-fetch": "0.0.0-next.33ca37d"
40
40
  },
41
41
  "devDependencies": {
42
42
  "zod": "^3.24.2"