@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.
- package/README.md +13 -4
- package/dist/OperationGenerator-CHXolL0o.d.cts +553 -0
- package/dist/OperationGenerator-CHXolL0o.d.ts +553 -0
- package/dist/Schema-Ch0dHkM5.d.ts +22 -0
- package/dist/Schema-ClNodlyP.d.cts +22 -0
- package/dist/chunk-6UWOTOZJ.cjs +92 -0
- package/dist/chunk-6UWOTOZJ.cjs.map +1 -0
- package/dist/chunk-AZKUU24F.js +700 -0
- package/dist/chunk-AZKUU24F.js.map +1 -0
- package/dist/chunk-DFQJ57GH.js +45 -0
- package/dist/chunk-DFQJ57GH.js.map +1 -0
- package/dist/chunk-GF26SDHQ.js +28 -0
- package/dist/chunk-GF26SDHQ.js.map +1 -0
- package/dist/chunk-HP5WAFBU.cjs +48 -0
- package/dist/chunk-HP5WAFBU.cjs.map +1 -0
- package/dist/chunk-JNGUNN72.cjs +708 -0
- package/dist/chunk-JNGUNN72.cjs.map +1 -0
- package/dist/chunk-PADR76WZ.cjs +4 -0
- package/dist/chunk-PADR76WZ.cjs.map +1 -0
- package/dist/chunk-R47XMJ32.js +3 -0
- package/dist/chunk-R47XMJ32.js.map +1 -0
- package/dist/{chunk-Y4V7HHX7.js → chunk-THGCWF2O.js} +8 -13
- package/dist/{chunk-Y4V7HHX7.js.map → chunk-THGCWF2O.js.map} +1 -1
- package/dist/chunk-TRA5BTWI.js +88 -0
- package/dist/chunk-TRA5BTWI.js.map +1 -0
- package/dist/chunk-UO57DZPV.cjs +36 -0
- package/dist/chunk-UO57DZPV.cjs.map +1 -0
- package/dist/chunk-ZWHQ54JM.cjs +32 -0
- package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
- package/dist/components.cjs +20 -17
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +12 -8
- package/dist/components.d.ts +12 -8
- package/dist/components.js +3 -17
- package/dist/components.js.map +1 -1
- package/dist/generators.cjs +14 -0
- package/dist/generators.cjs.map +1 -0
- package/dist/generators.d.cts +10 -0
- package/dist/generators.d.ts +10 -0
- package/dist/generators.js +5 -0
- package/dist/generators.js.map +1 -0
- package/dist/hooks.cjs +101 -57
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +40 -8
- package/dist/hooks.d.ts +40 -8
- package/dist/hooks.js +90 -53
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +283 -261
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -77
- package/dist/index.d.ts +6 -77
- package/dist/index.js +235 -240
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +32 -87
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +7 -41
- package/dist/utils.d.ts +7 -41
- package/dist/utils.js +8 -86
- package/dist/utils.js.map +1 -1
- package/package.json +20 -14
- package/src/OperationGenerator.ts +75 -43
- package/src/SchemaGenerator.ts +44 -18
- package/src/SchemaMapper.ts +1 -1
- package/src/components/Oas.tsx +9 -3
- package/src/components/Operation.tsx +1 -1
- package/src/components/Schema.tsx +2 -102
- package/src/generator.tsx +133 -0
- package/src/generators/index.ts +1 -0
- package/src/generators/jsonGenerator.ts +32 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useOperationManager.ts +76 -28
- package/src/hooks/useSchemaManager.ts +77 -0
- package/src/index.ts +3 -9
- package/src/plugin.ts +64 -47
- package/src/types.ts +23 -12
- package/src/utils/getParams.ts +2 -2
- package/src/utils/index.ts +2 -2
- package/dist/OperationGenerator-CeM_9pxW.d.cts +0 -60
- package/dist/OperationGenerator-DhUhvRJE.d.ts +0 -60
- package/dist/Schema-DefwBJMc.d.ts +0 -35
- package/dist/Schema-an5hOrjZ.d.cts +0 -35
- package/dist/SchemaMapper-CsBQ6eEx.d.cts +0 -248
- package/dist/SchemaMapper-CsBQ6eEx.d.ts +0 -248
- package/dist/chunk-CJXRFYEF.cjs +0 -698
- package/dist/chunk-CJXRFYEF.cjs.map +0 -1
- package/dist/chunk-DRLYORTT.cjs +0 -3265
- package/dist/chunk-DRLYORTT.cjs.map +0 -1
- package/dist/chunk-K6KUETAI.js +0 -698
- package/dist/chunk-K6KUETAI.js.map +0 -1
- package/dist/chunk-LEACSHKT.js +0 -3265
- package/dist/chunk-LEACSHKT.js.map +0 -1
- package/dist/chunk-P42X362U.cjs +0 -101
- package/dist/chunk-P42X362U.cjs.map +0 -1
- package/dist/chunk-QLJIL3U5.cjs +0 -35
- package/dist/chunk-QLJIL3U5.cjs.map +0 -1
- package/dist/chunk-UB552H4J.js +0 -101
- package/dist/chunk-UB552H4J.js.map +0 -1
- package/dist/types-Dte3MA6H.d.cts +0 -143
- package/dist/types-Dte3MA6H.d.ts +0 -143
- package/src/utils/getGroupedByTagFiles.ts +0 -82
- package/src/utils/refSorter.ts +0 -13
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/index.cjs","../src/index.ts","../src/plugin.ts","../src/OperationGenerator.ts"],"names":["path","method"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACjBA,8CAAA,CAAA;ADmBA;AACA;AEpBA,8CAAA,CAAA;AAAA,wEAAiB;AAEjB,kCAA6B;AAC7B,mHAA0B;AAWnB,IAAM,cAAA,EAAgB,YAAA;AAEtB,IAAM,UAAA,EAAY,gCAAA,CAAyB,OAAA,EAAA,GAAY;AAC5D,EAAA,MAAM;AAAA,IACJ,OAAA,EAAS,EAAE,IAAA,EAAM,SAAA,EAAW,MAAA,EAAQ,MAAM,CAAA;AAAA,IAC1C,kBAAA,EAAoB,MAAA;AAAA,IACpB,gBAAA,EAAkB,IAAA;AAAA,IAClB,SAAA,EAAW,IAAA;AAAA,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ACU,EAAA;AAGR,EAAA;AACM,IAAA;AACF,MAAA;AACX,IAAA;AAEa,IAAA;AACF,MAAA;AACX,IAAA;AAEa,IAAA;AACF,MAAA;AACX,IAAA;AAEa,IAAA;AACF,MAAA;AACX,IAAA;AAEO,IAAA;AACO,EAAA;AAEpB;AAAA;AAAA;AAAA;AAAA;AAKW;AACU,EAAA;AACL,EAAA;AAEK,EAAA;AACJ,IAAA;AACC,MAAA;AACd,IAAA;AAEa,IAAA;AACC,MAAA;AACd,IAAA;AAEa,IAAA;AACC,MAAA;AACd,IAAA;AAEa,IAAA;AACC,MAAA;AACd,IAAA;AACD,EAAA;AAEM,EAAA;AACT;AAAA;AAAA;AAAA;AAAA;AAKW;AACU,EAAA;AACL,EAAA;AAEK,EAAA;AACJ,IAAA;AACC,MAAA;AACd,IAAA;AAEa,IAAA;AACC,MAAA;AACd,IAAA;AAEa,IAAA;AACC,MAAA;AACd,IAAA;AAEa,IAAA;AACC,MAAA;AACd,IAAA;AACD,EAAA;AAEM,EAAA;AACT;AAiGY;AACH,EAAA;AACK,IAAA;AACC,IAAA;AACC,IAAA;AACF,IAAA;AACG,IAAA;AACP,IAAA;AACG,IAAA;AACF,IAAA;AACT,EAAA;AACF;AH6JmB;AACA;ACxWf;AAES;ADyWM;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/index.cjs","sourcesContent":[null,"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[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return null\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/OperationGenerator.ts","../src/plugin.ts"],"names":["BaseGenerator","transformers","path","method","methods","item","createPlugin","jsonGenerator","parseFromConfig","getSchemas","options","FileManager","SchemaGenerator"],"mappings":";;;;;;;;;;;;;;;;;AAgCa,IAAA,kBAAA,GAAN,cAGGA,kBAA6G,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,SAAS,aAAe,EAAA;AAC1B,QAAA,OAAO,CAAC,CAAC,SAAA,CAAU,cAAe,EAAA,CAAE,MAAM,OAAO,CAAA,CAAA;AAAA,OACnD;AAEA,MAAA,IAAI,SAAS,MAAQ,EAAA;AACnB,QAAA,OAAO,CAAC,CAAC,SAAU,CAAA,IAAA,CAAK,MAAM,OAAO,CAAA,CAAA;AAAA,OACvC;AAEA,MAAA,IAAI,SAAS,QAAU,EAAA;AACrB,QAAA,OAAO,CAAC,CAAC,MAAO,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,OAC/B;AAEA,MAAO,OAAA,KAAA,CAAA;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AAC;AAAA,UACf,GAAG,KAAK,MAAO,CAAA,OAAA;AAAA,SACjB;AAAA,QACA;AAAA,UACE,GAAA;AAAA,UACA,eAAe,IAAK,CAAA,aAAA;AAAA,UACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,WAAA;AAAA,UACA,OAAS,EAAA,KAAA,CAAA;AAAA,UACT,QAAU,EAAA,KAAA,CAAA;AAAA,UACV,IAAM,EAAA,OAAA;AAAA,UACN,QAAQ,MAAO,CAAA,IAAA;AAAA,SACjB;AAAA,OACF,CAAA;AAEA,MAAA,MAAM,WAAc,GAAA,MAAM,eAAgB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA,CAAA;AAC7D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAEjC,MAAA,MAAM,kBAAqB,GAAA,IAAI,kBAAmB,CAAA,IAAA,CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA;AAAA,QACA,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,QAAU,EAAA,KAAA,CAAA;AAAA,QACV,IAAM,EAAA,OAAA;AAAA,OACP,CAAA,CAAA;AAED,MAAA,MAAM,cAAiB,GAAA,MAAM,kBAAmB,CAAA,KAAA,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.cjs","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/index.d.cts
CHANGED
|
@@ -1,83 +1,12 @@
|
|
|
1
|
+
import { O as Options, P as PluginOas } from './OperationGenerator-CHXolL0o.cjs';
|
|
2
|
+
export { A as API, E as Exclude, o as Generator, p as GeneratorOptions, G as GetOperationGeneratorOptions, c as GetSchemaGeneratorOptions, I as Include, b as OperationGenerator, a as OperationMethodResult, v as OperationSchema, w as OperationSchemas, x as OperationsByMethod, y as Override, R as ReactGeneratorOptions, r as Ref, t as Refs, q as ResolvePathOptions, u as Resolver, g as Schema, f as SchemaGenerator, S as SchemaGeneratorBuildOptions, d as SchemaGeneratorOptions, h as SchemaKeyword, i as SchemaKeywordBase, j as SchemaKeywordMapper, k as SchemaMapper, e as SchemaMethodResult, m as createGenerator, n as createReactGenerator, l as isKeyword, s as schemaKeywords } from './OperationGenerator-CHXolL0o.cjs';
|
|
1
3
|
import * as _kubb_core from '@kubb/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export { G as GetOperationGeneratorOptions, a as OperationGenerator, O as OperationMethodResult } from './OperationGenerator-CeM_9pxW.cjs';
|
|
6
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
7
|
-
import { SchemaObject, Oas, contentType } from '@kubb/oas';
|
|
8
|
-
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-CsBQ6eEx.cjs';
|
|
9
|
-
export { b as SchemaKeyword, c as SchemaKeywordBase, d as SchemaMapper, i as isKeyword, s as schemaKeywords } from './SchemaMapper-CsBQ6eEx.cjs';
|
|
4
|
+
import '@kubb/fs/types';
|
|
5
|
+
import '@kubb/oas';
|
|
6
|
+
import '@kubb/react/types';
|
|
10
7
|
import '@kubb/oas/parser';
|
|
11
8
|
|
|
12
9
|
declare const pluginOasName = "plugin-oas";
|
|
13
10
|
declare const pluginOas: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginOas>;
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
17
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
18
|
-
oas: Oas;
|
|
19
|
-
pluginManager: PluginManager;
|
|
20
|
-
/**
|
|
21
|
-
* Current plugin
|
|
22
|
-
*/
|
|
23
|
-
plugin: Plugin<TPluginOptions>;
|
|
24
|
-
mode: KubbFile.Mode;
|
|
25
|
-
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
26
|
-
override: Array<Override<TOptions>> | undefined;
|
|
27
|
-
contentType?: contentType;
|
|
28
|
-
output?: string;
|
|
29
|
-
};
|
|
30
|
-
type SchemaGeneratorOptions = {
|
|
31
|
-
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
32
|
-
unknownType: 'any' | 'unknown';
|
|
33
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
34
|
-
enumSuffix?: string;
|
|
35
|
-
usedEnumNames?: Record<string, number>;
|
|
36
|
-
mapper?: Record<string, string>;
|
|
37
|
-
typed?: boolean;
|
|
38
|
-
transformers: {
|
|
39
|
-
/**
|
|
40
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
41
|
-
*/
|
|
42
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
43
|
-
/**
|
|
44
|
-
* Receive schema and name(propertName) and return FakerMeta array
|
|
45
|
-
* TODO TODO add docs
|
|
46
|
-
* @beta
|
|
47
|
-
*/
|
|
48
|
-
schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
52
|
-
type SchemaProps = {
|
|
53
|
-
schema?: SchemaObject;
|
|
54
|
-
name?: string;
|
|
55
|
-
parentName?: string;
|
|
56
|
-
};
|
|
57
|
-
declare abstract class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
58
|
-
#private;
|
|
59
|
-
refs: Refs;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a type node from a given schema.
|
|
62
|
-
* Delegates to getBaseTypeFromSchema internally and
|
|
63
|
-
* optionally adds a union with null.
|
|
64
|
-
*/
|
|
65
|
-
parse(props: SchemaProps): Schema[];
|
|
66
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
67
|
-
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
68
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
69
|
-
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
70
|
-
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
71
|
-
build(): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
72
|
-
/**
|
|
73
|
-
* Schema
|
|
74
|
-
*/
|
|
75
|
-
abstract schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use `import { pluginOas } from '@kubb/plugin-oas'` instead
|
|
80
|
-
*/
|
|
81
|
-
declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginOas>;
|
|
82
|
-
|
|
83
|
-
export { type GetSchemaGeneratorOptions, OperationSchema, Options, Override, PluginOas, Refs, Schema, SchemaGenerator, type SchemaGeneratorBuildOptions, type SchemaGeneratorOptions, SchemaKeywordMapper, type SchemaMethodResult, definePluginDefault as default, pluginOas, pluginOasName };
|
|
12
|
+
export { Options, PluginOas, pluginOas, pluginOasName };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,83 +1,12 @@
|
|
|
1
|
+
import { O as Options, P as PluginOas } from './OperationGenerator-CHXolL0o.js';
|
|
2
|
+
export { A as API, E as Exclude, o as Generator, p as GeneratorOptions, G as GetOperationGeneratorOptions, c as GetSchemaGeneratorOptions, I as Include, b as OperationGenerator, a as OperationMethodResult, v as OperationSchema, w as OperationSchemas, x as OperationsByMethod, y as Override, R as ReactGeneratorOptions, r as Ref, t as Refs, q as ResolvePathOptions, u as Resolver, g as Schema, f as SchemaGenerator, S as SchemaGeneratorBuildOptions, d as SchemaGeneratorOptions, h as SchemaKeyword, i as SchemaKeywordBase, j as SchemaKeywordMapper, k as SchemaMapper, e as SchemaMethodResult, m as createGenerator, n as createReactGenerator, l as isKeyword, s as schemaKeywords } from './OperationGenerator-CHXolL0o.js';
|
|
1
3
|
import * as _kubb_core from '@kubb/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export { G as GetOperationGeneratorOptions, a as OperationGenerator, O as OperationMethodResult } from './OperationGenerator-DhUhvRJE.js';
|
|
6
|
-
import * as KubbFile from '@kubb/fs/types';
|
|
7
|
-
import { SchemaObject, Oas, contentType } from '@kubb/oas';
|
|
8
|
-
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-CsBQ6eEx.js';
|
|
9
|
-
export { b as SchemaKeyword, c as SchemaKeywordBase, d as SchemaMapper, i as isKeyword, s as schemaKeywords } from './SchemaMapper-CsBQ6eEx.js';
|
|
4
|
+
import '@kubb/fs/types';
|
|
5
|
+
import '@kubb/oas';
|
|
6
|
+
import '@kubb/react/types';
|
|
10
7
|
import '@kubb/oas/parser';
|
|
11
8
|
|
|
12
9
|
declare const pluginOasName = "plugin-oas";
|
|
13
10
|
declare const pluginOas: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginOas>;
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
17
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
18
|
-
oas: Oas;
|
|
19
|
-
pluginManager: PluginManager;
|
|
20
|
-
/**
|
|
21
|
-
* Current plugin
|
|
22
|
-
*/
|
|
23
|
-
plugin: Plugin<TPluginOptions>;
|
|
24
|
-
mode: KubbFile.Mode;
|
|
25
|
-
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
26
|
-
override: Array<Override<TOptions>> | undefined;
|
|
27
|
-
contentType?: contentType;
|
|
28
|
-
output?: string;
|
|
29
|
-
};
|
|
30
|
-
type SchemaGeneratorOptions = {
|
|
31
|
-
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
32
|
-
unknownType: 'any' | 'unknown';
|
|
33
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
34
|
-
enumSuffix?: string;
|
|
35
|
-
usedEnumNames?: Record<string, number>;
|
|
36
|
-
mapper?: Record<string, string>;
|
|
37
|
-
typed?: boolean;
|
|
38
|
-
transformers: {
|
|
39
|
-
/**
|
|
40
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
41
|
-
*/
|
|
42
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
43
|
-
/**
|
|
44
|
-
* Receive schema and name(propertName) and return FakerMeta array
|
|
45
|
-
* TODO TODO add docs
|
|
46
|
-
* @beta
|
|
47
|
-
*/
|
|
48
|
-
schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
52
|
-
type SchemaProps = {
|
|
53
|
-
schema?: SchemaObject;
|
|
54
|
-
name?: string;
|
|
55
|
-
parentName?: string;
|
|
56
|
-
};
|
|
57
|
-
declare abstract class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
58
|
-
#private;
|
|
59
|
-
refs: Refs;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a type node from a given schema.
|
|
62
|
-
* Delegates to getBaseTypeFromSchema internally and
|
|
63
|
-
* optionally adds a union with null.
|
|
64
|
-
*/
|
|
65
|
-
parse(props: SchemaProps): Schema[];
|
|
66
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
67
|
-
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
68
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
|
|
69
|
-
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
70
|
-
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
71
|
-
build(): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
72
|
-
/**
|
|
73
|
-
* Schema
|
|
74
|
-
*/
|
|
75
|
-
abstract schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use `import { pluginOas } from '@kubb/plugin-oas'` instead
|
|
80
|
-
*/
|
|
81
|
-
declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginOas>;
|
|
82
|
-
|
|
83
|
-
export { type GetSchemaGeneratorOptions, OperationSchema, Options, Override, PluginOas, Refs, Schema, SchemaGenerator, type SchemaGeneratorBuildOptions, type SchemaGeneratorOptions, SchemaKeywordMapper, type SchemaMethodResult, definePluginDefault as default, pluginOas, pluginOasName };
|
|
12
|
+
export { Options, PluginOas, pluginOas, pluginOasName };
|