@orpc/openapi-client 0.0.0-next.df024bb → 0.0.0-next.df486d6

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
@@ -32,7 +32,7 @@
32
32
  - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
33
  - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
34
  - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
35
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
36
  - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
37
  - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
38
  - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
@@ -53,16 +53,29 @@ 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).
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).
60
+ - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
58
61
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
62
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
60
63
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
64
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
65
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
61
66
 
62
67
  ## `@orpc/openapi-client`
63
68
 
64
69
  Provides core serializer for OpenAPI requests and responses.
65
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
+
66
79
  ## License
67
80
 
68
81
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,16 @@
1
+ import { ClientContext } from '@orpc/client';
2
+ import { LinkFetchClientOptions } from '@orpc/client/fetch';
3
+ import { AnyContractRouter } from '@orpc/contract';
4
+ import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.D_hC2pAM.mjs';
5
+ import '@orpc/client/standard';
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 StandardOpenAPILink<T> {
12
+ constructor(contract: AnyContractRouter, options: OpenAPILinkOptions<T>);
13
+ }
14
+
15
+ export { OpenAPILink };
16
+ export type { OpenAPILinkOptions };
@@ -0,0 +1,16 @@
1
+ import { ClientContext } from '@orpc/client';
2
+ import { LinkFetchClientOptions } from '@orpc/client/fetch';
3
+ import { AnyContractRouter } from '@orpc/contract';
4
+ import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.D_hC2pAM.js';
5
+ import '@orpc/client/standard';
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 StandardOpenAPILink<T> {
12
+ constructor(contract: AnyContractRouter, options: OpenAPILinkOptions<T>);
13
+ }
14
+
15
+ export { OpenAPILink };
16
+ export type { OpenAPILinkOptions };
@@ -0,0 +1,16 @@
1
+ import { LinkFetchClient } from '@orpc/client/fetch';
2
+ import '@orpc/shared';
3
+ import { b as StandardOpenAPILink } from '../../shared/openapi-client.D89vdV2Y.mjs';
4
+ import '@orpc/client';
5
+ import '@orpc/client/standard';
6
+ import '@orpc/contract';
7
+ import '@orpc/standard-server';
8
+
9
+ class OpenAPILink extends StandardOpenAPILink {
10
+ constructor(contract, options) {
11
+ const linkClient = new LinkFetchClient(options);
12
+ super(contract, linkClient, options);
13
+ }
14
+ }
15
+
16
+ export { OpenAPILink };
@@ -1,27 +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, g as StandardOpenAPILink, f as StandardOpenAPILinkOptions, j as StandardOpenAPISerializeOptions, k as StandardOpenAPISerializer, i as StandardOpenapiLinkCodec, h as StandardOpenapiLinkCodecOptions } from '../../shared/openapi-client.D_hC2pAM.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 BracketNotationSerialized = [string, unknown][];
4
- declare class BracketNotationSerializer {
5
- serialize(data: unknown, segments?: Segment[], result?: BracketNotationSerialized): BracketNotationSerialized;
6
- deserialize(serialized: BracketNotationSerialized): 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 OpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
12
- declare class OpenAPIJsonSerializer {
13
- serialize(data: unknown, hasBlobRef?: {
14
- value: boolean;
15
- }): OpenAPIJsonSerialized;
16
- }
17
-
18
- declare class OpenAPISerializer {
19
- #private;
20
- private readonly jsonSerializer;
21
- private readonly bracketNotation;
22
- constructor(jsonSerializer?: OpenAPIJsonSerializer, bracketNotation?: BracketNotationSerializer);
23
- serialize(data: unknown): unknown;
24
- deserialize(data: unknown): unknown;
25
- }
26
-
27
- export { type BracketNotationSerialized, BracketNotationSerializer, type OpenAPIJsonSerialized, OpenAPIJsonSerializer, OpenAPISerializer };
20
+ export { getDynamicParams, standardizeHTTPPath };
@@ -1,27 +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, g as StandardOpenAPILink, f as StandardOpenAPILinkOptions, j as StandardOpenAPISerializeOptions, k as StandardOpenAPISerializer, i as StandardOpenapiLinkCodec, h as StandardOpenapiLinkCodecOptions } from '../../shared/openapi-client.D_hC2pAM.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 BracketNotationSerialized = [string, unknown][];
4
- declare class BracketNotationSerializer {
5
- serialize(data: unknown, segments?: Segment[], result?: BracketNotationSerialized): BracketNotationSerialized;
6
- deserialize(serialized: BracketNotationSerialized): 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 OpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
12
- declare class OpenAPIJsonSerializer {
13
- serialize(data: unknown, hasBlobRef?: {
14
- value: boolean;
15
- }): OpenAPIJsonSerialized;
16
- }
17
-
18
- declare class OpenAPISerializer {
19
- #private;
20
- private readonly jsonSerializer;
21
- private readonly bracketNotation;
22
- constructor(jsonSerializer?: OpenAPIJsonSerializer, bracketNotation?: BracketNotationSerializer);
23
- serialize(data: unknown): unknown;
24
- deserialize(data: unknown): unknown;
25
- }
26
-
27
- export { type BracketNotationSerialized, BracketNotationSerializer, type OpenAPIJsonSerialized, OpenAPIJsonSerializer, OpenAPISerializer };
20
+ export { getDynamicParams, standardizeHTTPPath };
@@ -1,216 +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 BracketNotationSerializer {
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 OpenAPIJsonSerializer {
125
- serialize(data, hasBlobRef = { value: false }) {
126
- if (data instanceof Blob) {
127
- hasBlobRef.value = true;
128
- return [data, hasBlobRef.value];
129
- }
130
- if (data instanceof Set) {
131
- return this.serialize(Array.from(data), hasBlobRef);
132
- }
133
- if (data instanceof Map) {
134
- return this.serialize(Array.from(data.entries()), hasBlobRef);
135
- }
136
- if (Array.isArray(data)) {
137
- const json = data.map((v) => v === void 0 ? null : this.serialize(v, hasBlobRef)[0]);
138
- return [json, hasBlobRef.value];
139
- }
140
- if (isObject(data)) {
141
- const json = {};
142
- for (const k in data) {
143
- json[k] = this.serialize(data[k], hasBlobRef)[0];
144
- }
145
- return [json, hasBlobRef.value];
146
- }
147
- if (typeof data === "bigint" || data instanceof RegExp || data instanceof URL) {
148
- return [data.toString(), hasBlobRef.value];
149
- }
150
- if (data instanceof Date) {
151
- return [Number.isNaN(data.getTime()) ? null : data.toISOString(), hasBlobRef.value];
152
- }
153
- if (Number.isNaN(data)) {
154
- return [null, hasBlobRef.value];
155
- }
156
- return [data, hasBlobRef.value];
157
- }
158
- }
159
-
160
- class OpenAPISerializer {
161
- constructor(jsonSerializer = new OpenAPIJsonSerializer(), bracketNotation = new BracketNotationSerializer()) {
162
- this.jsonSerializer = jsonSerializer;
163
- this.bracketNotation = bracketNotation;
164
- }
165
- serialize(data) {
166
- if (isAsyncIteratorObject(data)) {
167
- return mapEventIterator(data, {
168
- value: async (value) => this.#serialize(value, false),
169
- error: async (e) => {
170
- return new ErrorEvent({
171
- data: this.#serialize(toORPCError(e).toJSON(), false),
172
- cause: e
173
- });
174
- }
175
- });
176
- }
177
- return this.#serialize(data, true);
178
- }
179
- #serialize(data, enableFormData) {
180
- if (data instanceof Blob || data === void 0) {
181
- return data;
182
- }
183
- const [json, hasBlob] = this.jsonSerializer.serialize(data);
184
- if (!enableFormData || !hasBlob) {
185
- return json;
186
- }
187
- const form = new FormData();
188
- for (const [path, value] of this.bracketNotation.serialize(json)) {
189
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
190
- form.append(path, value.toString());
191
- } else if (value instanceof Blob) {
192
- form.append(path, value);
193
- }
194
- }
195
- return form;
196
- }
197
- deserialize(data) {
198
- if (data instanceof URLSearchParams || data instanceof FormData) {
199
- return this.bracketNotation.deserialize(Array.from(data.entries()));
200
- }
201
- if (isAsyncIteratorObject(data)) {
202
- return mapEventIterator(data, {
203
- value: async (value) => value,
204
- error: async (e) => {
205
- if (e instanceof ErrorEvent && ORPCError.isValidJSON(e.data)) {
206
- return ORPCError.fromJSON(e.data, { cause: e });
207
- }
208
- return e;
209
- }
210
- });
211
- }
212
- return data;
213
- }
214
- }
215
-
216
- export { BracketNotationSerializer, OpenAPIJsonSerializer, OpenAPISerializer };
1
+ export { S as StandardBracketNotationSerializer, a as StandardOpenAPIJsonSerializer, b as StandardOpenAPILink, d as StandardOpenAPISerializer, c as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.D89vdV2Y.mjs';
2
+ import '@orpc/client/standard';
3
+ import '@orpc/shared';
4
+ import '@orpc/client';
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,413 @@
1
+ import { toHttpPath, getMalformedResponseErrorCode, StandardLink } from '@orpc/client/standard';
2
+ import { isObject, value, get, isAsyncIteratorObject } from '@orpc/shared';
3
+ import { isORPCErrorStatus, isORPCErrorJson, createORPCErrorFromJson, mapEventIterator, toORPCError } from '@orpc/client';
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, headers) : this.#encodeDetailed(procedure, path, input, options, baseUrl, 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);
225
+ url.pathname = `${url.pathname.replace(/\/$/, "")}${httpPath}`;
226
+ if (method === "GET") {
227
+ const serialized = this.serializer.serialize(httpBody, { outputFormat: "URLSearchParams" });
228
+ for (const [key, value2] of serialized) {
229
+ url.searchParams.append(key, value2);
230
+ }
231
+ return {
232
+ url,
233
+ method,
234
+ headers,
235
+ body: void 0,
236
+ signal: options.signal
237
+ };
238
+ }
239
+ return {
240
+ url,
241
+ method,
242
+ headers,
243
+ body: this.serializer.serialize(httpBody),
244
+ signal: options.signal
245
+ };
246
+ }
247
+ #encodeDetailed(procedure, path, input, options, baseUrl, headers) {
248
+ let httpPath = standardizeHTTPPath(procedure["~orpc"].route.path ?? toHttpPath(path));
249
+ const dynamicParams = getDynamicParams(httpPath);
250
+ if (!isObject(input) && input !== void 0) {
251
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "detailed" structure at ${path.join(".")}.`);
252
+ }
253
+ if (dynamicParams?.length) {
254
+ if (!isObject(input?.params)) {
255
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.params shape for "detailed" structure when has dynamic params at ${path.join(".")}.`);
256
+ }
257
+ for (const param of dynamicParams) {
258
+ const value2 = input.params[param.name];
259
+ httpPath = httpPath.replace(param.raw, `/${encodeURIComponent(`${this.serializer.serialize(value2)}`)}`);
260
+ }
261
+ }
262
+ let mergedHeaders = headers;
263
+ if (input?.headers !== void 0) {
264
+ if (!isObject(input.headers)) {
265
+ throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.headers shape for "detailed" structure at ${path.join(".")}.`);
266
+ }
267
+ mergedHeaders = mergeStandardHeaders(input.headers, headers);
268
+ }
269
+ const method = fallbackContractConfig("defaultMethod", procedure["~orpc"].route.method);
270
+ const url = new URL(baseUrl);
271
+ url.pathname = `${url.pathname.replace(/\/$/, "")}${httpPath}`;
272
+ if (input?.query !== void 0) {
273
+ const query = this.serializer.serialize(input.query, { outputFormat: "URLSearchParams" });
274
+ for (const [key, value2] of query) {
275
+ url.searchParams.append(key, value2);
276
+ }
277
+ }
278
+ if (method === "GET") {
279
+ return {
280
+ url,
281
+ method,
282
+ headers: mergedHeaders,
283
+ body: void 0,
284
+ signal: options.signal
285
+ };
286
+ }
287
+ return {
288
+ url,
289
+ method,
290
+ headers: mergedHeaders,
291
+ body: this.serializer.serialize(input?.body),
292
+ signal: options.signal
293
+ };
294
+ }
295
+ async decode(response, _options, path) {
296
+ const isOk = !isORPCErrorStatus(response.status);
297
+ const deserialized = await (async () => {
298
+ let isBodyOk = false;
299
+ try {
300
+ const body = await response.body();
301
+ isBodyOk = true;
302
+ return this.serializer.deserialize(body);
303
+ } catch (error) {
304
+ if (!isBodyOk) {
305
+ throw new Error("Cannot parse response body, please check the response body and content-type.", {
306
+ cause: error
307
+ });
308
+ }
309
+ throw new Error("Invalid OpenAPI response format.", {
310
+ cause: error
311
+ });
312
+ }
313
+ })();
314
+ if (!isOk) {
315
+ if (isORPCErrorJson(deserialized)) {
316
+ throw createORPCErrorFromJson(deserialized);
317
+ }
318
+ throw new ORPCError(getMalformedResponseErrorCode(response.status), {
319
+ status: response.status,
320
+ data: { ...response, body: deserialized }
321
+ });
322
+ }
323
+ const procedure = get(this.contract, path);
324
+ if (!isContractProcedure(procedure)) {
325
+ throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${path.join(".")}`);
326
+ }
327
+ const outputStructure = fallbackContractConfig("defaultOutputStructure", procedure["~orpc"].route.outputStructure);
328
+ if (outputStructure === "compact") {
329
+ return deserialized;
330
+ }
331
+ return {
332
+ headers: response.headers,
333
+ body: deserialized
334
+ };
335
+ }
336
+ }
337
+
338
+ class StandardOpenAPISerializer {
339
+ constructor(jsonSerializer, bracketNotation) {
340
+ this.jsonSerializer = jsonSerializer;
341
+ this.bracketNotation = bracketNotation;
342
+ }
343
+ serialize(data, options = {}) {
344
+ if (isAsyncIteratorObject(data) && !options.outputFormat) {
345
+ return mapEventIterator(data, {
346
+ value: async (value) => this.#serialize(value, { outputFormat: "plain" }),
347
+ error: async (e) => {
348
+ return new ErrorEvent({
349
+ data: this.#serialize(toORPCError(e).toJSON(), { outputFormat: "plain" }),
350
+ cause: e
351
+ });
352
+ }
353
+ });
354
+ }
355
+ return this.#serialize(data, options);
356
+ }
357
+ #serialize(data, options) {
358
+ const [json, hasBlob] = this.jsonSerializer.serialize(data);
359
+ if (options.outputFormat === "plain") {
360
+ return json;
361
+ }
362
+ if (options.outputFormat === "URLSearchParams") {
363
+ const params = new URLSearchParams();
364
+ for (const [path, value] of this.bracketNotation.serialize(json)) {
365
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
366
+ params.append(path, value.toString());
367
+ }
368
+ }
369
+ return params;
370
+ }
371
+ if (json instanceof Blob || json === void 0 || !hasBlob) {
372
+ return json;
373
+ }
374
+ const form = new FormData();
375
+ for (const [path, value] of this.bracketNotation.serialize(json)) {
376
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
377
+ form.append(path, value.toString());
378
+ } else if (value instanceof Blob) {
379
+ form.append(path, value);
380
+ }
381
+ }
382
+ return form;
383
+ }
384
+ deserialize(data) {
385
+ if (data instanceof URLSearchParams || data instanceof FormData) {
386
+ return this.bracketNotation.deserialize(Array.from(data.entries()));
387
+ }
388
+ if (isAsyncIteratorObject(data)) {
389
+ return mapEventIterator(data, {
390
+ value: async (value) => value,
391
+ error: async (e) => {
392
+ if (e instanceof ErrorEvent && isORPCErrorJson(e.data)) {
393
+ return createORPCErrorFromJson(e.data, { cause: e });
394
+ }
395
+ return e;
396
+ }
397
+ });
398
+ }
399
+ return data;
400
+ }
401
+ }
402
+
403
+ class StandardOpenAPILink extends StandardLink {
404
+ constructor(contract, linkClient, options) {
405
+ const jsonSerializer = new StandardOpenAPIJsonSerializer(options);
406
+ const bracketNotationSerializer = new StandardBracketNotationSerializer();
407
+ const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
408
+ const linkCodec = new StandardOpenapiLinkCodec(contract, serializer, options);
409
+ super(linkCodec, linkClient, options);
410
+ }
411
+ }
412
+
413
+ export { StandardBracketNotationSerializer as S, StandardOpenAPIJsonSerializer as a, StandardOpenAPILink as b, StandardOpenapiLinkCodec as c, StandardOpenAPISerializer as d, getDynamicParams as g, standardizeHTTPPath as s };
@@ -0,0 +1,79 @@
1
+ import { ClientContext, ClientOptions } from '@orpc/client';
2
+ import { StandardLinkCodec, StandardLinkOptions, StandardLink, StandardLinkClient } 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
+ declare class StandardOpenAPILink<T extends ClientContext> extends StandardLink<T> {
75
+ constructor(contract: AnyContractRouter, linkClient: StandardLinkClient<T>, options: StandardOpenAPILinkOptions<T>);
76
+ }
77
+
78
+ export { StandardBracketNotationSerializer as a, StandardOpenAPIJsonSerializer as e, StandardOpenAPILink as g, StandardOpenapiLinkCodec as i, StandardOpenAPISerializer as k };
79
+ export type { StandardBracketNotationSerialized as S, StandardOpenAPIJsonSerialized as b, StandardOpenAPICustomJsonSerializer as c, StandardOpenAPIJsonSerializerOptions as d, StandardOpenAPILinkOptions as f, StandardOpenapiLinkCodecOptions as h, StandardOpenAPISerializeOptions as j };
@@ -0,0 +1,79 @@
1
+ import { ClientContext, ClientOptions } from '@orpc/client';
2
+ import { StandardLinkCodec, StandardLinkOptions, StandardLink, StandardLinkClient } 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
+ declare class StandardOpenAPILink<T extends ClientContext> extends StandardLink<T> {
75
+ constructor(contract: AnyContractRouter, linkClient: StandardLinkClient<T>, options: StandardOpenAPILinkOptions<T>);
76
+ }
77
+
78
+ export { StandardBracketNotationSerializer as a, StandardOpenAPIJsonSerializer as e, StandardOpenAPILink as g, StandardOpenapiLinkCodec as i, StandardOpenAPISerializer as k };
79
+ export type { StandardBracketNotationSerialized as S, StandardOpenAPIJsonSerialized as b, StandardOpenAPICustomJsonSerializer as c, StandardOpenAPIJsonSerializerOptions as d, StandardOpenAPILinkOptions as f, StandardOpenapiLinkCodecOptions as h, StandardOpenAPISerializeOptions 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.0.0-next.df024bb",
4
+ "version": "0.0.0-next.df486d6",
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/shared": "0.0.0-next.df024bb",
33
- "@orpc/standard-server": "0.0.0-next.df024bb",
34
- "@orpc/client": "0.0.0-next.df024bb"
37
+ "@orpc/client": "0.0.0-next.df486d6",
38
+ "@orpc/contract": "0.0.0-next.df486d6",
39
+ "@orpc/shared": "0.0.0-next.df486d6",
40
+ "@orpc/standard-server": "0.0.0-next.df486d6"
41
+ },
42
+ "devDependencies": {
43
+ "@orpc/server": "0.0.0-next.df486d6"
35
44
  },
36
45
  "scripts": {
37
46
  "build": "unbuild",