@kubb/plugin-oas 2.19.6 → 2.21.0

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 (41) hide show
  1. package/dist/{OperationGenerator-BL3W1CH2.d.ts → OperationGenerator-8DNneYd8.d.ts} +4 -1
  2. package/dist/{OperationGenerator-B6_KXF47.d.cts → OperationGenerator-BHo9OWOG.d.cts} +4 -1
  3. package/dist/{chunk-IJDG7KT6.cjs → chunk-5RQSHNR5.cjs} +21 -21
  4. package/dist/{chunk-IJDG7KT6.cjs.map → chunk-5RQSHNR5.cjs.map} +1 -1
  5. package/dist/{chunk-RLUQTHVB.js → chunk-6ORMGOKP.js} +3 -3
  6. package/dist/{chunk-MZJFTD2Z.cjs → chunk-IP3FZPIH.cjs} +3 -3
  7. package/dist/{chunk-VHGCZBHU.js → chunk-NIW3BYXF.js} +3 -3
  8. package/dist/{chunk-VHGCZBHU.js.map → chunk-NIW3BYXF.js.map} +1 -1
  9. package/dist/{chunk-LXHYPSLT.cjs → chunk-OD3SN2E7.cjs} +3 -3
  10. package/dist/{chunk-LXHYPSLT.cjs.map → chunk-OD3SN2E7.cjs.map} +1 -1
  11. package/dist/{chunk-AHPYTLES.js → chunk-PSE6BVVE.js} +2 -2
  12. package/dist/chunk-PSE6BVVE.js.map +1 -0
  13. package/dist/{chunk-V7H5ZWZY.js → chunk-SRJ6I3CB.js} +2 -2
  14. package/dist/{chunk-XE6N3VWS.cjs → chunk-Y3ERH6OV.cjs} +23 -23
  15. package/dist/components.cjs +5 -5
  16. package/dist/components.d.cts +1 -1
  17. package/dist/components.d.ts +1 -1
  18. package/dist/components.js +3 -3
  19. package/dist/hooks.cjs +31 -18
  20. package/dist/hooks.cjs.map +1 -1
  21. package/dist/hooks.d.cts +9 -3
  22. package/dist/hooks.d.ts +9 -3
  23. package/dist/hooks.js +21 -8
  24. package/dist/hooks.js.map +1 -1
  25. package/dist/index.cjs +27 -27
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +10 -10
  30. package/dist/index.js.map +1 -1
  31. package/dist/utils.cjs +8 -8
  32. package/dist/utils.js +2 -2
  33. package/package.json +11 -11
  34. package/src/OperationGenerator.ts +10 -7
  35. package/src/SchemaGenerator.ts +1 -1
  36. package/src/hooks/useOperationManager.ts +27 -7
  37. package/dist/chunk-AHPYTLES.js.map +0 -1
  38. /package/dist/{chunk-RLUQTHVB.js.map → chunk-6ORMGOKP.js.map} +0 -0
  39. /package/dist/{chunk-MZJFTD2Z.cjs.map → chunk-IP3FZPIH.cjs.map} +0 -0
  40. /package/dist/{chunk-V7H5ZWZY.js.map → chunk-SRJ6I3CB.js.map} +0 -0
  41. /package/dist/{chunk-XE6N3VWS.cjs.map → chunk-Y3ERH6OV.cjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SchemaMapper.ts","../src/SchemaGenerator.ts"],"sourcesContent":["import type * as KubbFile from '@kubb/fs/types'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n strict: { keyword: 'strict' }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: { name: string; path: KubbFile.OptionalPath; isTypeOnly?: boolean }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n strict: 'strict',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n optional: 'optional',\n readOnly: 'readOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n","import { type FileMetaBase, Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\n\nimport { isReference } from '@kubb/oas'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.ts'\n\nimport type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Oas, OpenAPIV3, SchemaObject, contentType } from '@kubb/oas'\nimport type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\n\nexport type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never\n\nexport type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n include?: Array<'schemas' | 'responses' | 'requestBodies'>\n override: Array<Override<TOptions>> | undefined\n contentType?: contentType\n output?: string\n}\n\nexport type SchemaGeneratorOptions = {\n dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'\n unknownType: 'any' | 'unknown'\n enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n enumSuffix?: string\n usedEnumNames?: Record<string, number>\n mapper?: Record<string, string>\n typed?: boolean\n transformers: {\n /**\n * Customize the names based on the type that is provided by the plugin.\n */\n name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n /**\n * Receive schema and name(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schema?: SchemaObject\n name?: string\n parentName?: string\n}\n\nexport abstract class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {\n // Collect the types of all referenced schemas, so we can export them later\n refs: Refs = {}\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n parse(props: SchemaProps): Schema[] {\n const options = this.#getOptions(props)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith<Schema>(schemas, isDeepEqual)\n }\n\n deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n return SchemaGenerator.deepSearch<T>(tree, keyword)\n }\n\n find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n return SchemaGenerator.find<T>(tree, keyword)\n }\n\n static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n const foundItems: SchemaKeywordMapper[T][] = []\n\n tree?.forEach((schema) => {\n if (schema.keyword === keyword) {\n foundItems.push(schema as SchemaKeywordMapper[T])\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n })\n\n return foundItems\n }\n\n static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>(entrySchema, keyword)\n }\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n #getUsedEnumNames(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n return options.usedEnumNames || {}\n }\n\n #getOptions({ name }: SchemaProps): Partial<TOptions> {\n const { override = [] } = this.context\n\n return {\n ...this.options,\n ...(override.find(({ pattern, type }) => {\n if (name && type === 'schemaName') {\n return !!name.match(pattern)\n }\n\n return false\n })?.options || {}),\n }\n }\n\n #getUnknownReturn(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n if (options.unknownType === 'any') {\n return schemaKeywords.any\n }\n\n return schemaKeywords.unknown\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #parseProperties({ schema, name }: SchemaProps): Schema[] {\n const properties = schema?.properties || {}\n const additionalProperties = schema?.additionalProperties\n const required = schema?.required\n\n const propertiesSchemas = Object.keys(properties)\n .map((propertyName) => {\n const validationFunctions: Schema[] = []\n const propertySchema = properties[propertyName] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required\n const nullable = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }))\n\n validationFunctions.push({\n keyword: schemaKeywords.name,\n args: propertyName,\n })\n\n if (!isRequired && nullable) {\n validationFunctions.push({ keyword: schemaKeywords.nullish })\n } else if (!isRequired) {\n validationFunctions.push({ keyword: schemaKeywords.optional })\n }\n\n return {\n [propertyName]: validationFunctions,\n }\n })\n .reduce((acc, curr) => ({ ...acc, ...curr }), {})\n let additionalPropertiesSchemas: Schema[] = []\n\n if (additionalProperties) {\n additionalPropertiesSchemas =\n additionalProperties === true\n ? [{ keyword: this.#getUnknownReturn({ schema, name }) }]\n : this.parse({ schema: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\n },\n ]\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject): Schema[] {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n if (ref) {\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref.path },\n },\n ]\n }\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'file',\n })\n const file = this.context.pluginManager.getFile({\n name: fileName,\n pluginKey: this.context.plugin.key,\n extName: '.ts',\n })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n path: file.path,\n }\n\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref?.path, isTypeOnly: false },\n },\n ]\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\n }\n\n /**\n * This is the very core of the OpenAPI to TS conversion - it takes a\n * schema and returns the appropriate type.\n */\n #parseSchemaObject({ schema: _schema, name, parentName }: SchemaProps): Schema[] {\n const options = this.#getOptions({ schema: _schema, name })\n const unknownReturn = this.#getUnknownReturn({ schema: _schema, name })\n const { schema, version } = this.#getParsedSchemaObject(_schema)\n const resolvedName = this.context.pluginManager.resolveName({\n name: `${parentName || ''} ${name}`,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n if (!schema) {\n return [{ keyword: unknownReturn }]\n }\n\n const baseItems: Schema[] = [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const nullable = schema.nullable ?? schema['x-nullable'] ?? false\n\n if (schema.default !== undefined && !Array.isArray(schema.default)) {\n if (typeof schema.default === 'string') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: transformers.stringify(schema.default),\n })\n }\n if (typeof schema.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default ?? false,\n })\n }\n }\n\n if (schema.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schema.description,\n })\n }\n\n if (schema.pattern) {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schema.pattern,\n })\n }\n\n if (max !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.max, args: max })\n }\n\n if (min !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.min, args: min })\n }\n\n if (nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (schema.type && Array.isArray(schema.type)) {\n const [_schema, nullable] = schema.type\n\n if (nullable === 'null') {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n }\n\n if (schema.readOnly) {\n baseItems.push({ keyword: schemaKeywords.readOnly })\n }\n\n if (isReference(schema)) {\n return [\n ...this.#getRefAlias(schema),\n nullable && { keyword: schemaKeywords.nullable },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ].filter(Boolean)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.oneOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n if (schemaWithoutOneOf.properties) {\n return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n\n if (schema.anyOf) {\n // union\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.anyOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n })\n .map((item) => {\n if (isKeyword(item, schemaKeywords.object)) {\n return {\n ...item,\n args: {\n ...item.args,\n strict: true,\n },\n }\n }\n return item\n }),\n }\n if (schemaWithoutAnyOf.properties) {\n return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined }\n\n const and: Schema = {\n keyword: schemaKeywords.and,\n args: schema.allOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n\n if (schemaWithoutAllOf.properties) {\n return [\n {\n ...and,\n args: [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName })],\n },\n ...baseItems,\n ]\n }\n\n return [and, ...baseItems]\n }\n\n if (schema.enum) {\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(' ')), this.#getUsedEnumNames({ schema, name }))\n const typeName = this.context.pluginManager.resolveName({\n name: enumName,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n const nullableEnum = schema.enum.includes(null)\n if (nullableEnum) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n const filteredValues = schema.enum.filter((value) => value !== null)\n\n // x-enumNames has priority\n const extensionEnums = ['x-enumNames', 'x-enum-varnames']\n .filter((extensionKey) => extensionKey in schema)\n .map((extensionKey) => {\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name,\n typeName,\n asConst: false,\n items: [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((name: string | number, index) => ({\n name: transformers.stringify(name),\n value: schema.enum?.[index] as string | number,\n format: isNumber(schema.enum?.[index]) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter(\n (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches,\n ),\n ]\n })\n\n if (schema.type === 'number' || schema.type === 'integer') {\n // we cannot use z.enum when enum type is number/integer\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'number',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'number',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n return extensionEnums[0]\n }\n\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: false,\n items: [...new Set(filteredValues)].map((value: string) => ({\n name: transformers.stringify(value),\n value,\n format: isNumber(value) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n\n return [\n {\n keyword: schemaKeywords.tuple,\n args: {\n min,\n max,\n items: prefixItems\n .map((item) => {\n return this.parse({ schema: item, name, parentName })[0]\n })\n .filter(Boolean),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n return [\n {\n keyword: schemaKeywords.const,\n args: {\n name: schema['const'],\n format: typeof schema['const'] === 'number' ? 'number' : 'string',\n value: schema['const'],\n },\n },\n ...baseItems,\n ]\n }\n return [{ keyword: schemaKeywords.null }]\n }\n\n /**\n * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The \"format\"\n * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are\n * > accurately described by authoritative resources, be they RFCs or other external specifications.\n *\n * In other words: format is more specific than type alone, hence it should override the type value, if possible.\n *\n * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7\n */\n if (schema.format) {\n switch (schema.format) {\n case 'binary':\n baseItems.push({ keyword: schemaKeywords.blob })\n return baseItems\n case 'date-time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n if (options.dateType === 'stringOffset') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } })\n return baseItems\n }\n\n if (options.dateType === 'stringLocal') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } })\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } })\n\n return baseItems\n }\n break\n case 'date':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'uuid':\n baseItems.unshift({ keyword: schemaKeywords.uuid })\n break\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n break\n case 'uri':\n case 'ipv4':\n case 'ipv6':\n case 'uri-reference':\n case 'hostname':\n case 'idn-hostname':\n baseItems.unshift({ keyword: schemaKeywords.url })\n break\n // case 'duration':\n // case 'json-pointer':\n // case 'relative-json-pointer':\n default:\n // formats not yet implemented: ignore.\n break\n }\n }\n\n // type based logic\n if ('items' in schema || schema.type === ('array' as 'string')) {\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const items = this.parse({ schema: 'items' in schema ? (schema.items as SchemaObject) : [], name, parentName })\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (schema.properties || schema.additionalProperties) {\n return [...this.#parseProperties({ schema, name }), ...baseItems]\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type] = schema.type as Array<OpenAPIV3.NonArraySchemaObjectType>\n\n return [\n ...this.parse({\n schema: {\n ...schema,\n type,\n },\n name,\n parentName,\n }),\n ...baseItems,\n ].filter(Boolean)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: schema.type }, ...baseItems]\n }\n\n return [{ keyword: unknownReturn }]\n }\n\n async build(): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n\n const schemas = getSchemas({ oas, contentType, includes: include })\n\n const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {\n const options = this.#getOptions({ name })\n const promiseOperation = this.schema.call(this, name, schema, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n return acc\n }, [] as SchemaMethodResult<TFileMeta>[])\n\n const files = await Promise.all(promises)\n\n // using .flat because schemaGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Schema\n */\n abstract schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>\n}\n"],"mappings":";;;;;;;;;;AAAA;AA+EO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QA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-NIW3BYXF.js";
4
4
 
5
5
  // src/utils/parseFromConfig.ts
6
6
  init_esm_shims();
@@ -31,4 +31,4 @@ function parseFromConfig(config, options = {}) {
31
31
  export {
32
32
  parseFromConfig
33
33
  };
34
- //# sourceMappingURL=chunk-V7H5ZWZY.js.map
34
+ //# sourceMappingURL=chunk-SRJ6I3CB.js.map
@@ -1,18 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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; }
2
2
 
3
3
 
4
- var _chunkIJDG7KT6cjs = require('./chunk-IJDG7KT6.cjs');
4
+ var _chunk5RQSHNR5cjs = require('./chunk-5RQSHNR5.cjs');
5
5
 
6
6
 
7
7
 
8
8
 
9
- var _chunkLXHYPSLTcjs = require('./chunk-LXHYPSLT.cjs');
9
+ var _chunkOD3SN2E7cjs = require('./chunk-OD3SN2E7.cjs');
10
10
 
11
11
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
12
- var require_react_production_min = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
12
+ var require_react_production_min = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
13
13
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js"(exports) {
14
14
  "use strict";
15
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
15
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
16
16
  var l = Symbol.for("react.element");
17
17
  var n = Symbol.for("react.portal");
18
18
  var p = Symbol.for("react.fragment");
@@ -283,10 +283,10 @@ var require_react_production_min = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
283
283
  });
284
284
 
285
285
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
286
- var require_react_development = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
286
+ var require_react_development = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
287
287
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js"(exports, module) {
288
288
  "use strict";
289
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
289
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
290
290
  if (process.env.NODE_ENV !== "production") {
291
291
  (function() {
292
292
  "use strict";
@@ -2158,10 +2158,10 @@ var require_react_development = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
2158
2158
  });
2159
2159
 
2160
2160
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
2161
- var require_react = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
2161
+ var require_react = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
2162
2162
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"(exports, module) {
2163
2163
  "use strict";
2164
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
2164
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
2165
2165
  if (process.env.NODE_ENV === "production") {
2166
2166
  module.exports = require_react_production_min();
2167
2167
  } else {
@@ -2171,10 +2171,10 @@ var require_react = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
2171
2171
  });
2172
2172
 
2173
2173
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js
2174
- var require_react_jsx_runtime_production_min = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
2174
+ var require_react_jsx_runtime_production_min = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
2175
2175
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js"(exports) {
2176
2176
  "use strict";
2177
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
2177
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
2178
2178
  var f = require_react();
2179
2179
  var k = Symbol.for("react.element");
2180
2180
  var l = Symbol.for("react.fragment");
@@ -2197,10 +2197,10 @@ var require_react_jsx_runtime_production_min = _chunkLXHYPSLTcjs.__commonJS.call
2197
2197
  });
2198
2198
 
2199
2199
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js
2200
- var require_react_jsx_runtime_development = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
2200
+ var require_react_jsx_runtime_development = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
2201
2201
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
2202
2202
  "use strict";
2203
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
2203
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
2204
2204
  if (process.env.NODE_ENV !== "production") {
2205
2205
  (function() {
2206
2206
  "use strict";
@@ -3091,10 +3091,10 @@ var require_react_jsx_runtime_development = _chunkLXHYPSLTcjs.__commonJS.call(vo
3091
3091
  });
3092
3092
 
3093
3093
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js
3094
- var require_jsx_runtime = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
3094
+ var require_jsx_runtime = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
3095
3095
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js"(exports, module) {
3096
3096
  "use strict";
3097
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
3097
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
3098
3098
  if (process.env.NODE_ENV === "production") {
3099
3099
  module.exports = require_react_jsx_runtime_production_min();
3100
3100
  } else {
@@ -3104,8 +3104,8 @@ var require_jsx_runtime = _chunkLXHYPSLTcjs.__commonJS.call(void 0, {
3104
3104
  });
3105
3105
 
3106
3106
  // src/components/Operation.tsx
3107
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
3108
- var import_jsx_runtime = _chunkLXHYPSLTcjs.__toESM.call(void 0, require_jsx_runtime(), 1);
3107
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
3108
+ var import_jsx_runtime = _chunkOD3SN2E7cjs.__toESM.call(void 0, require_jsx_runtime(), 1);
3109
3109
  var _react = require('@kubb/react');
3110
3110
  var OperationContext = _react.createContext.call(void 0, {});
3111
3111
  function Operation({ operation, children }) {
@@ -3114,13 +3114,13 @@ function Operation({ operation, children }) {
3114
3114
  Operation.Context = OperationContext;
3115
3115
 
3116
3116
  // src/hooks/useSchema.ts
3117
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
3117
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
3118
3118
 
3119
3119
 
3120
3120
  // src/components/Schema.tsx
3121
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
3121
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
3122
3122
 
3123
- var import_jsx_runtime2 = _chunkLXHYPSLTcjs.__toESM.call(void 0, require_jsx_runtime(), 1);
3123
+ var import_jsx_runtime2 = _chunkOD3SN2E7cjs.__toESM.call(void 0, require_jsx_runtime(), 1);
3124
3124
  var SchemaContext = _react.createContext.call(void 0, {
3125
3125
  name: "unknown",
3126
3126
  tree: []
@@ -3182,7 +3182,7 @@ Schema.File = function({ output, isTypeOnly, children }) {
3182
3182
  Schema.Imports = ({ isTypeOnly }) => {
3183
3183
  const { tree } = useSchema();
3184
3184
  const { path: root } = _react.useFile.call(void 0, );
3185
- const refs = _chunkIJDG7KT6cjs.SchemaGenerator.deepSearch(tree, _chunkIJDG7KT6cjs.schemaKeywords.ref);
3185
+ const refs = _chunk5RQSHNR5cjs.SchemaGenerator.deepSearch(tree, _chunk5RQSHNR5cjs.schemaKeywords.ref);
3186
3186
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: _optionalChain([refs, 'optionalAccess', _ => _.map, 'call', _2 => _2((item, i) => {
3187
3187
  if (!item.args.path) {
3188
3188
  return void 0;
@@ -3199,9 +3199,9 @@ function useSchema() {
3199
3199
  }
3200
3200
 
3201
3201
  // src/components/Oas.tsx
3202
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
3202
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
3203
3203
 
3204
- var import_jsx_runtime3 = _chunkLXHYPSLTcjs.__toESM.call(void 0, require_jsx_runtime(), 1);
3204
+ var import_jsx_runtime3 = _chunkOD3SN2E7cjs.__toESM.call(void 0, require_jsx_runtime(), 1);
3205
3205
  var OasContext = _react.createContext.call(void 0, {});
3206
3206
  function Oas({ oas, children, operations, generator }) {
3207
3207
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(OasContext.Provider, { value: { oas, generator, operations }, children });
@@ -3262,4 +3262,4 @@ react/cjs/react-jsx-runtime.development.js:
3262
3262
  * LICENSE file in the root directory of this source tree.
3263
3263
  *)
3264
3264
  */
3265
- //# sourceMappingURL=chunk-XE6N3VWS.cjs.map
3265
+ //# sourceMappingURL=chunk-Y3ERH6OV.cjs.map
@@ -2,17 +2,17 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXE6N3VWScjs = require('./chunk-XE6N3VWS.cjs');
6
- require('./chunk-IJDG7KT6.cjs');
5
+ var _chunkY3ERH6OVcjs = require('./chunk-Y3ERH6OV.cjs');
6
+ require('./chunk-5RQSHNR5.cjs');
7
7
 
8
8
 
9
- var _chunkLXHYPSLTcjs = require('./chunk-LXHYPSLT.cjs');
9
+ var _chunkOD3SN2E7cjs = require('./chunk-OD3SN2E7.cjs');
10
10
 
11
11
  // src/components/index.ts
12
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
12
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
13
13
 
14
14
 
15
15
 
16
16
 
17
- exports.Oas = _chunkXE6N3VWScjs.Oas; exports.Operation = _chunkXE6N3VWScjs.Operation; exports.Schema = _chunkXE6N3VWScjs.Schema;
17
+ exports.Oas = _chunkY3ERH6OVcjs.Oas; exports.Operation = _chunkY3ERH6OVcjs.Operation; exports.Schema = _chunkY3ERH6OVcjs.Schema;
18
18
  //# sourceMappingURL=components.cjs.map
@@ -2,7 +2,7 @@ import { S as Schema } from './Schema-FGI5VPqc.cjs';
2
2
  import * as react from 'react';
3
3
  import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
4
4
  import { KubbNode } from '@kubb/react';
5
- import { a as OperationGenerator } from './OperationGenerator-B6_KXF47.cjs';
5
+ import { a as OperationGenerator } from './OperationGenerator-BHo9OWOG.cjs';
6
6
  import './SchemaMapper-CsBQ6eEx.cjs';
7
7
  import '@kubb/fs/types';
8
8
  import '@kubb/core';
@@ -2,7 +2,7 @@ import { S as Schema } from './Schema-D41ItX9C.js';
2
2
  import * as react from 'react';
3
3
  import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
4
4
  import { KubbNode } from '@kubb/react';
5
- import { a as OperationGenerator } from './OperationGenerator-BL3W1CH2.js';
5
+ import { a as OperationGenerator } from './OperationGenerator-8DNneYd8.js';
6
6
  import './SchemaMapper-CsBQ6eEx.js';
7
7
  import '@kubb/fs/types';
8
8
  import '@kubb/core';
@@ -2,11 +2,11 @@ import {
2
2
  Oas,
3
3
  Operation,
4
4
  Schema
5
- } from "./chunk-RLUQTHVB.js";
6
- import "./chunk-AHPYTLES.js";
5
+ } from "./chunk-6ORMGOKP.js";
6
+ import "./chunk-PSE6BVVE.js";
7
7
  import {
8
8
  init_esm_shims
9
- } from "./chunk-VHGCZBHU.js";
9
+ } from "./chunk-NIW3BYXF.js";
10
10
 
11
11
  // src/components/index.ts
12
12
  init_esm_shims();
package/dist/hooks.cjs CHANGED
@@ -2,20 +2,20 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXE6N3VWScjs = require('./chunk-XE6N3VWS.cjs');
6
- require('./chunk-IJDG7KT6.cjs');
5
+ var _chunkY3ERH6OVcjs = require('./chunk-Y3ERH6OV.cjs');
6
+ require('./chunk-5RQSHNR5.cjs');
7
7
 
8
8
 
9
- var _chunkLXHYPSLTcjs = require('./chunk-LXHYPSLT.cjs');
9
+ var _chunkOD3SN2E7cjs = require('./chunk-OD3SN2E7.cjs');
10
10
 
11
11
  // src/hooks/index.ts
12
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
12
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
13
13
 
14
14
  // src/hooks/useOas.ts
15
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
15
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
16
16
  var _react = require('@kubb/react');
17
17
  function useOas() {
18
- const { oas } = _react.useContext.call(void 0, _chunkXE6N3VWScjs.Oas.Context);
18
+ const { oas } = _react.useContext.call(void 0, _chunkY3ERH6OVcjs.Oas.Context);
19
19
  if (!oas) {
20
20
  throw new Error("Oas is not defined");
21
21
  }
@@ -23,10 +23,10 @@ function useOas() {
23
23
  }
24
24
 
25
25
  // src/hooks/useOperation.ts
26
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
26
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
27
27
 
28
28
  function useOperation() {
29
- const { operation } = _react.useContext.call(void 0, _chunkXE6N3VWScjs.Operation.Context);
29
+ const { operation } = _react.useContext.call(void 0, _chunkY3ERH6OVcjs.Operation.Context);
30
30
  if (!operation) {
31
31
  throw new Error("Operation is not defined");
32
32
  }
@@ -34,11 +34,11 @@ function useOperation() {
34
34
  }
35
35
 
36
36
  // src/hooks/useOperationManager.ts
37
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
37
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
38
38
 
39
39
  function useOperationManager() {
40
40
  const { plugin, pluginManager } = _react.useApp.call(void 0, );
41
- const { generator } = _react.useContext.call(void 0, _chunkXE6N3VWScjs.Oas.Context);
41
+ const { generator } = _react.useContext.call(void 0, _chunkY3ERH6OVcjs.Oas.Context);
42
42
  if (!generator) {
43
43
  throw new Error(`'generator' is not defined`);
44
44
  }
@@ -68,7 +68,7 @@ function useOperationManager() {
68
68
  }
69
69
  };
70
70
  };
71
- const groupSchemasByByName = (operation, { pluginKey = plugin.key, type }) => {
71
+ const groupSchemasByName = (operation, { pluginKey = plugin.key, type }) => {
72
72
  const schemas = generator.getSchemas(operation);
73
73
  const errors = (schemas.errors || []).reduce(
74
74
  (prev, acc) => {
@@ -77,7 +77,7 @@ function useOperationManager() {
77
77
  }
78
78
  prev[acc.statusCode] = pluginManager.resolveName({
79
79
  name: acc.name,
80
- pluginKey: plugin.key,
80
+ pluginKey,
81
81
  type
82
82
  });
83
83
  return prev;
@@ -113,23 +113,36 @@ function useOperationManager() {
113
113
  pluginKey,
114
114
  type
115
115
  }),
116
+ ["default"]: pluginManager.resolveName({
117
+ name: schemas.response.name,
118
+ pluginKey,
119
+ type
120
+ }),
116
121
  ...errors
117
- }
122
+ },
123
+ errors
118
124
  };
119
125
  };
120
126
  return {
121
127
  getName,
122
128
  getFile,
123
- getSchemas: (operation, forStatusCode) => generator.getSchemas(operation, forStatusCode),
124
- groupSchemasByByName
129
+ getSchemas: (operation, params, forStatusCode) => generator.getSchemas(operation, {
130
+ forStatusCode,
131
+ resolveName: (name) => pluginManager.resolveName({
132
+ name,
133
+ pluginKey: _optionalChain([params, 'optionalAccess', _14 => _14.pluginKey]),
134
+ type: _optionalChain([params, 'optionalAccess', _15 => _15.type])
135
+ })
136
+ }),
137
+ groupSchemasByName
125
138
  };
126
139
  }
127
140
 
128
141
  // src/hooks/useOperations.ts
129
- _chunkLXHYPSLTcjs.init_cjs_shims.call(void 0, );
142
+ _chunkOD3SN2E7cjs.init_cjs_shims.call(void 0, );
130
143
 
131
144
  function useOperations({ method, path } = {}) {
132
- const { operations } = _react.useContext.call(void 0, _chunkXE6N3VWScjs.Oas.Context);
145
+ const { operations } = _react.useContext.call(void 0, _chunkY3ERH6OVcjs.Oas.Context);
133
146
  if (!operations) {
134
147
  throw new Error("Operations is not defined");
135
148
  }
@@ -148,5 +161,5 @@ function useOperations({ method, path } = {}) {
148
161
 
149
162
 
150
163
 
151
- exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkXE6N3VWScjs.useSchema;
164
+ exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkY3ERH6OVcjs.useSchema;
152
165
  //# sourceMappingURL=hooks.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/index.ts","../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts"],"names":["useContext"],"mappings":";;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,kBAAkB;AAMpB,SAAS,SAAkB;AAChC,QAAM,EAAE,IAAI,IAAI,WAAW,IAAI,OAAO;AAEtC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,oBAAoB;AAAA,EACtC;AAEA,SAAO;AACT;;;ACdA;AAAA,SAAS,cAAAA,mBAAkB;AASpB,SAAS,eAA8B;AAC5C,QAAM,EAAE,UAAU,IAAIA,YAAW,UAAU,OAAO;AAElD,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,0BAA0B;AAAA,EAC5C;AAEA,SAAO;AACT;;;ACjBA;AAAA,SAAS,QAAQ,cAAAA,mBAAkB;AAmC5B,SAAS,sBAAiD;AAC/D,QAAM,EAAE,QAAQ,cAAc,IAAI,OAAO;AACzC,QAAM,EAAE,UAAU,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useOperation } from './useOperation.ts'\nexport { useOperationManager } from './useOperationManager.ts'\nexport { useOperations } from './useOperations.ts'\nexport { useSchema } from './useSchema.ts'\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import { useApp, useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n tag?: string\n}\n\ntype SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: Record<number, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (operation: OperationType, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (operation: OperationType, params?: { pluginKey?: Plugin['key']; extName?: KubbFile.Extname }) => KubbFile.File<FileMeta>\n groupSchemasByByName: (operation: OperationType, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => SchemaNames\n getSchemas: (operation: Operation, forStatusCode?: string | number) => OperationSchemas\n}\n\n/**\n * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const { plugin, pluginManager } = useApp()\n const { generator } = useContext(Oas.Context)\n\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n const getName: UseOperationManagerResult['getName'] = (operation, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: operation.getOperationId(),\n pluginKey,\n type,\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { pluginKey = plugin.key, extName = '.ts' } = {}) => {\n // needed for the `output.group`\n const tag = operation.getTags().at(0)?.name\n const name = getName(operation, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name,\n extName,\n pluginKey,\n options: { type: 'file', pluginKey, tag },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n tag,\n },\n }\n }\n\n const groupSchemasByByName: UseOperationManagerResult['groupSchemasByByName'] = (operation, { pluginKey = plugin.key, type }) => {\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey: plugin.key,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n [schemas.response.statusCode || 'default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas: (operation, forStatusCode) => generator.getSchemas(operation, forStatusCode),\n groupSchemasByByName,\n }\n}\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/index.ts","../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts"],"names":["useContext"],"mappings":";;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,kBAAkB;AAMpB,SAAS,SAAkB;AAChC,QAAM,EAAE,IAAI,IAAI,WAAW,IAAI,OAAO;AAEtC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,oBAAoB;AAAA,EACtC;AAEA,SAAO;AACT;;;ACdA;AAAA,SAAS,cAAAA,mBAAkB;AASpB,SAAS,eAA8B;AAC5C,QAAM,EAAE,UAAU,IAAIA,YAAW,UAAU,OAAO;AAElD,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,0BAA0B;AAAA,EAC5C;AAEA,SAAO;AACT;;;ACjBA;AAAA,SAAS,QAAQ,cAAAA,mBAAkB;AAwC5B,SAAS,sBAAiD;AAC/D,QAAM,EAAE,QAAQ,cAAc,IAAI,OAAO;AACzC,QAAM,EAAE,UAAU,IAAIA,YAAW,IAAI,OAAO;AAE5C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AAEA,QAAM,UAAgD,CAAC,WAAW,EAAE,YAAY,OAAO,KAAK,KAAK,MAAM;AACrG,WAAO,cAAc,YAAY;AAAA,MAC/B,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A,EACvD;AAEA,SAAO;AACT","sourcesContent":["export { useOas } from './useOas.ts'\nexport { useOperation } from './useOperation.ts'\nexport { useOperationManager } from './useOperationManager.ts'\nexport { useOperations } from './useOperations.ts'\nexport { useSchema } from './useSchema.ts'\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import { useApp, useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n tag?: string\n}\n\ntype SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (operation: OperationType, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (operation: OperationType, params?: { pluginKey?: Plugin['key']; extName?: KubbFile.Extname }) => KubbFile.File<FileMeta>\n groupSchemasByName: (operation: OperationType, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => SchemaNames\n getSchemas: (\n operation: Operation,\n params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] },\n forStatusCode?: string | number,\n ) => OperationSchemas\n}\n\n/**\n * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const { plugin, pluginManager } = useApp()\n const { generator } = useContext(Oas.Context)\n\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n const getName: UseOperationManagerResult['getName'] = (operation, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: operation.getOperationId(),\n pluginKey,\n type,\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { pluginKey = plugin.key, extName = '.ts' } = {}) => {\n // needed for the `output.group`\n const tag = operation.getTags().at(0)?.name\n const name = getName(operation, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name,\n extName,\n pluginKey,\n options: { type: 'file', pluginKey, tag },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n tag,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginKey = plugin.key, type }) => {\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n [schemas.response.statusCode || 'default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas: (operation, params, forStatusCode) =>\n generator.getSchemas(operation, {\n forStatusCode,\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginKey: params?.pluginKey,\n type: params?.type,\n }),\n }),\n groupSchemasByName,\n }\n}\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n"]}
package/dist/hooks.d.cts CHANGED
@@ -27,7 +27,10 @@ type SchemaNames = {
27
27
  query: string | undefined;
28
28
  header: string | undefined;
29
29
  };
30
- responses: Record<number, string>;
30
+ responses: {
31
+ default?: string;
32
+ } & Record<number | string, string>;
33
+ errors: Record<number | string, string>;
31
34
  };
32
35
  type UseOperationManagerResult = {
33
36
  getName: (operation: Operation, params: {
@@ -38,11 +41,14 @@ type UseOperationManagerResult = {
38
41
  pluginKey?: Plugin['key'];
39
42
  extName?: KubbFile.Extname;
40
43
  }) => KubbFile.File<FileMeta>;
41
- groupSchemasByByName: (operation: Operation, params: {
44
+ groupSchemasByName: (operation: Operation, params: {
42
45
  pluginKey?: Plugin['key'];
43
46
  type: ResolveNameParams['type'];
44
47
  }) => SchemaNames;
45
- getSchemas: (operation: Operation, forStatusCode?: string | number) => OperationSchemas;
48
+ getSchemas: (operation: Operation, params?: {
49
+ pluginKey?: Plugin['key'];
50
+ type?: ResolveNameParams['type'];
51
+ }, forStatusCode?: string | number) => OperationSchemas;
46
52
  };
47
53
  /**
48
54
  * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
package/dist/hooks.d.ts CHANGED
@@ -27,7 +27,10 @@ type SchemaNames = {
27
27
  query: string | undefined;
28
28
  header: string | undefined;
29
29
  };
30
- responses: Record<number, string>;
30
+ responses: {
31
+ default?: string;
32
+ } & Record<number | string, string>;
33
+ errors: Record<number | string, string>;
31
34
  };
32
35
  type UseOperationManagerResult = {
33
36
  getName: (operation: Operation, params: {
@@ -38,11 +41,14 @@ type UseOperationManagerResult = {
38
41
  pluginKey?: Plugin['key'];
39
42
  extName?: KubbFile.Extname;
40
43
  }) => KubbFile.File<FileMeta>;
41
- groupSchemasByByName: (operation: Operation, params: {
44
+ groupSchemasByName: (operation: Operation, params: {
42
45
  pluginKey?: Plugin['key'];
43
46
  type: ResolveNameParams['type'];
44
47
  }) => SchemaNames;
45
- getSchemas: (operation: Operation, forStatusCode?: string | number) => OperationSchemas;
48
+ getSchemas: (operation: Operation, params?: {
49
+ pluginKey?: Plugin['key'];
50
+ type?: ResolveNameParams['type'];
51
+ }, forStatusCode?: string | number) => OperationSchemas;
46
52
  };
47
53
  /**
48
54
  * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
package/dist/hooks.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  Oas,
3
3
  Operation,
4
4
  useSchema
5
- } from "./chunk-RLUQTHVB.js";
6
- import "./chunk-AHPYTLES.js";
5
+ } from "./chunk-6ORMGOKP.js";
6
+ import "./chunk-PSE6BVVE.js";
7
7
  import {
8
8
  init_esm_shims
9
- } from "./chunk-VHGCZBHU.js";
9
+ } from "./chunk-NIW3BYXF.js";
10
10
 
11
11
  // src/hooks/index.ts
12
12
  init_esm_shims();
@@ -68,7 +68,7 @@ function useOperationManager() {
68
68
  }
69
69
  };
70
70
  };
71
- const groupSchemasByByName = (operation, { pluginKey = plugin.key, type }) => {
71
+ const groupSchemasByName = (operation, { pluginKey = plugin.key, type }) => {
72
72
  const schemas = generator.getSchemas(operation);
73
73
  const errors = (schemas.errors || []).reduce(
74
74
  (prev, acc) => {
@@ -77,7 +77,7 @@ function useOperationManager() {
77
77
  }
78
78
  prev[acc.statusCode] = pluginManager.resolveName({
79
79
  name: acc.name,
80
- pluginKey: plugin.key,
80
+ pluginKey,
81
81
  type
82
82
  });
83
83
  return prev;
@@ -113,15 +113,28 @@ function useOperationManager() {
113
113
  pluginKey,
114
114
  type
115
115
  }),
116
+ ["default"]: pluginManager.resolveName({
117
+ name: schemas.response.name,
118
+ pluginKey,
119
+ type
120
+ }),
116
121
  ...errors
117
- }
122
+ },
123
+ errors
118
124
  };
119
125
  };
120
126
  return {
121
127
  getName,
122
128
  getFile,
123
- getSchemas: (operation, forStatusCode) => generator.getSchemas(operation, forStatusCode),
124
- groupSchemasByByName
129
+ getSchemas: (operation, params, forStatusCode) => generator.getSchemas(operation, {
130
+ forStatusCode,
131
+ resolveName: (name) => pluginManager.resolveName({
132
+ name,
133
+ pluginKey: params?.pluginKey,
134
+ type: params?.type
135
+ })
136
+ }),
137
+ groupSchemasByName
125
138
  };
126
139
  }
127
140