@orpc/openapi 0.0.0-next.9b3a030 → 0.0.0-next.a2e4a58

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-XYIZDXKB.js";
3
+ } from "./chunk-UG6W4GSA.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-YOKECDND.js.map
25
+ //# sourceMappingURL=chunk-GEDPF5HA.js.map
@@ -2,7 +2,7 @@ import {
2
2
  JSONSerializer,
3
3
  forEachContractProcedure,
4
4
  standardizeHTTPPath
5
- } from "./chunk-KNYXLM77.js";
5
+ } from "./chunk-V4HFPIEN.js";
6
6
 
7
7
  // src/adapters/fetch/bracket-notation.ts
8
8
  import { isPlainObject } from "@orpc/shared";
@@ -402,7 +402,8 @@ var OpenAPIPayloadCodec = class {
402
402
  };
403
403
 
404
404
  // src/adapters/fetch/openapi-procedure-matcher.ts
405
- import { fallbackToGlobalConfig, getLazyRouterPrefix, getRouterChild, isProcedure, unlazy } from "@orpc/server";
405
+ import { fallbackContractConfig } from "@orpc/contract";
406
+ import { getLazyRouterPrefix, getRouterChild, isProcedure, unlazy } from "@orpc/server";
406
407
  import { mapValues } from "@orpc/shared";
407
408
  var OpenAPIProcedureMatcher = class {
408
409
  constructor(hono, router) {
@@ -446,7 +447,7 @@ var OpenAPIProcedureMatcher = class {
446
447
  }
447
448
  add(path, router) {
448
449
  const lazies = forEachContractProcedure({ path, router }, ({ path: path2, contract }) => {
449
- const method = fallbackToGlobalConfig("defaultMethod", contract["~orpc"].route?.method);
450
+ const method = fallbackContractConfig("defaultMethod", contract["~orpc"].route?.method);
450
451
  const httpPath = contract["~orpc"].route?.path ? this.convertOpenAPIPathToRouterPath(contract["~orpc"].route?.path) : `/${path2.map(encodeURIComponent).join("/")}`;
451
452
  this.hono.add(method, httpPath, [httpPath, path2]);
452
453
  });
@@ -485,7 +486,8 @@ var CompositeSchemaCoercer = class {
485
486
  };
486
487
 
487
488
  // src/adapters/fetch/openapi-handler.ts
488
- import { createProcedureClient, fallbackToGlobalConfig as fallbackToGlobalConfig2, ORPCError as ORPCError2 } from "@orpc/server";
489
+ import { fallbackContractConfig as fallbackContractConfig2 } from "@orpc/contract";
490
+ import { createProcedureClient, ORPCError as ORPCError2 } from "@orpc/server";
489
491
  import { executeWithHooks, isPlainObject as isPlainObject3, trim } from "@orpc/shared";
490
492
  var OpenAPIHandler = class {
491
493
  constructor(hono, router, options) {
@@ -519,16 +521,15 @@ var OpenAPIHandler = class {
519
521
  const contractDef = matched.procedure["~orpc"].contract["~orpc"];
520
522
  const input = await this.decodeInput(matched.procedure, matched.params, request);
521
523
  const coercedInput = this.compositeSchemaCoercer.coerce(contractDef.InputSchema, input);
522
- const client = createProcedureClient({
524
+ const client = createProcedureClient(matched.procedure, {
523
525
  context,
524
- procedure: matched.procedure,
525
526
  path: matched.path
526
527
  });
527
528
  const output = await client(coercedInput, { signal: request.signal });
528
529
  const { body, headers: resHeaders } = this.encodeOutput(matched.procedure, output, accept);
529
530
  const response = new Response(body, {
530
531
  headers: resHeaders,
531
- status: fallbackToGlobalConfig2("defaultSuccessStatus", contractDef.route?.successStatus)
532
+ status: fallbackContractConfig2("defaultSuccessStatus", contractDef.route?.successStatus)
532
533
  });
533
534
  return { matched: true, response };
534
535
  };
@@ -563,7 +564,7 @@ var OpenAPIHandler = class {
563
564
  }
564
565
  }
565
566
  async decodeInput(procedure, params, request) {
566
- const inputStructure = fallbackToGlobalConfig2("defaultInputStructure", procedure["~orpc"].contract["~orpc"].route?.inputStructure);
567
+ const inputStructure = fallbackContractConfig2("defaultInputStructure", procedure["~orpc"].contract["~orpc"].route?.inputStructure);
567
568
  const url = new URL(request.url);
568
569
  const query = url.searchParams;
569
570
  const headers = request.headers;
@@ -579,7 +580,7 @@ var OpenAPIHandler = class {
579
580
  return this.inputStructureDetailed.build(params, decodedQuery, decodedHeaders, decodedBody);
580
581
  }
581
582
  encodeOutput(procedure, output, accept) {
582
- const outputStructure = fallbackToGlobalConfig2("defaultOutputStructure", procedure["~orpc"].contract["~orpc"].route?.outputStructure);
583
+ const outputStructure = fallbackContractConfig2("defaultOutputStructure", procedure["~orpc"].contract["~orpc"].route?.outputStructure);
583
584
  if (outputStructure === "compact") {
584
585
  return this.payloadCodec.encode(output, accept);
585
586
  }
@@ -649,4 +650,4 @@ export {
649
650
  CompositeSchemaCoercer,
650
651
  OpenAPIHandler
651
652
  };
652
- //# sourceMappingURL=chunk-XYIZDXKB.js.map
653
+ //# sourceMappingURL=chunk-UG6W4GSA.js.map
@@ -104,4 +104,4 @@ export {
104
104
  forEachAllContractProcedure,
105
105
  standardizeHTTPPath
106
106
  };
107
- //# sourceMappingURL=chunk-KNYXLM77.js.map
107
+ //# sourceMappingURL=chunk-V4HFPIEN.js.map
package/dist/fetch.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPIServerHandler,
3
3
  OpenAPIServerlessHandler
4
- } from "./chunk-YOKECDND.js";
4
+ } from "./chunk-GEDPF5HA.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-XYIZDXKB.js";
18
- import "./chunk-KNYXLM77.js";
17
+ } from "./chunk-UG6W4GSA.js";
18
+ import "./chunk-V4HFPIEN.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-YOKECDND.js";
4
+ } from "./chunk-GEDPF5HA.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-XYIZDXKB.js";
18
- import "./chunk-KNYXLM77.js";
17
+ } from "./chunk-UG6W4GSA.js";
18
+ import "./chunk-V4HFPIEN.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-KNYXLM77.js";
6
+ } from "./chunk-V4HFPIEN.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 { fallbackORPCErrorStatus, fallbackToGlobalConfig as fallbackToGlobalConfig2 } from "@orpc/contract";
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 { fallbackToGlobalConfig } from "@orpc/contract";
47
+ import { fallbackContractConfig } from "@orpc/contract";
48
48
  var OpenAPIInputStructureParser = class {
49
49
  constructor(schemaConverter, schemaUtils, pathParser) {
50
50
  this.schemaConverter = schemaConverter;
@@ -53,7 +53,7 @@ var OpenAPIInputStructureParser = class {
53
53
  }
54
54
  parse(contract, structure) {
55
55
  const inputSchema = this.schemaConverter.convert(contract["~orpc"].InputSchema, { strategy: "input" });
56
- const method = fallbackToGlobalConfig("defaultMethod", contract["~orpc"].route?.method);
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 {
@@ -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 = fallbackToGlobalConfig2("defaultMethod", def.route?.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 = fallbackToGlobalConfig2("defaultInputStructure", def.route?.inputStructure);
418
- const outputStructure = fallbackToGlobalConfig2("defaultOutputStructure", def.route?.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,8 +429,8 @@ var OpenAPIGenerator = class {
429
429
  content: this.contentBuilder.build(bodySchema)
430
430
  } : void 0;
431
431
  const responses = {};
432
- responses[fallbackToGlobalConfig2("defaultSuccessStatus", def.route?.successStatus)] = {
433
- description: fallbackToGlobalConfig2("defaultSuccessDescription", def.route?.successDescription),
432
+ responses[fallbackContractConfig2("defaultSuccessStatus", def.route?.successStatus)] = {
433
+ description: fallbackContractConfig2("defaultSuccessDescription", def.route?.successDescription),
434
434
  content: resBodySchema !== void 0 ? this.contentBuilder.build(resBodySchema, {
435
435
  example: def.outputExample
436
436
  }) : void 0,
package/dist/next.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPIServerHandler,
3
3
  OpenAPIServerlessHandler
4
- } from "./chunk-YOKECDND.js";
4
+ } from "./chunk-GEDPF5HA.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-XYIZDXKB.js";
18
- import "./chunk-KNYXLM77.js";
17
+ } from "./chunk-UG6W4GSA.js";
18
+ import "./chunk-V4HFPIEN.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-XYIZDXKB.js";
4
- import "./chunk-KNYXLM77.js";
3
+ } from "./chunk-UG6W4GSA.js";
4
+ import "./chunk-V4HFPIEN.js";
5
5
 
6
6
  // src/adapters/node/openapi-handler.ts
7
7
  import { createRequest, sendResponse } from "@orpc/server/node";
@@ -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_ROUTER, doc: Omit<OpenAPI.OpenAPIObject, 'openapi'>): Promise<OpenAPI.OpenAPIObject>;
64
+ generate(router: ContractRouter<any> | ANY_ROUTER, doc: Omit<OpenAPI.OpenAPIObject, 'openapi'>): Promise<OpenAPI.OpenAPIObject>;
65
65
  }
66
66
  export {};
67
67
  //# sourceMappingURL=openapi-generator.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { ContractRouter, HTTPPath, WELL_CONTRACT_PROCEDURE } from '@orpc/contract';
2
2
  import type { ANY_PROCEDURE, ANY_ROUTER, Lazy } from '@orpc/server';
3
3
  export interface EachLeafOptions {
4
- router: ContractRouter | ANY_ROUTER;
4
+ router: ContractRouter<any> | ANY_ROUTER;
5
5
  path: string[];
6
6
  }
7
7
  export interface EachLeafCallbackOptions {
@@ -13,6 +13,6 @@ export interface EachContractLeafResultItem {
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: ContractRouter | ANY_ROUTER, callback: (options: EachLeafCallbackOptions) => void): Promise<void>;
16
+ export declare function forEachAllContractProcedure(router: ContractRouter<any> | ANY_ROUTER, 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.9b3a030",
4
+ "version": "0.0.0-next.a2e4a58",
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/contract": "0.0.0-next.9b3a030",
62
- "@orpc/shared": "0.0.0-next.9b3a030",
63
- "@orpc/server": "0.0.0-next.9b3a030"
61
+ "@orpc/contract": "0.0.0-next.a2e4a58",
62
+ "@orpc/shared": "0.0.0-next.a2e4a58",
63
+ "@orpc/server": "0.0.0-next.a2e4a58"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@readme/openapi-parser": "^2.6.0",