@orpc/openapi-client 0.0.0-next.25532a8 → 0.0.0-next.2568a3f
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/dist/adapters/fetch/index.d.mts +6 -5
- package/dist/adapters/fetch/index.d.ts +6 -5
- package/dist/adapters/fetch/index.mjs +4 -8
- 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.B-GardF8.mjs → openapi-client.D89vdV2Y.mjs} +18 -8
- package/dist/shared/{openapi-client.N18yafE2.d.mts → openapi-client.D_hC2pAM.d.mts} +6 -2
- package/dist/shared/{openapi-client.N18yafE2.d.ts → openapi-client.D_hC2pAM.d.ts} +6 -2
- package/package.json +6 -6
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
|
-
import { AnyContractRouter } from '@orpc/contract';
|
|
3
2
|
import { LinkFetchClientOptions } from '@orpc/client/fetch';
|
|
4
|
-
import {
|
|
5
|
-
import { f as StandardOpenAPILinkOptions } from '../../shared/openapi-client.
|
|
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
6
|
import '@orpc/shared';
|
|
7
7
|
import '@orpc/standard-server';
|
|
8
8
|
|
|
9
9
|
interface OpenAPILinkOptions<T extends ClientContext> extends StandardOpenAPILinkOptions<T>, LinkFetchClientOptions<T> {
|
|
10
10
|
}
|
|
11
|
-
declare class OpenAPILink<T extends ClientContext> extends
|
|
11
|
+
declare class OpenAPILink<T extends ClientContext> extends StandardOpenAPILink<T> {
|
|
12
12
|
constructor(contract: AnyContractRouter, options: OpenAPILinkOptions<T>);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export { OpenAPILink
|
|
15
|
+
export { OpenAPILink };
|
|
16
|
+
export type { OpenAPILinkOptions };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
|
-
import { AnyContractRouter } from '@orpc/contract';
|
|
3
2
|
import { LinkFetchClientOptions } from '@orpc/client/fetch';
|
|
4
|
-
import {
|
|
5
|
-
import { f as StandardOpenAPILinkOptions } from '../../shared/openapi-client.
|
|
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
6
|
import '@orpc/shared';
|
|
7
7
|
import '@orpc/standard-server';
|
|
8
8
|
|
|
9
9
|
interface OpenAPILinkOptions<T extends ClientContext> extends StandardOpenAPILinkOptions<T>, LinkFetchClientOptions<T> {
|
|
10
10
|
}
|
|
11
|
-
declare class OpenAPILink<T extends ClientContext> extends
|
|
11
|
+
declare class OpenAPILink<T extends ClientContext> extends StandardOpenAPILink<T> {
|
|
12
12
|
constructor(contract: AnyContractRouter, options: OpenAPILinkOptions<T>);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export { OpenAPILink
|
|
15
|
+
export { OpenAPILink };
|
|
16
|
+
export type { OpenAPILinkOptions };
|
|
@@ -1,19 +1,15 @@
|
|
|
1
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.B-GardF8.mjs';
|
|
4
2
|
import '@orpc/shared';
|
|
3
|
+
import { b as StandardOpenAPILink } from '../../shared/openapi-client.D89vdV2Y.mjs';
|
|
5
4
|
import '@orpc/client';
|
|
5
|
+
import '@orpc/client/standard';
|
|
6
6
|
import '@orpc/contract';
|
|
7
7
|
import '@orpc/standard-server';
|
|
8
8
|
|
|
9
|
-
class OpenAPILink extends
|
|
9
|
+
class OpenAPILink extends StandardOpenAPILink {
|
|
10
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
11
|
const linkClient = new LinkFetchClient(options);
|
|
16
|
-
super(
|
|
12
|
+
super(contract, linkClient, options);
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as StandardBracketNotationSerialized, a as StandardBracketNotationSerializer, c as StandardOpenAPICustomJsonSerializer, b as StandardOpenAPIJsonSerialized, e as StandardOpenAPIJsonSerializer, d as StandardOpenAPIJsonSerializerOptions, f as StandardOpenAPILinkOptions,
|
|
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
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, f as StandardOpenAPILinkOptions,
|
|
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
2
|
import { HTTPPath } from '@orpc/client';
|
|
3
3
|
import '@orpc/client/standard';
|
|
4
4
|
import '@orpc/contract';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { S as StandardBracketNotationSerializer, a as StandardOpenAPIJsonSerializer,
|
|
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';
|
|
2
3
|
import '@orpc/shared';
|
|
3
4
|
import '@orpc/client';
|
|
4
|
-
import '@orpc/client/standard';
|
|
5
5
|
import '@orpc/contract';
|
|
6
6
|
import '@orpc/standard-server';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { toHttpPath, getMalformedResponseErrorCode, StandardLink } from '@orpc/client/standard';
|
|
1
2
|
import { isObject, value, get, isAsyncIteratorObject } from '@orpc/shared';
|
|
2
|
-
import { isORPCErrorStatus,
|
|
3
|
-
import { toHttpPath, getMalformedResponseErrorCode } from '@orpc/client/standard';
|
|
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';
|
|
6
6
|
|
|
@@ -312,12 +312,12 @@ class StandardOpenapiLinkCodec {
|
|
|
312
312
|
}
|
|
313
313
|
})();
|
|
314
314
|
if (!isOk) {
|
|
315
|
-
if (
|
|
316
|
-
throw
|
|
315
|
+
if (isORPCErrorJson(deserialized)) {
|
|
316
|
+
throw createORPCErrorFromJson(deserialized);
|
|
317
317
|
}
|
|
318
318
|
throw new ORPCError(getMalformedResponseErrorCode(response.status), {
|
|
319
319
|
status: response.status,
|
|
320
|
-
data: deserialized
|
|
320
|
+
data: { ...response, body: deserialized }
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
const procedure = get(this.contract, path);
|
|
@@ -389,8 +389,8 @@ class StandardOpenAPISerializer {
|
|
|
389
389
|
return mapEventIterator(data, {
|
|
390
390
|
value: async (value) => value,
|
|
391
391
|
error: async (e) => {
|
|
392
|
-
if (e instanceof ErrorEvent &&
|
|
393
|
-
return
|
|
392
|
+
if (e instanceof ErrorEvent && isORPCErrorJson(e.data)) {
|
|
393
|
+
return createORPCErrorFromJson(e.data, { cause: e });
|
|
394
394
|
}
|
|
395
395
|
return e;
|
|
396
396
|
}
|
|
@@ -400,4 +400,14 @@ class StandardOpenAPISerializer {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientContext, ClientOptions } from '@orpc/client';
|
|
2
|
-
import { StandardLinkCodec, StandardLinkOptions } from '@orpc/client/standard';
|
|
2
|
+
import { StandardLinkCodec, StandardLinkOptions, StandardLink, StandardLinkClient } from '@orpc/client/standard';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
4
|
import { Segment, Value } from '@orpc/shared';
|
|
5
5
|
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
@@ -71,5 +71,9 @@ declare class StandardOpenapiLinkCodec<T extends ClientContext> implements Stand
|
|
|
71
71
|
|
|
72
72
|
interface StandardOpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardOpenapiLinkCodecOptions<T>, StandardOpenAPIJsonSerializerOptions {
|
|
73
73
|
}
|
|
74
|
+
declare class StandardOpenAPILink<T extends ClientContext> extends StandardLink<T> {
|
|
75
|
+
constructor(contract: AnyContractRouter, linkClient: StandardLinkClient<T>, options: StandardOpenAPILinkOptions<T>);
|
|
76
|
+
}
|
|
74
77
|
|
|
75
|
-
export {
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientContext, ClientOptions } from '@orpc/client';
|
|
2
|
-
import { StandardLinkCodec, StandardLinkOptions } from '@orpc/client/standard';
|
|
2
|
+
import { StandardLinkCodec, StandardLinkOptions, StandardLink, StandardLinkClient } from '@orpc/client/standard';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
4
|
import { Segment, Value } from '@orpc/shared';
|
|
5
5
|
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
@@ -71,5 +71,9 @@ declare class StandardOpenapiLinkCodec<T extends ClientContext> implements Stand
|
|
|
71
71
|
|
|
72
72
|
interface StandardOpenAPILinkOptions<T extends ClientContext> extends StandardLinkOptions<T>, StandardOpenapiLinkCodecOptions<T>, StandardOpenAPIJsonSerializerOptions {
|
|
73
73
|
}
|
|
74
|
+
declare class StandardOpenAPILink<T extends ClientContext> extends StandardLink<T> {
|
|
75
|
+
constructor(contract: AnyContractRouter, linkClient: StandardLinkClient<T>, options: StandardOpenAPILinkOptions<T>);
|
|
76
|
+
}
|
|
74
77
|
|
|
75
|
-
export {
|
|
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.
|
|
4
|
+
"version": "0.0.0-next.2568a3f",
|
|
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/
|
|
37
|
+
"@orpc/standard-server": "0.0.0-next.2568a3f",
|
|
38
|
+
"@orpc/shared": "0.0.0-next.2568a3f",
|
|
39
|
+
"@orpc/client": "0.0.0-next.2568a3f",
|
|
40
|
+
"@orpc/contract": "0.0.0-next.2568a3f"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@orpc/server": "0.0.0-next.
|
|
43
|
+
"@orpc/server": "0.0.0-next.2568a3f"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "unbuild",
|