{"version":3,"file":"index.cjs","names":["BaseGenerator","transformers","path","#isExcluded","#isIncluded","pLimit","#getOptions","buildOperation","buildOperations","jsonGenerator","oas: Oas","oas","path","options","groupName: Group['name']","SchemaGenerator","_createGenerator","_createReactGenerator"],"sources":["../src/OperationGenerator.ts","../src/plugin.ts","../src/index.ts"],"sourcesContent":["import type { Plugin, PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, HttpMethod, Oas, OasTypes, Operation, SchemaObject } from '@kubb/oas'\nimport type { Fabric } from '@kubb/react-fabric'\nimport pLimit from 'p-limit'\nimport type { Generator } from './generators/types.ts'\nimport type { Exclude, Include, OperationSchemas, Override } from './types.ts'\nimport { buildOperation, buildOperations } from './utils.tsx'\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n  fabric: Fabric\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  TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n  TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {\n  #getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']> {\n    const { override = [] } = this.context\n    const operationId = operation.getOperationId({ friendlyCase: true })\n    const contentType = operation.getContentType()\n\n    return (\n      override.find(({ pattern, type }) => {\n        switch (type) {\n          case 'tag':\n            return operation.getTags().some((tag) => tag.name.match(pattern))\n          case 'operationId':\n            return !!operationId.match(pattern)\n          case 'path':\n            return !!operation.path.match(pattern)\n          case 'method':\n            return !!method.match(pattern)\n          case 'contentType':\n            return !!contentType.match(pattern)\n          default:\n            return false\n        }\n      })?.options || {}\n    )\n  }\n\n  #isExcluded(operation: Operation, method: HttpMethod): boolean {\n    const { exclude = [] } = this.context\n    const operationId = operation.getOperationId({ friendlyCase: true })\n    const contentType = operation.getContentType()\n\n    return exclude.some(({ pattern, type }) => {\n      switch (type) {\n        case 'tag':\n          return operation.getTags().some((tag) => tag.name.match(pattern))\n        case 'operationId':\n          return !!operationId.match(pattern)\n        case 'path':\n          return !!operation.path.match(pattern)\n        case 'method':\n          return !!method.match(pattern)\n        case 'contentType':\n          return !!contentType.match(pattern)\n        default:\n          return false\n      }\n    })\n  }\n\n  #isIncluded(operation: Operation, method: HttpMethod): boolean {\n    const { include = [] } = this.context\n    const operationId = operation.getOperationId({ friendlyCase: true })\n    const contentType = operation.getContentType()\n\n    return include.some(({ pattern, type }) => {\n      switch (type) {\n        case 'tag':\n          return operation.getTags().some((tag) => tag.name.match(pattern))\n        case 'operationId':\n          return !!operationId.match(pattern)\n        case 'path':\n          return !!operation.path.match(pattern)\n        case 'method':\n          return !!method.match(pattern)\n        case 'contentType':\n          return !!contentType.match(pattern)\n        default:\n          return false\n      }\n    })\n  }\n\n  getSchemas(\n    operation: Operation,\n    {\n      resolveName = (name) => name,\n    }: {\n      resolveName?: (name: string) => string\n    } = {},\n  ): OperationSchemas {\n    const operationId = operation.getOperationId({ friendlyCase: true })\n    const method = operation.method\n    const operationName = transformers.pascalCase(operationId)\n\n    const resolveKeys = (schema?: SchemaObject) => (schema?.properties ? Object.keys(schema.properties) : undefined)\n\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 statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n      const name = statusCode === 'default' ? 'error' : statusCode\n      const schema = this.context.oas.getResponseSchema(operation, statusCode)\n      const keys = resolveKeys(schema)\n\n      return {\n        name: resolveName(transformers.pascalCase(`${operationId} ${name}`)),\n        description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n        schema,\n        operation,\n        operationName,\n        statusCode: name === 'error' ? undefined : Number(statusCode),\n        keys,\n        keysToOmit: keys?.filter((key) => (schema?.properties?.[key] as OasTypes.SchemaObject)?.writeOnly),\n      }\n    })\n\n    const successful = statusCodes.filter((item) => item.statusCode?.toString().startsWith('2'))\n    const errors = statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5'))\n\n    return {\n      pathParams: pathParamsSchema\n        ? {\n            name: resolveName(transformers.pascalCase(`${operationId} PathParams`)),\n            operation,\n            operationName,\n            schema: pathParamsSchema,\n            keys: resolveKeys(pathParamsSchema),\n          }\n        : undefined,\n      queryParams: queryParamsSchema\n        ? {\n            name: resolveName(transformers.pascalCase(`${operationId} QueryParams`)),\n            operation,\n            operationName,\n            schema: queryParamsSchema,\n            keys: resolveKeys(queryParamsSchema) || [],\n          }\n        : undefined,\n      headerParams: headerParamsSchema\n        ? {\n            name: resolveName(transformers.pascalCase(`${operationId} HeaderParams`)),\n            operation,\n            operationName,\n            schema: headerParamsSchema,\n            keys: resolveKeys(headerParamsSchema),\n          }\n        : undefined,\n      request: requestSchema\n        ? {\n            name: resolveName(transformers.pascalCase(`${operationId} ${method === 'get' ? 'queryRequest' : 'mutationRequest'}`)),\n            description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n            operation,\n            operationName,\n            schema: requestSchema,\n            keys: resolveKeys(requestSchema),\n            keysToOmit: resolveKeys(requestSchema)?.filter((key) => (requestSchema.properties?.[key] as OasTypes.SchemaObject)?.readOnly),\n          }\n        : undefined,\n      response: {\n        name: resolveName(transformers.pascalCase(`${operationId} ${method === 'get' ? 'queryResponse' : 'mutationResponse'}`)),\n        operation,\n        operationName,\n        schema: {\n          oneOf: successful.map((item) => ({ ...item.schema, $ref: item.name })) || undefined,\n        } as SchemaObject,\n      },\n      responses: successful,\n      errors,\n      statusCodes,\n    }\n  }\n\n  async getOperations(): Promise<Array<{ path: string; method: HttpMethod; operation: Operation }>> {\n    const { oas } = this.context\n\n    const paths = oas.getPaths()\n\n    return Object.entries(paths).flatMap(([path, methods]) =>\n      Object.entries(methods)\n        .map((values) => {\n          const [method, operation] = values as [HttpMethod, Operation]\n          if (this.#isExcluded(operation, method)) {\n            return null\n          }\n\n          if (this.context.include && !this.#isIncluded(operation, method)) {\n            return null\n          }\n\n          return operation ? { path, method: method as HttpMethod, operation } : null\n        })\n        .filter(Boolean),\n    )\n  }\n\n  async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n    const operations = await this.getOperations()\n\n    const generatorLimit = pLimit(1)\n    const operationLimit = pLimit(10)\n\n    const writeTasks = generators.map((generator) =>\n      generatorLimit(async () => {\n        const operationTasks = operations.map(({ operation, method }) =>\n          operationLimit(async () => {\n            const options = this.#getOptions(operation, method)\n\n            if (generator.type === 'react') {\n              await buildOperation(operation, {\n                config: this.context.pluginManager.config,\n                fabric: this.context.fabric,\n                Component: generator.Operation,\n                generator: this,\n                plugin: {\n                  ...this.context.plugin,\n                  options: {\n                    ...this.options,\n                    ...options,\n                  },\n                },\n              })\n\n              return []\n            }\n\n            const result = await generator.operation?.({\n              generator: this,\n              config: this.context.pluginManager.config,\n              operation,\n              plugin: {\n                ...this.context.plugin,\n                options: {\n                  ...this.options,\n                  ...options,\n                },\n              },\n            })\n\n            return result ?? []\n          }),\n        )\n\n        const operationResults = await Promise.all(operationTasks)\n        const opResultsFlat = operationResults.flat()\n\n        if (generator.type === 'react') {\n          await buildOperations(\n            operations.map((op) => op.operation),\n            {\n              fabric: this.context.fabric,\n              config: this.context.pluginManager.config,\n              Component: generator.Operations,\n              generator: this,\n              plugin: this.context.plugin,\n            },\n          )\n\n          return []\n        }\n\n        const operationsResult = await generator.operations?.({\n          generator: this,\n          config: this.context.pluginManager.config,\n          operations: operations.map((op) => op.operation),\n          plugin: this.context.plugin,\n        })\n\n        return [...opResultsFlat, ...(operationsResult ?? [])] as unknown as KubbFile.File<TFileMeta>\n      }),\n    )\n\n    const nestedResults = await Promise.all(writeTasks)\n\n    return nestedResults.flat()\n  }\n}\n","import path from 'node:path'\nimport { type Config, definePlugin, type Group, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { Oas } from '@kubb/oas'\nimport { parseFromConfig } from '@kubb/oas'\nimport { jsonGenerator } from './generators'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = definePlugin<PluginOas>((options) => {\n  const {\n    output = {\n      path: 'schemas',\n    },\n    group,\n    validate = true,\n    generators = [jsonGenerator],\n    serverIndex,\n    contentType,\n    oasClass,\n    discriminator = 'strict',\n  } = options\n\n  const getOas = async ({ config }: { config: Config }): Promise<Oas> => {\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, oasClass)\n\n    oas.setOptions({\n      contentType,\n      discriminator,\n    })\n\n    try {\n      if (validate) {\n        await oas.valdiate()\n      }\n    } catch (e) {\n      const error = e as Error\n\n      console.warn(error?.message)\n    }\n\n    return oas\n  }\n\n  return {\n    name: pluginOasName,\n    options: {\n      output,\n      validate,\n      discriminator,\n      ...options,\n    },\n    inject() {\n      const config = this.config\n      let oas: Oas\n\n      return {\n        async getOas() {\n          if (!oas) {\n            oas = await getOas({ config })\n          }\n\n          return oas\n        },\n        async getBaseURL() {\n          const oas = await getOas({ config })\n          if (serverIndex) {\n            return oas.api.servers?.at(serverIndex)?.url\n          }\n\n          return undefined\n        },\n      }\n    },\n    resolvePath(baseName, pathMode, options) {\n      const root = path.resolve(this.config.root, this.config.output.path)\n      const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n      if (mode === 'single') {\n        /**\n         * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n         * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n         */\n        return path.resolve(root, output.path)\n      }\n\n      if (group && (options?.group?.path || options?.group?.tag)) {\n        const groupName: Group['name'] = group?.name\n          ? group.name\n          : (ctx) => {\n              if (group?.type === 'path') {\n                return `${ctx.group.split('/')[1]}`\n              }\n              return `${camelCase(ctx.group)}Controller`\n            }\n\n        return path.resolve(\n          root,\n          output.path,\n          groupName({\n            group: group.type === 'path' ? options.group.path! : options.group.tag!,\n          }),\n          baseName,\n        )\n      }\n\n      return path.resolve(root, output.path, baseName)\n    },\n    async install() {\n      if (!output) {\n        return\n      }\n\n      const oas = await this.getOas()\n      await oas.dereference()\n\n      const schemaGenerator = new SchemaGenerator(\n        {\n          unknownType: 'unknown',\n          emptySchemaType: 'unknown',\n          dateType: 'date',\n          transformers: {},\n          ...this.plugin.options,\n        },\n        {\n          fabric: this.fabric,\n          oas,\n          pluginManager: this.pluginManager,\n          plugin: this.plugin,\n          contentType,\n          include: undefined,\n          override: undefined,\n          mode: 'split',\n          output: output.path,\n        },\n      )\n\n      const schemaFiles = await schemaGenerator.build(...generators)\n      await this.upsertFile(...schemaFiles)\n\n      const operationGenerator = new OperationGenerator(this.plugin.options, {\n        fabric: this.fabric,\n        oas,\n        pluginManager: this.pluginManager,\n        plugin: this.plugin,\n        contentType,\n        exclude: undefined,\n        include: undefined,\n        override: undefined,\n        mode: 'split',\n      })\n\n      const operationFiles = await operationGenerator.build(...generators)\n\n      await this.upsertFile(...operationFiles)\n    },\n  }\n})\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport { createGenerator as _createGenerator } from './generators/createGenerator.ts'\nimport { createReactGenerator as _createReactGenerator } from './generators/createReactGenerator.ts'\nimport type { Generator as _Generator } from './generators/types.ts'\n\nexport type { OperationMethodResult } from './OperationGenerator.ts'\nexport { OperationGenerator } from './OperationGenerator.ts'\nexport { pluginOas, pluginOasName } from './plugin.ts'\nexport type {\n  GetSchemaGeneratorOptions,\n  SchemaGeneratorBuildOptions,\n  SchemaGeneratorOptions,\n  SchemaMethodResult,\n} from './SchemaGenerator.ts'\nexport { SchemaGenerator } from './SchemaGenerator.ts'\nexport type {\n  Schema,\n  SchemaKeyword,\n  SchemaKeywordBase,\n  SchemaKeywordMapper,\n  SchemaMapper,\n  SchemaTree,\n} from './SchemaMapper.ts'\nexport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nexport type * from './types.ts'\nexport { buildOperation, buildOperations, buildSchema } from './utils.tsx'\n\n/**\n * @deprecated use `import { createGenerator } from '@kubb/plugin-oas/generators'`\n */\nexport const createGenerator = _createGenerator\n\n/**\n * @deprecated use `import { createReactGenerator } from '@kubb/plugin-oas/generators'`\n */\nexport const createReactGenerator = _createReactGenerator\n\n/**\n * @deprecated use `import { Generator } from '@kubb/plugin-oas/generators'`\n */\nexport type Generator<TOptions extends PluginFactoryOptions> = _Generator<TOptions>\n"],"mappings":";;;;;;;;;;;;;;AA4BA,IAAa,qBAAb,cAGUA,0BAA6G;CACrH,YAAY,WAAsB,QAAgE;EAChG,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK;EAC/B,MAAM,cAAc,UAAU,eAAe,EAAE,cAAc,MAAM,CAAC;EACpE,MAAM,cAAc,UAAU,gBAAgB;AAE9C,SACE,SAAS,MAAM,EAAE,SAAS,WAAW;AACnC,WAAQ,MAAR;IACE,KAAK,MACH,QAAO,UAAU,SAAS,CAAC,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,CAAC;IACnE,KAAK,cACH,QAAO,CAAC,CAAC,YAAY,MAAM,QAAQ;IACrC,KAAK,OACH,QAAO,CAAC,CAAC,UAAU,KAAK,MAAM,QAAQ;IACxC,KAAK,SACH,QAAO,CAAC,CAAC,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