@orpc/openapi 0.0.0-next.f22c7ec → 0.0.0-next.f56d2b3
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/{chunk-V4HFPIEN.js → chunk-Q2LSK6YZ.js} +2 -7
- package/dist/{chunk-TW72MGM2.js → chunk-SOVQ5ARD.js} +16 -17
- package/dist/{chunk-N7JLIFHD.js → chunk-VFGNQS5W.js} +2 -2
- package/dist/fetch.js +3 -3
- package/dist/hono.js +3 -3
- package/dist/index.js +13 -17
- package/dist/next.js +3 -3
- package/dist/node.js +2 -2
- package/dist/src/adapters/fetch/openapi-handler.d.ts +2 -2
- package/dist/src/adapters/fetch/openapi-procedure-matcher.d.ts +3 -3
- package/dist/src/adapters/fetch/schema-coercer.d.ts +1 -1
- package/dist/src/openapi-generator.d.ts +2 -2
- package/dist/src/openapi-input-structure-parser.d.ts +2 -2
- package/dist/src/openapi-output-structure-parser.d.ts +2 -2
- package/dist/src/schema-converter.d.ts +2 -2
- package/dist/src/utils.d.ts +6 -6
- package/package.json +4 -4
|
@@ -35,7 +35,7 @@ var JSONSerializer = class {
|
|
|
35
35
|
|
|
36
36
|
// src/utils.ts
|
|
37
37
|
import { isContractProcedure } from "@orpc/contract";
|
|
38
|
-
import { getRouterContract, isLazy,
|
|
38
|
+
import { getRouterContract, isLazy, unlazy } from "@orpc/server";
|
|
39
39
|
function forEachContractProcedure(options, callback, result = [], isCurrentRouterContract = false) {
|
|
40
40
|
const hiddenContract = getRouterContract(options.router);
|
|
41
41
|
if (!isCurrentRouterContract && hiddenContract) {
|
|
@@ -54,11 +54,6 @@ function forEachContractProcedure(options, callback, result = [], isCurrentRoute
|
|
|
54
54
|
router: options.router,
|
|
55
55
|
path: options.path
|
|
56
56
|
});
|
|
57
|
-
} else if (isProcedure(options.router)) {
|
|
58
|
-
callback({
|
|
59
|
-
contract: options.router["~orpc"].contract,
|
|
60
|
-
path: options.path
|
|
61
|
-
});
|
|
62
57
|
} else if (isContractProcedure(options.router)) {
|
|
63
58
|
callback({
|
|
64
59
|
contract: options.router,
|
|
@@ -104,4 +99,4 @@ export {
|
|
|
104
99
|
forEachAllContractProcedure,
|
|
105
100
|
standardizeHTTPPath
|
|
106
101
|
};
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-Q2LSK6YZ.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
JSONSerializer,
|
|
3
3
|
forEachContractProcedure,
|
|
4
4
|
standardizeHTTPPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q2LSK6YZ.js";
|
|
6
6
|
|
|
7
7
|
// src/adapters/fetch/bracket-notation.ts
|
|
8
8
|
import { isPlainObject } from "@orpc/shared";
|
|
@@ -288,8 +288,7 @@ var OpenAPIPayloadCodec = class {
|
|
|
288
288
|
if (isExpectedMultipartFormData) {
|
|
289
289
|
return this.encodeAsFormData(handledPayload);
|
|
290
290
|
}
|
|
291
|
-
throw new ORPCError({
|
|
292
|
-
code: "NOT_ACCEPTABLE",
|
|
291
|
+
throw new ORPCError("NOT_ACCEPTABLE", {
|
|
293
292
|
message: `Unsupported content-type: ${accept}`
|
|
294
293
|
});
|
|
295
294
|
}
|
|
@@ -392,8 +391,7 @@ var OpenAPIPayloadCodec = class {
|
|
|
392
391
|
type: blob.type
|
|
393
392
|
});
|
|
394
393
|
} catch (e) {
|
|
395
|
-
throw new ORPCError({
|
|
396
|
-
code: "BAD_REQUEST",
|
|
394
|
+
throw new ORPCError("BAD_REQUEST", {
|
|
397
395
|
message: "Cannot parse request/response. Please check the request/response body and Content-Type header.",
|
|
398
396
|
cause: e
|
|
399
397
|
});
|
|
@@ -402,7 +400,8 @@ var OpenAPIPayloadCodec = class {
|
|
|
402
400
|
};
|
|
403
401
|
|
|
404
402
|
// src/adapters/fetch/openapi-procedure-matcher.ts
|
|
405
|
-
import {
|
|
403
|
+
import { fallbackContractConfig } from "@orpc/contract";
|
|
404
|
+
import { getLazyRouterPrefix, getRouterChild, isProcedure, unlazy } from "@orpc/server";
|
|
406
405
|
import { mapValues } from "@orpc/shared";
|
|
407
406
|
var OpenAPIProcedureMatcher = class {
|
|
408
407
|
constructor(hono, router) {
|
|
@@ -446,7 +445,7 @@ var OpenAPIProcedureMatcher = class {
|
|
|
446
445
|
}
|
|
447
446
|
add(path, router) {
|
|
448
447
|
const lazies = forEachContractProcedure({ path, router }, ({ path: path2, contract }) => {
|
|
449
|
-
const method =
|
|
448
|
+
const method = fallbackContractConfig("defaultMethod", contract["~orpc"].route?.method);
|
|
450
449
|
const httpPath = contract["~orpc"].route?.path ? this.convertOpenAPIPathToRouterPath(contract["~orpc"].route?.path) : `/${path2.map(encodeURIComponent).join("/")}`;
|
|
451
450
|
this.hono.add(method, httpPath, [httpPath, path2]);
|
|
452
451
|
});
|
|
@@ -485,7 +484,8 @@ var CompositeSchemaCoercer = class {
|
|
|
485
484
|
};
|
|
486
485
|
|
|
487
486
|
// src/adapters/fetch/openapi-handler.ts
|
|
488
|
-
import {
|
|
487
|
+
import { fallbackContractConfig as fallbackContractConfig2 } from "@orpc/contract";
|
|
488
|
+
import { createProcedureClient, ORPCError as ORPCError2 } from "@orpc/server";
|
|
489
489
|
import { executeWithHooks, isPlainObject as isPlainObject3, trim } from "@orpc/shared";
|
|
490
490
|
var OpenAPIHandler = class {
|
|
491
491
|
constructor(hono, router, options) {
|
|
@@ -503,7 +503,7 @@ var OpenAPIHandler = class {
|
|
|
503
503
|
inputStructureDetailed;
|
|
504
504
|
compositeSchemaCoercer;
|
|
505
505
|
async handle(request, ...[options]) {
|
|
506
|
-
const context = options?.context;
|
|
506
|
+
const context = options?.context ?? {};
|
|
507
507
|
const headers = request.headers;
|
|
508
508
|
const accept = headers.get("accept") || void 0;
|
|
509
509
|
const execute = async () => {
|
|
@@ -516,9 +516,9 @@ var OpenAPIHandler = class {
|
|
|
516
516
|
if (!matched) {
|
|
517
517
|
return { matched: false, response: void 0 };
|
|
518
518
|
}
|
|
519
|
-
const
|
|
519
|
+
const def = matched.procedure["~orpc"];
|
|
520
520
|
const input = await this.decodeInput(matched.procedure, matched.params, request);
|
|
521
|
-
const coercedInput = this.compositeSchemaCoercer.coerce(
|
|
521
|
+
const coercedInput = this.compositeSchemaCoercer.coerce(def.inputSchema, input);
|
|
522
522
|
const client = createProcedureClient(matched.procedure, {
|
|
523
523
|
context,
|
|
524
524
|
path: matched.path
|
|
@@ -527,7 +527,7 @@ var OpenAPIHandler = class {
|
|
|
527
527
|
const { body, headers: resHeaders } = this.encodeOutput(matched.procedure, output, accept);
|
|
528
528
|
const response = new Response(body, {
|
|
529
529
|
headers: resHeaders,
|
|
530
|
-
status:
|
|
530
|
+
status: fallbackContractConfig2("defaultSuccessStatus", def.route?.successStatus)
|
|
531
531
|
});
|
|
532
532
|
return { matched: true, response };
|
|
533
533
|
};
|
|
@@ -562,7 +562,7 @@ var OpenAPIHandler = class {
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
async decodeInput(procedure, params, request) {
|
|
565
|
-
const inputStructure =
|
|
565
|
+
const inputStructure = fallbackContractConfig2("defaultInputStructure", procedure["~orpc"].route.inputStructure);
|
|
566
566
|
const url = new URL(request.url);
|
|
567
567
|
const query = url.searchParams;
|
|
568
568
|
const headers = request.headers;
|
|
@@ -578,7 +578,7 @@ var OpenAPIHandler = class {
|
|
|
578
578
|
return this.inputStructureDetailed.build(params, decodedQuery, decodedHeaders, decodedBody);
|
|
579
579
|
}
|
|
580
580
|
encodeOutput(procedure, output, accept) {
|
|
581
|
-
const outputStructure =
|
|
581
|
+
const outputStructure = fallbackContractConfig2("defaultOutputStructure", procedure["~orpc"].route.outputStructure);
|
|
582
582
|
if (outputStructure === "compact") {
|
|
583
583
|
return this.payloadCodec.encode(output, accept);
|
|
584
584
|
}
|
|
@@ -627,8 +627,7 @@ var OpenAPIHandler = class {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
convertToORPCError(e) {
|
|
630
|
-
return e instanceof ORPCError2 ? e : new ORPCError2({
|
|
631
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
630
|
+
return e instanceof ORPCError2 ? e : new ORPCError2("INTERNAL_SERVER_ERROR", {
|
|
632
631
|
message: "Internal server error",
|
|
633
632
|
cause: e
|
|
634
633
|
});
|
|
@@ -648,4 +647,4 @@ export {
|
|
|
648
647
|
CompositeSchemaCoercer,
|
|
649
648
|
OpenAPIHandler
|
|
650
649
|
};
|
|
651
|
-
//# sourceMappingURL=chunk-
|
|
650
|
+
//# sourceMappingURL=chunk-SOVQ5ARD.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenAPIHandler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SOVQ5ARD.js";
|
|
4
4
|
|
|
5
5
|
// src/adapters/fetch/openapi-handler-server.ts
|
|
6
6
|
import { TrieRouter } from "hono/router/trie-router";
|
|
@@ -22,4 +22,4 @@ export {
|
|
|
22
22
|
OpenAPIServerHandler,
|
|
23
23
|
OpenAPIServerlessHandler
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-VFGNQS5W.js.map
|
package/dist/fetch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenAPIServerHandler,
|
|
3
3
|
OpenAPIServerlessHandler
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VFGNQS5W.js";
|
|
5
5
|
import {
|
|
6
6
|
CompositeSchemaCoercer,
|
|
7
7
|
InputStructureCompact,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
parsePath,
|
|
15
15
|
serialize,
|
|
16
16
|
stringifyPath
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-SOVQ5ARD.js";
|
|
18
|
+
import "./chunk-Q2LSK6YZ.js";
|
|
19
19
|
export {
|
|
20
20
|
CompositeSchemaCoercer,
|
|
21
21
|
InputStructureCompact,
|
package/dist/hono.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenAPIServerHandler,
|
|
3
3
|
OpenAPIServerlessHandler
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VFGNQS5W.js";
|
|
5
5
|
import {
|
|
6
6
|
CompositeSchemaCoercer,
|
|
7
7
|
InputStructureCompact,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
parsePath,
|
|
15
15
|
serialize,
|
|
16
16
|
stringifyPath
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-SOVQ5ARD.js";
|
|
18
|
+
import "./chunk-Q2LSK6YZ.js";
|
|
19
19
|
export {
|
|
20
20
|
CompositeSchemaCoercer,
|
|
21
21
|
InputStructureCompact,
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
forEachAllContractProcedure,
|
|
4
4
|
forEachContractProcedure,
|
|
5
5
|
standardizeHTTPPath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q2LSK6YZ.js";
|
|
7
7
|
|
|
8
8
|
// src/openapi.ts
|
|
9
9
|
import { OpenApiBuilder } from "openapi3-ts/oas31";
|
|
@@ -36,7 +36,7 @@ var OpenAPIContentBuilder = class {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// src/openapi-generator.ts
|
|
39
|
-
import {
|
|
39
|
+
import { fallbackContractConfig as fallbackContractConfig2, fallbackORPCErrorStatus } from "@orpc/contract";
|
|
40
40
|
import { group } from "@orpc/shared";
|
|
41
41
|
|
|
42
42
|
// src/openapi-error.ts
|
|
@@ -44,7 +44,7 @@ var OpenAPIError = class extends Error {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// src/openapi-input-structure-parser.ts
|
|
47
|
-
import {
|
|
47
|
+
import { fallbackContractConfig } from "@orpc/contract";
|
|
48
48
|
var OpenAPIInputStructureParser = class {
|
|
49
49
|
constructor(schemaConverter, schemaUtils, pathParser) {
|
|
50
50
|
this.schemaConverter = schemaConverter;
|
|
@@ -52,8 +52,8 @@ var OpenAPIInputStructureParser = class {
|
|
|
52
52
|
this.pathParser = pathParser;
|
|
53
53
|
}
|
|
54
54
|
parse(contract, structure) {
|
|
55
|
-
const inputSchema = this.schemaConverter.convert(contract["~orpc"].
|
|
56
|
-
const method =
|
|
55
|
+
const inputSchema = this.schemaConverter.convert(contract["~orpc"].inputSchema, { strategy: "input" });
|
|
56
|
+
const method = fallbackContractConfig("defaultMethod", contract["~orpc"].route?.method);
|
|
57
57
|
const httpPath = contract["~orpc"].route?.path;
|
|
58
58
|
if (this.schemaUtils.isAnySchema(inputSchema)) {
|
|
59
59
|
return {
|
|
@@ -145,7 +145,7 @@ var OpenAPIOutputStructureParser = class {
|
|
|
145
145
|
this.schemaUtils = schemaUtils;
|
|
146
146
|
}
|
|
147
147
|
parse(contract, structure) {
|
|
148
|
-
const outputSchema = this.schemaConverter.convert(contract["~orpc"].
|
|
148
|
+
const outputSchema = this.schemaConverter.convert(contract["~orpc"].outputSchema, { strategy: "output" });
|
|
149
149
|
if (this.schemaUtils.isAnySchema(outputSchema)) {
|
|
150
150
|
return {
|
|
151
151
|
headersSchema: void 0,
|
|
@@ -412,10 +412,10 @@ var OpenAPIGenerator = class {
|
|
|
412
412
|
if (this.ignoreUndefinedPathProcedures && def.route?.path === void 0) {
|
|
413
413
|
return;
|
|
414
414
|
}
|
|
415
|
-
const method =
|
|
415
|
+
const method = fallbackContractConfig2("defaultMethod", def.route?.method);
|
|
416
416
|
const httpPath = def.route?.path ? standardizeHTTPPath(def.route?.path) : `/${path.map(encodeURIComponent).join("/")}`;
|
|
417
|
-
const inputStructure =
|
|
418
|
-
const outputStructure =
|
|
417
|
+
const inputStructure = fallbackContractConfig2("defaultInputStructure", def.route?.inputStructure);
|
|
418
|
+
const outputStructure = fallbackContractConfig2("defaultOutputStructure", def.route?.outputStructure);
|
|
419
419
|
const { paramsSchema, querySchema, headersSchema, bodySchema } = this.inputStructureParser.parse(contract, inputStructure);
|
|
420
420
|
const { headersSchema: resHeadersSchema, bodySchema: resBodySchema } = this.outputStructureParser.parse(contract, outputStructure);
|
|
421
421
|
const params = paramsSchema ? this.parametersBuilder.build("path", paramsSchema, {
|
|
@@ -429,14 +429,10 @@ var OpenAPIGenerator = class {
|
|
|
429
429
|
content: this.contentBuilder.build(bodySchema)
|
|
430
430
|
} : void 0;
|
|
431
431
|
const responses = {};
|
|
432
|
-
responses[
|
|
433
|
-
description:
|
|
434
|
-
content: resBodySchema !== void 0 ? this.contentBuilder.build(resBodySchema,
|
|
435
|
-
|
|
436
|
-
}) : void 0,
|
|
437
|
-
headers: resHeadersSchema !== void 0 ? this.parametersBuilder.buildHeadersObject(resHeadersSchema, {
|
|
438
|
-
example: def.outputExample
|
|
439
|
-
}) : void 0
|
|
432
|
+
responses[fallbackContractConfig2("defaultSuccessStatus", def.route?.successStatus)] = {
|
|
433
|
+
description: fallbackContractConfig2("defaultSuccessDescription", def.route?.successDescription),
|
|
434
|
+
content: resBodySchema !== void 0 ? this.contentBuilder.build(resBodySchema) : void 0,
|
|
435
|
+
headers: resHeadersSchema !== void 0 ? this.parametersBuilder.buildHeadersObject(resHeadersSchema) : void 0
|
|
440
436
|
};
|
|
441
437
|
const errors = group(Object.entries(def.errorMap ?? {}).filter(([_, config]) => config).map(([code, config]) => ({
|
|
442
438
|
...config,
|
package/dist/next.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenAPIServerHandler,
|
|
3
3
|
OpenAPIServerlessHandler
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VFGNQS5W.js";
|
|
5
5
|
import {
|
|
6
6
|
CompositeSchemaCoercer,
|
|
7
7
|
InputStructureCompact,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
parsePath,
|
|
15
15
|
serialize,
|
|
16
16
|
stringifyPath
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-SOVQ5ARD.js";
|
|
18
|
+
import "./chunk-Q2LSK6YZ.js";
|
|
19
19
|
export {
|
|
20
20
|
CompositeSchemaCoercer,
|
|
21
21
|
InputStructureCompact,
|
package/dist/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenAPIHandler
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-SOVQ5ARD.js";
|
|
4
|
+
import "./chunk-Q2LSK6YZ.js";
|
|
5
5
|
|
|
6
6
|
// src/adapters/node/openapi-handler.ts
|
|
7
7
|
import { createRequest, sendResponse } from "@orpc/server/node";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context, Router
|
|
1
|
+
import type { Context, Router } from '@orpc/server';
|
|
2
2
|
import type { FetchHandler, FetchHandleRest, FetchHandleResult } from '@orpc/server/fetch';
|
|
3
3
|
import type { PublicInputStructureCompact } from './input-structure-compact';
|
|
4
4
|
import { type Hooks } from '@orpc/shared';
|
|
@@ -7,7 +7,7 @@ import { type PublicInputStructureDetailed } from './input-structure-detailed';
|
|
|
7
7
|
import { type PublicOpenAPIPayloadCodec } from './openapi-payload-codec';
|
|
8
8
|
import { type Hono, type PublicOpenAPIProcedureMatcher } from './openapi-procedure-matcher';
|
|
9
9
|
import { type SchemaCoercer } from './schema-coercer';
|
|
10
|
-
export type OpenAPIHandlerOptions<T extends Context> = Hooks<Request, FetchHandleResult, T,
|
|
10
|
+
export type OpenAPIHandlerOptions<T extends Context> = Hooks<Request, FetchHandleResult, T, any> & {
|
|
11
11
|
jsonSerializer?: PublicJSONSerializer;
|
|
12
12
|
procedureMatcher?: PublicOpenAPIProcedureMatcher;
|
|
13
13
|
payloadCodec?: PublicOpenAPIPayloadCodec;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import type { AnyProcedure, AnyRouter } from '@orpc/server';
|
|
1
2
|
import type { Router as BaseHono, Params } from 'hono/router';
|
|
2
|
-
import { type ANY_PROCEDURE, type ANY_ROUTER } from '@orpc/server';
|
|
3
3
|
export type Hono = BaseHono<[string, string[]]>;
|
|
4
4
|
export declare class OpenAPIProcedureMatcher {
|
|
5
5
|
private readonly hono;
|
|
6
6
|
private readonly router;
|
|
7
7
|
private pendingRouters;
|
|
8
|
-
constructor(hono: Hono, router:
|
|
8
|
+
constructor(hono: Hono, router: AnyRouter);
|
|
9
9
|
match(method: string, pathname: string): Promise<{
|
|
10
10
|
path: string[];
|
|
11
|
-
procedure:
|
|
11
|
+
procedure: AnyProcedure;
|
|
12
12
|
params: Params;
|
|
13
13
|
} | undefined>;
|
|
14
14
|
private add;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Schema } from '@orpc/contract';
|
|
2
2
|
export interface SchemaCoercer {
|
|
3
|
-
coerce
|
|
3
|
+
coerce(schema: Schema, value: unknown): unknown;
|
|
4
4
|
}
|
|
5
5
|
export declare class CompositeSchemaCoercer implements SchemaCoercer {
|
|
6
6
|
private readonly coercers;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyRouter } from '@orpc/server';
|
|
2
2
|
import type { PublicOpenAPIInputStructureParser } from './openapi-input-structure-parser';
|
|
3
3
|
import type { PublicOpenAPIOutputStructureParser } from './openapi-output-structure-parser';
|
|
4
4
|
import type { PublicOpenAPIPathParser } from './openapi-path-parser';
|
|
@@ -61,7 +61,7 @@ export declare class OpenAPIGenerator {
|
|
|
61
61
|
private readonly considerMissingTagDefinitionAsError;
|
|
62
62
|
private readonly strictErrorResponses;
|
|
63
63
|
constructor(options?: OpenAPIGeneratorOptions);
|
|
64
|
-
generate(router: ContractRouter<any> |
|
|
64
|
+
generate(router: ContractRouter<any> | AnyRouter, doc: Omit<OpenAPI.OpenAPIObject, 'openapi'>): Promise<OpenAPI.OpenAPIObject>;
|
|
65
65
|
}
|
|
66
66
|
export {};
|
|
67
67
|
//# sourceMappingURL=openapi-generator.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { AnyContractProcedure } from '@orpc/contract';
|
|
1
2
|
import type { PublicOpenAPIPathParser } from './openapi-path-parser';
|
|
2
3
|
import type { JSONSchema, ObjectSchema } from './schema';
|
|
3
4
|
import type { SchemaConverter } from './schema-converter';
|
|
4
5
|
import type { PublicSchemaUtils } from './schema-utils';
|
|
5
|
-
import { type ANY_CONTRACT_PROCEDURE } from '@orpc/contract';
|
|
6
6
|
export interface OpenAPIInputStructureParseResult {
|
|
7
7
|
paramsSchema: ObjectSchema | undefined;
|
|
8
8
|
querySchema: ObjectSchema | undefined;
|
|
@@ -14,7 +14,7 @@ export declare class OpenAPIInputStructureParser {
|
|
|
14
14
|
private readonly schemaUtils;
|
|
15
15
|
private readonly pathParser;
|
|
16
16
|
constructor(schemaConverter: SchemaConverter, schemaUtils: PublicSchemaUtils, pathParser: PublicOpenAPIPathParser);
|
|
17
|
-
parse(contract:
|
|
17
|
+
parse(contract: AnyContractProcedure, structure: 'compact' | 'detailed'): OpenAPIInputStructureParseResult;
|
|
18
18
|
private parseDetailedSchema;
|
|
19
19
|
private parseCompactSchema;
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyContractProcedure } from '@orpc/contract';
|
|
2
2
|
import type { JSONSchema, ObjectSchema } from './schema';
|
|
3
3
|
import type { SchemaConverter } from './schema-converter';
|
|
4
4
|
import type { PublicSchemaUtils } from './schema-utils';
|
|
@@ -10,7 +10,7 @@ export declare class OpenAPIOutputStructureParser {
|
|
|
10
10
|
private readonly schemaConverter;
|
|
11
11
|
private readonly schemaUtils;
|
|
12
12
|
constructor(schemaConverter: SchemaConverter, schemaUtils: PublicSchemaUtils);
|
|
13
|
-
parse(contract:
|
|
13
|
+
parse(contract: AnyContractProcedure, structure: 'compact' | 'detailed'): OpenAPIOutputStructureParseResult;
|
|
14
14
|
private parseDetailedSchema;
|
|
15
15
|
private parseCompactSchema;
|
|
16
16
|
}
|
|
@@ -4,8 +4,8 @@ export interface SchemaConvertOptions {
|
|
|
4
4
|
strategy: 'input' | 'output';
|
|
5
5
|
}
|
|
6
6
|
export interface SchemaConverter {
|
|
7
|
-
condition
|
|
8
|
-
convert
|
|
7
|
+
condition(schema: Schema, options: SchemaConvertOptions): boolean;
|
|
8
|
+
convert(schema: Schema, options: SchemaConvertOptions): JSONSchema.JSONSchema;
|
|
9
9
|
}
|
|
10
10
|
export declare class CompositeSchemaConverter implements SchemaConverter {
|
|
11
11
|
private readonly converters;
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { AnyContractProcedure, AnyContractRouter, HTTPPath } from '@orpc/contract';
|
|
2
|
+
import type { AnyProcedure, AnyRouter, Lazy } from '@orpc/server';
|
|
3
3
|
export interface EachLeafOptions {
|
|
4
|
-
router:
|
|
4
|
+
router: AnyContractRouter | AnyRouter;
|
|
5
5
|
path: string[];
|
|
6
6
|
}
|
|
7
7
|
export interface EachLeafCallbackOptions {
|
|
8
|
-
contract:
|
|
8
|
+
contract: AnyContractProcedure;
|
|
9
9
|
path: string[];
|
|
10
10
|
}
|
|
11
11
|
export interface EachContractLeafResultItem {
|
|
12
|
-
router: Lazy<
|
|
12
|
+
router: Lazy<AnyProcedure> | Lazy<Record<string, AnyRouter> | AnyProcedure>;
|
|
13
13
|
path: string[];
|
|
14
14
|
}
|
|
15
15
|
export declare function forEachContractProcedure(options: EachLeafOptions, callback: (options: EachLeafCallbackOptions) => void, result?: EachContractLeafResultItem[], isCurrentRouterContract?: boolean): EachContractLeafResultItem[];
|
|
16
|
-
export declare function forEachAllContractProcedure(router:
|
|
16
|
+
export declare function forEachAllContractProcedure(router: AnyContractRouter | AnyRouter, callback: (options: EachLeafCallbackOptions) => void): Promise<void>;
|
|
17
17
|
export declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
|
|
18
18
|
//# sourceMappingURL=utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.f56d2b3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"json-schema-typed": "^8.0.1",
|
|
59
59
|
"openapi3-ts": "^4.4.0",
|
|
60
60
|
"wildcard-match": "^5.1.3",
|
|
61
|
-
"@orpc/
|
|
62
|
-
"@orpc/
|
|
63
|
-
"@orpc/
|
|
61
|
+
"@orpc/server": "0.0.0-next.f56d2b3",
|
|
62
|
+
"@orpc/contract": "0.0.0-next.f56d2b3",
|
|
63
|
+
"@orpc/shared": "0.0.0-next.f56d2b3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@readme/openapi-parser": "^2.6.0",
|