@kubb/plugin-oas 3.0.0-alpha.2 → 3.0.0-alpha.21

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.
Files changed (101) hide show
  1. package/README.md +13 -4
  2. package/dist/OperationGenerator-CHXolL0o.d.cts +553 -0
  3. package/dist/OperationGenerator-CHXolL0o.d.ts +553 -0
  4. package/dist/Schema-Ch0dHkM5.d.ts +22 -0
  5. package/dist/Schema-ClNodlyP.d.cts +22 -0
  6. package/dist/chunk-6UWOTOZJ.cjs +92 -0
  7. package/dist/chunk-6UWOTOZJ.cjs.map +1 -0
  8. package/dist/chunk-AZKUU24F.js +700 -0
  9. package/dist/chunk-AZKUU24F.js.map +1 -0
  10. package/dist/chunk-DFQJ57GH.js +45 -0
  11. package/dist/chunk-DFQJ57GH.js.map +1 -0
  12. package/dist/chunk-GF26SDHQ.js +28 -0
  13. package/dist/chunk-GF26SDHQ.js.map +1 -0
  14. package/dist/chunk-HP5WAFBU.cjs +48 -0
  15. package/dist/chunk-HP5WAFBU.cjs.map +1 -0
  16. package/dist/chunk-JNGUNN72.cjs +708 -0
  17. package/dist/chunk-JNGUNN72.cjs.map +1 -0
  18. package/dist/chunk-PADR76WZ.cjs +4 -0
  19. package/dist/chunk-PADR76WZ.cjs.map +1 -0
  20. package/dist/chunk-R47XMJ32.js +3 -0
  21. package/dist/chunk-R47XMJ32.js.map +1 -0
  22. package/dist/{chunk-Y4V7HHX7.js → chunk-THGCWF2O.js} +8 -13
  23. package/dist/{chunk-Y4V7HHX7.js.map → chunk-THGCWF2O.js.map} +1 -1
  24. package/dist/chunk-TRA5BTWI.js +88 -0
  25. package/dist/chunk-TRA5BTWI.js.map +1 -0
  26. package/dist/chunk-UO57DZPV.cjs +36 -0
  27. package/dist/chunk-UO57DZPV.cjs.map +1 -0
  28. package/dist/chunk-ZWHQ54JM.cjs +32 -0
  29. package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
  30. package/dist/components.cjs +20 -17
  31. package/dist/components.cjs.map +1 -1
  32. package/dist/components.d.cts +12 -8
  33. package/dist/components.d.ts +12 -8
  34. package/dist/components.js +3 -17
  35. package/dist/components.js.map +1 -1
  36. package/dist/generators.cjs +14 -0
  37. package/dist/generators.cjs.map +1 -0
  38. package/dist/generators.d.cts +10 -0
  39. package/dist/generators.d.ts +10 -0
  40. package/dist/generators.js +5 -0
  41. package/dist/generators.js.map +1 -0
  42. package/dist/hooks.cjs +101 -57
  43. package/dist/hooks.cjs.map +1 -1
  44. package/dist/hooks.d.cts +40 -8
  45. package/dist/hooks.d.ts +40 -8
  46. package/dist/hooks.js +90 -53
  47. package/dist/hooks.js.map +1 -1
  48. package/dist/index.cjs +283 -261
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +6 -77
  51. package/dist/index.d.ts +6 -77
  52. package/dist/index.js +235 -240
  53. package/dist/index.js.map +1 -1
  54. package/dist/utils.cjs +32 -87
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +7 -41
  57. package/dist/utils.d.ts +7 -41
  58. package/dist/utils.js +8 -86
  59. package/dist/utils.js.map +1 -1
  60. package/package.json +20 -14
  61. package/src/OperationGenerator.ts +75 -43
  62. package/src/SchemaGenerator.ts +44 -18
  63. package/src/SchemaMapper.ts +1 -1
  64. package/src/components/Oas.tsx +9 -3
  65. package/src/components/Operation.tsx +1 -1
  66. package/src/components/Schema.tsx +2 -102
  67. package/src/generator.tsx +133 -0
  68. package/src/generators/index.ts +1 -0
  69. package/src/generators/jsonGenerator.ts +32 -0
  70. package/src/hooks/index.ts +2 -0
  71. package/src/hooks/useOperationManager.ts +76 -28
  72. package/src/hooks/useSchemaManager.ts +77 -0
  73. package/src/index.ts +3 -9
  74. package/src/plugin.ts +64 -47
  75. package/src/types.ts +23 -12
  76. package/src/utils/getParams.ts +2 -2
  77. package/src/utils/index.ts +2 -2
  78. package/dist/OperationGenerator-CeM_9pxW.d.cts +0 -60
  79. package/dist/OperationGenerator-DhUhvRJE.d.ts +0 -60
  80. package/dist/Schema-DefwBJMc.d.ts +0 -35
  81. package/dist/Schema-an5hOrjZ.d.cts +0 -35
  82. package/dist/SchemaMapper-CsBQ6eEx.d.cts +0 -248
  83. package/dist/SchemaMapper-CsBQ6eEx.d.ts +0 -248
  84. package/dist/chunk-CJXRFYEF.cjs +0 -698
  85. package/dist/chunk-CJXRFYEF.cjs.map +0 -1
  86. package/dist/chunk-DRLYORTT.cjs +0 -3265
  87. package/dist/chunk-DRLYORTT.cjs.map +0 -1
  88. package/dist/chunk-K6KUETAI.js +0 -698
  89. package/dist/chunk-K6KUETAI.js.map +0 -1
  90. package/dist/chunk-LEACSHKT.js +0 -3265
  91. package/dist/chunk-LEACSHKT.js.map +0 -1
  92. package/dist/chunk-P42X362U.cjs +0 -101
  93. package/dist/chunk-P42X362U.cjs.map +0 -1
  94. package/dist/chunk-QLJIL3U5.cjs +0 -35
  95. package/dist/chunk-QLJIL3U5.cjs.map +0 -1
  96. package/dist/chunk-UB552H4J.js +0 -101
  97. package/dist/chunk-UB552H4J.js.map +0 -1
  98. package/dist/types-Dte3MA6H.d.cts +0 -143
  99. package/dist/types-Dte3MA6H.d.ts +0 -143
  100. package/src/utils/getGroupedByTagFiles.ts +0 -82
  101. package/src/utils/refSorter.ts +0 -13
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/plugin.ts","../src/OperationGenerator.ts"],"sourcesContent":["import { pluginOas } from './plugin.ts'\n\nexport 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'\n\n/**\n * @deprecated Use `import { pluginOas } from '@kubb/plugin-oas'` instead\n */\nconst definePluginDefault = pluginOas\n\nexport default definePluginDefault\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'\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'\nimport { parseFromConfig } from './utils/parseFromConfig.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 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 resolvePath(baseName) {\n if (output === false) {\n return undefined\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n return camelCase(name, { isFile: type === 'file' })\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 const schemas = getSchemas({ oas, contentType })\n\n const mapSchema = async ([name, schema]: [string, OasTypes.SchemaObject]) => {\n const resolvedPath = this.resolvePath({\n baseName: `${name}.json`,\n pluginKey: this.plugin.key,\n })\n\n const resvoledFileName = this.resolveName({\n name: `${name}.json`,\n pluginKey: [pluginOasName],\n type: 'file',\n }) as `${string}.json`\n\n if (!resolvedPath) {\n return\n }\n\n await this.addFile({\n path: resolvedPath,\n baseName: resvoledFileName,\n source: JSON.stringify(schema),\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const promises = Object.entries(schemas).map(mapSchema)\n await Promise.all(promises)\n },\n }\n})\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'\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 abstract 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 * @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 * @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 { forStatusCode, resolveName = (name) => name }: { forStatusCode?: string | number; resolveName?: (name: string) => string } = {},\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 get #methods() {\n return {\n get: this.get,\n post: this.post,\n patch: this.patch,\n put: this.put,\n delete: this.delete,\n head: undefined,\n options: undefined,\n trace: undefined,\n } as const\n }\n\n async build(): 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[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 const promiseMethod = this.#methods[method]?.call(this, operation, {\n ...this.options,\n ...options,\n })\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n if (promiseOperation) {\n acc.push(promiseOperation)\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 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 null\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return null\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return null\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return null\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return null\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return null\n }\n\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], pa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D;AAEA,QAAI,SAAS,UAAU,CAAC,SAAS;AAC/B,gBAAU,CAAC,CAAC,UAAU,KAAK,MAAM,OAAO;AAAA,IAC1C;AAEA,QAAI,SAAS,YAAY,CAAC,SAAS;AACjC,gBAAU,CAAC,CAAC,OAAO,MAAM,OAAO;AAAA,IAClC;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAiGI,cAAQ,WAAG;AACb,SAAO;AAAA,IACL,KAAK,KAAK;AAAA,IACV,MAAM,KAAK;AAAA,IACX,OAAO,KAAK;AAAA,IACZ,KAAK,KAAK;AAAA,IACV,QAAQ,KAAK;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AACF;;;AF1MF,IAAM,sBAAsB;AAE5B,IAAO,cAAQ;","names":["path","method","item"]}
1
+ {"version":3,"sources":["../src/OperationGenerator.ts","../src/plugin.ts"],"names":["path","method","methods","item","options"],"mappings":";;;;;;;;;;;;AAgCa,IAAA,kBAAA,GAAN,cAGG,aAA6G,CAAA;AAAA,EACrH,sBAA0C,EAAC,CAAA;AAAA,EAC3C,IAAI,kBAAyC,GAAA;AAC3C,IAAA,OAAO,IAAK,CAAA,mBAAA,CAAA;AAAA,GACd;AAAA,EAEA,IAAI,mBAAmB,KAA2B,EAAA;AAChD,IAAA,IAAA,CAAK,mBAAsB,GAAA,KAAA,CAAA;AAAA,GAC7B;AAAA,EAEA,WAAA,CAAY,WAAsB,MAAgE,EAAA;AAChG,IAAA,MAAM,EAAE,QAAA,GAAW,EAAC,KAAM,IAAK,CAAA,OAAA,CAAA;AAE/B,IAAA,OACE,SAAS,IAAK,CAAA,CAAC,EAAE,OAAA,EAAS,MAAW,KAAA;AACnC,MAAA,IAAI,SAAS,KAAO,EAAA;AAClB,QAAO,OAAA,CAAC,CAAC,SAAU,CAAA,OAAA,GAAU,CAAC,CAAA,EAAG,IAAK,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,OACrD;AAEA,MAAA,IAAI,SAA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A,CAAM,GAAG,UAAU,CAAA,CAAA;AAEnE,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,cAAc,CAAA,CAAA;AAAA,KACtC;AAAA,GACF,CAAA;AACF,CAAC","file":"index.js","sourcesContent":["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 = any> = any\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 TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], 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<TPluginOptions['resolvedOptions']> {\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 resolveName = (name) => name,\n }: {\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 = (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<TPluginOptions>>): 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: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TPluginOptions['resolvedOptions']): 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 { FileManager, createPlugin } from '@kubb/core'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport path from 'node:path'\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas } from '@kubb/oas'\nimport type { FormatOptions } from '@kubb/oas/parser'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport { jsonGenerator } from './generators'\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 = {\n path: 'schemas',\n export: false,\n exportType: 'barrelNamed',\n },\n experimentalFilter: filter,\n experimentalSort: sort,\n validate = true,\n generators = [jsonGenerator],\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 options: {\n output,\n ...options,\n },\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 return oasInstance.api.servers?.at(serverIndex)?.url\n },\n contentType,\n }\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.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 return path.resolve(root, output.path, baseName)\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 schemaGenerator = new SchemaGenerator(\n {\n unknownType: 'unknown',\n dateType: 'date',\n transformers: {},\n ...this.plugin.options,\n },\n {\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.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\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.addFile(...operationFiles)\n },\n }\n})\n"]}
package/dist/utils.cjs CHANGED
@@ -1,77 +1,23 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ 'use strict';
2
2
 
3
- var _chunkQLJIL3U5cjs = require('./chunk-QLJIL3U5.cjs');
3
+ var chunkUO57DZPV_cjs = require('./chunk-UO57DZPV.cjs');
4
+ var chunkHP5WAFBU_cjs = require('./chunk-HP5WAFBU.cjs');
5
+ var transformers = require('@kubb/core/transformers');
6
+ var utils = require('@kubb/core/utils');
7
+ var oas = require('@kubb/oas');
4
8
 
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
5
10
 
11
+ var transformers__default = /*#__PURE__*/_interopDefault(transformers);
6
12
 
7
-
8
- var _chunkP42X362Ucjs = require('./chunk-P42X362U.cjs');
9
-
10
- // src/utils/index.ts
11
- _chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
12
-
13
- // src/utils/getComments.ts
14
- _chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
15
- var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
16
- var _utils = require('@kubb/core/utils');
17
13
  function getComments(operation) {
18
14
  return [
19
15
  operation.getDescription() && `@description ${operation.getDescription()}`,
20
16
  operation.getSummary() && `@summary ${operation.getSummary()}`,
21
- operation.path && `@link ${new (0, _utils.URLPath)(operation.path).URL}`,
17
+ operation.path && `@link ${new utils.URLPath(operation.path).URL}`,
22
18
  operation.isDeprecated() && "@deprecated"
23
- ].filter(Boolean).map((text) => _transformers2.default.trim(text));
19
+ ].filter(Boolean).map((text) => transformers__default.default.trim(text));
24
20
  }
25
-
26
- // src/utils/getGroupedByTagFiles.ts
27
- _chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
28
- var _path = require('path');
29
- var _core = require('@kubb/core');
30
-
31
-
32
- var _fs = require('@kubb/fs');
33
- async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }) {
34
- const { path, exportType = "barrel" } = output;
35
- const mode = _core.FileManager.getMode(_path.resolve.call(void 0, root, path));
36
- if (mode === "single" || exportType === false) {
37
- return [];
38
- }
39
- return files.filter((file) => {
40
- const name = _optionalChain([file, 'access', _ => _.meta, 'optionalAccess', _2 => _2.pluginKey, 'optionalAccess', _3 => _3[0]]);
41
- return name === plugin.name;
42
- }).map((file) => {
43
- if (!_optionalChain([file, 'access', _4 => _4.meta, 'optionalAccess', _5 => _5.tag])) {
44
- _optionalChain([logger, 'optionalAccess', _6 => _6.emit, 'call', _7 => _7("debug", [`Could not find a tagName for ${JSON.stringify(file, void 0, 2)}`])]);
45
- return;
46
- }
47
- const tag = _optionalChain([file, 'access', _8 => _8.meta, 'optionalAccess', _9 => _9.tag]) && _transformers2.default.camelCase(file.meta.tag);
48
- const tagPath = _fs.getRelativePath.call(void 0, _path.resolve.call(void 0, root, output.path), _path.resolve.call(void 0, root, _utils.renderTemplate.call(void 0, template, { tag })));
49
- const tagName = _utils.renderTemplate.call(void 0, exportAs, { tag });
50
- if (tagName) {
51
- return {
52
- baseName: "index.ts",
53
- path: _path.resolve.call(void 0, root, output.path, "index.ts"),
54
- source: "",
55
- exports: [
56
- {
57
- path: output.extName ? `${tagPath}/index${output.extName}` : `${tagPath}/index`,
58
- asAlias: true,
59
- name: tagName
60
- }
61
- ],
62
- meta: {
63
- pluginKey: plugin.key
64
- },
65
- exportable: true
66
- };
67
- }
68
- }).filter(Boolean);
69
- }
70
-
71
- // src/utils/getParams.ts
72
- _chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
73
- var _oas = require('@kubb/oas');
74
-
75
21
  function getASTParams(operationSchema, {
76
22
  typed = false,
77
23
  override
@@ -80,7 +26,7 @@ function getASTParams(operationSchema, {
80
26
  return [];
81
27
  }
82
28
  return Object.entries(operationSchema.schema.properties).map(([name, schema]) => {
83
- const isParam = _oas.isParameterObject.call(void 0, schema);
29
+ const isParam = oas.isParameterObject(schema);
84
30
  const data = {
85
31
  name,
86
32
  enabled: !!name,
@@ -93,7 +39,7 @@ function getASTParams(operationSchema, {
93
39
  function getPathParams(operationSchema, options = {}) {
94
40
  return getASTParams(operationSchema, options).reduce((acc, curr) => {
95
41
  if (curr.name && curr.enabled) {
96
- acc[_transformers.camelCase.call(void 0, curr.name)] = {
42
+ acc[transformers.camelCase(curr.name)] = {
97
43
  default: curr.default,
98
44
  type: curr.type,
99
45
  optional: !curr.required
@@ -103,25 +49,24 @@ function getPathParams(operationSchema, options = {}) {
103
49
  }, {});
104
50
  }
105
51
 
106
- // src/utils/refSorter.ts
107
- _chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
108
- function refsSorter(a, b) {
109
- if (_optionalChain([Object, 'access', _10 => _10.keys, 'call', _11 => _11(a.import.refs), 'optionalAccess', _12 => _12.length]) < _optionalChain([Object, 'access', _13 => _13.keys, 'call', _14 => _14(b.import.refs), 'optionalAccess', _15 => _15.length])) {
110
- return -1;
111
- }
112
- if (_optionalChain([Object, 'access', _16 => _16.keys, 'call', _17 => _17(a.import.refs), 'optionalAccess', _18 => _18.length]) > _optionalChain([Object, 'access', _19 => _19.keys, 'call', _20 => _20(b.import.refs), 'optionalAccess', _21 => _21.length])) {
113
- return 1;
114
- }
115
- return 0;
116
- }
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
- exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory = _chunkP42X362Ucjs.getSchemaFactory; exports.getSchemas = _chunkP42X362Ucjs.getSchemas; exports.parseFromConfig = _chunkQLJIL3U5cjs.parseFromConfig; exports.refsSorter = refsSorter;
52
+ Object.defineProperty(exports, "parseFromConfig", {
53
+ enumerable: true,
54
+ get: function () { return chunkUO57DZPV_cjs.parseFromConfig; }
55
+ });
56
+ Object.defineProperty(exports, "getSchemaFactory", {
57
+ enumerable: true,
58
+ get: function () { return chunkHP5WAFBU_cjs.getSchemaFactory; }
59
+ });
60
+ Object.defineProperty(exports, "getSchemas", {
61
+ enumerable: true,
62
+ get: function () { return chunkHP5WAFBU_cjs.getSchemas; }
63
+ });
64
+ Object.defineProperty(exports, "isOptional", {
65
+ enumerable: true,
66
+ get: function () { return oas.isOptional; }
67
+ });
68
+ exports.getASTParams = getASTParams;
69
+ exports.getComments = getComments;
70
+ exports.getPathParams = getPathParams;
71
+ //# sourceMappingURL=utils.cjs.map
127
72
  //# sourceMappingURL=utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/utils.cjs","../src/utils/index.ts","../src/utils/getComments.ts","../src/utils/getGroupedByTagFiles.ts","../src/utils/getParams.ts","../src/utils/refSorter.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,8CAAA,CAAA;ADWA;AACA;AEZA,8CAAA,CAAA;AAAA,mHAAyB;AACzB,yCAAwB;AAIjB,SAAS,WAAA,CAAY,SAAA,EAAgC;AAC1D,EAAA,OAAO;AAAA,IACL,SAAA,CAAU,cAAA,CAAe,EAAA,GAAK,CAAA,aAAA,EAAgB,SAAA,CAAU,cAAA,CAAe,CAAC,CAAA,CAAA;AACZ,IAAA;AACF,IAAA;AAC9B,IAAA;AAGU,EAAA;AAC1C;AFU6E;AACA;AGzB7E;AAAwB;AAEI;AACH;AACM;AACC;AAgC8C;AACpC,EAAA;AACY,EAAA;AAEL,EAAA;AACrC,IAAA;AACV,EAAA;AAGoB,EAAA;AACqB,IAAA;AACd,IAAA;AAEe,EAAA;AACjB,IAAA;AACmD,sBAAA;AAEtE,MAAA;AACF,IAAA;AAEkE,IAAA;AACE,IAAA;AACpB,IAAA;AAEnC,IAAA;AACJ,MAAA;AACK,QAAA;AACiC,QAAA;AACnC,QAAA;AACC,QAAA;AACP,UAAA;AACkE,YAAA;AACvD,YAAA;AACH,YAAA;AACR,UAAA;AACF,QAAA;AACM,QAAA;AACc,UAAA;AACpB,QAAA;AACY,QAAA;AACd,MAAA;AACF,IAAA;AAEa,EAAA;AACnB;AHZ6E;AACA;AItE7E;AAAkC;AAMR;AAQxB;AACU,EAAA;AACR,EAAA;AAKmB;AAC0C,EAAA;AACrD,IAAA;AACV,EAAA;AAE2E,EAAA;AACjC,IAAA;AACR,IAAA;AAC9B,MAAA;AACW,MAAA;AAC2B,MAAA;AACe,MAAA;AACvD,IAAA;AAEmC,IAAA;AACpC,EAAA;AACH;AAQE;AACoE,EAAA;AACnC,IAAA;AACD,MAAA;AACZ,QAAA;AACH,QAAA;AACK,QAAA;AAClB,MAAA;AACF,IAAA;AAEO,IAAA;AACM,EAAA;AACjB;AJ+C6E;AACA;AKzG7E;AAIoE;AACG,EAAA;AAC5D,IAAA;AACT,EAAA;AACqE,EAAA;AAC5D,IAAA;AACT,EAAA;AACO,EAAA;AACT;ALwG6E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/utils.cjs","sourcesContent":[null,"export { getComments } from './getComments.ts'\nexport { getGroupedByTagFiles } from './getGroupedByTagFiles.ts'\nexport { getASTParams, getPathParams } from './getParams.ts'\nexport { getSchemaFactory } from './getSchemaFactory.ts'\nexport type { GetSchemasProps } from './getSchemas.ts'\nexport { getSchemas } from './getSchemas.ts'\nexport { refsSorter } from './refSorter.ts'\nexport { parseFromConfig } from './parseFromConfig.ts'\n","import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { resolve } from 'node:path'\n\nimport { FileManager } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { getRelativePath } from '@kubb/fs'\n\nimport type { Plugin } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type * as KubbFile from '@kubb/fs/types'\n\ntype Options = {\n logger: Logger\n files: Array<KubbFile.File<FileMeta>>\n plugin: Plugin\n template: string\n exportAs: string\n /**\n * Root based on root and output.path specified in the config\n */\n root: string\n /**\n * Output for plugin\n */\n output: {\n path: string\n exportAs?: string\n extName?: KubbFile.Extname\n exportType?: 'barrel' | 'barrelNamed' | false\n }\n}\n\ntype FileMeta = {\n pluginKey?: Plugin['key']\n tag?: string\n}\n\nexport async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }: Options): Promise<KubbFile.File<FileMeta>[]> {\n const { path, exportType = 'barrel' } = output\n const mode = FileManager.getMode(resolve(root, path))\n\n if (mode === 'single' || exportType === false) {\n return []\n }\n\n return files\n .filter((file) => {\n const name = file.meta?.pluginKey?.[0]\n return name === plugin.name\n })\n .map((file: KubbFile.File<FileMeta>) => {\n if (!file.meta?.tag) {\n logger?.emit('debug', [`Could not find a tagName for ${JSON.stringify(file, undefined, 2)}`])\n\n return\n }\n\n const tag = file.meta?.tag && transformers.camelCase(file.meta.tag)\n const tagPath = getRelativePath(resolve(root, output.path), resolve(root, renderTemplate(template, { tag })))\n const tagName = renderTemplate(exportAs, { tag })\n\n if (tagName) {\n return {\n baseName: 'index.ts' as const,\n path: resolve(root, output.path, 'index.ts'),\n source: '',\n exports: [\n {\n path: output.extName ? `${tagPath}/index${output.extName}` : `${tagPath}/index`,\n asAlias: true,\n name: tagName,\n },\n ],\n meta: {\n pluginKey: plugin.key,\n },\n exportable: true,\n }\n }\n })\n .filter(Boolean)\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react'\nimport type { OperationSchema } from '../types.ts'\nimport { camelCase } from '@kubb/core/transformers'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import type { Refs } from '../types.ts'\n\ntype Generated = { import: { refs: Refs; name: string } }\n\nexport function refsSorter<T extends Generated>(a: T, b: T): number {\n if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {\n return -1\n }\n if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {\n return 1\n }\n return 0\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"names":["URLPath","transformers","isParameterObject","camelCase"],"mappings":";;;;;;;;;;;;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAS,MAAA,EAAA,IAAIA,cAAQ,SAAU,CAAA,IAAI,EAAE,GAAG,CAAA,CAAA;AAAA,IAC1D,SAAA,CAAU,cAAkB,IAAA,aAAA;AAAA,GAC9B,CACG,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAC,IAAS,KAAAC,6BAAA,CAAa,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAC1C,CAAA;ACFO,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QAAA;AAAA,OAClB,CAAA;AAAA,KACF;AAEA,IAAO,OAAA,GAAA,CAAA;AAAA,GACT,EAAG,EAAY,CAAA,CAAA;AACjB","file":"utils.cjs","sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n"]}
package/dist/utils.d.cts CHANGED
@@ -1,41 +1,15 @@
1
1
  import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1 } from '@kubb/oas';
2
- import { Plugin, Config } from '@kubb/core';
3
- import { Logger } from '@kubb/core/logger';
4
- import * as KubbFile from '@kubb/fs/types';
2
+ export { isOptional } from '@kubb/oas';
5
3
  import { FunctionParamsAST } from '@kubb/core/utils';
6
- import { Params } from '@kubb/react';
7
- import { a as OperationSchema, R as Refs } from './types-Dte3MA6H.cjs';
8
- export { G as GetSchemasProps, h as getSchemas } from './types-Dte3MA6H.cjs';
4
+ import { Params } from '@kubb/react/types';
5
+ import { v as OperationSchema } from './OperationGenerator-CHXolL0o.cjs';
6
+ export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-CHXolL0o.cjs';
9
7
  import { FormatOptions } from '@kubb/oas/parser';
8
+ import { Config } from '@kubb/core';
9
+ import '@kubb/fs/types';
10
10
 
11
11
  declare function getComments(operation: Operation): string[];
12
12
 
13
- type Options = {
14
- logger: Logger;
15
- files: Array<KubbFile.File<FileMeta>>;
16
- plugin: Plugin;
17
- template: string;
18
- exportAs: string;
19
- /**
20
- * Root based on root and output.path specified in the config
21
- */
22
- root: string;
23
- /**
24
- * Output for plugin
25
- */
26
- output: {
27
- path: string;
28
- exportAs?: string;
29
- extName?: KubbFile.Extname;
30
- exportType?: 'barrel' | 'barrelNamed' | false;
31
- };
32
- };
33
- type FileMeta = {
34
- pluginKey?: Plugin['key'];
35
- tag?: string;
36
- };
37
- declare function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }: Options): Promise<KubbFile.File<FileMeta>[]>;
38
-
39
13
  /**
40
14
  *
41
15
  * @deprecated
@@ -68,14 +42,6 @@ type SchemaResult<TWithRef extends boolean = false> = {
68
42
  };
69
43
  declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef>;
70
44
 
71
- type Generated = {
72
- import: {
73
- refs: Refs;
74
- name: string;
75
- };
76
- };
77
- declare function refsSorter<T extends Generated>(a: T, b: T): number;
78
-
79
45
  declare function parseFromConfig(config: Config, options?: FormatOptions, oasClass?: typeof Oas): Promise<Oas>;
80
46
 
81
- export { getASTParams, getComments, getGroupedByTagFiles, getPathParams, getSchemaFactory, parseFromConfig, refsSorter };
47
+ export { getASTParams, getComments, getPathParams, getSchemaFactory, parseFromConfig };
package/dist/utils.d.ts CHANGED
@@ -1,41 +1,15 @@
1
1
  import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1 } from '@kubb/oas';
2
- import { Plugin, Config } from '@kubb/core';
3
- import { Logger } from '@kubb/core/logger';
4
- import * as KubbFile from '@kubb/fs/types';
2
+ export { isOptional } from '@kubb/oas';
5
3
  import { FunctionParamsAST } from '@kubb/core/utils';
6
- import { Params } from '@kubb/react';
7
- import { a as OperationSchema, R as Refs } from './types-Dte3MA6H.js';
8
- export { G as GetSchemasProps, h as getSchemas } from './types-Dte3MA6H.js';
4
+ import { Params } from '@kubb/react/types';
5
+ import { v as OperationSchema } from './OperationGenerator-CHXolL0o.js';
6
+ export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-CHXolL0o.js';
9
7
  import { FormatOptions } from '@kubb/oas/parser';
8
+ import { Config } from '@kubb/core';
9
+ import '@kubb/fs/types';
10
10
 
11
11
  declare function getComments(operation: Operation): string[];
12
12
 
13
- type Options = {
14
- logger: Logger;
15
- files: Array<KubbFile.File<FileMeta>>;
16
- plugin: Plugin;
17
- template: string;
18
- exportAs: string;
19
- /**
20
- * Root based on root and output.path specified in the config
21
- */
22
- root: string;
23
- /**
24
- * Output for plugin
25
- */
26
- output: {
27
- path: string;
28
- exportAs?: string;
29
- extName?: KubbFile.Extname;
30
- exportType?: 'barrel' | 'barrelNamed' | false;
31
- };
32
- };
33
- type FileMeta = {
34
- pluginKey?: Plugin['key'];
35
- tag?: string;
36
- };
37
- declare function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }: Options): Promise<KubbFile.File<FileMeta>[]>;
38
-
39
13
  /**
40
14
  *
41
15
  * @deprecated
@@ -68,14 +42,6 @@ type SchemaResult<TWithRef extends boolean = false> = {
68
42
  };
69
43
  declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef>;
70
44
 
71
- type Generated = {
72
- import: {
73
- refs: Refs;
74
- name: string;
75
- };
76
- };
77
- declare function refsSorter<T extends Generated>(a: T, b: T): number;
78
-
79
45
  declare function parseFromConfig(config: Config, options?: FormatOptions, oasClass?: typeof Oas): Promise<Oas>;
80
46
 
81
- export { getASTParams, getComments, getGroupedByTagFiles, getPathParams, getSchemaFactory, parseFromConfig, refsSorter };
47
+ export { getASTParams, getComments, getPathParams, getSchemaFactory, parseFromConfig };
package/dist/utils.js CHANGED
@@ -1,19 +1,10 @@
1
- import {
2
- parseFromConfig
3
- } from "./chunk-Y4V7HHX7.js";
4
- import {
5
- getSchemaFactory,
6
- getSchemas,
7
- init_esm_shims
8
- } from "./chunk-UB552H4J.js";
1
+ export { parseFromConfig } from './chunk-THGCWF2O.js';
2
+ export { getSchemaFactory, getSchemas } from './chunk-DFQJ57GH.js';
3
+ import transformers, { camelCase } from '@kubb/core/transformers';
4
+ import { URLPath } from '@kubb/core/utils';
5
+ import { isParameterObject } from '@kubb/oas';
6
+ export { isOptional } from '@kubb/oas';
9
7
 
10
- // src/utils/index.ts
11
- init_esm_shims();
12
-
13
- // src/utils/getComments.ts
14
- init_esm_shims();
15
- import transformers from "@kubb/core/transformers";
16
- import { URLPath } from "@kubb/core/utils";
17
8
  function getComments(operation) {
18
9
  return [
19
10
  operation.getDescription() && `@description ${operation.getDescription()}`,
@@ -22,56 +13,6 @@ function getComments(operation) {
22
13
  operation.isDeprecated() && "@deprecated"
23
14
  ].filter(Boolean).map((text) => transformers.trim(text));
24
15
  }
25
-
26
- // src/utils/getGroupedByTagFiles.ts
27
- init_esm_shims();
28
- import { resolve } from "path";
29
- import { FileManager } from "@kubb/core";
30
- import transformers2 from "@kubb/core/transformers";
31
- import { renderTemplate } from "@kubb/core/utils";
32
- import { getRelativePath } from "@kubb/fs";
33
- async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }) {
34
- const { path, exportType = "barrel" } = output;
35
- const mode = FileManager.getMode(resolve(root, path));
36
- if (mode === "single" || exportType === false) {
37
- return [];
38
- }
39
- return files.filter((file) => {
40
- const name = file.meta?.pluginKey?.[0];
41
- return name === plugin.name;
42
- }).map((file) => {
43
- if (!file.meta?.tag) {
44
- logger?.emit("debug", [`Could not find a tagName for ${JSON.stringify(file, void 0, 2)}`]);
45
- return;
46
- }
47
- const tag = file.meta?.tag && transformers2.camelCase(file.meta.tag);
48
- const tagPath = getRelativePath(resolve(root, output.path), resolve(root, renderTemplate(template, { tag })));
49
- const tagName = renderTemplate(exportAs, { tag });
50
- if (tagName) {
51
- return {
52
- baseName: "index.ts",
53
- path: resolve(root, output.path, "index.ts"),
54
- source: "",
55
- exports: [
56
- {
57
- path: output.extName ? `${tagPath}/index${output.extName}` : `${tagPath}/index`,
58
- asAlias: true,
59
- name: tagName
60
- }
61
- ],
62
- meta: {
63
- pluginKey: plugin.key
64
- },
65
- exportable: true
66
- };
67
- }
68
- }).filter(Boolean);
69
- }
70
-
71
- // src/utils/getParams.ts
72
- init_esm_shims();
73
- import { isParameterObject } from "@kubb/oas";
74
- import { camelCase } from "@kubb/core/transformers";
75
16
  function getASTParams(operationSchema, {
76
17
  typed = false,
77
18
  override
@@ -103,25 +44,6 @@ function getPathParams(operationSchema, options = {}) {
103
44
  }, {});
104
45
  }
105
46
 
106
- // src/utils/refSorter.ts
107
- init_esm_shims();
108
- function refsSorter(a, b) {
109
- if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {
110
- return -1;
111
- }
112
- if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {
113
- return 1;
114
- }
115
- return 0;
116
- }
117
- export {
118
- getASTParams,
119
- getComments,
120
- getGroupedByTagFiles,
121
- getPathParams,
122
- getSchemaFactory,
123
- getSchemas,
124
- parseFromConfig,
125
- refsSorter
126
- };
47
+ export { getASTParams, getComments, getPathParams };
48
+ //# sourceMappingURL=utils.js.map
127
49
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/index.ts","../src/utils/getComments.ts","../src/utils/getGroupedByTagFiles.ts","../src/utils/getParams.ts","../src/utils/refSorter.ts"],"sourcesContent":["export { getComments } from './getComments.ts'\nexport { getGroupedByTagFiles } from './getGroupedByTagFiles.ts'\nexport { getASTParams, getPathParams } from './getParams.ts'\nexport { getSchemaFactory } from './getSchemaFactory.ts'\nexport type { GetSchemasProps } from './getSchemas.ts'\nexport { getSchemas } from './getSchemas.ts'\nexport { refsSorter } from './refSorter.ts'\nexport { parseFromConfig } from './parseFromConfig.ts'\n","import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { resolve } from 'node:path'\n\nimport { FileManager } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { getRelativePath } from '@kubb/fs'\n\nimport type { Plugin } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type * as KubbFile from '@kubb/fs/types'\n\ntype Options = {\n logger: Logger\n files: Array<KubbFile.File<FileMeta>>\n plugin: Plugin\n template: string\n exportAs: string\n /**\n * Root based on root and output.path specified in the config\n */\n root: string\n /**\n * Output for plugin\n */\n output: {\n path: string\n exportAs?: string\n extName?: KubbFile.Extname\n exportType?: 'barrel' | 'barrelNamed' | false\n }\n}\n\ntype FileMeta = {\n pluginKey?: Plugin['key']\n tag?: string\n}\n\nexport async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }: Options): Promise<KubbFile.File<FileMeta>[]> {\n const { path, exportType = 'barrel' } = output\n const mode = FileManager.getMode(resolve(root, path))\n\n if (mode === 'single' || exportType === false) {\n return []\n }\n\n return files\n .filter((file) => {\n const name = file.meta?.pluginKey?.[0]\n return name === plugin.name\n })\n .map((file: KubbFile.File<FileMeta>) => {\n if (!file.meta?.tag) {\n logger?.emit('debug', [`Could not find a tagName for ${JSON.stringify(file, undefined, 2)}`])\n\n return\n }\n\n const tag = file.meta?.tag && transformers.camelCase(file.meta.tag)\n const tagPath = getRelativePath(resolve(root, output.path), resolve(root, renderTemplate(template, { tag })))\n const tagName = renderTemplate(exportAs, { tag })\n\n if (tagName) {\n return {\n baseName: 'index.ts' as const,\n path: resolve(root, output.path, 'index.ts'),\n source: '',\n exports: [\n {\n path: output.extName ? `${tagPath}/index${output.extName}` : `${tagPath}/index`,\n asAlias: true,\n name: tagName,\n },\n ],\n meta: {\n pluginKey: plugin.key,\n },\n exportable: true,\n }\n }\n })\n .filter(Boolean)\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react'\nimport type { OperationSchema } from '../types.ts'\nimport { camelCase } from '@kubb/core/transformers'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import type { Refs } from '../types.ts'\n\ntype Generated = { import: { refs: Refs; name: string } }\n\nexport function refsSorter<T extends Generated>(a: T, b: T): number {\n if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {\n return -1\n }\n if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {\n return 1\n }\n return 0\n}\n"],"mappings":";;;;;;;;;;AAAA;;;ACAA;AAAA,OAAO,kBAAkB;AACzB,SAAS,eAAe;AAIjB,SAAS,YAAY,WAAgC;AAC1D,SAAO;AAAA,IACL,UAAU,eAAe,KAAK,gBAAgB,UAAU,eAAe,CAAC;AAAA,IACxE,UAAU,WAAW,KAAK,YAAY,UAAU,WAAW,CAAC;AAAA,IAC5D,UAAU,QAAQ,SAAS,IAAI,QAAQ,UAAU,IAAI,EAAE,GAAG;AAAA,IAC1D,UAAU,aAAa,KAAK;AAAA,EAC9B,EACG,OAAO,OAAO,EACd,IAAI,CAAC,SAAS,aAAa,KAAK,IAAI,CAAC;AAC1C;;;ACdA;AAAA,SAAS,eAAe;AAExB,SAAS,mBAAmB;AAC5B,OAAOA,mBAAkB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAgChC,eAAsB,qBAAqB,EAAE,QAAQ,OAAO,QAAQ,UAAU,UAAU,MAAM,OAAO,GAAgD;AACnJ,QAAM,EAAE,MAAM,aAAa,SAAS,IAAI;AACxC,QAAM,OAAO,YAAY,QAA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OAGI,GAAA,EACJ,EAAA;AACA,EAAA,OAAO,aAAa,eAAiB,EAAA,OAAO,EAAE,MAAO,CAAA,CAAC,KAAK,IAAS,KAAA;AAClE,IAAI,IAAA,IAAA,CAAK,IAAQ,IAAA,IAAA,CAAK,OAAS,EAAA;AAC7B,MAAA,GAAA,CAAI,SAAU,CAAA,IAAA,CAAK,IAAI,CAAC,CAAI,GAAA;AAAA,QAC1B,SAAS,IAAK,CAAA,OAAA;AAAA,QACd,MAAM,IAAK,CAAA,IAAA;AAAA,QACX,QAAA,EAAU,CAAC,IAAK,CAAA,QAAA;AAAA,OAClB,CAAA;AAAA,KACF;AAEA,IAAO,OAAA,GAAA,CAAA;AAAA,GACT,EAAG,EAAY,CAAA,CAAA;AACjB","file":"utils.js","sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n"]}