@orpc/openapi-client 0.50.0 → 0.52.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
@@ -53,6 +53,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
53
53
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
54
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
55
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
56
57
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
58
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
58
59
  - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
@@ -67,6 +68,14 @@ You can find the full documentation [here](https://orpc.unnoq.com).
67
68
 
68
69
  Provides core serializer for OpenAPI requests and responses.
69
70
 
71
+ ## Sponsors
72
+
73
+ <p align="center">
74
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
75
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
76
+ </a>
77
+ </p>
78
+
70
79
  ## License
71
80
 
72
81
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,15 @@
1
+ import { ClientContext } from '@orpc/client';
2
+ import { AnyContractRouter } from '@orpc/contract';
3
+ import { LinkFetchClientOptions } from '@orpc/client/fetch';
4
+ import { StandardLink } from '@orpc/client/standard';
5
+ import { f as StandardOpenAPILinkOptions } from '../../shared/openapi-client.N18yafE2.mjs';
6
+ import '@orpc/shared';
7
+ import '@orpc/standard-server';
8
+
9
+ interface OpenAPILinkOptions<T extends ClientContext> extends StandardOpenAPILinkOptions<T>, LinkFetchClientOptions<T> {
10
+ }
11
+ declare class OpenAPILink<T extends ClientContext> extends StandardLink<T> {
12
+ constructor(contract: AnyContractRouter, options: OpenAPILinkOptions<T>);
13
+ }
14
+
15
+ export { OpenAPILink, type OpenAPILinkOptions };
@@ -0,0 +1,15 @@
1
+ import { ClientContext } from '@orpc/client';
2
+ import { AnyContractRouter } from '@orpc/contract';
3
+ import { LinkFetchClientOptions } from '@orpc/client/fetch';
4
+ import { StandardLink } from '@orpc/client/standard';
5
+ import { f as StandardOpenAPILinkOptions } from '../../shared/openapi-client.N18yafE2.js';
6
+ import '@orpc/shared';
7
+ import '@orpc/standard-server';
8
+
9
+ interface OpenAPILinkOptions<T extends ClientContext> extends StandardOpenAPILinkOptions<T>, LinkFetchClientOptions<T> {
10
+ }
11
+ declare class OpenAPILink<T extends ClientContext> extends StandardLink<T> {
12
+ constructor(contract: AnyContractRouter, options: OpenAPILinkOptions<T>);
13
+ }
14
+
15
+ export { OpenAPILink, type OpenAPILinkOptions };
@@ -0,0 +1,20 @@
1
+ import { LinkFetchClient } from '@orpc/client/fetch';
2
+ import { StandardLink } from '@orpc/client/standard';
3
+ import { a as StandardOpenAPIJsonSerializer, b as StandardOpenapiLinkCodec, c as StandardOpenAPISerializer, S as StandardBracketNotationSerializer } from '../../shared/openapi-client.C6BK9Q71.mjs';
4
+ import '@orpc/shared';
5
+ import '@orpc/client';
6
+ import '@orpc/contract';
7
+ import '@orpc/standard-server';
8
+
9
+ class OpenAPILink extends StandardLink {
10
+ constructor(contract, options) {
11
+ const jsonSerializer = new StandardOpenAPIJsonSerializer(options);
12
+ const bracketNotationSerializer = new StandardBracketNotationSerializer();
13
+ const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
14
+ const linkCodec = new StandardOpenapiLinkCodec(contract, serializer, options);
15
+ const linkClient = new LinkFetchClient(options);
16
+ super(linkCodec, linkClient, options);
17
+ }
18
+ }
19
+
20
+ export { OpenAPILink };
@@ -1,36 +1,20 @@
1
- import { Segment } from '@orpc/shared';
1
+ export { S as StandardBracketNotationSerialized, a as StandardBracketNotationSerializer, c as StandardOpenAPICustomJsonSerializer, b as StandardOpenAPIJsonSerialized, e as StandardOpenAPIJsonSerializer, d as StandardOpenAPIJsonSerializerOptions, f as StandardOpenAPILinkOptions, i as StandardOpenAPISerializeOptions, j as StandardOpenAPISerializer, h as StandardOpenapiLinkCodec, g as StandardOpenapiLinkCodecOptions } from '../../shared/openapi-client.N18yafE2.mjs';
2
+ import { HTTPPath } from '@orpc/client';
3
+ import '@orpc/client/standard';
4
+ import '@orpc/contract';
5
+ import '@orpc/shared';
6
+ import '@orpc/standard-server';
2
7
 
3
- type StandardBracketNotationSerialized = [string, unknown][];
4
- declare class StandardBracketNotationSerializer {
5
- serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
6
- deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
7
- stringifyPath(segments: readonly Segment[]): string;
8
- parsePath(path: string): string[];
9
- }
8
+ /**
9
+ * @internal
10
+ */
11
+ declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
12
+ /**
13
+ * @internal
14
+ */
15
+ declare function getDynamicParams(path: HTTPPath | undefined): {
16
+ raw: string;
17
+ name: string;
18
+ }[] | undefined;
10
19
 
11
- type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
12
- interface StandardOpenAPICustomJsonSerializer {
13
- condition(data: unknown): boolean;
14
- serialize(data: any): unknown;
15
- }
16
- interface StandardOpenAPIJsonSerializerOptions {
17
- customJsonSerializers?: readonly StandardOpenAPICustomJsonSerializer[];
18
- }
19
- declare class StandardOpenAPIJsonSerializer {
20
- private readonly customSerializers;
21
- constructor(options?: StandardOpenAPIJsonSerializerOptions);
22
- serialize(data: unknown, hasBlobRef?: {
23
- value: boolean;
24
- }): StandardOpenAPIJsonSerialized;
25
- }
26
-
27
- declare class StandardOpenAPISerializer {
28
- #private;
29
- private readonly jsonSerializer;
30
- private readonly bracketNotation;
31
- constructor(jsonSerializer: StandardOpenAPIJsonSerializer, bracketNotation: StandardBracketNotationSerializer);
32
- serialize(data: unknown): unknown;
33
- deserialize(data: unknown): unknown;
34
- }
35
-
36
- export { type StandardBracketNotationSerialized, StandardBracketNotationSerializer, type StandardOpenAPICustomJsonSerializer, type StandardOpenAPIJsonSerialized, StandardOpenAPIJsonSerializer, type StandardOpenAPIJsonSerializerOptions, StandardOpenAPISerializer };
20
+ export { getDynamicParams, standardizeHTTPPath };
@@ -1,36 +1,20 @@
1
- import { Segment } from '@orpc/shared';
1
+ export { S as StandardBracketNotationSerialized, a as StandardBracketNotationSerializer, c as StandardOpenAPICustomJsonSerializer, b as StandardOpenAPIJsonSerialized, e as StandardOpenAPIJsonSerializer, d as StandardOpenAPIJsonSerializerOptions, f as StandardOpenAPILinkOptions, i as StandardOpenAPISerializeOptions, j as StandardOpenAPISerializer, h as StandardOpenapiLinkCodec, g as StandardOpenapiLinkCodecOptions } from '../../shared/openapi-client.N18yafE2.js';
2
+ import { HTTPPath } from '@orpc/client';
3
+ import '@orpc/client/standard';
4
+ import '@orpc/contract';
5
+ import '@orpc/shared';
6
+ import '@orpc/standard-server';
2
7
 
3
- type StandardBracketNotationSerialized = [string, unknown][];
4
- declare class StandardBracketNotationSerializer {
5
- serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
6
- deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
7
- stringifyPath(segments: readonly Segment[]): string;
8
- parsePath(path: string): string[];
9
- }
8
+ /**
9
+ * @internal
10
+ */
11
+ declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
12
+ /**
13
+ * @internal
14
+ */
15
+ declare function getDynamicParams(path: HTTPPath | undefined): {
16
+ raw: string;
17
+ name: string;
18
+ }[] | undefined;
10
19
 
11
- type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
12
- interface StandardOpenAPICustomJsonSerializer {
13
- condition(data: unknown): boolean;
14
- serialize(data: any): unknown;
15
- }
16
- interface StandardOpenAPIJsonSerializerOptions {
17
- customJsonSerializers?: readonly StandardOpenAPICustomJsonSerializer[];
18
- }
19
- declare class StandardOpenAPIJsonSerializer {
20
- private readonly customSerializers;
21
- constructor(options?: StandardOpenAPIJsonSerializerOptions);
22
- serialize(data: unknown, hasBlobRef?: {
23
- value: boolean;
24
- }): StandardOpenAPIJsonSerialized;
25
- }
26
-
27
- declare class StandardOpenAPISerializer {
28
- #private;
29
- private readonly jsonSerializer;
30
- private readonly bracketNotation;
31
- constructor(jsonSerializer: StandardOpenAPIJsonSerializer, bracketNotation: StandardBracketNotationSerializer);
32
- serialize(data: unknown): unknown;
33
- deserialize(data: unknown): unknown;
34
- }
35
-
36
- export { type StandardBracketNotationSerialized, StandardBracketNotationSerializer, type StandardOpenAPICustomJsonSerializer, type StandardOpenAPIJsonSerialized, StandardOpenAPIJsonSerializer, type StandardOpenAPIJsonSerializerOptions, StandardOpenAPISerializer };
20
+ export { getDynamicParams, standardizeHTTPPath };
@@ -1,229 +1,6 @@
1
- import { isObject, isAsyncIteratorObject } from '@orpc/shared';
2
- import { mapEventIterator, toORPCError, ORPCError } from '@orpc/client';
3
- import { ErrorEvent } from '@orpc/standard-server';
4
-
5
- class StandardBracketNotationSerializer {
6
- serialize(data, segments = [], result = []) {
7
- if (Array.isArray(data)) {
8
- data.forEach((item, i) => {
9
- this.serialize(item, [...segments, i], result);
10
- });
11
- } else if (isObject(data)) {
12
- for (const key in data) {
13
- this.serialize(data[key], [...segments, key], result);
14
- }
15
- } else {
16
- result.push([this.stringifyPath(segments), data]);
17
- }
18
- return result;
19
- }
20
- deserialize(serialized) {
21
- if (serialized.length === 0) {
22
- return {};
23
- }
24
- const arrayPushStyles = /* @__PURE__ */ new WeakSet();
25
- const ref = { value: [] };
26
- for (const [path, value] of serialized) {
27
- const segments = this.parsePath(path);
28
- let currentRef = ref;
29
- let nextSegment = "value";
30
- segments.forEach((segment, i) => {
31
- if (!Array.isArray(currentRef[nextSegment]) && !isObject(currentRef[nextSegment])) {
32
- currentRef[nextSegment] = [];
33
- }
34
- if (i !== segments.length - 1) {
35
- if (Array.isArray(currentRef[nextSegment]) && !isValidArrayIndex(segment)) {
36
- currentRef[nextSegment] = { ...currentRef[nextSegment] };
37
- }
38
- } else {
39
- if (Array.isArray(currentRef[nextSegment])) {
40
- if (segment === "") {
41
- if (currentRef[nextSegment].length && !arrayPushStyles.has(currentRef[nextSegment])) {
42
- currentRef[nextSegment] = { ...currentRef[nextSegment] };
43
- }
44
- } else {
45
- if (arrayPushStyles.has(currentRef[nextSegment])) {
46
- currentRef[nextSegment] = { "": currentRef[nextSegment].at(-1) };
47
- } else if (!isValidArrayIndex(segment)) {
48
- currentRef[nextSegment] = { ...currentRef[nextSegment] };
49
- }
50
- }
51
- }
52
- }
53
- currentRef = currentRef[nextSegment];
54
- nextSegment = segment;
55
- });
56
- if (Array.isArray(currentRef)) {
57
- if (nextSegment === "") {
58
- arrayPushStyles.add(currentRef);
59
- currentRef.push(value);
60
- } else {
61
- currentRef[Number(nextSegment)] = value;
62
- }
63
- } else {
64
- currentRef[nextSegment] = value;
65
- }
66
- }
67
- return ref.value;
68
- }
69
- stringifyPath(segments) {
70
- return segments.map((segment) => {
71
- return segment.toString().replace(/[\\[\]]/g, (match) => {
72
- switch (match) {
73
- case "\\":
74
- return "\\\\";
75
- case "[":
76
- return "\\[";
77
- case "]":
78
- return "\\]";
79
- /* v8 ignore next 2 */
80
- default:
81
- return match;
82
- }
83
- });
84
- }).reduce((result, segment, i) => {
85
- if (i === 0) {
86
- return segment;
87
- }
88
- return `${result}[${segment}]`;
89
- }, "");
90
- }
91
- parsePath(path) {
92
- const segments = [];
93
- let inBrackets = false;
94
- let currentSegment = "";
95
- let backslashCount = 0;
96
- for (let i = 0; i < path.length; i++) {
97
- const char = path[i];
98
- const nextChar = path[i + 1];
99
- if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[") && backslashCount % 2 === 0) {
100
- if (nextChar === void 0) {
101
- inBrackets = false;
102
- }
103
- segments.push(currentSegment);
104
- currentSegment = "";
105
- i++;
106
- } else if (segments.length === 0 && char === "[" && backslashCount % 2 === 0) {
107
- inBrackets = true;
108
- segments.push(currentSegment);
109
- currentSegment = "";
110
- } else if (char === "\\") {
111
- backslashCount++;
112
- } else {
113
- currentSegment += "\\".repeat(backslashCount / 2) + char;
114
- backslashCount = 0;
115
- }
116
- }
117
- return inBrackets || segments.length === 0 ? [path] : segments;
118
- }
119
- }
120
- function isValidArrayIndex(value) {
121
- return /^0$|^[1-9]\d*$/.test(value);
122
- }
123
-
124
- class StandardOpenAPIJsonSerializer {
125
- customSerializers;
126
- constructor(options = {}) {
127
- this.customSerializers = options.customJsonSerializers ?? [];
128
- }
129
- serialize(data, hasBlobRef = { value: false }) {
130
- for (const custom of this.customSerializers) {
131
- if (custom.condition(data)) {
132
- const result = this.serialize(custom.serialize(data), hasBlobRef);
133
- return result;
134
- }
135
- }
136
- if (data instanceof Blob) {
137
- hasBlobRef.value = true;
138
- return [data, hasBlobRef.value];
139
- }
140
- if (data instanceof Set) {
141
- return this.serialize(Array.from(data), hasBlobRef);
142
- }
143
- if (data instanceof Map) {
144
- return this.serialize(Array.from(data.entries()), hasBlobRef);
145
- }
146
- if (Array.isArray(data)) {
147
- const json = data.map((v) => v === void 0 ? null : this.serialize(v, hasBlobRef)[0]);
148
- return [json, hasBlobRef.value];
149
- }
150
- if (isObject(data)) {
151
- const json = {};
152
- for (const k in data) {
153
- if (k === "toJSON" && typeof data[k] === "function") {
154
- continue;
155
- }
156
- json[k] = this.serialize(data[k], hasBlobRef)[0];
157
- }
158
- return [json, hasBlobRef.value];
159
- }
160
- if (typeof data === "bigint" || data instanceof RegExp || data instanceof URL) {
161
- return [data.toString(), hasBlobRef.value];
162
- }
163
- if (data instanceof Date) {
164
- return [Number.isNaN(data.getTime()) ? null : data.toISOString(), hasBlobRef.value];
165
- }
166
- if (Number.isNaN(data)) {
167
- return [null, hasBlobRef.value];
168
- }
169
- return [data, hasBlobRef.value];
170
- }
171
- }
172
-
173
- class StandardOpenAPISerializer {
174
- constructor(jsonSerializer, bracketNotation) {
175
- this.jsonSerializer = jsonSerializer;
176
- this.bracketNotation = bracketNotation;
177
- }
178
- serialize(data) {
179
- if (isAsyncIteratorObject(data)) {
180
- return mapEventIterator(data, {
181
- value: async (value) => this.#serialize(value, false),
182
- error: async (e) => {
183
- return new ErrorEvent({
184
- data: this.#serialize(toORPCError(e).toJSON(), false),
185
- cause: e
186
- });
187
- }
188
- });
189
- }
190
- return this.#serialize(data, true);
191
- }
192
- #serialize(data, enableFormData) {
193
- if (data instanceof Blob || data === void 0) {
194
- return data;
195
- }
196
- const [json, hasBlob] = this.jsonSerializer.serialize(data);
197
- if (!enableFormData || !hasBlob) {
198
- return json;
199
- }
200
- const form = new FormData();
201
- for (const [path, value] of this.bracketNotation.serialize(json)) {
202
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
203
- form.append(path, value.toString());
204
- } else if (value instanceof Blob) {
205
- form.append(path, value);
206
- }
207
- }
208
- return form;
209
- }
210
- deserialize(data) {
211
- if (data instanceof URLSearchParams || data instanceof FormData) {
212
- return this.bracketNotation.deserialize(Array.from(data.entries()));
213
- }
214
- if (isAsyncIteratorObject(data)) {
215
- return mapEventIterator(data, {
216
- value: async (value) => value,
217
- error: async (e) => {
218
- if (e instanceof ErrorEvent && ORPCError.isValidJSON(e.data)) {
219
- return ORPCError.fromJSON(e.data, { cause: e });
220
- }
221
- return e;
222
- }
223
- });
224
- }
225
- return data;
226
- }
227
- }
228
-
229
- export { StandardBracketNotationSerializer, StandardOpenAPIJsonSerializer, StandardOpenAPISerializer };
1
+ export { S as StandardBracketNotationSerializer, a as StandardOpenAPIJsonSerializer, c as StandardOpenAPISerializer, b as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.C6BK9Q71.mjs';
2
+ import '@orpc/shared';
3
+ import '@orpc/client';
4
+ import '@orpc/client/standard';
5
+ import '@orpc/contract';
6
+ import '@orpc/standard-server';
package/dist/index.d.mts CHANGED
@@ -1,2 +1,11 @@
1
+ import { NestedClient, Client, ORPCError } from '@orpc/client';
1
2
 
2
- export { }
3
+ type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
4
+ [K in keyof T]: JsonifiedValue<T[K]>;
5
+ } : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
6
+ type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [U extends undefined ? null : JsonifiedValue<U>, ...JsonifiedArray<V>] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
7
+ type JsonifiedClient<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? Client<UClientContext, UInput, JsonifiedValue<UOutput>, UError extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : UError> : {
8
+ [K in keyof T]: T[K] extends NestedClient<any> ? JsonifiedClient<T[K]> : T[K];
9
+ };
10
+
11
+ export type { JsonifiedArray, JsonifiedClient, JsonifiedValue };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,11 @@
1
+ import { NestedClient, Client, ORPCError } from '@orpc/client';
1
2
 
2
- export { }
3
+ type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
4
+ [K in keyof T]: JsonifiedValue<T[K]>;
5
+ } : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
6
+ type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [U extends undefined ? null : JsonifiedValue<U>, ...JsonifiedArray<V>] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
7
+ type JsonifiedClient<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? Client<UClientContext, UInput, JsonifiedValue<UOutput>, UError extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : UError> : {
8
+ [K in keyof T]: T[K] extends NestedClient<any> ? JsonifiedClient<T[K]> : T[K];
9
+ };
10
+
11
+ export type { JsonifiedArray, JsonifiedClient, JsonifiedValue };
@@ -0,0 +1,401 @@
1
+ import { isObject, value, get, isAsyncIteratorObject } from '@orpc/shared';
2
+ import { isORPCErrorStatus, mapEventIterator, toORPCError, ORPCError as ORPCError$1 } from '@orpc/client';
3
+ import { toHttpPath, getMalformedResponseErrorCode } from '@orpc/client/standard';
4
+ import { isContractProcedure, fallbackContractConfig, ORPCError } from '@orpc/contract';
5
+ import { mergeStandardHeaders, ErrorEvent } from '@orpc/standard-server';
6
+
7
+ class StandardBracketNotationSerializer {
8
+ serialize(data, segments = [], result = []) {
9
+ if (Array.isArray(data)) {
10
+ data.forEach((item, i) => {
11
+ this.serialize(item, [...segments, i], result);
12
+ });
13
+ } else if (isObject(data)) {
14
+ for (const key in data) {
15
+ this.serialize(data[key], [...segments, key], result);
16
+ }
17
+ } else {
18
+ result.push([this.stringifyPath(segments), data]);
19
+ }
20
+ return result;
21
+ }
22
+ deserialize(serialized) {
23
+ if (serialized.length === 0) {
24
+ return {};
25
+ }
26
+ const arrayPushStyles = /* @__PURE__ */ new WeakSet();
27
+ const ref = { value: [] };
28
+ for (const [path, value] of serialized) {
29
+ const segments = this.parsePath(path);
30
+ let currentRef = ref;
31
+ let nextSegment = "value";
32
+ segments.forEach((segment, i) => {
33
+ if (!Array.isArray(currentRef[nextSegment]) && !isObject(currentRef[nextSegment])) {
34
+ currentRef[nextSegment] = [];
35
+ }
36
+ if (i !== segments.length - 1) {
37
+ if (Array.isArray(currentRef[nextSegment]) && !isValidArrayIndex(segment)) {
38
+ currentRef[nextSegment] = { ...currentRef[nextSegment] };
39
+ }
40
+ } else {
41
+ if (Array.isArray(currentRef[nextSegment])) {
42
+ if (segment === "") {
43
+ if (currentRef[nextSegment].length && !arrayPushStyles.has(currentRef[nextSegment])) {
44
+ currentRef[nextSegment] = { ...currentRef[nextSegment] };
45
+ }
46
+ } else {
47
+ if (arrayPushStyles.has(currentRef[nextSegment])) {
48
+ currentRef[nextSegment] = { "": currentRef[nextSegment].at(-1) };
49
+ } else if (!isValidArrayIndex(segment)) {
50
+ currentRef[nextSegment] = { ...currentRef[nextSegment] };
51
+ }
52
+ }
53
+ }
54
+ }
55
+ currentRef = currentRef[nextSegment];
56
+ nextSegment = segment;
57
+ });
58
+ if (Array.isArray(currentRef)) {
59
+ if (nextSegment === "") {
60
+ arrayPushStyles.add(currentRef);
61
+ currentRef.push(value);
62
+ } else {
63
+ currentRef[Number(nextSegment)] = value;
64
+ }
65
+ } else {
66
+ currentRef[nextSegment] = value;
67
+ }
68
+ }
69
+ return ref.value;
70
+ }
71
+ stringifyPath(segments) {
72
+ return segments.map((segment) => {
73
+ return segment.toString().replace(/[\\[\]]/g, (match) => {
74
+ switch (match) {
75
+ case "\\":
76
+ return "\\\\";
77
+ case "[":
78
+ return "\\[";
79
+ case "]":
80
+ return "\\]";
81
+ /* v8 ignore next 2 */
82
+ default:
83
+ return match;
84
+ }
85
+ });
86
+ }).reduce((result, segment, i) => {
87
+ if (i === 0) {
88
+ return segment;
89
+ }
90
+ return `${result}[${segment}]`;
91
+ }, "");
92
+ }
93
+ parsePath(path) {
94
+ const segments = [];
95
+ let inBrackets = false;
96
+ let currentSegment = "";
97
+ let backslashCount = 0;
98
+ for (let i = 0; i < path.length; i++) {
99
+ const char = path[i];
100
+ const nextChar = path[i + 1];
101
+ if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[") && backslashCount % 2 === 0) {
102
+ if (nextChar === void 0) {
103
+ inBrackets = false;
104
+ }
105
+ segments.push(currentSegment);
106
+ currentSegment = "";
107
+ i++;
108
+ } else if (segments.length === 0 && char === "[" && backslashCount % 2 === 0) {
109
+ inBrackets = true;
110
+ segments.push(currentSegment);
111
+ currentSegment = "";
112
+ } else if (char === "\\") {
113
+ backslashCount++;
114
+ } else {
115
+ currentSegment += "\\".repeat(backslashCount / 2) + char;
116
+ backslashCount = 0;
117
+ }
118
+ }
119
+ return inBrackets || segments.length === 0 ? [path] : segments;
120
+ }
121
+ }
122
+ function isValidArrayIndex(value) {
123
+ return /^0$|^[1-9]\d*$/.test(value);
124
+ }
125
+
126
+ class StandardOpenAPIJsonSerializer {
127
+ customSerializers;
128
+ constructor(options = {}) {
129
+ this.customSerializers = options.customJsonSerializers ?? [];
130
+ }
131
+ serialize(data, hasBlobRef = { value: false }) {
132
+ for (const custom of this.customSerializers) {
133
+ if (custom.condition(data)) {
134
+ const result = this.serialize(custom.serialize(data), hasBlobRef);
135
+ return result;
136
+ }
137
+ }
138
+ if (data instanceof Blob) {
139
+ hasBlobRef.value = true;
140
+ return [data, hasBlobRef.value];
141
+ }
142
+ if (data instanceof Set) {
143
+ return this.serialize(Array.from(data), hasBlobRef);
144
+ }
145
+ if (data instanceof Map) {
146
+ return this.serialize(Array.from(data.entries()), hasBlobRef);
147
+ }
148
+ if (Array.isArray(data)) {
149
+ const json = data.map((v) => v === void 0 ? null : this.serialize(v, hasBlobRef)[0]);
150
+ return [json, hasBlobRef.value];
151
+ }
152
+ if (isObject(data)) {
153
+ const json = {};
154
+ for (const k in data) {
155
+ if (k === "toJSON" && typeof data[k] === "function") {
156
+ continue;
157
+ }
158
+ json[k] = this.serialize(data[k], hasBlobRef)[0];
159
+ }
160
+ return [json, hasBlobRef.value];
161
+ }
162
+ if (typeof data === "bigint" || data instanceof RegExp || data instanceof URL) {
163
+ return [data.toString(), hasBlobRef.value];
164
+ }
165
+ if (data instanceof Date) {
166
+ return [Number.isNaN(data.getTime()) ? null : data.toISOString(), hasBlobRef.value];
167
+ }
168
+ if (Number.isNaN(data)) {
169
+ return [null, hasBlobRef.value];
170
+ }
171
+ return [data, hasBlobRef.value];
172
+ }
173
+ }
174
+
175
+ function standardizeHTTPPath(path) {
176
+ return `/${path.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
177
+ }
178
+ function getDynamicParams(path) {
179
+ return path ? standardizeHTTPPath(path).match(/\/\{[^}]+\}/g)?.map((v) => ({
180
+ raw: v,
181
+ name: v.match(/\{\+?([^}]+)\}/)[1]
182
+ })) : void 0;
183
+ }
184
+
185
+ class StandardOpenapiLinkCodec {
186
+ constructor(contract, serializer, options) {
187
+ this.contract = contract;
188
+ this.serializer = serializer;
189
+ this.baseUrl = options.url;
190
+ this.headers = options.headers ?? {};
191
+ }
192
+ baseUrl;
193
+ headers;
194
+ async encode(path, input, options) {
195
+ const baseUrl = await value(this.baseUrl, options, path, input);
196
+ let headers = await value(this.headers, options, path, input);
197
+ if (options.lastEventId !== void 0) {
198
+ headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
199
+ }
200
+ const procedure = get(this.contract, path);
201
+ if (!isContractProcedure(procedure)) {
202
+ throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${path.join(".")}`);
203
+ }
204
+ const inputStructure = fallbackContractConfig("defaultInputStructure", procedure["~orpc"].route.inputStructure);
205
+ return inputStructure === "compact" ? this.#encodeCompact(procedure, path, input, options, baseUrl.toString(), headers) : this.#encodeDetailed(procedure, path, input, options, baseUrl.toString(), headers);
206
+ }
207
+ #encodeCompact(procedure, path, input, options, baseUrl, headers) {
208
+ let httpPath = standardizeHTTPPath(procedure["~orpc"].route.path ?? toHttpPath(path));
209
+ let httpBody = input;
210
+ const dynamicParams = getDynamicParams(httpPath);
211
+ if (dynamicParams?.length) {
212
+ if (!isObject(input)) {
213
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "compact" structure when has dynamic params at ${path.join(".")}.`);
214
+ }
215
+ const body = { ...input };
216
+ for (const param of dynamicParams) {
217
+ const value2 = input[param.name];
218
+ httpPath = httpPath.replace(param.raw, `/${encodeURIComponent(`${this.serializer.serialize(value2)}`)}`);
219
+ delete body[param.name];
220
+ }
221
+ httpBody = Object.keys(body).length ? body : void 0;
222
+ }
223
+ const method = fallbackContractConfig("defaultMethod", procedure["~orpc"].route.method);
224
+ const url = new URL(`${baseUrl.toString().replace(/\/$/, "")}${httpPath}`);
225
+ if (method === "GET") {
226
+ const serialized = this.serializer.serialize(httpBody, { outputFormat: "URLSearchParams" });
227
+ for (const [key, value2] of serialized) {
228
+ url.searchParams.append(key, value2);
229
+ }
230
+ return {
231
+ url,
232
+ method,
233
+ headers,
234
+ body: void 0,
235
+ signal: options.signal
236
+ };
237
+ }
238
+ return {
239
+ url,
240
+ method,
241
+ headers,
242
+ body: this.serializer.serialize(httpBody),
243
+ signal: options.signal
244
+ };
245
+ }
246
+ #encodeDetailed(procedure, path, input, options, baseUrl, headers) {
247
+ let httpPath = standardizeHTTPPath(procedure["~orpc"].route.path ?? toHttpPath(path));
248
+ const dynamicParams = getDynamicParams(httpPath);
249
+ if (!isObject(input) && input !== void 0) {
250
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "detailed" structure at ${path.join(".")}.`);
251
+ }
252
+ if (dynamicParams?.length) {
253
+ if (!isObject(input?.params)) {
254
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.params shape for "detailed" structure when has dynamic params at ${path.join(".")}.`);
255
+ }
256
+ for (const param of dynamicParams) {
257
+ const value2 = input.params[param.name];
258
+ httpPath = httpPath.replace(param.raw, `/${encodeURIComponent(`${this.serializer.serialize(value2)}`)}`);
259
+ }
260
+ }
261
+ let mergedHeaders = headers;
262
+ if (input?.headers !== void 0) {
263
+ if (!isObject(input.headers)) {
264
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.headers shape for "detailed" structure at ${path.join(".")}.`);
265
+ }
266
+ mergedHeaders = mergeStandardHeaders(input.headers, headers);
267
+ }
268
+ const method = fallbackContractConfig("defaultMethod", procedure["~orpc"].route.method);
269
+ const url = new URL(`${baseUrl.toString().replace(/\/$/, "")}${httpPath}`);
270
+ if (input?.query !== void 0) {
271
+ const query = this.serializer.serialize(input.query, { outputFormat: "URLSearchParams" });
272
+ for (const [key, value2] of query) {
273
+ url.searchParams.append(key, value2);
274
+ }
275
+ }
276
+ if (method === "GET") {
277
+ return {
278
+ url,
279
+ method,
280
+ headers: mergedHeaders,
281
+ body: void 0,
282
+ signal: options.signal
283
+ };
284
+ }
285
+ return {
286
+ url,
287
+ method,
288
+ headers: mergedHeaders,
289
+ body: this.serializer.serialize(input?.body),
290
+ signal: options.signal
291
+ };
292
+ }
293
+ async decode(response, _options, path) {
294
+ const isOk = !isORPCErrorStatus(response.status);
295
+ const deserialized = await (async () => {
296
+ let isBodyOk = false;
297
+ try {
298
+ const body = await response.body();
299
+ isBodyOk = true;
300
+ return this.serializer.deserialize(body);
301
+ } catch (error) {
302
+ if (!isBodyOk) {
303
+ throw new Error("Cannot parse response body, please check the response body and content-type.", {
304
+ cause: error
305
+ });
306
+ }
307
+ throw new Error("Invalid OpenAPI response format.", {
308
+ cause: error
309
+ });
310
+ }
311
+ })();
312
+ if (!isOk) {
313
+ if (ORPCError.isValidJSON(deserialized)) {
314
+ throw ORPCError.fromJSON(deserialized);
315
+ }
316
+ throw new ORPCError(getMalformedResponseErrorCode(response.status), {
317
+ status: response.status,
318
+ data: deserialized
319
+ });
320
+ }
321
+ const procedure = get(this.contract, path);
322
+ if (!isContractProcedure(procedure)) {
323
+ throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${path.join(".")}`);
324
+ }
325
+ const outputStructure = fallbackContractConfig("defaultOutputStructure", procedure["~orpc"].route.outputStructure);
326
+ if (outputStructure === "compact") {
327
+ return deserialized;
328
+ }
329
+ return {
330
+ headers: response.headers,
331
+ body: deserialized
332
+ };
333
+ }
334
+ }
335
+
336
+ class StandardOpenAPISerializer {
337
+ constructor(jsonSerializer, bracketNotation) {
338
+ this.jsonSerializer = jsonSerializer;
339
+ this.bracketNotation = bracketNotation;
340
+ }
341
+ serialize(data, options = {}) {
342
+ if (isAsyncIteratorObject(data) && !options.outputFormat) {
343
+ return mapEventIterator(data, {
344
+ value: async (value) => this.#serialize(value, { outputFormat: "plain" }),
345
+ error: async (e) => {
346
+ return new ErrorEvent({
347
+ data: this.#serialize(toORPCError(e).toJSON(), { outputFormat: "plain" }),
348
+ cause: e
349
+ });
350
+ }
351
+ });
352
+ }
353
+ return this.#serialize(data, options);
354
+ }
355
+ #serialize(data, options) {
356
+ const [json, hasBlob] = this.jsonSerializer.serialize(data);
357
+ if (options.outputFormat === "plain") {
358
+ return json;
359
+ }
360
+ if (options.outputFormat === "URLSearchParams") {
361
+ const params = new URLSearchParams();
362
+ for (const [path, value] of this.bracketNotation.serialize(json)) {
363
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
364
+ params.append(path, value.toString());
365
+ }
366
+ }
367
+ return params;
368
+ }
369
+ if (json instanceof Blob || json === void 0 || !hasBlob) {
370
+ return json;
371
+ }
372
+ const form = new FormData();
373
+ for (const [path, value] of this.bracketNotation.serialize(json)) {
374
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
375
+ form.append(path, value.toString());
376
+ } else if (value instanceof Blob) {
377
+ form.append(path, value);
378
+ }
379
+ }
380
+ return form;
381
+ }
382
+ deserialize(data) {
383
+ if (data instanceof URLSearchParams || data instanceof FormData) {
384
+ return this.bracketNotation.deserialize(Array.from(data.entries()));
385
+ }
386
+ if (isAsyncIteratorObject(data)) {
387
+ return mapEventIterator(data, {
388
+ value: async (value) => value,
389
+ error: async (e) => {
390
+ if (e instanceof ErrorEvent && ORPCError$1.isValidJSON(e.data)) {
391
+ return ORPCError$1.fromJSON(e.data, { cause: e });
392
+ }
393
+ return e;
394
+ }
395
+ });
396
+ }
397
+ return data;
398
+ }
399
+ }
400
+
401
+ export { StandardBracketNotationSerializer as S, StandardOpenAPIJsonSerializer as a, StandardOpenapiLinkCodec as b, StandardOpenAPISerializer as c, getDynamicParams as g, standardizeHTTPPath as s };
@@ -0,0 +1,75 @@
1
+ import { ClientContext, ClientOptions } from '@orpc/client';
2
+ import { StandardLinkCodec, StandardLinkOptions } from '@orpc/client/standard';
3
+ import { AnyContractRouter } from '@orpc/contract';
4
+ import { Segment, Value } from '@orpc/shared';
5
+ import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
6
+
7
+ type StandardBracketNotationSerialized = [string, unknown][];
8
+ declare class StandardBracketNotationSerializer {
9
+ serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
10
+ deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
11
+ stringifyPath(segments: readonly Segment[]): string;
12
+ parsePath(path: string): string[];
13
+ }
14
+
15
+ type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
16
+ interface StandardOpenAPICustomJsonSerializer {
17
+ condition(data: unknown): boolean;
18
+ serialize(data: any): unknown;
19
+ }
20
+ interface StandardOpenAPIJsonSerializerOptions {
21
+ customJsonSerializers?: readonly StandardOpenAPICustomJsonSerializer[];
22
+ }
23
+ declare class StandardOpenAPIJsonSerializer {
24
+ private readonly customSerializers;
25
+ constructor(options?: StandardOpenAPIJsonSerializerOptions);
26
+ serialize(data: unknown, hasBlobRef?: {
27
+ value: boolean;
28
+ }): StandardOpenAPIJsonSerialized;
29
+ }
30
+
31
+ interface StandardOpenAPISerializeOptions {
32
+ outputFormat?: 'plain' | 'URLSearchParams';
33
+ }
34
+ declare class StandardOpenAPISerializer {
35
+ #private;
36
+ private readonly jsonSerializer;
37
+ private readonly bracketNotation;
38
+ constructor(jsonSerializer: StandardOpenAPIJsonSerializer, bracketNotation: StandardBracketNotationSerializer);
39
+ serialize(data: unknown, options?: StandardOpenAPISerializeOptions): unknown;
40
+ deserialize(data: unknown): unknown;
41
+ }
42
+
43
+ interface StandardOpenapiLinkCodecOptions<T extends ClientContext> {
44
+ /**
45
+ * Base url for all requests.
46
+ */
47
+ url: Value<string | URL, [
48
+ options: ClientOptions<T>,
49
+ path: readonly string[],
50
+ input: unknown
51
+ ]>;
52
+ /**
53
+ * Inject headers to the request.
54
+ */
55
+ headers?: Value<StandardHeaders, [
56
+ options: ClientOptions<T>,
57
+ path: readonly string[],
58
+ input: unknown
59
+ ]>;
60
+ }
61
+ declare class StandardOpenapiLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
62
+ #private;
63
+ private readonly contract;
64
+ private readonly serializer;
65
+ private readonly baseUrl;
66
+ private readonly headers;
67
+ constructor(contract: AnyContractRouter, serializer: StandardOpenAPISerializer, options: StandardOpenapiLinkCodecOptions<T>);
68
+ encode(path: readonly string[], input: unknown, options: ClientOptions<T>): Promise<StandardRequest>;
69
+ decode(response: StandardLazyResponse, _options: ClientOptions<T>, path: readonly string[]): Promise<unknown>;
70
+ }
71
+
72
+ interface StandardOpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardOpenapiLinkCodecOptions<T>, StandardOpenAPIJsonSerializerOptions {
73
+ }
74
+
75
+ export { type StandardBracketNotationSerialized as S, StandardBracketNotationSerializer as a, type StandardOpenAPIJsonSerialized as b, type StandardOpenAPICustomJsonSerializer as c, type StandardOpenAPIJsonSerializerOptions as d, StandardOpenAPIJsonSerializer as e, type StandardOpenAPILinkOptions as f, type StandardOpenapiLinkCodecOptions as g, StandardOpenapiLinkCodec as h, type StandardOpenAPISerializeOptions as i, StandardOpenAPISerializer as j };
@@ -0,0 +1,75 @@
1
+ import { ClientContext, ClientOptions } from '@orpc/client';
2
+ import { StandardLinkCodec, StandardLinkOptions } from '@orpc/client/standard';
3
+ import { AnyContractRouter } from '@orpc/contract';
4
+ import { Segment, Value } from '@orpc/shared';
5
+ import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
6
+
7
+ type StandardBracketNotationSerialized = [string, unknown][];
8
+ declare class StandardBracketNotationSerializer {
9
+ serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
10
+ deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
11
+ stringifyPath(segments: readonly Segment[]): string;
12
+ parsePath(path: string): string[];
13
+ }
14
+
15
+ type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
16
+ interface StandardOpenAPICustomJsonSerializer {
17
+ condition(data: unknown): boolean;
18
+ serialize(data: any): unknown;
19
+ }
20
+ interface StandardOpenAPIJsonSerializerOptions {
21
+ customJsonSerializers?: readonly StandardOpenAPICustomJsonSerializer[];
22
+ }
23
+ declare class StandardOpenAPIJsonSerializer {
24
+ private readonly customSerializers;
25
+ constructor(options?: StandardOpenAPIJsonSerializerOptions);
26
+ serialize(data: unknown, hasBlobRef?: {
27
+ value: boolean;
28
+ }): StandardOpenAPIJsonSerialized;
29
+ }
30
+
31
+ interface StandardOpenAPISerializeOptions {
32
+ outputFormat?: 'plain' | 'URLSearchParams';
33
+ }
34
+ declare class StandardOpenAPISerializer {
35
+ #private;
36
+ private readonly jsonSerializer;
37
+ private readonly bracketNotation;
38
+ constructor(jsonSerializer: StandardOpenAPIJsonSerializer, bracketNotation: StandardBracketNotationSerializer);
39
+ serialize(data: unknown, options?: StandardOpenAPISerializeOptions): unknown;
40
+ deserialize(data: unknown): unknown;
41
+ }
42
+
43
+ interface StandardOpenapiLinkCodecOptions<T extends ClientContext> {
44
+ /**
45
+ * Base url for all requests.
46
+ */
47
+ url: Value<string | URL, [
48
+ options: ClientOptions<T>,
49
+ path: readonly string[],
50
+ input: unknown
51
+ ]>;
52
+ /**
53
+ * Inject headers to the request.
54
+ */
55
+ headers?: Value<StandardHeaders, [
56
+ options: ClientOptions<T>,
57
+ path: readonly string[],
58
+ input: unknown
59
+ ]>;
60
+ }
61
+ declare class StandardOpenapiLinkCodec<T extends ClientContext> implements StandardLinkCodec<T> {
62
+ #private;
63
+ private readonly contract;
64
+ private readonly serializer;
65
+ private readonly baseUrl;
66
+ private readonly headers;
67
+ constructor(contract: AnyContractRouter, serializer: StandardOpenAPISerializer, options: StandardOpenapiLinkCodecOptions<T>);
68
+ encode(path: readonly string[], input: unknown, options: ClientOptions<T>): Promise<StandardRequest>;
69
+ decode(response: StandardLazyResponse, _options: ClientOptions<T>, path: readonly string[]): Promise<unknown>;
70
+ }
71
+
72
+ interface StandardOpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardOpenapiLinkCodecOptions<T>, StandardOpenAPIJsonSerializerOptions {
73
+ }
74
+
75
+ export { type StandardBracketNotationSerialized as S, StandardBracketNotationSerializer as a, type StandardOpenAPIJsonSerialized as b, type StandardOpenAPICustomJsonSerializer as c, type StandardOpenAPIJsonSerializerOptions as d, StandardOpenAPIJsonSerializer as e, type StandardOpenAPILinkOptions as f, type StandardOpenapiLinkCodecOptions as g, StandardOpenapiLinkCodec as h, type StandardOpenAPISerializeOptions as i, StandardOpenAPISerializer as j };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/openapi-client",
3
3
  "type": "module",
4
- "version": "0.50.0",
4
+ "version": "0.52.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -23,15 +23,24 @@
23
23
  "types": "./dist/adapters/standard/index.d.mts",
24
24
  "import": "./dist/adapters/standard/index.mjs",
25
25
  "default": "./dist/adapters/standard/index.mjs"
26
+ },
27
+ "./fetch": {
28
+ "types": "./dist/adapters/fetch/index.d.mts",
29
+ "import": "./dist/adapters/fetch/index.mjs",
30
+ "default": "./dist/adapters/fetch/index.mjs"
26
31
  }
27
32
  },
28
33
  "files": [
29
34
  "dist"
30
35
  ],
31
36
  "dependencies": {
32
- "@orpc/client": "0.50.0",
33
- "@orpc/standard-server": "0.50.0",
34
- "@orpc/shared": "0.50.0"
37
+ "@orpc/client": "0.52.0",
38
+ "@orpc/shared": "0.52.0",
39
+ "@orpc/contract": "0.52.0",
40
+ "@orpc/standard-server": "0.52.0"
41
+ },
42
+ "devDependencies": {
43
+ "@orpc/server": "0.52.0"
35
44
  },
36
45
  "scripts": {
37
46
  "build": "unbuild",