@kubb/plugin-oas 3.0.0-alpha.7 → 3.0.0-alpha.9

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.
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkVSVVTCQBcjs = require('./chunk-VSVVTCQB.cjs');
6
+ var _chunkIAUV3UKHcjs = require('./chunk-IAUV3UKH.cjs');
7
7
  require('./chunk-NU4F7G47.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
- exports.Oas = _chunkVSVVTCQBcjs.Oas; exports.Operation = _chunkVSVVTCQBcjs.Operation; exports.Schema = _chunkVSVVTCQBcjs.Schema;
12
+ exports.Oas = _chunkIAUV3UKHcjs.Oas; exports.Operation = _chunkIAUV3UKHcjs.Operation; exports.Schema = _chunkIAUV3UKHcjs.Schema;
13
13
  //# sourceMappingURL=components.cjs.map
@@ -2,7 +2,7 @@ import { S as Schema } from './Schema-DoSFh7Qd.cjs';
2
2
  import * as react from 'react';
3
3
  import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
4
4
  import { KubbNode } from '@kubb/react/types';
5
- import { a as OperationGenerator } from './OperationGenerator-DhJ0MBKc.cjs';
5
+ import { a as OperationGenerator } from './OperationGenerator-Gd1X7wUz.cjs';
6
6
  import './SchemaMapper-sGcY1xL5.cjs';
7
7
  import '@kubb/fs/types';
8
8
  import '@kubb/core';
@@ -2,7 +2,7 @@ import { S as Schema } from './Schema-B1vcPGiK.js';
2
2
  import * as react from 'react';
3
3
  import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
4
4
  import { KubbNode } from '@kubb/react/types';
5
- import { a as OperationGenerator } from './OperationGenerator-DeXrfGDC.js';
5
+ import { a as OperationGenerator } from './OperationGenerator-By5WOmWB.js';
6
6
  import './SchemaMapper-sGcY1xL5.js';
7
7
  import '@kubb/fs/types';
8
8
  import '@kubb/core';
@@ -3,7 +3,7 @@ import {
3
3
  Oas,
4
4
  Operation,
5
5
  Schema
6
- } from "./chunk-MUI5DWM3.js";
6
+ } from "./chunk-M347763D.js";
7
7
  import "./chunk-SZDO532A.js";
8
8
  export {
9
9
  Oas,
package/dist/hooks.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkVSVVTCQBcjs = require('./chunk-VSVVTCQB.cjs');
5
+ var _chunkIAUV3UKHcjs = require('./chunk-IAUV3UKH.cjs');
6
6
 
7
7
 
8
8
  var _chunkNU4F7G47cjs = require('./chunk-NU4F7G47.cjs');
@@ -14,7 +14,7 @@ _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
14
14
  _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
15
15
  var _react = require('@kubb/react');
16
16
  function useOas() {
17
- const { oas } = _react.useContext.call(void 0, _chunkVSVVTCQBcjs.Oas.Context);
17
+ const { oas } = _react.useContext.call(void 0, _chunkIAUV3UKHcjs.Oas.Context);
18
18
  if (!oas) {
19
19
  throw new Error("Oas is not defined");
20
20
  }
@@ -25,7 +25,7 @@ function useOas() {
25
25
  _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
26
26
 
27
27
  function useOperation() {
28
- const { operation } = _react.useContext.call(void 0, _chunkVSVVTCQBcjs.Operation.Context);
28
+ const { operation } = _react.useContext.call(void 0, _chunkIAUV3UKHcjs.Operation.Context);
29
29
  if (!operation) {
30
30
  throw new Error("Operation is not defined");
31
31
  }
@@ -37,7 +37,7 @@ _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
37
37
 
38
38
  function useOperationManager() {
39
39
  const { plugin, pluginManager } = _react.useApp.call(void 0, );
40
- const { generator } = _react.useContext.call(void 0, _chunkVSVVTCQBcjs.Oas.Context);
40
+ const { generator } = _react.useContext.call(void 0, _chunkIAUV3UKHcjs.Oas.Context);
41
41
  if (!generator) {
42
42
  throw new Error(`'generator' is not defined`);
43
43
  }
@@ -141,7 +141,7 @@ function useOperationManager() {
141
141
  _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
142
142
 
143
143
  function useOperations({ method, path } = {}) {
144
- const { operations } = _react.useContext.call(void 0, _chunkVSVVTCQBcjs.Oas.Context);
144
+ const { operations } = _react.useContext.call(void 0, _chunkIAUV3UKHcjs.Oas.Context);
145
145
  if (!operations) {
146
146
  throw new Error("Operations is not defined");
147
147
  }
@@ -160,5 +160,5 @@ function useOperations({ method, path } = {}) {
160
160
 
161
161
 
162
162
 
163
- exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkVSVVTCQBcjs.useSchema;
163
+ exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkIAUV3UKHcjs.useSchema;
164
164
  //# sourceMappingURL=hooks.cjs.map
package/dist/hooks.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  Oas,
3
3
  Operation,
4
4
  useSchema
5
- } from "./chunk-MUI5DWM3.js";
5
+ } from "./chunk-M347763D.js";
6
6
  import {
7
7
  init_esm_shims
8
8
  } from "./chunk-SZDO532A.js";
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@ require('./chunk-75BIOXB7.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunkVSVVTCQBcjs = require('./chunk-VSVVTCQB.cjs');
11
+ var _chunkIAUV3UKHcjs = require('./chunk-IAUV3UKH.cjs');
12
12
 
13
13
 
14
14
 
@@ -22,7 +22,7 @@ _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
22
22
  _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
23
23
  var _core = require('@kubb/core');
24
24
  var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
25
- var OperationGenerator = class extends _core.Generator {
25
+ var OperationGenerator = class extends _core.BaseGenerator {
26
26
  #operationsByMethod = {};
27
27
  get operationsByMethod() {
28
28
  return this.#operationsByMethod;
@@ -171,14 +171,15 @@ var OperationGenerator = class extends _core.Generator {
171
171
  statusCodes
172
172
  };
173
173
  }
174
- async build(...parsers) {
174
+ #methods = ["get", "post", "patch", "put", "delete"];
175
+ async build(...generators) {
175
176
  const { oas } = this.context;
176
177
  const paths = oas.getPaths();
177
178
  this.operationsByMethod = Object.entries(paths).reduce((acc, [path2, method]) => {
178
179
  const methods = Object.keys(method);
179
180
  methods.forEach((method2) => {
180
181
  const operation = oas.operation(path2, method2);
181
- if (operation) {
182
+ if (operation && [this.#methods].some((methods2) => method2 === operation.method)) {
182
183
  const isExcluded = this.#isExcluded(operation, method2);
183
184
  const isIncluded = this.context.include ? this.#isIncluded(operation, method2) : true;
184
185
  if (isIncluded && !isExcluded) {
@@ -219,8 +220,8 @@ var OperationGenerator = class extends _core.Generator {
219
220
  if (promiseOperation) {
220
221
  acc.push(promiseOperation);
221
222
  }
222
- _optionalChain([parsers, 'optionalAccess', _57 => _57.forEach, 'call', _58 => _58((parser) => {
223
- const promise = _optionalChain([parser, 'access', _59 => _59.operation, 'optionalCall', _60 => _60({
223
+ _optionalChain([generators, 'optionalAccess', _57 => _57.forEach, 'call', _58 => _58((generator) => {
224
+ const promise = _optionalChain([generator, 'access', _59 => _59.operation, 'optionalCall', _60 => _60({
224
225
  instance: this,
225
226
  operation,
226
227
  options: {
@@ -237,8 +238,8 @@ var OperationGenerator = class extends _core.Generator {
237
238
  }, []);
238
239
  const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item2) => item2.operation));
239
240
  promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod));
240
- _optionalChain([parsers, 'optionalAccess', _61 => _61.forEach, 'call', _62 => _62((parser) => {
241
- const promise = _optionalChain([parser, 'access', _63 => _63.operations, 'optionalCall', _64 => _64({
241
+ _optionalChain([generators, 'optionalAccess', _61 => _61.forEach, 'call', _62 => _62((generator) => {
242
+ const promise = _optionalChain([generator, 'access', _63 => _63.operations, 'optionalCall', _64 => _64({
242
243
  instance: this,
243
244
  operations: operations.flat().filter(Boolean),
244
245
  operationsByMethod: this.operationsByMethod,
@@ -380,6 +381,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
380
381
  {
381
382
  name: _transformers.camelCase.call(void 0, name),
382
383
  isExportable: false,
384
+ isIndexable: false,
383
385
  value: JSON.stringify(schema)
384
386
  }
385
387
  ]
@@ -391,14 +393,14 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
391
393
  };
392
394
  });
393
395
 
394
- // src/parser.tsx
396
+ // src/generator.tsx
395
397
  _chunkNU4F7G47cjs.init_cjs_shims.call(void 0, );
398
+ var import_jsx_runtime = _chunkNU4F7G47cjs.__toESM.call(void 0, _chunkIAUV3UKHcjs.require_jsx_runtime.call(void 0, ), 1);
396
399
  var _react = require('@kubb/react');
397
- var import_jsx_runtime = _chunkNU4F7G47cjs.__toESM.call(void 0, _chunkVSVVTCQBcjs.require_jsx_runtime.call(void 0, ), 1);
398
- function createParser(parseOptions) {
400
+ function createGenerator(parseOptions) {
399
401
  return parseOptions;
400
402
  }
401
- function createReactParser(parseOptions) {
403
+ function createReactGenerator(parseOptions) {
402
404
  return {
403
405
  ...parseOptions,
404
406
  async operations({ instance, options, operations, operationsByMethod }) {
@@ -410,7 +412,7 @@ function createReactParser(parseOptions) {
410
412
  logger: pluginManager.logger
411
413
  });
412
414
  root.render(
413
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_react.App, { pluginManager, plugin, mode, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkVSVVTCQBcjs.Oas, { oas, operations, generator: instance, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(parseOptions.Operations, { operations, instance, operationsByMethod, options }) }) })
415
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_react.App, { pluginManager, plugin, mode, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkIAUV3UKHcjs.Oas, { oas, operations, generator: instance, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(parseOptions.Operations, { operations, instance, operationsByMethod, options }) }) })
414
416
  );
415
417
  return root.files;
416
418
  },
@@ -423,7 +425,7 @@ function createReactParser(parseOptions) {
423
425
  logger: pluginManager.logger
424
426
  });
425
427
  root.render(
426
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkVSVVTCQBcjs.Oas, { oas, operations: [operation], generator: instance, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkVSVVTCQBcjs.Oas.Operation, { operation, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(parseOptions.Operation, { operation, options, instance }) }) }) })
428
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkIAUV3UKHcjs.Oas, { oas, operations: [operation], generator: instance, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkIAUV3UKHcjs.Oas.Operation, { operation, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(parseOptions.Operation, { operation, options, instance }) }) }) })
427
429
  );
428
430
  return root.files;
429
431
  },
@@ -437,7 +439,7 @@ function createReactParser(parseOptions) {
437
439
  });
438
440
  const tree = instance.parse({ schema, name });
439
441
  root.render(
440
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkVSVVTCQBcjs.Oas, { oas, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkVSVVTCQBcjs.Oas.Schema, { name, value: schema, tree, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(parseOptions.Schema, { schema, options, instance, name }) }) }) })
442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkIAUV3UKHcjs.Oas, { oas, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_chunkIAUV3UKHcjs.Oas.Schema, { name, value: schema, tree, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(parseOptions.Schema, { schema, options, instance, name }) }) }) })
441
443
  );
442
444
  return root.files;
443
445
  }
@@ -452,5 +454,5 @@ function createReactParser(parseOptions) {
452
454
 
453
455
 
454
456
 
455
- exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator = _chunkVSVVTCQBcjs.SchemaGenerator; exports.createParser = createParser; exports.createReactParser = createReactParser; exports.isKeyword = _chunkVSVVTCQBcjs.isKeyword; exports.pluginOas = pluginOas; exports.pluginOasName = pluginOasName; exports.schemaKeywords = _chunkVSVVTCQBcjs.schemaKeywords;
457
+ exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator = _chunkIAUV3UKHcjs.SchemaGenerator; exports.createGenerator = createGenerator; exports.createReactGenerator = createReactGenerator; exports.isKeyword = _chunkIAUV3UKHcjs.isKeyword; exports.pluginOas = pluginOas; exports.pluginOasName = pluginOasName; exports.schemaKeywords = _chunkIAUV3UKHcjs.schemaKeywords;
456
458
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/index.cjs","../src/index.ts","../src/OperationGenerator.ts","../src/plugin.ts","../src/parser.tsx"],"names":["method"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACjBA,8CAAA,CAAA;ADmBA;AACA;AEpBA,8CAAA,CAAA;AAAA,kCAA6C;AAC7C,mHAAyB;AA4BlB,IAAM,mBAAA,EAAN,MAAA,QAIG,gBAAuD;AAAA,EAC/D,CAAA,mBAAA,EAA0C,CAAC,CAAA;AAAA,EAC3C,IAAI,kB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AA;AACV,MAAA;AAE2C,MAAA;AACxC,QAAA;AACK,QAAA;AAErB,QAAA;AACX,UAAA;AACN,UAAA;AACM,UAAA;AACmB,YAAA;AACzB,UAAA;AACS,UAAA;AACP,YAAA;AACsB,cAAA;AACN,cAAA;AACc,cAAA;AAC9B,YAAA;AACF,UAAA;AACD,QAAA;AACH,MAAA;AAE6C,MAAA;AACnB,MAAA;AAC5B,IAAA;AACF,EAAA;AACD;AHiRkD;AACA;AIzYnD;AAEgC;AAgEpB;AA3BiH;AACpH,EAAA;AACT;AASuI;AAC9H,EAAA;AACF,IAAA;AACmC,IAAA;AACN,MAAA;AACpB,QAAA;AACV,MAAA;AAE6C,MAAA;AACrB,MAAA;AACA,QAAA;AACvB,MAAA;AAEI,MAAA;AACH,wBAAA;AAKF,MAAA;AAEY,MAAA;AACd,IAAA;AAC+C,IAAA;AAChB,MAAA;AACnB,QAAA;AACV,MAAA;AAE6C,MAAA;AACrB,MAAA;AACA,QAAA;AACvB,MAAA;AAEI,MAAA;AACH,wBAAA;AAOF,MAAA;AAEY,MAAA;AACd,IAAA;AAC+C,IAAA;AACnB,MAAA;AAChB,QAAA;AACV,MAAA;AAE6C,MAAA;AACrB,MAAA;AACA,QAAA;AACvB,MAAA;AAE2C,MAAA;AAEvC,MAAA;AACH,wBAAA;AAOF,MAAA;AAEY,MAAA;AACd,IAAA;AACF,EAAA;AACF;AJqUmD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/index.cjs","sourcesContent":[null,"export type {\n GetOperationGeneratorOptions,\n OperationMethodResult,\n} from './OperationGenerator.ts'\nexport { OperationGenerator } from './OperationGenerator.ts'\nexport { pluginOas, pluginOasName } from './plugin.ts'\nexport type {\n GetSchemaGeneratorOptions,\n SchemaGeneratorBuildOptions,\n SchemaGeneratorOptions,\n} from './SchemaGenerator.ts'\nexport type { SchemaMethodResult } from './SchemaGenerator.ts'\nexport { SchemaGenerator } from './SchemaGenerator.ts'\nexport type {\n Schema,\n SchemaKeyword,\n SchemaKeywordBase,\n SchemaKeywordMapper,\n SchemaMapper,\n} from './SchemaMapper.ts'\nexport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nexport type * from './types.ts'\nexport { createParser, createReactParser } from './parser.tsx'\nexport type { ParserReactOptions } from './parser.tsx'\nexport type { Parser, ParserOptions } from './parser.tsx'\n","import { type FileMetaBase, Generator } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, contentType } from '@kubb/oas'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\nimport type { Parser } from './parser.tsx'\n\nexport type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TOptions = unknown,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TOptions> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n /**\n *\n * @deprecated\n */\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n /**\n *\n * @deprecated\n */\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n forStatusCode,\n resolveName = (name) => name,\n }: {\n forStatusCode?: string | number\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const responseStatusCode =\n forStatusCode || (operation.schema.responses && Object.keys(operation.schema.responses).find((key) => key.startsWith('2'))) || 200\n const responseSchema = this.context.oas.getResponseSchema(operation, responseStatusCode)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n }\n })\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`)),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`)),\n description: operation.getResponseAsJSONSchema(responseStatusCode)?.at(0)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: responseSchema,\n statusCode: Number(responseStatusCode),\n keys: responseSchema?.properties ? Object.keys(responseSchema.properties) : undefined,\n keysToOmit: responseSchema?.properties\n ? Object.keys(responseSchema.properties).filter((key) => {\n const item = responseSchema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n },\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n async build(...parsers: Array<Parser<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n parsers?.forEach((parser) => {\n const promise = parser.operation?.({\n instance: this,\n operation,\n options: {\n ...this.options,\n ...options,\n },\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n acc.push(promise)\n }\n })\n })\n\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n parsers?.forEach((parser) => {\n const promise = parser.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import path from 'node:path'\n\nimport { createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas, OasTypes } from '@kubb/oas'\nimport type { FormatOptions } from '@kubb/oas/parser'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = { path: 'schemas', export: false },\n experimentalFilter: filter,\n experimentalSort: sort,\n validate = true,\n serverIndex = 0,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger, formatOptions }: { config: Config; logger: Logger; formatOptions?: FormatOptions }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, formatOptions, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, {}, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n output:\n output === false\n ? {\n path: '',\n exportType: false,\n }\n : {\n exportType: 'barrelNamed',\n ...output,\n },\n options,\n context() {\n const { config, logger } = this\n\n return {\n getOas(formatOptions) {\n return getOas({ config, logger, formatOptions })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n const baseURL = oasInstance.api.servers?.at(serverIndex)?.url\n return baseURL\n },\n contentType,\n }\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n formatOptions: {\n filterSet: filter,\n sortSet: sort,\n },\n })\n await oas.dereference()\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const schemas = getSchemas({ oas, contentType })\n\n const mapSchema = async ([name, schema]: [string, OasTypes.SchemaObject]) => {\n const baseName = `${camelCase(name)}.json` as `${string}.json`\n const resolvedPath = path.resolve(root, output.path, baseName)\n\n await this.addFile({\n path: resolvedPath,\n baseName,\n meta: {\n pluginKey: this.plugin.key,\n },\n sources: [\n {\n name: camelCase(name),\n isExportable: false,\n value: JSON.stringify(schema),\n },\n ],\n })\n }\n\n const promises = Object.entries(schemas).map(mapSchema)\n await Promise.all(promises)\n },\n }\n})\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { OperationsByMethod } from './types.ts'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n name: string\n schema: SchemaObject\n options: TOptions['resolvedOptions']\n}\n\nexport type ParserOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Parser<TOptions extends PluginFactoryOptions> = ParserOptions<TOptions>\n\nexport function createParser<TOptions extends PluginFactoryOptions>(parseOptions: ParserOptions<TOptions>): Parser<TOptions> {\n return parseOptions\n}\n\nexport type ParserReactOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (props: OperationsProps<TOptions>) => KubbNode\n Operation?: (props: OperationProps<TOptions>) => KubbNode\n Schema?: (props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactParser<TOptions extends PluginFactoryOptions>(parseOptions: ParserReactOptions<TOptions>): Parser<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <parseOptions.Operations operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <parseOptions.Operation operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, name, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const tree = instance.parse({ schema, name })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={name} value={schema} tree={tree}>\n <parseOptions.Schema schema={schema} options={options} instance={instance} name={name} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/index.cjs","../src/index.ts","../src/OperationGenerator.ts","../src/plugin.ts","../src/generator.tsx"],"names":["method","methods"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACjBA,8CAAA,CAAA;ADmBA;AACA;AEpBA,8CAAA,CAAA;AAAA,kCAAiD;AACjD,mHAAyB;AA+BlB,IAAM,mBAAA,EAAN,MAAA,QAIG,oBAA2D;AAAA,EACnE,CAAA,mBAAA,EAA0C,CAAC,CAAA;AAAA,EAC3C,IAAI,kBAAA,CAAA,EAAyC;AAC3C,IAAA,OAAO,IAAA,CAAK,CAAA,kBAAA;AAAA,EACd;AAAA,EAEA,IAAI,kBAAA,CAAmB,KAAA,EAA2B;AAChD,IAAA,IAAA,CAAK,CAAA,mBAAA,EAAsB,KAAA;AAAA,EAC7B;AAAA,EAEA,CAAA,UAAA,CAAY,SAAA,EAAsB,MAAA,EAAuC;AACvE,IAAA,MAAM,EAAE,SAAA,EAAW,CAAC,EAAE,EAAA,EAAI,IAAA,CAAK,OAAA;AAE/B,IAAA,uBACE,QAAA,mBAAS,IAAA,mBAAK,CAAC,EAAE,OAAA,EAAS,KAAK,CAAA,EAAA,GAAM;AACnC,MAAA,GAAA,CAAI,KAAA,IAAS,KAAA,EAAO;AAClB,QAAA,OAAO,CAAC,iBAAC,SAAA,qBAAU,OAAA,mBAAQ,CAAA,qBAAE,CAAC,CAAA,6BAAG,IAAA,qBAAK,KAAA,mBAAM,OAAO,GAAA;AAAA,MACrD;AAEA,MAAA,GAAA,CAAI,KAAA,IAAS,aAAA,EAAe;AAC1B,QAAA,OAAO,CAAC,CAAC,SAAA,CAAU,cAAA,CAAe,CAAA,CAAE,KAAA,CAAM,OAAO,CAAA;AAAA,MACnD;AAEA,MAAA,GAAA,CAAI,KAAA,IAAS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B,MAAA;AAE2C,MAAA;AAEvC,MAAA;AACH,wBAAA;AAOF,MAAA;AAEY,MAAA;AACd,IAAA;AACF,EAAA;AACF;AJmUmD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/index.cjs","sourcesContent":[null,"export type {\n GetOperationGeneratorOptions,\n OperationMethodResult,\n} from './OperationGenerator.ts'\nexport { OperationGenerator } from './OperationGenerator.ts'\nexport { pluginOas, pluginOasName } from './plugin.ts'\nexport type {\n GetSchemaGeneratorOptions,\n SchemaGeneratorBuildOptions,\n SchemaGeneratorOptions,\n} from './SchemaGenerator.ts'\nexport type { SchemaMethodResult } from './SchemaGenerator.ts'\nexport { SchemaGenerator } from './SchemaGenerator.ts'\nexport type {\n Schema,\n SchemaKeyword,\n SchemaKeywordBase,\n SchemaKeywordMapper,\n SchemaMapper,\n} from './SchemaMapper.ts'\nexport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nexport type * from './types.ts'\nexport { createGenerator, createReactGenerator } from './generator.tsx'\nexport type { ReactGeneratorOptions } from './generator.tsx'\nexport type { Generator, GeneratorOptions } from './generator.tsx'\n","import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, contentType } from '@kubb/oas'\nimport type { Generator } from './generator.tsx'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\n\n/**\n * @deprecated\n */\nexport type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TOptions = unknown,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TOptions> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n /**\n *\n * @deprecated\n */\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n /**\n *\n * @deprecated\n */\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n forStatusCode,\n resolveName = (name) => name,\n }: {\n forStatusCode?: string | number\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const responseStatusCode =\n forStatusCode || (operation.schema.responses && Object.keys(operation.schema.responses).find((key) => key.startsWith('2'))) || 200\n const responseSchema = this.context.oas.getResponseSchema(operation, responseStatusCode)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n }\n })\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`)),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`)),\n description: operation.getResponseAsJSONSchema(responseStatusCode)?.at(0)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: responseSchema,\n statusCode: Number(responseStatusCode),\n keys: responseSchema?.properties ? Object.keys(responseSchema.properties) : undefined,\n keysToOmit: responseSchema?.properties\n ? Object.keys(responseSchema.properties).filter((key) => {\n const item = responseSchema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n },\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n #methods = ['get', 'post', 'patch', 'put', 'delete']\n\n async build(...generators: Array<Generator<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation && [this.#methods].some((methods) => method === operation.method)) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const promise = generator.operation?.({\n instance: this,\n operation,\n options: {\n ...this.options,\n ...options,\n },\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n acc.push(promise)\n }\n })\n })\n\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n generators?.forEach((generator) => {\n const promise = generator.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import path from 'node:path'\n\nimport { createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas, OasTypes } from '@kubb/oas'\nimport type { FormatOptions } from '@kubb/oas/parser'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = { path: 'schemas', export: false },\n experimentalFilter: filter,\n experimentalSort: sort,\n validate = true,\n serverIndex = 0,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger, formatOptions }: { config: Config; logger: Logger; formatOptions?: FormatOptions }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, formatOptions, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, {}, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n output:\n output === false\n ? {\n path: '',\n exportType: false,\n }\n : {\n exportType: 'barrelNamed',\n ...output,\n },\n options,\n context() {\n const { config, logger } = this\n\n return {\n getOas(formatOptions) {\n return getOas({ config, logger, formatOptions })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n const baseURL = oasInstance.api.servers?.at(serverIndex)?.url\n return baseURL\n },\n contentType,\n }\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n formatOptions: {\n filterSet: filter,\n sortSet: sort,\n },\n })\n await oas.dereference()\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const schemas = getSchemas({ oas, contentType })\n\n const mapSchema = async ([name, schema]: [string, OasTypes.SchemaObject]) => {\n const baseName = `${camelCase(name)}.json` as `${string}.json`\n const resolvedPath = path.resolve(root, output.path, baseName)\n\n await this.addFile({\n path: resolvedPath,\n baseName,\n meta: {\n pluginKey: this.plugin.key,\n },\n sources: [\n {\n name: camelCase(name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema),\n },\n ],\n })\n }\n\n const promises = Object.entries(schemas).map(mapSchema)\n await Promise.all(promises)\n },\n }\n})\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n name: string\n schema: SchemaObject\n options: TOptions['resolvedOptions']\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (props: OperationsProps<TOptions>) => KubbNode\n Operation?: (props: OperationProps<TOptions>) => KubbNode\n Schema?: (props: SchemaProps<TOptions>) => KubbNode\n /**\n * Combine all react nodes and only render ones(to string or render)\n */\n render?: () => any\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <parseOptions.Operations operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <parseOptions.Operation operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, name, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const tree = instance.parse({ schema, name })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={name} value={schema} tree={tree}>\n <parseOptions.Schema schema={schema} options={options} instance={instance} name={name} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { G as GetOperationGeneratorOptions, b as GetSchemaGeneratorOptions, a as OperationGenerator, O as OperationMethodResult, h as Parser, i as ParserOptions, P as ParserReactOptions, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, d as SchemaMethodResult, f as createParser, g as createReactParser } from './OperationGenerator-DhJ0MBKc.cjs';
1
+ export { h as Generator, i as GeneratorOptions, G as GetOperationGeneratorOptions, b as GetSchemaGeneratorOptions, a as OperationGenerator, O as OperationMethodResult, R as ReactGeneratorOptions, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, d as SchemaMethodResult, f as createGenerator, g as createReactGenerator } from './OperationGenerator-Gd1X7wUz.cjs';
2
2
  import * as _kubb_core from '@kubb/core';
3
3
  import { O as Options, P as PluginOas } from './types-CZTUCaE5.cjs';
4
4
  export { A as API, E as Exclude, I as Include, d as OperationSchema, e as OperationSchemas, f as OperationsByMethod, g as Override, a as Ref, b as Refs, R as ResolvePathOptions, c as Resolver } from './types-CZTUCaE5.cjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { G as GetOperationGeneratorOptions, b as GetSchemaGeneratorOptions, a as OperationGenerator, O as OperationMethodResult, h as Parser, i as ParserOptions, P as ParserReactOptions, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, d as SchemaMethodResult, f as createParser, g as createReactParser } from './OperationGenerator-DeXrfGDC.js';
1
+ export { h as Generator, i as GeneratorOptions, G as GetOperationGeneratorOptions, b as GetSchemaGeneratorOptions, a as OperationGenerator, O as OperationMethodResult, R as ReactGeneratorOptions, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, d as SchemaMethodResult, f as createGenerator, g as createReactGenerator } from './OperationGenerator-By5WOmWB.js';
2
2
  import * as _kubb_core from '@kubb/core';
3
3
  import { O as Options, P as PluginOas } from './types-CZTUCaE5.js';
4
4
  export { A as API, E as Exclude, I as Include, d as OperationSchema, e as OperationSchemas, f as OperationsByMethod, g as Override, a as Ref, b as Refs, R as ResolvePathOptions, c as Resolver } from './types-CZTUCaE5.js';
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  isKeyword,
9
9
  require_jsx_runtime,
10
10
  schemaKeywords
11
- } from "./chunk-MUI5DWM3.js";
11
+ } from "./chunk-M347763D.js";
12
12
  import {
13
13
  __toESM,
14
14
  getSchemas,
@@ -20,9 +20,9 @@ init_esm_shims();
20
20
 
21
21
  // src/OperationGenerator.ts
22
22
  init_esm_shims();
23
- import { Generator } from "@kubb/core";
23
+ import { BaseGenerator } from "@kubb/core";
24
24
  import transformers from "@kubb/core/transformers";
25
- var OperationGenerator = class extends Generator {
25
+ var OperationGenerator = class extends BaseGenerator {
26
26
  #operationsByMethod = {};
27
27
  get operationsByMethod() {
28
28
  return this.#operationsByMethod;
@@ -171,14 +171,15 @@ var OperationGenerator = class extends Generator {
171
171
  statusCodes
172
172
  };
173
173
  }
174
- async build(...parsers) {
174
+ #methods = ["get", "post", "patch", "put", "delete"];
175
+ async build(...generators) {
175
176
  const { oas } = this.context;
176
177
  const paths = oas.getPaths();
177
178
  this.operationsByMethod = Object.entries(paths).reduce((acc, [path2, method]) => {
178
179
  const methods = Object.keys(method);
179
180
  methods.forEach((method2) => {
180
181
  const operation = oas.operation(path2, method2);
181
- if (operation) {
182
+ if (operation && [this.#methods].some((methods2) => method2 === operation.method)) {
182
183
  const isExcluded = this.#isExcluded(operation, method2);
183
184
  const isIncluded = this.context.include ? this.#isIncluded(operation, method2) : true;
184
185
  if (isIncluded && !isExcluded) {
@@ -219,8 +220,8 @@ var OperationGenerator = class extends Generator {
219
220
  if (promiseOperation) {
220
221
  acc.push(promiseOperation);
221
222
  }
222
- parsers?.forEach((parser) => {
223
- const promise = parser.operation?.({
223
+ generators?.forEach((generator) => {
224
+ const promise = generator.operation?.({
224
225
  instance: this,
225
226
  operation,
226
227
  options: {
@@ -237,8 +238,8 @@ var OperationGenerator = class extends Generator {
237
238
  }, []);
238
239
  const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item2) => item2.operation));
239
240
  promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod));
240
- parsers?.forEach((parser) => {
241
- const promise = parser.operations?.({
241
+ generators?.forEach((generator) => {
242
+ const promise = generator.operations?.({
242
243
  instance: this,
243
244
  operations: operations.flat().filter(Boolean),
244
245
  operationsByMethod: this.operationsByMethod,
@@ -380,6 +381,7 @@ var pluginOas = createPlugin((options) => {
380
381
  {
381
382
  name: camelCase(name),
382
383
  isExportable: false,
384
+ isIndexable: false,
383
385
  value: JSON.stringify(schema)
384
386
  }
385
387
  ]
@@ -391,14 +393,14 @@ var pluginOas = createPlugin((options) => {
391
393
  };
392
394
  });
393
395
 
394
- // src/parser.tsx
396
+ // src/generator.tsx
395
397
  init_esm_shims();
396
- import { App, createRoot } from "@kubb/react";
397
398
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
398
- function createParser(parseOptions) {
399
+ import { App, createRoot } from "@kubb/react";
400
+ function createGenerator(parseOptions) {
399
401
  return parseOptions;
400
402
  }
401
- function createReactParser(parseOptions) {
403
+ function createReactGenerator(parseOptions) {
402
404
  return {
403
405
  ...parseOptions,
404
406
  async operations({ instance, options, operations, operationsByMethod }) {
@@ -446,8 +448,8 @@ function createReactParser(parseOptions) {
446
448
  export {
447
449
  OperationGenerator,
448
450
  SchemaGenerator,
449
- createParser,
450
- createReactParser,
451
+ createGenerator,
452
+ createReactGenerator,
451
453
  isKeyword,
452
454
  pluginOas,
453
455
  pluginOasName,