@orpc/openapi 0.0.0-next.bc9d3dd → 0.0.0-next.bf323bf

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,10 +1,10 @@
1
1
  import {
2
2
  OpenAPICodec,
3
3
  OpenAPIMatcher
4
- } from "./chunk-44Q55FOB.js";
4
+ } from "./chunk-TOZPXKQC.js";
5
5
 
6
6
  // src/adapters/fetch/openapi-handler.ts
7
- import { fetchRequestToStandardRequest, standardResponseToFetchResponse } from "@orpc/server/fetch";
7
+ import { toFetchResponse, toStandardRequest } from "@orpc/server-standard-fetch";
8
8
  import { StandardHandler } from "@orpc/server/standard";
9
9
  var OpenAPIHandler = class {
10
10
  standardHandler;
@@ -14,14 +14,14 @@ var OpenAPIHandler = class {
14
14
  this.standardHandler = new StandardHandler(router, matcher, codec, options);
15
15
  }
16
16
  async handle(request, ...rest) {
17
- const standardRequest = fetchRequestToStandardRequest(request);
17
+ const standardRequest = toStandardRequest(request);
18
18
  const result = await this.standardHandler.handle(standardRequest, ...rest);
19
19
  if (!result.matched) {
20
20
  return result;
21
21
  }
22
22
  return {
23
23
  matched: true,
24
- response: standardResponseToFetchResponse(result.response)
24
+ response: toFetchResponse(result.response)
25
25
  };
26
26
  }
27
27
  };
@@ -29,4 +29,4 @@ var OpenAPIHandler = class {
29
29
  export {
30
30
  OpenAPIHandler
31
31
  };
32
- //# sourceMappingURL=chunk-WBGO55OM.js.map
32
+ //# sourceMappingURL=chunk-5QMOOQSF.js.map
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/json-serializer.ts
8
- import { isPlainObject } from "@orpc/shared";
8
+ import { isObject } from "@orpc/shared";
9
9
  var JSONSerializer = class {
10
10
  serialize(payload) {
11
11
  if (payload instanceof Set)
@@ -26,7 +26,7 @@ var JSONSerializer = class {
26
26
  return payload.toString();
27
27
  if (payload instanceof URL)
28
28
  return payload.toString();
29
- if (!isPlainObject(payload))
29
+ if (!isObject(payload))
30
30
  return payload;
31
31
  return Object.keys(payload).reduce(
32
32
  (carry, key) => {
@@ -49,4 +49,4 @@ export {
49
49
  JSONSerializer,
50
50
  standardizeHTTPPath
51
51
  };
52
- //# sourceMappingURL=chunk-BHJYKXQL.js.map
52
+ //# sourceMappingURL=chunk-HC5PVG4R.js.map
@@ -2,7 +2,7 @@ import {
2
2
  JSONSerializer,
3
3
  __export,
4
4
  standardizeHTTPPath
5
- } from "./chunk-BHJYKXQL.js";
5
+ } from "./chunk-HC5PVG4R.js";
6
6
 
7
7
  // src/adapters/standard/bracket-notation.ts
8
8
  var bracket_notation_exports = {};
@@ -13,9 +13,9 @@ __export(bracket_notation_exports, {
13
13
  serialize: () => serialize,
14
14
  stringifyPath: () => stringifyPath
15
15
  });
16
- import { isPlainObject } from "@orpc/shared";
16
+ import { isObject } from "@orpc/shared";
17
17
  function serialize(payload, parentKey = "") {
18
- if (!Array.isArray(payload) && !isPlainObject(payload))
18
+ if (!Array.isArray(payload) && !isObject(payload))
19
19
  return [["", payload]];
20
20
  const result = [];
21
21
  function helper(value, path) {
@@ -23,7 +23,7 @@ function serialize(payload, parentKey = "") {
23
23
  value.forEach((item, index) => {
24
24
  helper(item, [...path, String(index)]);
25
25
  });
26
- } else if (isPlainObject(value)) {
26
+ } else if (isObject(value)) {
27
27
  for (const [key, val] of Object.entries(value)) {
28
28
  helper(val, [...path, key]);
29
29
  }
@@ -223,9 +223,11 @@ function parsePath(path) {
223
223
 
224
224
  // src/adapters/standard/openapi-codec.ts
225
225
  import { fallbackContractConfig } from "@orpc/contract";
226
- import { isPlainObject as isPlainObject2 } from "@orpc/shared";
226
+ import { isObject as isObject2 } from "@orpc/shared";
227
227
 
228
228
  // src/adapters/standard/openapi-serializer.ts
229
+ import { mapEventIterator, ORPCError, toORPCError } from "@orpc/contract";
230
+ import { ErrorEvent, isAsyncIteratorObject } from "@orpc/server-standard";
229
231
  import { findDeepMatches } from "@orpc/shared";
230
232
  var OpenAPISerializer = class {
231
233
  jsonSerializer;
@@ -236,6 +238,23 @@ var OpenAPISerializer = class {
236
238
  if (data instanceof Blob || data === void 0) {
237
239
  return data;
238
240
  }
241
+ if (isAsyncIteratorObject(data)) {
242
+ return mapEventIterator(data, {
243
+ value: async (value) => this.jsonSerializer.serialize(value),
244
+ error: async (e) => {
245
+ if (e instanceof ErrorEvent) {
246
+ return new ErrorEvent({
247
+ data: this.jsonSerializer.serialize(e.data),
248
+ cause: e
249
+ });
250
+ }
251
+ return new ErrorEvent({
252
+ data: this.jsonSerializer.serialize(toORPCError(e).toJSON()),
253
+ cause: e
254
+ });
255
+ }
256
+ });
257
+ }
239
258
  const serializedJSON = this.jsonSerializer.serialize(data);
240
259
  const { values: blobs } = findDeepMatches((v) => v instanceof Blob, serializedJSON);
241
260
  if (blobs.length === 0) {
@@ -257,6 +276,17 @@ var OpenAPISerializer = class {
257
276
  if (serialized instanceof URLSearchParams || serialized instanceof FormData) {
258
277
  return deserialize([...serialized.entries()]);
259
278
  }
279
+ if (isAsyncIteratorObject(serialized)) {
280
+ return mapEventIterator(serialized, {
281
+ value: async (value) => value,
282
+ error: async (e) => {
283
+ if (e instanceof ErrorEvent && ORPCError.isValidJSON(e.data)) {
284
+ return ORPCError.fromJSON(e.data, { cause: e });
285
+ }
286
+ return e;
287
+ }
288
+ });
289
+ }
260
290
  return serialized;
261
291
  }
262
292
  };
@@ -274,7 +304,7 @@ var OpenAPICodec = class {
274
304
  if (data === void 0) {
275
305
  return params;
276
306
  }
277
- if (isPlainObject2(data)) {
307
+ if (isObject2(data)) {
278
308
  return {
279
309
  ...params,
280
310
  ...data
@@ -309,7 +339,7 @@ var OpenAPICodec = class {
309
339
  body: this.serializer.serialize(output)
310
340
  };
311
341
  }
312
- if (!isPlainObject2(output)) {
342
+ if (!isObject2(output)) {
313
343
  throw new Error(
314
344
  'Invalid output structure for "detailed" output. Expected format: { body: any, headers?: Record<string, string | string[] | undefined> }'
315
345
  );
@@ -403,8 +433,7 @@ var OpenAPIMatcher = class {
403
433
  return {
404
434
  path: match.data.path,
405
435
  procedure: match.data.procedure,
406
- params: match.params ? { ...match.params } : void 0
407
- // normalize params to be a plain object
436
+ params: match.params
408
437
  };
409
438
  }
410
439
  };
@@ -418,4 +447,4 @@ export {
418
447
  OpenAPICodec,
419
448
  OpenAPIMatcher
420
449
  };
421
- //# sourceMappingURL=chunk-44Q55FOB.js.map
450
+ //# sourceMappingURL=chunk-TOZPXKQC.js.map
package/dist/fetch.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-WBGO55OM.js";
4
- import "./chunk-44Q55FOB.js";
5
- import "./chunk-BHJYKXQL.js";
3
+ } from "./chunk-5QMOOQSF.js";
4
+ import "./chunk-TOZPXKQC.js";
5
+ import "./chunk-HC5PVG4R.js";
6
6
  export {
7
7
  OpenAPIHandler
8
8
  };
package/dist/hono.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-WBGO55OM.js";
4
- import "./chunk-44Q55FOB.js";
5
- import "./chunk-BHJYKXQL.js";
3
+ } from "./chunk-5QMOOQSF.js";
4
+ import "./chunk-TOZPXKQC.js";
5
+ import "./chunk-HC5PVG4R.js";
6
6
  export {
7
7
  OpenAPIHandler
8
8
  };
package/dist/index.js CHANGED
@@ -1,7 +1,53 @@
1
1
  import {
2
2
  JSONSerializer,
3
3
  standardizeHTTPPath
4
- } from "./chunk-BHJYKXQL.js";
4
+ } from "./chunk-HC5PVG4R.js";
5
+
6
+ // src/openapi-operation-extender.ts
7
+ import { isProcedure } from "@orpc/server";
8
+ var OPERATION_EXTENDER_SYMBOL = Symbol("ORPC_OPERATION_EXTENDER");
9
+ function setOperationExtender(o, extend) {
10
+ return new Proxy(o, {
11
+ get(target, prop, receiver) {
12
+ if (prop === OPERATION_EXTENDER_SYMBOL) {
13
+ return extend;
14
+ }
15
+ return Reflect.get(target, prop, receiver);
16
+ }
17
+ });
18
+ }
19
+ function getOperationExtender(o) {
20
+ return o[OPERATION_EXTENDER_SYMBOL];
21
+ }
22
+ function extendOperation(operation, procedure) {
23
+ const operationExtenders = [];
24
+ for (const errorItem of Object.values(procedure["~orpc"].errorMap)) {
25
+ const maybeExtender = getOperationExtender(errorItem);
26
+ if (maybeExtender) {
27
+ operationExtenders.push(maybeExtender);
28
+ }
29
+ }
30
+ if (isProcedure(procedure)) {
31
+ for (const middleware of procedure["~orpc"].middlewares) {
32
+ const maybeExtender = getOperationExtender(middleware);
33
+ if (maybeExtender) {
34
+ operationExtenders.push(maybeExtender);
35
+ }
36
+ }
37
+ }
38
+ let currentOperation = operation;
39
+ for (const extender of operationExtenders) {
40
+ if (typeof extender === "function") {
41
+ currentOperation = extender(currentOperation, procedure);
42
+ } else {
43
+ currentOperation = {
44
+ ...currentOperation,
45
+ ...extender
46
+ };
47
+ }
48
+ }
49
+ return currentOperation;
50
+ }
5
51
 
6
52
  // src/openapi.ts
7
53
  import { OpenApiBuilder } from "openapi3-ts/oas31";
@@ -34,7 +80,7 @@ var OpenAPIContentBuilder = class {
34
80
  };
35
81
 
36
82
  // src/openapi-generator.ts
37
- import { fallbackContractConfig as fallbackContractConfig2, fallbackORPCErrorStatus } from "@orpc/contract";
83
+ import { fallbackContractConfig as fallbackContractConfig2, fallbackORPCErrorStatus, getEventIteratorSchemaDetails } from "@orpc/contract";
38
84
  import { eachAllContractProcedure } from "@orpc/server";
39
85
  import { group } from "@orpc/shared";
40
86
 
@@ -183,14 +229,14 @@ var OpenAPIOutputStructureParser = class {
183
229
  };
184
230
 
185
231
  // src/openapi-parameters-builder.ts
186
- import { get, isPlainObject, omit } from "@orpc/shared";
232
+ import { get, isObject, omit } from "@orpc/shared";
187
233
  var OpenAPIParametersBuilder = class {
188
234
  build(paramIn, jsonSchema, options) {
189
235
  const parameters = [];
190
236
  for (const name in jsonSchema.properties) {
191
237
  const schema = jsonSchema.properties[name];
192
238
  const paramExamples = jsonSchema.examples?.filter((example) => {
193
- return isPlainObject(example) && name in example;
239
+ return isObject(example) && name in example;
194
240
  }).map((example) => {
195
241
  return example[name];
196
242
  });
@@ -251,7 +297,7 @@ var CompositeSchemaConverter = class {
251
297
  };
252
298
 
253
299
  // src/schema-utils.ts
254
- import { isPlainObject as isPlainObject2 } from "@orpc/shared";
300
+ import { isObject as isObject2 } from "@orpc/shared";
255
301
 
256
302
  // src/schema.ts
257
303
  import * as JSONSchema from "json-schema-typed/draft-2020-12";
@@ -313,7 +359,7 @@ var SchemaUtils = class {
313
359
  }, {});
314
360
  matched.required = schema.required?.filter((key) => separatedProperties.includes(key));
315
361
  matched.examples = schema.examples?.map((example) => {
316
- if (!isPlainObject2(example)) {
362
+ if (!isObject2(example)) {
317
363
  return example;
318
364
  }
319
365
  return Object.entries(example).reduce((acc, [key, value]) => {
@@ -329,7 +375,7 @@ var SchemaUtils = class {
329
375
  }, {});
330
376
  rest.required = schema.required?.filter((key) => !separatedProperties.includes(key));
331
377
  rest.examples = schema.examples?.map((example) => {
332
- if (!isPlainObject2(example)) {
378
+ if (!isObject2(example)) {
333
379
  return example;
334
380
  }
335
381
  return Object.entries(example).reduce((acc, [key, value]) => {
@@ -416,26 +462,123 @@ var OpenAPIGenerator = class {
416
462
  }
417
463
  const method = fallbackContractConfig2("defaultMethod", def.route?.method);
418
464
  const httpPath = def.route?.path ? standardizeHTTPPath(def.route?.path) : `/${path.map(encodeURIComponent).join("/")}`;
419
- const inputStructure = fallbackContractConfig2("defaultInputStructure", def.route?.inputStructure);
420
- const outputStructure = fallbackContractConfig2("defaultOutputStructure", def.route?.outputStructure);
421
- const { paramsSchema, querySchema, headersSchema, bodySchema } = this.inputStructureParser.parse(contract, inputStructure);
422
- const { headersSchema: resHeadersSchema, bodySchema: resBodySchema } = this.outputStructureParser.parse(contract, outputStructure);
423
- const params = paramsSchema ? this.parametersBuilder.build("path", paramsSchema, {
424
- required: true
425
- }) : [];
426
- const query = querySchema ? this.parametersBuilder.build("query", querySchema) : [];
427
- const headers = headersSchema ? this.parametersBuilder.build("header", headersSchema) : [];
428
- const parameters = [...params, ...query, ...headers];
429
- const requestBody = bodySchema !== void 0 ? {
430
- required: this.schemaUtils.isUndefinableSchema(bodySchema),
431
- content: this.contentBuilder.build(bodySchema)
432
- } : void 0;
433
- const responses = {};
434
- responses[fallbackContractConfig2("defaultSuccessStatus", def.route?.successStatus)] = {
435
- description: fallbackContractConfig2("defaultSuccessDescription", def.route?.successDescription),
436
- content: resBodySchema !== void 0 ? this.contentBuilder.build(resBodySchema) : void 0,
437
- headers: resHeadersSchema !== void 0 ? this.parametersBuilder.buildHeadersObject(resHeadersSchema) : void 0
438
- };
465
+ const { parameters, requestBody } = (() => {
466
+ const eventIteratorSchemaDetails = getEventIteratorSchemaDetails(def.inputSchema);
467
+ if (eventIteratorSchemaDetails) {
468
+ const requestBody3 = {
469
+ required: true,
470
+ content: {
471
+ "text/event-stream": {
472
+ schema: {
473
+ oneOf: [
474
+ {
475
+ type: "object",
476
+ properties: {
477
+ event: { type: "string", const: "message" },
478
+ data: this.schemaConverter.convert(eventIteratorSchemaDetails.yields, { strategy: "input" }),
479
+ id: { type: "string" },
480
+ retry: { type: "number" }
481
+ },
482
+ required: ["event", "data"]
483
+ },
484
+ {
485
+ type: "object",
486
+ properties: {
487
+ event: { type: "string", const: "done" },
488
+ data: this.schemaConverter.convert(eventIteratorSchemaDetails.returns, { strategy: "input" }),
489
+ id: { type: "string" },
490
+ retry: { type: "number" }
491
+ },
492
+ required: ["event", "data"]
493
+ },
494
+ {
495
+ type: "object",
496
+ properties: {
497
+ event: { type: "string", const: "error" },
498
+ data: {},
499
+ id: { type: "string" },
500
+ retry: { type: "number" }
501
+ },
502
+ required: ["event", "data"]
503
+ }
504
+ ]
505
+ }
506
+ }
507
+ }
508
+ };
509
+ return { requestBody: requestBody3, parameters: [] };
510
+ }
511
+ const inputStructure = fallbackContractConfig2("defaultInputStructure", def.route?.inputStructure);
512
+ const { paramsSchema, querySchema, headersSchema, bodySchema } = this.inputStructureParser.parse(contract, inputStructure);
513
+ const params = paramsSchema ? this.parametersBuilder.build("path", paramsSchema, {
514
+ required: true
515
+ }) : [];
516
+ const query = querySchema ? this.parametersBuilder.build("query", querySchema) : [];
517
+ const headers = headersSchema ? this.parametersBuilder.build("header", headersSchema) : [];
518
+ const parameters2 = [...params, ...query, ...headers];
519
+ const requestBody2 = bodySchema !== void 0 ? {
520
+ required: this.schemaUtils.isUndefinableSchema(bodySchema),
521
+ content: this.contentBuilder.build(bodySchema)
522
+ } : void 0;
523
+ return { parameters: parameters2, requestBody: requestBody2 };
524
+ })();
525
+ const { responses } = (() => {
526
+ const eventIteratorSchemaDetails = getEventIteratorSchemaDetails(def.outputSchema);
527
+ if (eventIteratorSchemaDetails) {
528
+ const responses3 = {};
529
+ responses3[fallbackContractConfig2("defaultSuccessStatus", def.route?.successStatus)] = {
530
+ description: fallbackContractConfig2("defaultSuccessDescription", def.route?.successDescription),
531
+ content: {
532
+ "text/event-stream": {
533
+ schema: {
534
+ oneOf: [
535
+ {
536
+ type: "object",
537
+ properties: {
538
+ event: { type: "string", const: "message" },
539
+ data: this.schemaConverter.convert(eventIteratorSchemaDetails.yields, { strategy: "input" }),
540
+ id: { type: "string" },
541
+ retry: { type: "number" }
542
+ },
543
+ required: ["event", "data"]
544
+ },
545
+ {
546
+ type: "object",
547
+ properties: {
548
+ event: { type: "string", const: "done" },
549
+ data: this.schemaConverter.convert(eventIteratorSchemaDetails.returns, { strategy: "input" }),
550
+ id: { type: "string" },
551
+ retry: { type: "number" }
552
+ },
553
+ required: ["event", "data"]
554
+ },
555
+ {
556
+ type: "object",
557
+ properties: {
558
+ event: { type: "string", const: "error" },
559
+ data: {},
560
+ id: { type: "string" },
561
+ retry: { type: "number" }
562
+ },
563
+ required: ["event", "data"]
564
+ }
565
+ ]
566
+ }
567
+ }
568
+ }
569
+ };
570
+ return { responses: responses3 };
571
+ }
572
+ const outputStructure = fallbackContractConfig2("defaultOutputStructure", def.route?.outputStructure);
573
+ const { headersSchema: resHeadersSchema, bodySchema: resBodySchema } = this.outputStructureParser.parse(contract, outputStructure);
574
+ const responses2 = {};
575
+ responses2[fallbackContractConfig2("defaultSuccessStatus", def.route?.successStatus)] = {
576
+ description: fallbackContractConfig2("defaultSuccessDescription", def.route?.successDescription),
577
+ content: resBodySchema !== void 0 ? this.contentBuilder.build(resBodySchema) : void 0,
578
+ headers: resHeadersSchema !== void 0 ? this.parametersBuilder.buildHeadersObject(resHeadersSchema) : void 0
579
+ };
580
+ return { responses: responses2 };
581
+ })();
439
582
  const errors = group(Object.entries(def.errorMap ?? {}).filter(([_, config]) => config).map(([code, config]) => ({
440
583
  ...config,
441
584
  code,
@@ -506,8 +649,9 @@ var OpenAPIGenerator = class {
506
649
  requestBody,
507
650
  responses
508
651
  };
652
+ const extendedOperation = extendOperation(operation, contract);
509
653
  builder.addPath(httpPath, {
510
- [method.toLocaleLowerCase()]: operation
654
+ [method.toLocaleLowerCase()]: extendedOperation
511
655
  });
512
656
  } catch (e) {
513
657
  if (e instanceof OpenAPIError) {
@@ -529,6 +673,11 @@ var OpenAPIGenerator = class {
529
673
  return this.jsonSerializer.serialize(builder.getSpec());
530
674
  }
531
675
  };
676
+
677
+ // src/index.ts
678
+ var oo = {
679
+ spec: setOperationExtender
680
+ };
532
681
  export {
533
682
  CompositeSchemaConverter,
534
683
  JSONSchema,
@@ -541,6 +690,10 @@ export {
541
690
  OpenAPIPathParser,
542
691
  OpenApiBuilder,
543
692
  SchemaUtils,
693
+ extendOperation,
694
+ getOperationExtender,
695
+ oo,
696
+ setOperationExtender,
544
697
  standardizeHTTPPath
545
698
  };
546
699
  //# sourceMappingURL=index.js.map
package/dist/next.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  OpenAPIHandler
3
- } from "./chunk-WBGO55OM.js";
4
- import "./chunk-44Q55FOB.js";
5
- import "./chunk-BHJYKXQL.js";
3
+ } from "./chunk-5QMOOQSF.js";
4
+ import "./chunk-TOZPXKQC.js";
5
+ import "./chunk-HC5PVG4R.js";
6
6
  export {
7
7
  OpenAPIHandler
8
8
  };
package/dist/node.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  OpenAPICodec,
3
3
  OpenAPIMatcher
4
- } from "./chunk-44Q55FOB.js";
5
- import "./chunk-BHJYKXQL.js";
4
+ } from "./chunk-TOZPXKQC.js";
5
+ import "./chunk-HC5PVG4R.js";
6
6
 
7
7
  // src/adapters/node/openapi-handler.ts
8
- import { nodeHttpResponseSendStandardResponse, nodeHttpToStandardRequest } from "@orpc/server/node";
8
+ import { sendStandardResponse, toStandardRequest } from "@orpc/server-standard-node";
9
9
  import { StandardHandler } from "@orpc/server/standard";
10
10
  var OpenAPIHandler = class {
11
11
  standardHandler;
@@ -15,12 +15,12 @@ var OpenAPIHandler = class {
15
15
  this.standardHandler = new StandardHandler(router, matcher, codec, { ...options });
16
16
  }
17
17
  async handle(req, res, ...rest) {
18
- const standardRequest = nodeHttpToStandardRequest(req, res);
18
+ const standardRequest = toStandardRequest(req, res);
19
19
  const result = await this.standardHandler.handle(standardRequest, ...rest);
20
20
  if (!result.matched) {
21
21
  return { matched: false };
22
22
  }
23
- await nodeHttpResponseSendStandardResponse(res, result.response);
23
+ await sendStandardResponse(res, result.response);
24
24
  return { matched: true };
25
25
  }
26
26
  };
@@ -1,10 +1,11 @@
1
1
  import type { Context, Router } from '@orpc/server';
2
2
  import type { FetchHandler, FetchHandleResult } from '@orpc/server/fetch';
3
- import type { StandardHandleRest } from '@orpc/server/standard';
3
+ import type { StandardHandleOptions } from '@orpc/server/standard';
4
+ import type { MaybeOptionalOptions } from '@orpc/shared';
4
5
  import type { OpenAPIHandlerOptions } from '../standard';
5
6
  export declare class OpenAPIHandler<T extends Context> implements FetchHandler<T> {
6
7
  private readonly standardHandler;
7
8
  constructor(router: Router<T, any>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
8
- handle(request: Request, ...rest: StandardHandleRest<T>): Promise<FetchHandleResult>;
9
+ handle(request: Request, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<FetchHandleResult>;
9
10
  }
10
11
  //# sourceMappingURL=openapi-handler.d.ts.map
@@ -1,10 +1,11 @@
1
1
  import type { Context, Router } from '@orpc/server';
2
2
  import type { NodeHttpHandler, NodeHttpHandleResult, NodeHttpRequest, NodeHttpResponse } from '@orpc/server/node';
3
- import type { StandardHandleRest } from '@orpc/server/standard';
3
+ import type { StandardHandleOptions } from '@orpc/server/standard';
4
+ import type { MaybeOptionalOptions } from '@orpc/shared';
4
5
  import type { OpenAPIHandlerOptions } from '../standard';
5
6
  export declare class OpenAPIHandler<T extends Context> implements NodeHttpHandler<T> {
6
7
  private readonly standardHandler;
7
8
  constructor(router: Router<T, any>, options?: NoInfer<OpenAPIHandlerOptions<T>>);
8
- handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: StandardHandleRest<T>): Promise<NodeHttpHandleResult>;
9
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
9
10
  }
10
11
  //# sourceMappingURL=openapi-handler.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import type { AnyProcedure } from '@orpc/server';
2
- import type { StandardCodec, StandardParams, StandardRequest, StandardResponse } from '@orpc/server/standard';
2
+ import type { StandardRequest, StandardResponse } from '@orpc/server-standard';
3
+ import type { StandardCodec, StandardParams } from '@orpc/server/standard';
3
4
  import { type ORPCError } from '@orpc/contract';
4
5
  import { OpenAPISerializer } from './openapi-serializer';
5
6
  export interface OpenAPICodecOptions {
@@ -1,12 +1,17 @@
1
1
  /** unnoq */
2
+ import { setOperationExtender } from './openapi-operation-extender';
2
3
  export * from './json-serializer';
3
4
  export * from './openapi';
4
5
  export * from './openapi-content-builder';
5
6
  export * from './openapi-generator';
7
+ export * from './openapi-operation-extender';
6
8
  export * from './openapi-parameters-builder';
7
9
  export * from './openapi-path-parser';
8
10
  export * from './schema';
9
11
  export * from './schema-converter';
10
12
  export * from './schema-utils';
11
13
  export * from './utils';
14
+ export declare const oo: {
15
+ spec: typeof setOperationExtender;
16
+ };
12
17
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { AnyContractProcedure } from '@orpc/contract';
2
+ import type { OpenAPI } from './openapi';
3
+ export type OverrideOperationValue = OpenAPI.OperationObject | ((current: OpenAPI.OperationObject, procedure: AnyContractProcedure) => OpenAPI.OperationObject);
4
+ export declare function setOperationExtender<T extends object>(o: T, extend: OverrideOperationValue): T;
5
+ export declare function getOperationExtender(o: object): OverrideOperationValue | undefined;
6
+ export declare function extendOperation(operation: OpenAPI.OperationObject, procedure: AnyContractProcedure): OpenAPI.OperationObject;
7
+ //# sourceMappingURL=openapi-operation-extender.d.ts.map
package/dist/standard.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  OpenAPIMatcher,
4
4
  OpenAPISerializer,
5
5
  bracket_notation_exports
6
- } from "./chunk-44Q55FOB.js";
7
- import "./chunk-BHJYKXQL.js";
6
+ } from "./chunk-TOZPXKQC.js";
7
+ import "./chunk-HC5PVG4R.js";
8
8
  export {
9
9
  bracket_notation_exports as BracketNotation,
10
10
  OpenAPICodec,
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.bc9d3dd",
4
+ "version": "0.0.0-next.bf323bf",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -54,15 +54,15 @@
54
54
  "dist"
55
55
  ],
56
56
  "dependencies": {
57
- "escape-string-regexp": "^5.0.0",
58
- "fast-content-type-parse": "^2.0.0",
57
+ "@orpc/server-standard": "^0.4.0",
58
+ "@orpc/server-standard-fetch": "^0.4.0",
59
+ "@orpc/server-standard-node": "^0.4.0",
59
60
  "json-schema-typed": "^8.0.1",
60
61
  "openapi3-ts": "^4.4.0",
61
62
  "rou3": "^0.5.1",
62
- "wildcard-match": "^5.1.3",
63
- "@orpc/server": "0.0.0-next.bc9d3dd",
64
- "@orpc/shared": "0.0.0-next.bc9d3dd",
65
- "@orpc/contract": "0.0.0-next.bc9d3dd"
63
+ "@orpc/server": "0.0.0-next.bf323bf",
64
+ "@orpc/shared": "0.0.0-next.bf323bf",
65
+ "@orpc/contract": "0.0.0-next.bf323bf"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@readme/openapi-parser": "^2.6.0",