@orpc/openapi 2.0.0-beta.5 → 2.0.0-beta.50
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 +137 -102
- package/dist/adapters/aws-lambda/index.d.ts +3 -0
- package/dist/adapters/aws-lambda/index.js +1 -0
- package/dist/adapters/aws-lambda/openapi-handler.d.ts +17 -0
- package/dist/adapters/aws-lambda/openapi-handler.js +20 -0
- package/dist/adapters/fastify/index.d.ts +2 -0
- package/dist/adapters/fastify/index.js +1 -0
- package/dist/adapters/fastify/openapi-handler.d.ts +14 -0
- package/dist/adapters/fastify/openapi-handler.js +17 -0
- package/dist/adapters/fetch/index.d.ts +3 -27
- package/dist/adapters/fetch/index.js +2 -0
- package/dist/adapters/fetch/openapi-handler.d.ts +14 -0
- package/dist/adapters/fetch/openapi-handler.js +17 -0
- package/dist/adapters/fetch/openapi-link.d.ts +20 -0
- package/dist/adapters/fetch/openapi-link.js +22 -0
- package/dist/adapters/node/index.d.ts +2 -18
- package/dist/adapters/node/index.js +1 -0
- package/dist/adapters/node/openapi-handler.d.ts +14 -0
- package/dist/adapters/node/openapi-handler.js +17 -0
- package/dist/adapters/standard/index.d.ts +4 -50
- package/dist/adapters/standard/index.js +3 -0
- package/dist/adapters/standard/openapi-handler-codec.d.ts +61 -0
- package/dist/adapters/standard/openapi-handler-codec.js +158 -0
- package/dist/adapters/standard/openapi-link-codec.d.ts +58 -0
- package/dist/adapters/standard/openapi-link-codec.js +290 -0
- package/dist/adapters/standard/openapi-matcher.d.ts +29 -0
- package/dist/adapters/standard/openapi-matcher.js +78 -0
- package/dist/adapters/standard/utils.js +31 -0
- package/dist/bracket-notation.d.ts +26 -0
- package/dist/bracket-notation.js +135 -0
- package/dist/client-factory.d.ts +24 -0
- package/dist/client-factory.js +15 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -0
- package/dist/extensions/route.d.ts +36 -42
- package/dist/extensions/route.js +13 -0
- package/dist/helpers/{index.d.mts → form-data.d.ts} +11 -5
- package/dist/helpers/form-data.js +78 -0
- package/dist/helpers/index.d.ts +2 -51
- package/dist/helpers/index.js +1 -0
- package/dist/index.d.ts +15 -120
- package/dist/index.js +11 -0
- package/dist/meta.d.ts +325 -0
- package/dist/meta.js +66 -0
- package/dist/openapi-generator-components.d.ts +2 -0
- package/dist/openapi-generator-components.js +227 -0
- package/dist/openapi-generator-operation.d.ts +13 -0
- package/dist/openapi-generator-operation.js +401 -0
- package/dist/openapi-generator.d.ts +87 -0
- package/dist/openapi-generator.js +119 -0
- package/dist/openapi-json-serializer.d.ts +79 -0
- package/dist/openapi-json-serializer.js +221 -0
- package/dist/openapi-serializer.d.ts +42 -0
- package/dist/openapi-serializer.js +69 -0
- package/dist/plugins/index.d.ts +2 -90
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/openapi-reference.d.ts +112 -0
- package/dist/plugins/openapi-reference.js +164 -0
- package/dist/router-utils.d.ts +17 -0
- package/dist/router-utils.js +32 -0
- package/dist/types.d.ts +27 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +44 -0
- package/package.json +87 -49
- package/dist/adapters/fetch/index.d.mts +0 -27
- package/dist/adapters/fetch/index.mjs +0 -34
- package/dist/adapters/node/index.d.mts +0 -18
- package/dist/adapters/node/index.mjs +0 -21
- package/dist/adapters/standard/index.d.mts +0 -50
- package/dist/adapters/standard/index.mjs +0 -12
- package/dist/extensions/route.d.mts +0 -43
- package/dist/extensions/route.mjs +0 -14
- package/dist/helpers/index.mjs +0 -39
- package/dist/index.d.mts +0 -120
- package/dist/index.mjs +0 -930
- package/dist/plugins/index.d.mts +0 -90
- package/dist/plugins/index.mjs +0 -162
- package/dist/shared/openapi.7vgmPxca.d.ts +0 -82
- package/dist/shared/openapi.B2SK0ZAr.mjs +0 -359
- package/dist/shared/openapi.B9PQzqBn.mjs +0 -49
- package/dist/shared/openapi.BQzzr4-4.d.ts +0 -299
- package/dist/shared/openapi.BcEtAxQj.d.mts +0 -299
- package/dist/shared/openapi.Bt87OzTt.mjs +0 -131
- package/dist/shared/openapi.C7m7NAmH.d.mts +0 -142
- package/dist/shared/openapi.C7m7NAmH.d.ts +0 -142
- package/dist/shared/openapi.CTlpLuKN.mjs +0 -318
- package/dist/shared/openapi.CX6Ri5dP.d.mts +0 -82
- package/dist/shared/openapi.CYgMBSUF.d.mts +0 -18
- package/dist/shared/openapi.CYgMBSUF.d.ts +0 -18
- package/dist/shared/openapi.DmAa7YPO.mjs +0 -275
package/dist/plugins/index.d.mts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Context } from '@orpc/server';
|
|
2
|
-
import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions } from '@orpc/server/standard';
|
|
3
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
4
|
-
import { ApiReferenceConfiguration } from '@scalar/api-reference';
|
|
5
|
-
import { StandardUrl } from '@standardserver/core';
|
|
6
|
-
import { SwaggerUIOptions } from 'swagger-ui';
|
|
7
|
-
import { a as OpenAPIDocument } from '../shared/openapi.CYgMBSUF.mjs';
|
|
8
|
-
import '@hey-api/spec-types';
|
|
9
|
-
import '@orpc/client';
|
|
10
|
-
|
|
11
|
-
type OpenAPIReferenceHandlerPluginProvider = 'scalar' | 'swagger';
|
|
12
|
-
interface OpenAPIReferenceHandlerPluginScalarConfig extends Partial<ApiReferenceConfiguration> {
|
|
13
|
-
}
|
|
14
|
-
interface OpenAPIReferenceHandlerPluginSwaggerConfig extends Partial<Omit<SwaggerUIOptions, 'dom_id' | 'presets' | 'plugins'>> {
|
|
15
|
-
dom_id?: undefined | never;
|
|
16
|
-
presets?: undefined | `SwaggerUIBundle.${string}`[];
|
|
17
|
-
plugins?: undefined | `SwaggerUIBundle.${string}`[];
|
|
18
|
-
}
|
|
19
|
-
interface OpenAPIReferenceHandlerPluginOptions<T extends Context, TProvider extends OpenAPIReferenceHandlerPluginProvider> {
|
|
20
|
-
/**
|
|
21
|
-
* A static or dynamic OpenAPI document to serve.
|
|
22
|
-
* Receives routing interceptor options when provided as a function.
|
|
23
|
-
*/
|
|
24
|
-
spec: Value<Promisable<OpenAPIDocument>, [StandardHandlerRoutingInterceptorOptions<T>]>;
|
|
25
|
-
/**
|
|
26
|
-
* The URL path at which to serve the OpenAPI JSON.
|
|
27
|
-
*
|
|
28
|
-
* @default '/spec.json'
|
|
29
|
-
*/
|
|
30
|
-
specPath?: StandardUrl;
|
|
31
|
-
/**
|
|
32
|
-
* The UI provider to use for rendering the API reference.
|
|
33
|
-
*
|
|
34
|
-
* @default 'scalar'
|
|
35
|
-
*/
|
|
36
|
-
provider?: TProvider;
|
|
37
|
-
/**
|
|
38
|
-
* Provider-specific configuration passed directly to the chosen UI library.
|
|
39
|
-
* Options differ depending on `provider`.
|
|
40
|
-
*/
|
|
41
|
-
providerConfig?: undefined | (TProvider extends 'swagger' ? OpenAPIReferenceHandlerPluginSwaggerConfig : OpenAPIReferenceHandlerPluginScalarConfig);
|
|
42
|
-
/**
|
|
43
|
-
* URL for the provider's main script bundle.
|
|
44
|
-
*
|
|
45
|
-
* @default 'https://cdn.jsdelivr.net/npm/@scalar/api-reference' | 'https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js'
|
|
46
|
-
*/
|
|
47
|
-
providerScriptUrl?: undefined | string;
|
|
48
|
-
/**
|
|
49
|
-
* URL for the provider's stylesheet.
|
|
50
|
-
*
|
|
51
|
-
* @default undefined | 'https://unpkg.com/swagger-ui-dist/swagger-ui.css'
|
|
52
|
-
*/
|
|
53
|
-
providerCssUrl?: undefined | string;
|
|
54
|
-
/**
|
|
55
|
-
* The URL path at which to serve the API reference UI.
|
|
56
|
-
*
|
|
57
|
-
* @default '/'
|
|
58
|
-
*/
|
|
59
|
-
docsPath?: StandardUrl;
|
|
60
|
-
/**
|
|
61
|
-
* The document title for the API reference UI.
|
|
62
|
-
*
|
|
63
|
-
* @default spec.info.title
|
|
64
|
-
*/
|
|
65
|
-
docsTitle?: Value<Promisable<string>, [StandardHandlerRoutingInterceptorOptions<T>]>;
|
|
66
|
-
/**
|
|
67
|
-
* Raw HTML to inject into the `<head>` of the API reference page.
|
|
68
|
-
* Useful for custom stylesheets, meta tags, or scripts.
|
|
69
|
-
*
|
|
70
|
-
* @default ''
|
|
71
|
-
*/
|
|
72
|
-
docsHead?: Value<Promisable<string>, [StandardHandlerRoutingInterceptorOptions<T>]>;
|
|
73
|
-
}
|
|
74
|
-
declare class OpenAPIReferenceHandlerPlugin<T extends Context, TProvider extends OpenAPIReferenceHandlerPluginProvider> implements StandardHandlerPlugin<T> {
|
|
75
|
-
name: string;
|
|
76
|
-
private readonly spec;
|
|
77
|
-
private readonly specPath;
|
|
78
|
-
private readonly provider;
|
|
79
|
-
private readonly providerConfig;
|
|
80
|
-
private readonly providerScriptUrl;
|
|
81
|
-
private readonly providerCssUrl;
|
|
82
|
-
private readonly docsPath;
|
|
83
|
-
private readonly docsTitle;
|
|
84
|
-
private readonly docsHead;
|
|
85
|
-
constructor(options: OpenAPIReferenceHandlerPluginOptions<T, TProvider>);
|
|
86
|
-
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export { OpenAPIReferenceHandlerPlugin };
|
|
90
|
-
export type { OpenAPIReferenceHandlerPluginOptions, OpenAPIReferenceHandlerPluginProvider, OpenAPIReferenceHandlerPluginScalarConfig, OpenAPIReferenceHandlerPluginSwaggerConfig };
|
package/dist/plugins/index.mjs
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { toArray, matchesHttpPath, mergeHttpPath, getOpenTelemetryConfig, value, stringifyJSON } from '@orpc/shared';
|
|
2
|
-
|
|
3
|
-
class OpenAPIReferenceHandlerPlugin {
|
|
4
|
-
name = "~openapi-reference";
|
|
5
|
-
spec;
|
|
6
|
-
specPath;
|
|
7
|
-
provider;
|
|
8
|
-
providerConfig;
|
|
9
|
-
providerScriptUrl;
|
|
10
|
-
providerCssUrl;
|
|
11
|
-
docsPath;
|
|
12
|
-
docsTitle;
|
|
13
|
-
docsHead;
|
|
14
|
-
constructor(options) {
|
|
15
|
-
this.spec = options.spec;
|
|
16
|
-
this.specPath = options.specPath ?? "/spec.json";
|
|
17
|
-
this.provider = options.provider ?? "scalar";
|
|
18
|
-
this.providerConfig = options.providerConfig;
|
|
19
|
-
this.providerScriptUrl = options.providerScriptUrl;
|
|
20
|
-
this.providerCssUrl = options.providerCssUrl;
|
|
21
|
-
this.docsTitle = options.docsTitle;
|
|
22
|
-
this.docsPath = options.docsPath ?? "/";
|
|
23
|
-
this.docsHead = options.docsHead ?? "";
|
|
24
|
-
}
|
|
25
|
-
init(options) {
|
|
26
|
-
return {
|
|
27
|
-
...options,
|
|
28
|
-
routingInterceptors: [
|
|
29
|
-
// Run after user-provided routing interceptors so they can capture the ui/spec responses
|
|
30
|
-
...toArray(options.routingInterceptors),
|
|
31
|
-
async ({ next, ...routingInterceptorOptions }) => {
|
|
32
|
-
const result = await next();
|
|
33
|
-
if (result.matched || routingInterceptorOptions.request.method !== "GET") {
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
const isSpecPath = matchesHttpPath(
|
|
37
|
-
routingInterceptorOptions.request.url,
|
|
38
|
-
routingInterceptorOptions.prefix ? mergeHttpPath(routingInterceptorOptions.prefix, this.specPath) : this.specPath
|
|
39
|
-
);
|
|
40
|
-
const isDocsPath = matchesHttpPath(
|
|
41
|
-
routingInterceptorOptions.request.url,
|
|
42
|
-
routingInterceptorOptions.prefix ? mergeHttpPath(routingInterceptorOptions.prefix, this.docsPath) : this.docsPath
|
|
43
|
-
);
|
|
44
|
-
if (!isSpecPath && !isDocsPath) {
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
const span = getOpenTelemetryConfig()?.trace.getActiveSpan();
|
|
48
|
-
const spec = await value(this.spec, routingInterceptorOptions);
|
|
49
|
-
if (isSpecPath) {
|
|
50
|
-
span?.updateName(`${routingInterceptorOptions.request.method} ${routingInterceptorOptions.request.url} (openapi spec)`);
|
|
51
|
-
const specFile = new File([stringifyJSON(spec)], `${spec.info.title}.json`, {
|
|
52
|
-
type: "application/json"
|
|
53
|
-
});
|
|
54
|
-
return { matched: true, response: { status: 200, headers: {}, body: specFile } };
|
|
55
|
-
}
|
|
56
|
-
span?.updateName(`${routingInterceptorOptions.request.method} ${routingInterceptorOptions.request.url} (${this.provider} ui)`);
|
|
57
|
-
const docsTitle = await value(this.docsTitle, routingInterceptorOptions) ?? spec.info.title;
|
|
58
|
-
const docsHead = await value(this.docsHead, routingInterceptorOptions);
|
|
59
|
-
let html;
|
|
60
|
-
if (this.provider === "swagger") {
|
|
61
|
-
const scriptUrl = this.providerScriptUrl ?? "https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js";
|
|
62
|
-
const cssUrl = this.providerCssUrl ?? "https://unpkg.com/swagger-ui-dist/swagger-ui.css";
|
|
63
|
-
const config = {
|
|
64
|
-
dom_id: "#app",
|
|
65
|
-
spec,
|
|
66
|
-
deepLinking: true,
|
|
67
|
-
presets: [
|
|
68
|
-
"SwaggerUIBundle.presets.apis",
|
|
69
|
-
"SwaggerUIBundle.presets.standalone"
|
|
70
|
-
],
|
|
71
|
-
plugins: [
|
|
72
|
-
"SwaggerUIBundle.plugins.DownloadUrl"
|
|
73
|
-
],
|
|
74
|
-
...this.providerConfig
|
|
75
|
-
};
|
|
76
|
-
html = `
|
|
77
|
-
<!doctype html>
|
|
78
|
-
<html>
|
|
79
|
-
<head>
|
|
80
|
-
<meta charset="utf-8" />
|
|
81
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
82
|
-
<title>${escapeHtmlEntities(docsTitle)}</title>
|
|
83
|
-
<link rel="stylesheet" type="text/css" href="${escapeHtmlEntities(cssUrl)}" />
|
|
84
|
-
${docsHead}
|
|
85
|
-
</head>
|
|
86
|
-
<body>
|
|
87
|
-
<div id="app"></div>
|
|
88
|
-
|
|
89
|
-
<script src="${escapeHtmlEntities(scriptUrl)}"><\/script>
|
|
90
|
-
|
|
91
|
-
<!-- IMPORTANT: assign to a variable first to prevent ), ( in values breaking the call expression. -->
|
|
92
|
-
<!-- IMPORTANT: escapeJsonForHtml ensures <, > cannot terminate the <\/script> tag prematurely. -->
|
|
93
|
-
<script>
|
|
94
|
-
const swaggerConfig = ${escapeJsonForHtml(config).replace(/"(SwaggerUIBundle\.[.a-zA-Z0-9]+)"/g, "$1")}
|
|
95
|
-
|
|
96
|
-
window.onload = () => {
|
|
97
|
-
window.ui = SwaggerUIBundle(swaggerConfig)
|
|
98
|
-
}
|
|
99
|
-
<\/script>
|
|
100
|
-
</body>
|
|
101
|
-
</html>
|
|
102
|
-
`;
|
|
103
|
-
} else {
|
|
104
|
-
const scriptUrl = this.providerScriptUrl ?? "https://cdn.jsdelivr.net/npm/@scalar/api-reference";
|
|
105
|
-
const cssUrl = this.providerCssUrl;
|
|
106
|
-
const config = {
|
|
107
|
-
content: stringifyJSON(spec),
|
|
108
|
-
...this.providerConfig
|
|
109
|
-
};
|
|
110
|
-
html = `
|
|
111
|
-
<!doctype html>
|
|
112
|
-
<html>
|
|
113
|
-
<head>
|
|
114
|
-
<meta charset="utf-8" />
|
|
115
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
116
|
-
<title>${escapeHtmlEntities(docsTitle)}</title>
|
|
117
|
-
${cssUrl ? `<link rel="stylesheet" type="text/css" href="${escapeHtmlEntities(cssUrl)}" />` : ""}
|
|
118
|
-
${docsHead}
|
|
119
|
-
</head>
|
|
120
|
-
<body>
|
|
121
|
-
<div id="app"></div>
|
|
122
|
-
|
|
123
|
-
<script src="${escapeHtmlEntities(scriptUrl)}"><\/script>
|
|
124
|
-
|
|
125
|
-
<!-- IMPORTANT: assign to a variable first to prevent ), ( in values breaking the call expression. -->
|
|
126
|
-
<!-- IMPORTANT: escapeJsonForHtml ensures <, > cannot terminate the <\/script> tag prematurely. -->
|
|
127
|
-
<script>
|
|
128
|
-
const scalarConfig = ${escapeJsonForHtml(config)}
|
|
129
|
-
|
|
130
|
-
Scalar.createApiReference('#app', scalarConfig)
|
|
131
|
-
<\/script>
|
|
132
|
-
</body>
|
|
133
|
-
</html>
|
|
134
|
-
`;
|
|
135
|
-
}
|
|
136
|
-
const htmlBlob = new Blob([html], {
|
|
137
|
-
type: "text/html"
|
|
138
|
-
});
|
|
139
|
-
return {
|
|
140
|
-
matched: true,
|
|
141
|
-
response: {
|
|
142
|
-
status: 200,
|
|
143
|
-
headers: {
|
|
144
|
-
"content-disposition": []
|
|
145
|
-
// disable auto-gen header
|
|
146
|
-
},
|
|
147
|
-
body: htmlBlob
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function escapeHtmlEntities(s) {
|
|
156
|
-
return s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
157
|
-
}
|
|
158
|
-
function escapeJsonForHtml(obj) {
|
|
159
|
-
return stringifyJSON(obj).replace(/&/g, "\\u0026").replace(/'/g, "\\u0027").replace(/</g, "\\u003C").replace(/>/g, "\\u003E").replace(/\//g, "\\u002F");
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export { OpenAPIReferenceHandlerPlugin };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { AnyORPCError } from '@orpc/client';
|
|
2
|
-
import { AnyProcedure, AnyRouter, Context } from '@orpc/server';
|
|
3
|
-
import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCodecResolvedProcedure } from '@orpc/server/standard';
|
|
4
|
-
import { Value, Promisable } from '@orpc/shared';
|
|
5
|
-
import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
|
|
6
|
-
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.C7m7NAmH.js';
|
|
8
|
-
|
|
9
|
-
interface OpenAPIMatcherOptions {
|
|
10
|
-
/**
|
|
11
|
-
* Filter which procedures are exposed for matching. Return `false` to exclude.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
filter?: Value<boolean, [contract: AnyProcedureContract | AnyProcedure, path: string[]]>;
|
|
16
|
-
}
|
|
17
|
-
declare class OpenAPIMatcher {
|
|
18
|
-
private readonly filter;
|
|
19
|
-
private readonly rootRouter;
|
|
20
|
-
private readonly tree;
|
|
21
|
-
private pendingLazyRouters;
|
|
22
|
-
constructor(router: AnyRouter, options?: OpenAPIMatcherOptions);
|
|
23
|
-
private index;
|
|
24
|
-
match(method: string, pathname: `/${string}`, prefix: `/${string}` | undefined): Promise<{
|
|
25
|
-
path: string[];
|
|
26
|
-
procedure: AnyProcedure;
|
|
27
|
-
params?: Record<string, string> | undefined;
|
|
28
|
-
} | undefined>;
|
|
29
|
-
private matchPathname;
|
|
30
|
-
private resolvePendingLazyRouters;
|
|
31
|
-
private resolveProcedure;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface OpenAPIHandlerCodecCoreOptions<_T extends Context> {
|
|
35
|
-
/**
|
|
36
|
-
* Override the default OpenAPI serializer.
|
|
37
|
-
*/
|
|
38
|
-
serializer?: Pick<OpenAPISerializer, keyof OpenAPISerializer>;
|
|
39
|
-
/**
|
|
40
|
-
* Mapping ORPCError Code -> HTTP Status Code
|
|
41
|
-
*
|
|
42
|
-
* @default COMMON_ERROR_STATUS_MAP, DEFAULT_ERROR_STATUS
|
|
43
|
-
*/
|
|
44
|
-
errorStatusMap?: Record<string, number> | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Customize how an ORPC error is serialized into a response body.
|
|
47
|
-
* Use this if your API needs a different error output structure.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* - Return `null | undefined` to fallback to default behavior
|
|
51
|
-
*
|
|
52
|
-
* @default ((e) => e.toJSON())
|
|
53
|
-
*/
|
|
54
|
-
customErrorResponseBodyEncoder?: (error: AnyORPCError) => unknown;
|
|
55
|
-
}
|
|
56
|
-
declare class OpenAPIHandlerCodecCore<T extends Context> {
|
|
57
|
-
private readonly serializer;
|
|
58
|
-
private readonly errorStatusMap;
|
|
59
|
-
private readonly customErrorResponseBodySerializer;
|
|
60
|
-
constructor(options?: OpenAPIHandlerCodecCoreOptions<T>);
|
|
61
|
-
decodeInput(matched: {
|
|
62
|
-
procedure: AnyProcedure;
|
|
63
|
-
params?: undefined | Record<string, string>;
|
|
64
|
-
}, request: StandardLazyRequest): Promise<unknown>;
|
|
65
|
-
/**
|
|
66
|
-
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
67
|
-
*/
|
|
68
|
-
encodeOutput(output: unknown, procedure: AnyProcedure, path: string[]): Promisable<StandardResponse>;
|
|
69
|
-
encodeError(error: AnyORPCError): Promisable<StandardResponse>;
|
|
70
|
-
private deserializeQuery;
|
|
71
|
-
private deserializeParams;
|
|
72
|
-
}
|
|
73
|
-
interface OpenAPIHandlerCodecOptions<T extends Context> extends OpenAPIHandlerCodecCoreOptions<T>, OpenAPIMatcherOptions {
|
|
74
|
-
}
|
|
75
|
-
declare class OpenAPIHandlerCodec<T extends Context> extends OpenAPIHandlerCodecCore<T> implements StandardHandlerCodec<T> {
|
|
76
|
-
private readonly matcher;
|
|
77
|
-
constructor(router: AnyRouter, options?: OpenAPIHandlerCodecOptions<T>);
|
|
78
|
-
resolveProcedure(request: StandardLazyRequest, options: StandardHandlerHandleOptions<T>): Promise<StandardHandlerCodecResolvedProcedure | undefined>;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { OpenAPIHandlerCodec as a, OpenAPIHandlerCodecCore as b, OpenAPIMatcher as d };
|
|
82
|
-
export type { OpenAPIHandlerCodecOptions as O, OpenAPIHandlerCodecCoreOptions as c, OpenAPIMatcherOptions as e };
|