{"version":3,"sources":["../../../../src/scripts/CreateTypes/CreateAsyncComponentType/index.mts","../../../../src/config/index.ts","../../../../src/func/SchemaMapper/index.ts","../../../../src/func/Typescript/TypeMaker/index.ts","../../../../src/types.ts","../../../../src/helper/index.ts","../../../../src/func/Typescript/TypeNameMaker/index.ts","../../../../src/func/Typescript/peer/index.ts","../../../../src/func/EnumMapper/index.ts","../../../../src/scripts/CreateTypes/CreateAsyncComponentType/getEnumAsyncType.mts","../../../../src/scripts/CreateTypes/CreateAsyncComponentType/getPremitiveAsyncType.mts","../../../../src/scripts/CreateTypes/CreateAsyncComponentType/refrenceTreatAsync.mts","../../../../src/scripts/CreateTypes/CreateAsyncComponentType/warnComponent.mts","../../../../src/data/collections.ts","../../../../src/func/Typescript/InterfaceMaker/index.ts","../../../../src/scripts/CreateTypes/CreateAsyncComponentType/componentMediaOrRef.mts","../../../../src/scripts/CreateTypes/CreateAsyncComponentType/AsyncRecursiveComponent.mts"],"sourcesContent":["import {configStore} from '../../../config/index.ts';\nimport {schemaIterator} from '../../../func/SchemaMapper/index.ts';\nimport {enumarateMaker} from '../../../func/Typescript/TypeMaker/index.ts';\nimport {Spec} from '../../../types.ts';\nimport {AsyncRecursiveComponent} from './AsyncRecursiveComponent.mts';\nimport {componentMediaOrRef} from './componentMediaOrRef.mts';\n\nexport async function CreateAsyncComponentType(defination: Spec) {\n  return new Promise<[string, string]>(async resolve => {\n    const iteratedSchema = schemaIterator(defination.components?.schemas);\n    const nameSpace = defination.info.title\n      .replaceAll('.', '')\n      .replaceAll(' ', '');\n    configStore?.setDefinition(nameSpace);\n    if (iteratedSchema?.length) {\n      const componentPromisses = iteratedSchema?.map(schema => {\n        return AsyncRecursiveComponent({\n          component: schema.objectSchema,\n          name: schema.objectName,\n          firstLvl: true,\n        });\n      });\n\n      if (componentPromisses?.length) {\n        const result = await Promise.all(componentPromisses);\n        const componentRes = result\n          .map(item => {\n            const res = componentMediaOrRef(item);\n            return res;\n          })\n          .join('');\n\n        const component = `declare namespace ${nameSpace}{\n          ${componentRes}\n        }`;\n\n        const enums = result\n          .map(item => {\n            const res =\n              item?.type === 'ENUM'\n                ? enumarateMaker(\n                    item?.name || 'NoName',\n                    item?.data[1] as string\n                  )\n                : '';\n            return res;\n          })\n          .join('');\n        resolve([component, enums]);\n      }\n    }\n    resolve(['', '']);\n  });\n}\n","import chalk from 'chalk';\nimport ora from 'ora';\nimport {cosmiconfig} from 'cosmiconfig';\nimport {IConfig} from '../types.ts';\nimport {ConfigStore} from './store/store.ts';\nconst spinner = ora('get hookgenrc config file');\nconst explorer = () => cosmiconfig('hookgenrc');\n// eslint-disable-next-line prefer-const\nexport let configStore: ConfigStore | undefined = undefined;\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n//@ts-ignore\nexport async function getConfig(): Promise<IConfig | undefined> {\n  spinner.start();\n  try {\n    const configFile = await explorer().load('./hookgenrc.json');\n    if (configFile?.isEmpty) {\n      spinner.warn();\n      console.warn(chalk.yellow(' └ codegen file is empty!'));\n      return Promise.resolve(undefined);\n    } else {\n      spinner.succeed();\n      configStore = new ConfigStore(configFile?.config as IConfig);\n      return configFile?.config as IConfig;\n    }\n  } catch (error) {\n    spinner.fail();\n    console.error(\n      chalk.bgRedBright(error ? error : ' └ Error get config file')\n    );\n    throw new Error(\n      chalk.bgRedBright(error ? error : ' └ Error get config file')\n    );\n  }\n}\n","import {OpenAPIV3} from 'openapi-types';\nimport chalk from 'chalk';\nimport {ISchema} from '../../types.ts';\n\nexport function schemaIterator(schema: ISchema | undefined) {\n  if (!schema) {\n    console.warn(\n      chalk.yellow(\n        ' └ Component must be include either OpenAPIV3.ReferenceObject or OpenAPIV3.SchemaObject but it is undefined!'\n      )\n    );\n    return;\n  }\n  const entries = Object.entries(schema);\n  const object = entries.map(cur => {\n    return {\n      objectName: cur[0],\n      objectSchema: cur[1] as\n        | OpenAPIV3.ReferenceObject\n        | OpenAPIV3.SchemaObject,\n    };\n  });\n\n  return object;\n}\n","export function typeMaker(\n  TypeName: string,\n  core: string,\n  object?: boolean,\n  hasExport?: boolean\n) {\n  if (object)\n    return (\n      `${hasExport ? 'export' : ''} type ` + TypeName + '= {' + core + '};'\n    );\n  return `${hasExport ? 'export' : ''} type ` + TypeName + '= ' + core + ';';\n}\n\nexport function enumarateMaker(enumName: string, core: string) {\n  return 'export enum ' + enumName + ' {' + core + '};';\n}\n","import {Options} from 'prettier';\nimport {Agent} from 'https';\nimport {OpenAPIV3} from 'openapi-types';\nimport {Ora} from 'ora';\n\nexport type Spec = OpenAPIV3.Document;\nexport interface IGetFromSwaggerRootHtml {\n  /**\n   * Get Root url of swagger and get list of scopes jsons.\n   *\n   * @param baseUrl - YOUR_BASE_URL\n   */\n  baseUrl: string;\n  sslConfiguredAgent?: Agent;\n}\nexport interface IGetSwaggerDefenitions {\n  requests: string[];\n  sslConfiguredAgent?: Agent;\n}\n\nexport interface ISwaggerRootHtml {\n  urls: URL[];\n  deepLinking: boolean;\n  persistAuthorization: boolean;\n  displayOperationId: boolean;\n  defaultModelsExpandDepth: number;\n  defaultModelExpandDepth: number;\n  defaultModelRendering: string;\n  displayRequestDuration: boolean;\n  docExpansion: string;\n  showExtensions: boolean;\n  showCommonExtensions: boolean;\n  supportedSubmitMethods: string[];\n}\n\nexport interface URL {\n  url: string;\n  name: string;\n}\nexport type fileTypes = 'mts' | 'ts' | 'd.ts' | 'md' | 'tsx';\nexport enum fileTypesEnum {\n  enums = 'enums',\n  types = 'types',\n  client = 'client',\n  api = 'api',\n  hook = 'hook',\n}\nexport interface IConfig {\n  baseUrl: string;\n  outDir: string;\n  archive?: boolean;\n  prettier?: Options;\n  resourcePick?: string;\n  filter?: RegExp;\n  singleJson?: boolean;\n  hook?: 'SWR' | 'ReactQuery' | 'NG';\n  fileTypes?: {[key in fileTypesEnum]: fileTypes};\n}\n\nexport interface ISaveFile {\n  fileName: string;\n  location: string;\n  data: unknown;\n  extention?: string;\n  beautify?: boolean;\n  comment?: string;\n}\nexport interface ISaveBatch {\n  files: {name: string; data: string; extention?: string; comment?: string}[];\n  location: string;\n  beautify?: boolean;\n  extention?: string;\n}\nexport type IOpenApiComponent =\n  | OpenAPIV3.ReferenceObject\n  | OpenAPIV3.SchemaObject;\nexport type ComponentSchema =\n  | {\n      objectName: string;\n      objectSchema: IOpenApiComponent;\n    }[]\n  | undefined;\n\nexport interface ICreateComponentSchemas {}\n\nexport function isReference(\n  schemaObject: IOpenApiComponent\n): schemaObject is OpenAPIV3.ReferenceObject {\n  return (schemaObject as OpenAPIV3.ReferenceObject).$ref !== undefined;\n}\n\nexport function isArraySchemaObject(\n  schemaObject: OpenAPIV3.ArraySchemaObject | OpenAPIV3.NonArraySchemaObject\n): schemaObject is OpenAPIV3.ArraySchemaObject {\n  return (schemaObject as OpenAPIV3.ArraySchemaObject).items !== undefined;\n}\n\nexport interface Spins {\n  id?: string;\n  spinner: Ora;\n}\n\nexport interface IRecursiveArraySchema {\n  /*\n  *\n  * @example:  properties?: {\n            [name: string]: ReferenceObject | SchemaObject;\n        };\n  */\n  component: OpenAPIV3.SchemaObject;\n  name: string;\n}\nexport interface IRecursiveComponentSchema {\n  /*\n  *\n  * @example:  properties?: {\n            [name: string]: ReferenceObject | SchemaObject;\n        };\n  */\n  component?: IOpenApiComponent;\n  name: string;\n}\n\nexport function isReferenceOrParameter(\n  object: OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject\n): object is OpenAPIV3.ReferenceObject {\n  return (object as OpenAPIV3.ReferenceObject).$ref !== undefined;\n}\n\nexport interface ICreateParameter {\n  parameters?: (OpenAPIV3.ReferenceObject | OpenAPIV3.ParameterObject)[];\n  pathName: string;\n  methodType: string;\n}\n\nexport function isReferenceOrRequestBody(\n  object: OpenAPIV3.RequestBodyObject | OpenAPIV3.ReferenceObject\n): object is OpenAPIV3.ReferenceObject {\n  return (object as OpenAPIV3.ReferenceObject).$ref !== undefined;\n}\nexport function isReferenceOrResponse(\n  object: OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject\n): object is OpenAPIV3.ReferenceObject {\n  return (object as OpenAPIV3.ReferenceObject).$ref !== undefined;\n}\n\nexport interface ICreateRequestBody {\n  requestBody?: OpenAPIV3.ReferenceObject | OpenAPIV3.RequestBodyObject;\n  pathName: string;\n  methodType: string;\n}\n\nexport interface ICreateResponse {\n  response: OpenAPIV3.ReferenceObject | OpenAPIV3.ResponseObject;\n  pathName: string;\n  methodType: string;\n  status: 'Ok' | 'Bad';\n}\n\nexport type ISchema = {[key: string]: IOpenApiComponent};\n\nexport type HttpMethodsUpperCase =\n  | 'Get'\n  | 'Put'\n  | 'Post'\n  | 'Delete'\n  | 'Options'\n  | 'Head'\n  | 'Patch';\n\nexport function isInterfaceEmpty(\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  object: {} | {[key: string]: any}\n): object is {} {\n  return Object.keys(object as {}).length === 0;\n}\n","import {OpenAPIV3} from 'openapi-types';\nimport {typeNameMaker} from '../func/Typescript/TypeNameMaker/index.ts';\nimport {Spec, isReference} from '../types.ts';\nconst repoTypes: string[] = [''];\nexport function capitalize(string: string) {\n  return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexport function camelize(str: string) {\n  return str\n    .replace(/(?:^\\w|[A-Z]|\\b\\w)/g, (word, index) => {\n      return index === 0 ? word.toLowerCase() : word.toUpperCase();\n    })\n    .replace(/\\s+/g, '');\n}\n\nexport const primitiveJs = (\n  key: 'string' | 'number' | 'boolean' | 'integer' | undefined\n) => {\n  switch (key) {\n    case 'integer':\n      return 'number';\n    case 'number':\n      return 'number';\n    case 'boolean':\n      return 'boolean';\n    case 'string':\n      return 'string';\n\n    default:\n      return 'unknown';\n  }\n};\n\nexport const definitionFullName = (defination: Spec) => {\n  return defination.info.title + '_' + defination.info.version;\n};\n\nexport const isDuplication = (name: string, data: string[]): boolean => {\n  const iName = typeNameMaker(name);\n  const include = repoTypes.some(item => item.includes(iName));\n  const dataInclude = data.some(item => item.includes(iName));\n  if (include && dataInclude) {\n    return true;\n  }\n  repoTypes.push(iName);\n  return false;\n};\n\nexport const isNullable = (\n  schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject\n): boolean | undefined => {\n  if (!isReference(schema)) {\n    return schema.nullable;\n  }\n  return undefined;\n};\n\nexport const definationComment = (defination: Spec, data: string[][]) => {\n  data.forEach(fileData => {\n    fileData.push(\n      `\\n/* ${defination.info.title} - ${defination.info.version} */\\n`\n    );\n  });\n};\nexport const getDefinationComment = (defination: Spec) => {\n  return ` ${defination.info.title} - ${defination.info.version}`;\n};\n\nexport function statusString(status: string) {\n  const okReg = /2\\d\\d/g;\n  const badReg = /400/g;\n  if (okReg.test(status)) {\n    return 'Ok';\n  }\n\n  if (badReg) {\n    return 'Bad';\n  }\n\n  return;\n}\n\nexport const pathSplit = (path: string) => {\n  const reg = /\\/{\\w*}/g;\n  const regBracketsParams = /{(.*?)}/g;\n  const refinePath = path.replace(reg, '');\n\n  const bracketsParams = path\n    .match(regBracketsParams)\n    ?.map(params => {\n      const name = params.replace(/{|}/g, '');\n      return 'By' + capitalize(name);\n    })\n    .join('');\n\n  const pathScope = refinePath.split('/') as string[];\n  const definationName = pathScope[1] as string;\n  const scopeName = pathScope[3] as string;\n  const itemName =\n    (((pathScope[pathScope.length - 1] as string) +\n      capitalize(pathScope[pathScope.length - 2])) as string) +\n    (bracketsParams || '');\n\n  return {pathScope, definationName, scopeName, itemName};\n};\n","import {camelize, capitalize} from '../../../helper/index.ts';\n\nexport function typeNameMaker(name: string, extra = 'Set') {\n  return 'I' + camelCase(name) + extra;\n}\nexport function typeNameSpaceMaker(\n  name: string,\n  namespace: string,\n  extra = 'Set'\n) {\n  return (\n    namespace + '.I' + capitalize(camelize(nameRefineWithDot(name))) + extra\n  );\n}\n\nexport function nameRefine(name: string) {\n  const reg = /[^a-zA-Z0-9]/g;\n\n  return name.toString().replace(reg, '');\n}\nexport function nameRefineWithDot(name: string) {\n  const reg = /[^a-zA-Z0-9.]/g;\n\n  return name.toString().replace(reg, '');\n}\n\nexport function nameStringify(name: string) {\n  return \"'\" + name + \"'\";\n}\n\nexport function camelCase(name: string) {\n  return capitalize(camelize(nameRefine(name)));\n}\n","import {nameStringify} from '../TypeNameMaker/index.ts';\n\nexport function peer(\n  name: string,\n  type: string,\n  nullable?: boolean,\n  isArray?: boolean\n) {\n  return (\n    nameStringify(name) +\n    (nullable ? '?:' : ':') +\n    type +\n    (isArray ? '[];' : ';')\n  );\n}\nexport function equal(name: string, type: string) {\n  return name + '=' + nameStringify(type) + ',';\n}\n","import {camelCase} from '../Typescript/TypeNameMaker/index.ts';\nimport {equal} from '../Typescript/peer/index.ts';\n\nexport function enumMapper(enums: string[]) {\n  const enumsType = '\"' + enums.join('\"|\"') + '\"';\n  return enumsType;\n}\nexport function enumPeer(enums: string[]) {\n  const value = enums.map(e => equal(camelCase(e), e));\n  const enumsType = value.join('');\n  return enumsType;\n}\n","import {enumMapper, enumPeer} from '../../../func/EnumMapper/index.ts';\n\nexport async function getEnumAsyncType(enums: any[]) {\n  return new Promise<[string, string?]>(resolve => {\n    const enumType = enumMapper(enums);\n    const enumValue = enumPeer(enums);\n    resolve([enumType, enumValue]);\n  });\n}\n","import {primitiveJs} from '../../../helper/index.ts';\n\nexport async function getPremitiveAsyncType(\n  type: 'string' | 'number' | 'boolean' | 'integer' | undefined\n) {\n  return new Promise<string>(resolve => {\n    const primitiveValue = primitiveJs(type);\n    resolve(primitiveValue);\n  });\n}\n","export function refrenceTreatAsync(rawRef: string) {\n  const refPath = rawRef.split('/');\n  const ref = refPath[refPath.length - 1];\n  return ref;\n}\n","import chalk from 'chalk';\n\nexport function warnComponent(name: string) {\n  console.warn(\n    chalk.yellow(\n      ' └ \"' +\n        name +\n        '\" dose not have any type! typescript may have problem with this! we set it to \"unknown\"'\n    )\n  );\n}\n","const duplications: string[] = [];\nexport {duplications};\n\nexport function isDuplicate(key: string) {\n  const isDuplicate = duplications.includes(key);\n  if (!isDuplicate) {\n    duplications.push(key);\n  }\n  // return isDuplicate;\n  return false;\n}\n","export function interfaceMaker(\n  InterfaceName: string,\n  core: string,\n  extend?: string\n) {\n  if (extend)\n    return (\n      'interface ' +\n      InterfaceName +\n      (extend ? ' extends ' + extend : '') +\n      ' {' +\n      core +\n      '}'\n    );\n  return 'interface ' + InterfaceName + '{' + core + '}';\n}\n","import {isDuplicate} from '../../../data/collections.ts';\nimport {interfaceMaker} from '../../../func/Typescript/InterfaceMaker/index.ts';\nimport {peer} from '../../../func/Typescript/peer/index.ts';\nimport {typeMaker} from '../../../func/Typescript/TypeMaker/index.ts';\nimport {typeNameMaker} from '../../../func/Typescript/TypeNameMaker/index.ts';\nimport {IAsyncRecursiveComponentResult} from './AsyncRecursiveComponent.mts';\n\nexport function componentMediaOrRef(\n  component: IAsyncRecursiveComponentResult | null\n) {\n  if (component) {\n    if (component.type === 'REF') {\n      return peer(\n        component.name || '___NoNameREF?',\n        typeNameMaker(component.data[0] || 'noNameREF_PARAM?'),\n        component.nullable,\n        component.isArray\n      );\n    }\n    if (component.type === 'PREM') {\n      return peer(\n        component.name || '___NoNamePREM?',\n        component.data[0],\n        component.nullable,\n        component.isArray\n      );\n    }\n    if (component.type === 'COM_PREM') {\n      return typeMaker(\n        typeNameMaker(component.name || '___NoNameENUM'),\n        component.data[0]\n      );\n    }\n    if (component.type === 'ENUM') {\n      const duplicate = isDuplicate(component.name as string);\n      return !duplicate\n        ? typeMaker(\n            typeNameMaker(component.name || '___NoNameENUM'),\n            component.data[0]\n          )\n        : '';\n    }\n    if (component.type === 'MEDIA') {\n      const duplicate = isDuplicate(component.name as string);\n      return !duplicate\n        ? interfaceMaker(\n            typeNameMaker(component.name || '___NoNameMEDIA'),\n            component.data[0]\n          )\n        : '';\n    }\n    if (component.type === 'MEDIA_TYPE') {\n      const duplicate = isDuplicate(component.name as string);\n      return !duplicate\n        ? typeMaker(\n            typeNameMaker(component.name || '___NoNameMEDIA'),\n            component.data[0]\n          )\n        : '';\n    }\n    if (component.type === 'RECORD') {\n      // const duplicate = isDuplicate(component.name as string);\n      // return !duplicate\n      //   ? typeMaker(\n      //       typeNameMaker(component.name || '___NoNameMEDIA'),\n      //       component.data[0]\n      //     )\n      //   : '';\n\n      if (component.data) {\n        const data = component.data[0] || 'any';\n        const type = `Record<PropertyKey,${data}>`;\n        return peer(\n          component.name || '___NoNamePREM?',\n          type,\n          component.nullable,\n          false\n        );\n      }\n    }\n  }\n  return '';\n}\n","import {OpenAPIV3} from 'openapi-types';\nimport {\n  IOpenApiComponent,\n  isArraySchemaObject,\n  isReference,\n} from '../../../types.ts';\nimport {schemaIterator} from '../../../func/SchemaMapper/index.ts';\nimport {getEnumAsyncType} from './getEnumAsyncType.mts';\nimport {getPremitiveAsyncType} from './getPremitiveAsyncType.mts';\nimport {refrenceTreatAsync} from './refrenceTreatAsync.mts';\nimport {warnComponent} from './warnComponent.mts';\nimport {componentMediaOrRef} from './componentMediaOrRef.mts';\n\nexport interface IAsyncRecursiveComponent {\n  component: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | undefined;\n  name?: string;\n  firstLvl?: boolean;\n}\nexport interface IAsyncRecursiveSchema {\n  component: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | undefined;\n  name: string;\n}\n\nexport type typeKey =\n  | 'REF'\n  | 'MEDIA'\n  | 'ENUM'\n  | 'PREM'\n  | 'ARRAY'\n  | 'MEDIA_TYPE'\n  | 'FORMDATA'\n  | 'COM_PREM'\n  | 'RECORD';\n\nexport interface IAsyncRecursiveComponentResult {\n  data: [string, string?];\n  name?: string;\n  type: typeKey;\n  nullable?: boolean;\n  isArray?: boolean;\n}\nexport function AsyncRecursiveComponent({\n  component,\n  name,\n  firstLvl = false,\n}: IAsyncRecursiveComponent) {\n  return new Promise<IAsyncRecursiveComponentResult | null>(async resolve => {\n    if (component) {\n      if (isReference(component)) {\n        const type = refrenceTreatAsync(component.$ref);\n        resolve({data: [type], type: 'REF', name});\n      } else {\n        if (component.type === undefined) {\n          warnComponent(name as string);\n          resolve({\n            data: ['unknown'],\n            type: 'MEDIA_TYPE',\n            name,\n            nullable: component.nullable,\n          });\n        } else {\n          const data = await recursiveSchemaAsyncType(\n            component,\n            name,\n            firstLvl\n          );\n          resolve({...(data as IAsyncRecursiveComponentResult), name});\n        }\n      }\n    } else {\n      resolve(null);\n    }\n  });\n}\n\nexport async function recursiveSchemaAsyncType(\n  component: OpenAPIV3.SchemaObject,\n  name?: string,\n  firstLvl = false\n) {\n  return new Promise<IAsyncRecursiveComponentResult | null>(\n    async (resolve, reject) => {\n      if (isArraySchemaObject(component)) {\n        const data = await AsyncRecursiveComponent({\n          component: component.items,\n          name: name,\n        });\n        resolve({\n          ...(data as IAsyncRecursiveComponentResult),\n          nullable: component.nullable,\n          isArray: true,\n        });\n      } else {\n        if (component.type === 'object') {\n          if (component.properties) {\n            const data = await ObjectSchemaAsyncComponents(\n              component.properties\n            );\n            resolve({\n              data: [data],\n              type: 'MEDIA',\n              nullable: component.nullable,\n              name: name,\n            });\n          } else if (component.additionalProperties !== undefined) {\n            const data = await ObjectSchemaAsyncComponentsAditional(\n              component.additionalProperties,\n              name\n            );\n            resolve({\n              ...(data as IAsyncRecursiveComponentResult),\n              type: 'RECORD',\n              nullable: component.nullable,\n              name: name,\n            });\n          } else {\n            warnComponent(name as string);\n            resolve({\n              data: ['unknown'],\n              type: 'MEDIA_TYPE',\n              nullable: component.nullable,\n              name: name,\n            });\n          }\n        } else {\n          if (!component.enum) {\n            const premitive = await getPremitiveAsyncType(component.type);\n\n            resolve({\n              data: [premitive],\n              type: firstLvl ? 'COM_PREM' : 'PREM',\n              name: name,\n              nullable: component.nullable,\n            });\n          } else {\n            const enums = await getEnumAsyncType(component.enum);\n            resolve({\n              data: enums,\n              type: 'ENUM',\n              nullable: component.nullable,\n              name: name,\n            });\n          }\n        }\n      }\n    }\n  );\n}\nfunction ObjectSchemaAsyncComponents(\n  properties: Pick<OpenAPIV3.BaseSchemaObject, 'properties'>['properties']\n) {\n  return new Promise<string>(async (resolve, reject) => {\n    const IteratedProperties = schemaIterator(properties);\n    const propertiesPromisses = IteratedProperties?.map(\n      async ({objectName, objectSchema}) => {\n        return await AsyncRecursiveSchema({\n          component: objectSchema,\n          name: objectName,\n        });\n      }\n    );\n\n    if (propertiesPromisses) {\n      const data = await Promise.all(propertiesPromisses);\n      resolve(data.join(''));\n    }\n  });\n}\nfunction ObjectSchemaAsyncComponentsAditional(\n  properties: Pick<\n    OpenAPIV3.BaseSchemaObject,\n    'additionalProperties'\n  >['additionalProperties'],\n  name?: string\n) {\n  return new Promise<IAsyncRecursiveComponentResult | null>(async resolve => {\n    if (properties !== undefined) {\n      if (typeof properties === 'boolean') {\n        resolve({\n          type: 'MEDIA_TYPE',\n          data: ['boolean'],\n          name: name,\n          nullable: true,\n        });\n      } else if (!isReference(properties as IOpenApiComponent)) {\n        const result = await recursiveSchemaAsyncType(\n          properties as OpenAPIV3.SchemaObject,\n          name\n        );\n        resolve(result);\n      }\n    }\n    resolve(null);\n  });\n}\n\nexport function AsyncRecursiveSchema({component, name}: IAsyncRecursiveSchema) {\n  return new Promise<string | null>(async resolve => {\n    if (component) {\n      if (isReference(component)) {\n        const type = refrenceTreatAsync(component.$ref);\n        const data = componentMediaOrRef({data: [type], type: 'REF', name});\n        resolve(data);\n      } else {\n        if (component.type === undefined) {\n          warnComponent(name);\n          const data = componentMediaOrRef({\n            data: ['unknown'],\n            type: 'PREM',\n            nullable: component.nullable,\n            name,\n          });\n          resolve(data);\n        } else {\n          const result = await recursiveSchemaAsyncType(component, name);\n          const data = componentMediaOrRef(result);\n          resolve(data);\n        }\n      }\n    } else {\n      resolve(null);\n    }\n  });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;AAClB,iBAAgB;AAChB,yBAA0B;AAG1B,IAAM,cAAU,WAAAA,SAAI,2BAA2B;AAGxC,IAAI,cAAuC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