@orpc/openapi 0.41.2 → 0.42.0

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,7 +1,7 @@
1
1
  import {
2
2
  OpenAPICodec,
3
3
  OpenAPIMatcher
4
- } from "./chunk-LPBZEW4B.js";
4
+ } from "./chunk-PGCWJMRO.js";
5
5
 
6
6
  // src/adapters/fetch/openapi-handler.ts
7
7
  import { toFetchResponse, toStandardRequest } from "@orpc/server-standard-fetch";
@@ -9,8 +9,8 @@ import { StandardHandler } from "@orpc/server/standard";
9
9
  var OpenAPIHandler = class {
10
10
  standardHandler;
11
11
  constructor(router, options) {
12
- const matcher = options?.matcher ?? new OpenAPIMatcher(options);
13
- const codec = options?.codec ?? new OpenAPICodec(options);
12
+ const matcher = options?.matcher ?? new OpenAPIMatcher();
13
+ const codec = options?.codec ?? new OpenAPICodec();
14
14
  this.standardHandler = new StandardHandler(router, matcher, codec, options);
15
15
  }
16
16
  async handle(request, ...rest) {
@@ -29,4 +29,4 @@ var OpenAPIHandler = class {
29
29
  export {
30
30
  OpenAPIHandler
31
31
  };
32
- //# sourceMappingURL=chunk-UU2TTVB2.js.map
32
+ //# sourceMappingURL=chunk-ATDLVTJE.js.map
@@ -7,9 +7,8 @@ import { OpenAPISerializer } from "@orpc/client/openapi";
7
7
  import { fallbackContractConfig } from "@orpc/contract";
8
8
  import { isObject } from "@orpc/shared";
9
9
  var OpenAPICodec = class {
10
- serializer;
11
- constructor(options) {
12
- this.serializer = options?.serializer ?? new OpenAPISerializer();
10
+ constructor(serializer = new OpenAPISerializer()) {
11
+ this.serializer = serializer;
13
12
  }
14
13
  async decode(request, params, procedure) {
15
14
  const inputStructure = fallbackContractConfig("defaultInputStructure", procedure["~orpc"].route.inputStructure);
@@ -79,19 +78,12 @@ import { convertPathToHttpPath, createContractedProcedure, eachContractProcedure
79
78
  import { addRoute, createRouter, findRoute } from "rou3";
80
79
  var OpenAPIMatcher = class {
81
80
  tree = createRouter();
82
- ignoreUndefinedMethod;
83
- constructor(options) {
84
- this.ignoreUndefinedMethod = options?.ignoreUndefinedMethod ?? false;
85
- }
86
81
  pendingRouters = [];
87
82
  init(router, path = []) {
88
83
  const laziedOptions = eachContractProcedure({
89
84
  router,
90
85
  path
91
86
  }, ({ path: path2, contract }) => {
92
- if (!contract["~orpc"].route.method && this.ignoreUndefinedMethod) {
93
- return;
94
- }
95
87
  const method = fallbackContractConfig2("defaultMethod", contract["~orpc"].route.method);
96
88
  const httpPath = contract["~orpc"].route.path ? toRou3Pattern(contract["~orpc"].route.path) : convertPathToHttpPath(path2);
97
89
  if (isProcedure(contract)) {
@@ -162,4 +154,4 @@ export {
162
154
  OpenAPICodec,
163
155
  OpenAPIMatcher
164
156
  };
165
- //# sourceMappingURL=chunk-LPBZEW4B.js.map
157
+ //# sourceMappingURL=chunk-PGCWJMRO.js.map
package/dist/fetch.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-UU2TTVB2.js";
4
- import "./chunk-LPBZEW4B.js";
3
+ } from "./chunk-ATDLVTJE.js";
4
+ import "./chunk-PGCWJMRO.js";
5
5
  import "./chunk-XGHV4TH3.js";
6
6
  export {
7
7
  OpenAPIHandler
package/dist/hono.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-UU2TTVB2.js";
4
- import "./chunk-LPBZEW4B.js";
3
+ } from "./chunk-ATDLVTJE.js";
4
+ import "./chunk-PGCWJMRO.js";
5
5
  import "./chunk-XGHV4TH3.js";
6
6
  export {
7
7
  OpenAPIHandler
package/dist/index.js CHANGED
@@ -672,7 +672,7 @@ var OpenAPIGenerator = class {
672
672
  }
673
673
  }
674
674
  });
675
- return this.jsonSerializer.serialize(builder.getSpec());
675
+ return this.jsonSerializer.serialize(builder.getSpec())[0];
676
676
  }
677
677
  };
678
678
 
package/dist/next.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-UU2TTVB2.js";
4
- import "./chunk-LPBZEW4B.js";
3
+ } from "./chunk-ATDLVTJE.js";
4
+ import "./chunk-PGCWJMRO.js";
5
5
  import "./chunk-XGHV4TH3.js";
6
6
  export {
7
7
  OpenAPIHandler
package/dist/node.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPICodec,
3
3
  OpenAPIMatcher
4
- } from "./chunk-LPBZEW4B.js";
4
+ } from "./chunk-PGCWJMRO.js";
5
5
  import "./chunk-XGHV4TH3.js";
6
6
 
7
7
  // src/adapters/node/openapi-handler.ts
@@ -10,8 +10,8 @@ import { StandardHandler } from "@orpc/server/standard";
10
10
  var OpenAPIHandler = class {
11
11
  standardHandler;
12
12
  constructor(router, options) {
13
- const matcher = options?.matcher ?? new OpenAPIMatcher(options);
14
- const codec = options?.codec ?? new OpenAPICodec(options);
13
+ const matcher = options?.matcher ?? new OpenAPIMatcher();
14
+ const codec = options?.codec ?? new OpenAPICodec();
15
15
  this.standardHandler = new StandardHandler(router, matcher, codec, { ...options });
16
16
  }
17
17
  async handle(req, res, ...rest) {
@@ -3,12 +3,9 @@ import type { AnyProcedure } from '@orpc/server';
3
3
  import type { StandardRequest, StandardResponse } from '@orpc/server-standard';
4
4
  import type { StandardCodec, StandardParams } from '@orpc/server/standard';
5
5
  import { OpenAPISerializer } from '@orpc/client/openapi';
6
- export interface OpenAPICodecOptions {
7
- serializer?: OpenAPISerializer;
8
- }
9
6
  export declare class OpenAPICodec implements StandardCodec {
10
7
  private readonly serializer;
11
- constructor(options?: OpenAPICodecOptions);
8
+ constructor(serializer?: OpenAPISerializer);
12
9
  decode(request: StandardRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
13
10
  encode(output: unknown, procedure: AnyProcedure): StandardResponse;
14
11
  encodeError(error: ORPCError<any, any>): StandardResponse;
@@ -1,7 +1,5 @@
1
1
  import type { Context } from '@orpc/server';
2
2
  import type { RPCHandlerOptions } from '@orpc/server/standard';
3
- import type { OpenAPICodecOptions } from './openapi-codec';
4
- import type { OpenAPIMatcherOptions } from './openapi-matcher';
5
- export interface OpenAPIHandlerOptions<T extends Context> extends RPCHandlerOptions<T>, OpenAPIMatcherOptions, OpenAPICodecOptions {
3
+ export interface OpenAPIHandlerOptions<T extends Context> extends RPCHandlerOptions<T> {
6
4
  }
7
5
  //# sourceMappingURL=openapi-handler.d.ts.map
@@ -1,18 +1,8 @@
1
1
  import type { AnyRouter } from '@orpc/server';
2
2
  import type { StandardMatcher, StandardMatchResult } from '@orpc/server/standard';
3
3
  import { type HTTPPath } from '@orpc/contract';
4
- export interface OpenAPIMatcherOptions {
5
- /**
6
- * Ignore procedure that does not have a method defined in the contract.
7
- *
8
- * @default false
9
- */
10
- ignoreUndefinedMethod?: boolean;
11
- }
12
4
  export declare class OpenAPIMatcher implements StandardMatcher {
13
5
  private readonly tree;
14
- private readonly ignoreUndefinedMethod;
15
- constructor(options?: OpenAPIMatcherOptions);
16
6
  private pendingRouters;
17
7
  init(router: AnyRouter, path?: string[]): void;
18
8
  match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
@@ -2,7 +2,7 @@ import type { PublicOpenAPIInputStructureParser } from './openapi-input-structur
2
2
  import type { PublicOpenAPIOutputStructureParser } from './openapi-output-structure-parser';
3
3
  import type { PublicOpenAPIPathParser } from './openapi-path-parser';
4
4
  import type { SchemaConverter } from './schema-converter';
5
- import { type PublicOpenAPIJsonSerializer } from '@orpc/client/openapi';
5
+ import { OpenAPIJsonSerializer } from '@orpc/client/openapi';
6
6
  import { type ContractRouter } from '@orpc/contract';
7
7
  import { type AnyRouter } from '@orpc/server';
8
8
  import { type OpenAPI } from './openapi';
@@ -15,7 +15,7 @@ export interface OpenAPIGeneratorOptions {
15
15
  parametersBuilder?: PublicOpenAPIParametersBuilder;
16
16
  schemaConverters?: SchemaConverter[];
17
17
  schemaUtils?: PublicSchemaUtils;
18
- jsonSerializer?: PublicOpenAPIJsonSerializer;
18
+ jsonSerializer?: OpenAPIJsonSerializer;
19
19
  pathParser?: PublicOpenAPIPathParser;
20
20
  inputStructureParser?: PublicOpenAPIInputStructureParser;
21
21
  outputStructureParser?: PublicOpenAPIOutputStructureParser;
package/dist/standard.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OpenAPICodec,
3
3
  OpenAPIMatcher
4
- } from "./chunk-LPBZEW4B.js";
4
+ } from "./chunk-PGCWJMRO.js";
5
5
  import "./chunk-XGHV4TH3.js";
6
6
  export {
7
7
  OpenAPICodec,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/openapi",
3
3
  "type": "module",
4
- "version": "0.41.2",
4
+ "version": "0.42.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -60,10 +60,10 @@
60
60
  "json-schema-typed": "^8.0.1",
61
61
  "openapi3-ts": "^4.4.0",
62
62
  "rou3": "^0.5.1",
63
- "@orpc/contract": "0.41.2",
64
- "@orpc/client": "0.41.2",
65
- "@orpc/server": "0.41.2",
66
- "@orpc/shared": "0.41.2"
63
+ "@orpc/client": "0.42.0",
64
+ "@orpc/contract": "0.42.0",
65
+ "@orpc/shared": "0.42.0",
66
+ "@orpc/server": "0.42.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "zod": "^3.24.1"