@orpc/openapi 2.0.0-beta.41 → 2.0.0-beta.42
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/aws-lambda/index.mjs +1 -1
- package/dist/adapters/fastify/index.mjs +1 -1
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/node/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/extensions/route.d.mts +1 -1
- package/dist/extensions/route.d.ts +1 -1
- package/dist/index.d.mts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/plugins/index.d.mts +3 -1
- package/dist/plugins/index.d.ts +3 -1
- package/dist/shared/{openapi.BgpM--nz.d.mts → openapi.BDiBd3_k.d.mts} +1 -0
- package/dist/shared/{openapi.Bi1qxGF9.mjs → openapi.BJRea9Uu.mjs} +74 -28
- package/dist/shared/{openapi.C6FFC29v.d.mts → openapi.BTq9wym2.d.mts} +3 -1
- package/dist/shared/{openapi.C6FFC29v.d.ts → openapi.BTq9wym2.d.ts} +3 -1
- package/dist/shared/{openapi.BCNfESWr.d.ts → openapi.CkzUS83v.d.ts} +1 -0
- package/dist/shared/{openapi.8cM6P94D.mjs → openapi.D326pNzT.mjs} +1 -1
- package/dist/shared/{openapi.Cem81Zhm.d.mts → openapi.r98bZ3Ig.d.mts} +1 -1
- package/dist/shared/{openapi.Cem81Zhm.d.ts → openapi.r98bZ3Ig.d.ts} +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BJRea9Uu.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FastifyHandler } from '@orpc/server/fastify';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BJRea9Uu.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FetchHandler } from '@orpc/server/fetch';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BJRea9Uu.mjs';
|
|
4
4
|
import { FetchLinkTransport } from '@orpc/client/fetch';
|
|
5
5
|
import { StandardLink } from '@orpc/client/standard';
|
|
6
|
-
import { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
6
|
+
import { O as OpenAPILinkCodec } from '../../shared/openapi.D326pNzT.mjs';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import '@orpc/shared';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeHttpHandler } from '@orpc/server/node';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.BJRea9Uu.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.BDiBd3_k.mjs';
|
|
2
2
|
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.Cg9h6jpm.mjs';
|
|
3
3
|
import { StandardHeaders } from '@standard-server/core';
|
|
4
4
|
import { OpenAPISerializer } from '../../index.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.
|
|
1
|
+
export { a as OpenAPIHandlerCodec, b as OpenAPIHandlerCodecCore, c as OpenAPIHandlerCodecCoreOptions, O as OpenAPIHandlerCodecOptions, d as OpenAPIMatcher, e as OpenAPIMatcherOptions } from '../../shared/openapi.CkzUS83v.js';
|
|
2
2
|
export { a as OpenAPILinkCodec, O as OpenAPILinkCodecOptions } from '../../shared/openapi.D0yWs-uW.js';
|
|
3
3
|
import { StandardHeaders } from '@standard-server/core';
|
|
4
4
|
import { OpenAPISerializer } from '../../index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.
|
|
2
|
-
export { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.BJRea9Uu.mjs';
|
|
2
|
+
export { O as OpenAPILinkCodec } from '../../shared/openapi.D326pNzT.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
|
5
5
|
import '@orpc/shared';
|
|
@@ -3,7 +3,7 @@ import { Context } from '@orpc/server';
|
|
|
3
3
|
import { OpenAPIMeta } from '../index.mjs';
|
|
4
4
|
import '@orpc/shared';
|
|
5
5
|
import '@standard-server/core';
|
|
6
|
-
import '@openapi-spec/types';
|
|
6
|
+
import '@openapi-spec/types/v3.2';
|
|
7
7
|
|
|
8
8
|
declare module '@orpc/contract' {
|
|
9
9
|
interface ContractBuilder<TErrorMap extends ErrorMap> {
|
|
@@ -3,7 +3,7 @@ import { Context } from '@orpc/server';
|
|
|
3
3
|
import { OpenAPIMeta } from '../index.js';
|
|
4
4
|
import '@orpc/shared';
|
|
5
5
|
import '@standard-server/core';
|
|
6
|
-
import '@openapi-spec/types';
|
|
6
|
+
import '@openapi-spec/types/v3.2';
|
|
7
7
|
|
|
8
8
|
declare module '@orpc/contract' {
|
|
9
9
|
interface ContractBuilder<TErrorMap extends ErrorMap> {
|
package/dist/index.d.mts
CHANGED
|
@@ -3,15 +3,19 @@ export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b
|
|
|
3
3
|
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
4
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
5
|
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
-
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.
|
|
8
|
-
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.
|
|
6
|
+
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.BTq9wym2.mjs';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.BTq9wym2.mjs';
|
|
8
|
+
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.r98bZ3Ig.mjs';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
11
|
import { Public, Value } from '@orpc/shared';
|
|
12
|
-
import
|
|
13
|
-
export {
|
|
12
|
+
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
13
|
+
export { OpenAPIV3_2 };
|
|
14
14
|
export { StandardBodyHint } from '@standard-server/core';
|
|
15
|
+
import * as OpenAPIV3_0 from '@openapi-spec/types/v3.0';
|
|
16
|
+
export { OpenAPIV3_0 };
|
|
17
|
+
import * as OpenAPIV3_1 from '@openapi-spec/types/v3.1';
|
|
18
|
+
export { OpenAPIV3_1 };
|
|
15
19
|
|
|
16
20
|
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
17
21
|
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,19 @@ export { B as BracketNotationSerializeResult, a as BracketNotationSerializer, b
|
|
|
3
3
|
import { ClientContext, ORPCClientOptions, ClientLink } from '@orpc/client';
|
|
4
4
|
export { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
5
5
|
import { RouterContract, RouterContractClient, AnyProcedureContract, ProcedureContract } from '@orpc/contract';
|
|
6
|
-
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.
|
|
7
|
-
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.
|
|
8
|
-
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.
|
|
6
|
+
import { J as JsonifiedClient, O as OpenAPIVersion, a as OpenAPIDocument } from './shared/openapi.BTq9wym2.js';
|
|
7
|
+
export { b as JsonifiedArray, c as JsonifiedClientError, d as JsonifiedValue } from './shared/openapi.BTq9wym2.js';
|
|
8
|
+
export { a as OpenAPIFunction, O as OpenAPIMeta, b as OpenAPIMetaPlugin, c as OpenAPIMethodMetaPlugin, d as OpenAPIPathMetaPlugin, e as OpenAPIPrefixMetaPlugin, f as OpenAPISpecMetaPlugin, g as getOpenAPIMeta, o as openapi } from './shared/openapi.r98bZ3Ig.js';
|
|
9
9
|
import { JsonSchema, JsonSchemaConverter } from '@orpc/json-schema';
|
|
10
10
|
import { AnyRouter, AnyProcedure } from '@orpc/server';
|
|
11
11
|
import { Public, Value } from '@orpc/shared';
|
|
12
|
-
import
|
|
13
|
-
export {
|
|
12
|
+
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
13
|
+
export { OpenAPIV3_2 };
|
|
14
14
|
export { StandardBodyHint } from '@standard-server/core';
|
|
15
|
+
import * as OpenAPIV3_0 from '@openapi-spec/types/v3.0';
|
|
16
|
+
export { OpenAPIV3_0 };
|
|
17
|
+
import * as OpenAPIV3_1 from '@openapi-spec/types/v3.1';
|
|
18
|
+
export { OpenAPIV3_1 };
|
|
15
19
|
|
|
16
20
|
interface ContractJsonifiedClientFactory<TClientContext extends ClientContext> {
|
|
17
21
|
<T extends RouterContract>(contract: T): JsonifiedClient<RouterContractClient<T, TClientContext>>;
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -5,7 +5,9 @@ import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
|
5
5
|
import { StandardUrl } from '@standard-server/core';
|
|
6
6
|
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
7
|
import { OpenAPIDocument, OpenAPIVersion } from '../index.mjs';
|
|
8
|
-
import '@openapi-spec/types';
|
|
8
|
+
import '@openapi-spec/types/v3.0';
|
|
9
|
+
import '@openapi-spec/types/v3.1';
|
|
10
|
+
import '@openapi-spec/types/v3.2';
|
|
9
11
|
import '@orpc/client';
|
|
10
12
|
|
|
11
13
|
type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
|
5
5
|
import { StandardUrl } from '@standard-server/core';
|
|
6
6
|
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
7
|
import { OpenAPIDocument, OpenAPIVersion } from '../index.js';
|
|
8
|
-
import '@openapi-spec/types';
|
|
8
|
+
import '@openapi-spec/types/v3.0';
|
|
9
|
+
import '@openapi-spec/types/v3.1';
|
|
10
|
+
import '@openapi-spec/types/v3.2';
|
|
9
11
|
import '@orpc/client';
|
|
10
12
|
|
|
11
13
|
type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
2
|
-
import { walkProcedureContractsSync,
|
|
3
|
-
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath, safeDecodeURIComponent, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
|
|
2
|
+
import { walkProcedureContractsSync, unlazy, getRouter, Procedure, createContractProcedure, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS } from '@orpc/server';
|
|
3
|
+
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath, setOwn, safeDecodeURIComponent, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
|
|
4
4
|
import { parseStandardUrl } from '@standard-server/core';
|
|
5
5
|
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Bu_PfTtX.mjs';
|
|
6
6
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
7
|
-
import { createRouter, addRoute, findRoute, routeToRegExp } from 'rou3';
|
|
7
|
+
import { createRouter, addRoute, findRoute, findAllRoutes, routeToRegExp } from 'rou3';
|
|
8
8
|
|
|
9
9
|
class OpenAPIMatcher {
|
|
10
10
|
filter;
|
|
@@ -17,6 +17,7 @@ class OpenAPIMatcher {
|
|
|
17
17
|
this.index(router);
|
|
18
18
|
}
|
|
19
19
|
index(router, path = []) {
|
|
20
|
+
const routes = [];
|
|
20
21
|
const lazyResults = walkProcedureContractsSync(router, (contract, path2) => {
|
|
21
22
|
if (!value(this.filter, contract, path2)) {
|
|
22
23
|
return;
|
|
@@ -25,19 +26,30 @@ class OpenAPIMatcher {
|
|
|
25
26
|
const method = meta?.method ?? DEFAULT_OPENAPI_METHOD;
|
|
26
27
|
const postHttpPath = meta?.path ?? pathToHttpPath(path2);
|
|
27
28
|
const openapiPath = meta?.prefix ? mergeHttpPath(meta.prefix, postHttpPath) : postHttpPath;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const { pattern, ...route } = toRou3Route(openapiPath);
|
|
30
|
+
routes.push({
|
|
31
|
+
method,
|
|
32
|
+
pattern,
|
|
33
|
+
entry: {
|
|
34
|
+
path: path2,
|
|
35
|
+
contract,
|
|
36
|
+
procedure: contract instanceof Procedure ? contract : void 0,
|
|
37
|
+
...route
|
|
38
|
+
}
|
|
33
39
|
});
|
|
34
40
|
}, path);
|
|
35
|
-
|
|
41
|
+
const pendingLazyRouters = lazyResults.map((result) => {
|
|
36
42
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
37
|
-
|
|
43
|
+
return {
|
|
38
44
|
...result,
|
|
39
45
|
matcher: prefix ? toRou3PrefixMatcher(prefix) : void 0
|
|
40
|
-
}
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
for (const { method, pattern, entry } of routes) {
|
|
49
|
+
addRoute(this.tree, method, pattern, entry);
|
|
50
|
+
}
|
|
51
|
+
for (const pending of pendingLazyRouters) {
|
|
52
|
+
this.pendingLazyRouters.add(pending);
|
|
41
53
|
}
|
|
42
54
|
}
|
|
43
55
|
async match(method, pathname, prefix) {
|
|
@@ -60,14 +72,14 @@ class OpenAPIMatcher {
|
|
|
60
72
|
if (loading !== void 0) {
|
|
61
73
|
await loading;
|
|
62
74
|
}
|
|
63
|
-
let match =
|
|
75
|
+
let match = this.findMatch(method, pathname);
|
|
64
76
|
if (match === void 0 && pathname.includes("%")) {
|
|
65
77
|
const normalizedPathname = normalizeHttpPath(pathname);
|
|
66
78
|
const normalizedLoading = this.resolvePendingLazyRouters(normalizedPathname);
|
|
67
79
|
if (normalizedLoading !== void 0) {
|
|
68
80
|
await normalizedLoading;
|
|
69
81
|
}
|
|
70
|
-
match =
|
|
82
|
+
match = this.findMatch(method, normalizedPathname);
|
|
71
83
|
}
|
|
72
84
|
if (match === void 0) {
|
|
73
85
|
return void 0;
|
|
@@ -76,9 +88,16 @@ class OpenAPIMatcher {
|
|
|
76
88
|
return {
|
|
77
89
|
path: entry.path,
|
|
78
90
|
procedure: entry.procedure ?? await this.resolveProcedure(entry),
|
|
79
|
-
params:
|
|
91
|
+
params: entry.params && decodeParams(entry.params, match.params)
|
|
80
92
|
};
|
|
81
93
|
}
|
|
94
|
+
findMatch(method, pathname) {
|
|
95
|
+
const match = findRoute(this.tree, method, pathname);
|
|
96
|
+
if (match === void 0 || !hasEmptyCatchAll(match)) {
|
|
97
|
+
return match;
|
|
98
|
+
}
|
|
99
|
+
return findAllRoutes(this.tree, method, pathname).reverse().find((match2) => !hasEmptyCatchAll(match2));
|
|
100
|
+
}
|
|
82
101
|
resolvePendingLazyRouters(pathname) {
|
|
83
102
|
for (const pending of this.pendingLazyRouters) {
|
|
84
103
|
if (pending.matcher === void 0 || pending.matcher.test(pathname)) {
|
|
@@ -118,24 +137,51 @@ class OpenAPIMatcher {
|
|
|
118
137
|
return entry.procedure;
|
|
119
138
|
}
|
|
120
139
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
124
|
-
return path;
|
|
140
|
+
function toRou3Route(path) {
|
|
141
|
+
const dynamicParams = getDynamicPathParams(path);
|
|
142
|
+
if (!dynamicParams) {
|
|
143
|
+
return { pattern: escapeRou3Literal(path) };
|
|
125
144
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
145
|
+
let pattern = "";
|
|
146
|
+
let literalStart = 0;
|
|
147
|
+
let catchAllKey;
|
|
148
|
+
const params = [];
|
|
149
|
+
for (const param of dynamicParams) {
|
|
150
|
+
const key = `p${params.length}`;
|
|
151
|
+
params.push([key, param.parameterName]);
|
|
152
|
+
pattern += escapeRou3Literal(path.slice(literalStart, param.startIndex));
|
|
153
|
+
literalStart = param.startIndex + param.segment.length;
|
|
154
|
+
if (param.allowsSlash) {
|
|
155
|
+
if (catchAllKey !== void 0) {
|
|
156
|
+
throw new TypeError(`OpenAPI path "${path}" has more than one catch-all param ({+name}), but only one is supported per path.`);
|
|
157
|
+
}
|
|
158
|
+
catchAllKey = key;
|
|
159
|
+
pattern += `:${key}(.*)`;
|
|
160
|
+
} else {
|
|
161
|
+
pattern += `:${key}`;
|
|
162
|
+
}
|
|
130
163
|
}
|
|
131
|
-
|
|
164
|
+
pattern += escapeRou3Literal(path.slice(literalStart));
|
|
165
|
+
return { pattern, params, catchAllKey };
|
|
132
166
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return
|
|
167
|
+
const ROU3_SYNTAX_REGEX = /[\\:*?+(){}]|(?<![^/])\.(?=\.?(?:\/|$))/g;
|
|
168
|
+
function escapeRou3Literal(text) {
|
|
169
|
+
return text.replace(ROU3_SYNTAX_REGEX, "\\$&");
|
|
136
170
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
171
|
+
function toRou3PrefixMatcher(prefix) {
|
|
172
|
+
const catchAll = getDynamicPathParams(prefix)?.find((param) => param.allowsSlash);
|
|
173
|
+
const head = catchAll ? prefix.slice(0, catchAll.startIndex) : prefix;
|
|
174
|
+
return routeToRegExp(mergeHttpPath(toRou3Route(head).pattern, "/**"));
|
|
175
|
+
}
|
|
176
|
+
function hasEmptyCatchAll(match) {
|
|
177
|
+
return match.data.catchAllKey !== void 0 && !match.params?.[match.data.catchAllKey];
|
|
178
|
+
}
|
|
179
|
+
function decodeParams(params, values) {
|
|
180
|
+
const decoded = {};
|
|
181
|
+
for (const [rou3Key, name] of params) {
|
|
182
|
+
setOwn(decoded, name, safeDecodeURIComponent(values[rou3Key]));
|
|
183
|
+
}
|
|
184
|
+
return decoded;
|
|
139
185
|
}
|
|
140
186
|
|
|
141
187
|
function serializeHeaders(headers, serializer) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as OpenAPIV3_0 from '@openapi-spec/types/v3.0';
|
|
2
|
+
import * as OpenAPIV3_1 from '@openapi-spec/types/v3.1';
|
|
3
|
+
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
2
4
|
import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
|
|
3
5
|
import { AsyncIteratorClass } from '@orpc/shared';
|
|
4
6
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as OpenAPIV3_0 from '@openapi-spec/types/v3.0';
|
|
2
|
+
import * as OpenAPIV3_1 from '@openapi-spec/types/v3.1';
|
|
3
|
+
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
2
4
|
import { AnyNestedClient, Client, ORPCError } from '@orpc/client';
|
|
3
5
|
import { AsyncIteratorClass } from '@orpc/shared';
|
|
4
6
|
|
|
@@ -6,7 +6,7 @@ import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
|
|
|
6
6
|
import { toStandardHeaders } from '@standard-server/fetch';
|
|
7
7
|
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.Bu_PfTtX.mjs';
|
|
8
8
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
9
|
-
import { s as serializeHeaders } from './openapi.
|
|
9
|
+
import { s as serializeHeaders } from './openapi.BJRea9Uu.mjs';
|
|
10
10
|
|
|
11
11
|
const END_SLASH_REGEX = /\/$/;
|
|
12
12
|
const DOT_SEGMENT_REGEX = /(?:^|\/)\.{1,2}(?:\/|$)/;
|
|
@@ -2,7 +2,7 @@ import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/con
|
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
4
|
import { StandardBodyHint } from '@standard-server/core';
|
|
5
|
-
import
|
|
5
|
+
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@ import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/con
|
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
4
|
import { StandardBodyHint } from '@standard-server/core';
|
|
5
|
-
import
|
|
5
|
+
import * as OpenAPIV3_2 from '@openapi-spec/types/v3.2';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.42",
|
|
5
5
|
"description": "Generate OpenAPI specs from oRPC routers and serve OpenAPI-compliant APIs with end-to-end type safety",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -97,20 +97,20 @@
|
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@openapi-spec/downgrader": "~0.
|
|
101
|
-
"@openapi-spec/types": "~0.
|
|
102
|
-
"@orpc/client": "2.0.0-beta.
|
|
103
|
-
"@orpc/contract": "2.0.0-beta.
|
|
104
|
-
"@orpc/json-schema": "2.0.0-beta.
|
|
105
|
-
"@orpc/server": "2.0.0-beta.
|
|
106
|
-
"@orpc/shared": "2.0.0-beta.
|
|
107
|
-
"@standard-server/core": "~0.10.
|
|
108
|
-
"@standard-server/fetch": "~0.10.
|
|
109
|
-
"rou3": "^0.
|
|
100
|
+
"@openapi-spec/downgrader": "~0.3.0",
|
|
101
|
+
"@openapi-spec/types": "~0.3.0",
|
|
102
|
+
"@orpc/client": "2.0.0-beta.42",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.42",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.42",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.42",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.42",
|
|
107
|
+
"@standard-server/core": "~0.10.1",
|
|
108
|
+
"@standard-server/fetch": "~0.10.1",
|
|
109
|
+
"rou3": "^1.0.0"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@scalar/api-reference": "^1.65.1",
|
|
113
|
-
"@standard-server/aws-lambda": "~0.10.
|
|
113
|
+
"@standard-server/aws-lambda": "~0.10.1",
|
|
114
114
|
"@types/swagger-ui": "^5.32.0",
|
|
115
115
|
"fastify": "^5.12.1",
|
|
116
116
|
"swagger-ui": "^5.32.14",
|