@orpc/openapi-client 0.0.0-next.92f04f2 → 0.0.0-next.93fa264
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 +4 -6
- package/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/fetch/index.mjs +1 -1
- package/dist/adapters/standard/index.d.mts +1 -1
- package/dist/adapters/standard/index.d.ts +1 -1
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/shared/{openapi-client.D_hC2pAM.d.mts → openapi-client.Bc2pHPqD.d.mts} +3 -3
- package/dist/shared/{openapi-client.D_hC2pAM.d.ts → openapi-client.Bc2pHPqD.d.ts} +3 -3
- package/dist/shared/{openapi-client.BwEwVdZl.mjs → openapi-client.Bix5hHnT.mjs} +30 -10
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -49,14 +49,12 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
49
49
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
50
50
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
51
51
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
52
|
-
- [@orpc/
|
|
52
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
53
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
53
54
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
54
|
-
- [@orpc/
|
|
55
|
-
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
56
|
-
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
|
57
|
-
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
|
55
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
58
56
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
59
|
-
- [@orpc/
|
|
57
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
60
58
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
61
59
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
62
60
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
2
|
import { LinkFetchClientOptions } from '@orpc/client/fetch';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
|
-
import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.
|
|
4
|
+
import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.Bc2pHPqD.mjs';
|
|
5
5
|
import '@orpc/client/standard';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@orpc/standard-server';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
2
|
import { LinkFetchClientOptions } from '@orpc/client/fetch';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
|
-
import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.
|
|
4
|
+
import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.Bc2pHPqD.js';
|
|
5
5
|
import '@orpc/client/standard';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@orpc/standard-server';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LinkFetchClient } from '@orpc/client/fetch';
|
|
2
2
|
import '@orpc/shared';
|
|
3
3
|
import '@orpc/contract';
|
|
4
|
-
import { b as StandardOpenAPILink } from '../../shared/openapi-client.
|
|
4
|
+
import { b as StandardOpenAPILink } from '../../shared/openapi-client.Bix5hHnT.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/client/standard';
|
|
7
7
|
import '@orpc/standard-server';
|
|
@@ -1,4 +1,4 @@
|
|
|
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.
|
|
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.Bc2pHPqD.mjs';
|
|
2
2
|
import { HTTPPath } from '@orpc/client';
|
|
3
3
|
import '@orpc/client/standard';
|
|
4
4
|
import '@orpc/contract';
|
|
@@ -1,4 +1,4 @@
|
|
|
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.
|
|
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.Bc2pHPqD.js';
|
|
2
2
|
import { HTTPPath } from '@orpc/client';
|
|
3
3
|
import '@orpc/client/standard';
|
|
4
4
|
import '@orpc/contract';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StandardBracketNotationSerializer } from '../../shared/openapi-client.
|
|
2
|
-
export { a as StandardOpenAPIJsonSerializer, b as StandardOpenAPILink, d as StandardOpenAPISerializer, c as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.
|
|
1
|
+
import { S as StandardBracketNotationSerializer } from '../../shared/openapi-client.Bix5hHnT.mjs';
|
|
2
|
+
export { a as StandardOpenAPIJsonSerializer, b as StandardOpenAPILink, d as StandardOpenAPISerializer, c as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.Bix5hHnT.mjs';
|
|
3
3
|
import { isSchemaIssue } from '@orpc/contract';
|
|
4
4
|
import { isTypescriptObject } from '@orpc/shared';
|
|
5
5
|
import '@orpc/client/standard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext, ClientOptions } from '@orpc/client';
|
|
2
2
|
import { StandardLinkCodec, StandardLinkOptions, StandardLink, StandardLinkClient } from '@orpc/client/standard';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
|
-
import { Segment, Value } from '@orpc/shared';
|
|
4
|
+
import { Segment, Value, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
type StandardBracketNotationSerialized = [string, unknown][];
|
|
@@ -44,7 +44,7 @@ interface StandardOpenapiLinkCodecOptions<T extends ClientContext> {
|
|
|
44
44
|
/**
|
|
45
45
|
* Base url for all requests.
|
|
46
46
|
*/
|
|
47
|
-
url: Value<string | URL
|
|
47
|
+
url: Value<Promisable<string | URL>, [
|
|
48
48
|
options: ClientOptions<T>,
|
|
49
49
|
path: readonly string[],
|
|
50
50
|
input: unknown
|
|
@@ -52,7 +52,7 @@ interface StandardOpenapiLinkCodecOptions<T extends ClientContext> {
|
|
|
52
52
|
/**
|
|
53
53
|
* Inject headers to the request.
|
|
54
54
|
*/
|
|
55
|
-
headers?: Value<StandardHeaders
|
|
55
|
+
headers?: Value<Promisable<StandardHeaders>, [
|
|
56
56
|
options: ClientOptions<T>,
|
|
57
57
|
path: readonly string[],
|
|
58
58
|
input: unknown
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext, ClientOptions } from '@orpc/client';
|
|
2
2
|
import { StandardLinkCodec, StandardLinkOptions, StandardLink, StandardLinkClient } from '@orpc/client/standard';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
|
-
import { Segment, Value } from '@orpc/shared';
|
|
4
|
+
import { Segment, Value, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
type StandardBracketNotationSerialized = [string, unknown][];
|
|
@@ -44,7 +44,7 @@ interface StandardOpenapiLinkCodecOptions<T extends ClientContext> {
|
|
|
44
44
|
/**
|
|
45
45
|
* Base url for all requests.
|
|
46
46
|
*/
|
|
47
|
-
url: Value<string | URL
|
|
47
|
+
url: Value<Promisable<string | URL>, [
|
|
48
48
|
options: ClientOptions<T>,
|
|
49
49
|
path: readonly string[],
|
|
50
50
|
input: unknown
|
|
@@ -52,7 +52,7 @@ interface StandardOpenapiLinkCodecOptions<T extends ClientContext> {
|
|
|
52
52
|
/**
|
|
53
53
|
* Inject headers to the request.
|
|
54
54
|
*/
|
|
55
|
-
headers?: Value<StandardHeaders
|
|
55
|
+
headers?: Value<Promisable<StandardHeaders>, [
|
|
56
56
|
options: ClientOptions<T>,
|
|
57
57
|
path: readonly string[],
|
|
58
58
|
input: unknown
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toHttpPath, getMalformedResponseErrorCode, StandardLink } from '@orpc/client/standard';
|
|
2
|
-
import { isObject, value, get, isAsyncIteratorObject } from '@orpc/shared';
|
|
2
|
+
import { isObject, NullProtoObj, value, get, isAsyncIteratorObject } from '@orpc/shared';
|
|
3
3
|
import { isORPCErrorStatus, isORPCErrorJson, createORPCErrorFromJson, mapEventIterator, toORPCError } from '@orpc/client';
|
|
4
4
|
import { isContractProcedure, fallbackContractConfig, ORPCError } from '@orpc/contract';
|
|
5
5
|
import { mergeStandardHeaders, ErrorEvent } from '@orpc/standard-server';
|
|
@@ -35,19 +35,25 @@ class StandardBracketNotationSerializer {
|
|
|
35
35
|
}
|
|
36
36
|
if (i !== segments.length - 1) {
|
|
37
37
|
if (Array.isArray(currentRef[nextSegment]) && !isValidArrayIndex(segment)) {
|
|
38
|
-
currentRef[nextSegment]
|
|
38
|
+
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
39
|
+
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
40
|
+
currentRef[nextSegment] = pushStyleArrayToObject(currentRef[nextSegment]);
|
|
41
|
+
} else {
|
|
42
|
+
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
} else {
|
|
41
46
|
if (Array.isArray(currentRef[nextSegment])) {
|
|
42
47
|
if (segment === "") {
|
|
43
48
|
if (currentRef[nextSegment].length && !arrayPushStyles.has(currentRef[nextSegment])) {
|
|
44
|
-
currentRef[nextSegment] =
|
|
49
|
+
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
45
50
|
}
|
|
46
51
|
} else {
|
|
47
52
|
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
48
|
-
currentRef[nextSegment]
|
|
53
|
+
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
54
|
+
currentRef[nextSegment] = pushStyleArrayToObject(currentRef[nextSegment]);
|
|
49
55
|
} else if (!isValidArrayIndex(segment)) {
|
|
50
|
-
currentRef[nextSegment] =
|
|
56
|
+
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
}
|
|
@@ -55,12 +61,14 @@ class StandardBracketNotationSerializer {
|
|
|
55
61
|
currentRef = currentRef[nextSegment];
|
|
56
62
|
nextSegment = segment;
|
|
57
63
|
});
|
|
58
|
-
if (Array.isArray(currentRef)) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
if (Array.isArray(currentRef) && nextSegment === "") {
|
|
65
|
+
arrayPushStyles.add(currentRef);
|
|
66
|
+
currentRef.push(value);
|
|
67
|
+
} else if (nextSegment in currentRef) {
|
|
68
|
+
if (Array.isArray(currentRef[nextSegment])) {
|
|
69
|
+
currentRef[nextSegment].push(value);
|
|
62
70
|
} else {
|
|
63
|
-
currentRef[
|
|
71
|
+
currentRef[nextSegment] = [currentRef[nextSegment], value];
|
|
64
72
|
}
|
|
65
73
|
} else {
|
|
66
74
|
currentRef[nextSegment] = value;
|
|
@@ -122,6 +130,18 @@ class StandardBracketNotationSerializer {
|
|
|
122
130
|
function isValidArrayIndex(value) {
|
|
123
131
|
return /^0$|^[1-9]\d*$/.test(value);
|
|
124
132
|
}
|
|
133
|
+
function arrayToObject(array) {
|
|
134
|
+
const obj = new NullProtoObj();
|
|
135
|
+
array.forEach((item, i) => {
|
|
136
|
+
obj[i] = item;
|
|
137
|
+
});
|
|
138
|
+
return obj;
|
|
139
|
+
}
|
|
140
|
+
function pushStyleArrayToObject(array) {
|
|
141
|
+
const obj = new NullProtoObj();
|
|
142
|
+
obj[""] = array.length === 1 ? array[0] : array;
|
|
143
|
+
return obj;
|
|
144
|
+
}
|
|
125
145
|
|
|
126
146
|
class StandardOpenAPIJsonSerializer {
|
|
127
147
|
customSerializers;
|
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.
|
|
4
|
+
"version": "0.0.0-next.93fa264",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@orpc/
|
|
38
|
-
"@orpc/
|
|
39
|
-
"@orpc/
|
|
40
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
37
|
+
"@orpc/contract": "0.0.0-next.93fa264",
|
|
38
|
+
"@orpc/client": "0.0.0-next.93fa264",
|
|
39
|
+
"@orpc/shared": "0.0.0-next.93fa264",
|
|
40
|
+
"@orpc/standard-server": "0.0.0-next.93fa264"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@orpc/server": "0.0.0-next.
|
|
43
|
+
"@orpc/server": "0.0.0-next.93fa264"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "unbuild",
|