@orval/core 7.12.1 → 7.12.2
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/dist/index.d.ts +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/index.d.ts.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["path","log","LogLevels: Record<LogLevel, number>","lastType: LogType | undefined","lastMsg: string | undefined","options","logger: Logger","path","debug","resolvedPath: string | undefined","fs","file: File | undefined","error: any","mm","replacement","module","path","isFunction","isString","basepath","propName","path","pascalMemory: Record<string, string>","regex","filter","count","path","isObject","keyword","path","ibmOpenapiRuleset","Spectral","errors: { message: string; path: string[] }[]","warnings: { message: string; path: string[] }[]","path","keyword","RefComponentSuffix: Record<RefComponent, string>","search","upath.getSchemaFileName","path","upath.resolve","getSchema","schemaByRefPaths: Schema | undefined","name","schema","additionalImports: GeneratorImport[]","imports","keyword","imports","schemas","keyword","name","separator","resolvedValue","separator","resolvedValue","resolvedValue: ScalarValue | undefined","path","paramGetterProps: GetterProps","imports","schemas","imports","schemas","contentType","path","imports","schemas","path","isRootKey","upath.join","exports","upath.relativeSafe","fs","path","Parser","property","returnStatement","filter","imp","upath.getSpecName","schema","verbOption: GeneratorVerbOptions","upath.join","path","fs","exports","upath.joinSafe","upath.relativeSafe","dirname","fs","path","upath.relativeSafe","dirname","upath.join","fs","acc","upath.join","dirname","fs","target","upath.relativeSafe","tag","upath.joinSafe","target","upath.relativeSafe","dirname","tag","upath.join","fs"],"sources":["../src/types.ts","../src/constants.ts","../src/utils/extension.ts","../src/utils/debug.ts","../src/utils/logger.ts","../src/utils/file.ts","../src/utils/path.ts","../src/utils/assertion.ts","../src/utils/async-reduce.ts","../src/utils/case.ts","../src/utils/compare-version.ts","../src/utils/doc.ts","../src/utils/dynamic-import.ts","../src/utils/file-extensions.ts","../src/utils/is-body-verb.ts","../src/utils/merge-deep.ts","../src/utils/occurrence.ts","../src/utils/open-api-converter.ts","../src/utils/sort.ts","../src/utils/string.ts","../src/utils/tsconfig.ts","../src/utils/validator.ts","../src/getters/enum.ts","../src/getters/ref.ts","../src/resolvers/ref.ts","../src/resolvers/value.ts","../src/resolvers/object.ts","../src/getters/array.ts","../src/getters/res-req-types.ts","../src/getters/body.ts","../src/getters/imports.ts","../src/getters/keys.ts","../src/getters/object.ts","../src/getters/scalar.ts","../src/getters/combine.ts","../src/getters/discriminators.ts","../src/getters/operation.ts","../src/getters/parameters.ts","../src/getters/params.ts","../src/getters/props.ts","../src/getters/query-params.ts","../src/getters/response.ts","../src/getters/route.ts","../src/generators/component-definition.ts","../src/generators/imports.ts","../src/generators/models-inline.ts","../src/generators/mutator.ts","../src/generators/options.ts","../src/generators/parameter-definition.ts","../src/generators/interface.ts","../src/generators/schema-definition.ts","../src/generators/verbs-options.ts","../src/writers/schemas.ts","../src/writers/generate-imports-for-builder.ts","../src/writers/target.ts","../src/writers/types.ts","../src/writers/single-mode.ts","../src/writers/split-mode.ts","../src/writers/target-tags.ts","../src/writers/split-tags-mode.ts","../src/writers/tags-mode.ts"],"sourcesContent":["import type SwaggerParser from '@apidevtools/swagger-parser';\nimport type { allLocales } from '@faker-js/faker';\nimport type { JSONSchema6, JSONSchema7 } from 'json-schema';\nimport type {\n InfoObject,\n OpenAPIObject,\n OperationObject,\n ParameterObject,\n ReferenceObject,\n RequestBodyObject,\n ResponsesObject,\n SchemaObject,\n} from 'openapi3-ts/oas30';\nimport type { ConvertInputOptions } from 'swagger2openapi';\nimport type { TypeDocOptions } from 'typedoc';\n\nexport interface Options {\n output?: string | OutputOptions;\n input?: string | InputOptions;\n hooks?: Partial<HooksOptions>;\n}\n\nexport type OptionsFn = () => Options | Promise<Options>;\nexport type OptionsExport = Options | Promise<Options> | OptionsFn;\n\nexport type Config = Record<string, OptionsExport>;\nexport type ConfigFn = () => Config | Promise<Config>;\n\nexport type ConfigExternal = Config | Promise<Config> | ConfigFn;\n\nexport type NormalizedConfig = Record<string, NormalizedOptions | undefined>;\n\nexport interface NormalizedOptions {\n output: NormalizedOutputOptions;\n input: NormalizedInputOptions;\n hooks: NormalizedHookOptions;\n}\n\nexport type NormalizedOutputOptions = {\n workspace?: string;\n target?: string;\n schemas?: string;\n namingConvention: NamingConvention;\n fileExtension: string;\n mode: OutputMode;\n mock?: GlobalMockOptions | ClientMockBuilder;\n override: NormalizedOverrideOutput;\n client: OutputClient | OutputClientFunc;\n httpClient: OutputHttpClient;\n clean: boolean | string[];\n docs: boolean | OutputDocsOptions;\n prettier: boolean;\n biome: boolean;\n tsconfig?: Tsconfig;\n packageJson?: PackageJson;\n headers: boolean;\n indexFiles: boolean;\n baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant;\n allParamsOptional: boolean;\n urlEncodeParameters: boolean;\n unionAddMissingProperties: boolean;\n optionsParamRequired: boolean;\n propertySortOrder: PropertySortOrder;\n};\n\nexport type NormalizedParamsSerializerOptions = {\n qs?: Record<string, any>;\n};\n\nexport type NormalizedOverrideOutput = {\n title?: (title: string) => string;\n transformer?: OutputTransformer;\n mutator?: NormalizedMutator;\n operations: Record<string, NormalizedOperationOptions>;\n tags: Record<string, NormalizedOperationOptions>;\n mock?: OverrideMockOptions;\n contentType?: OverrideOutputContentType;\n header: false | ((info: InfoObject) => string[] | string);\n formData: NormalizedFormDataType<NormalizedMutator>;\n formUrlEncoded: boolean | NormalizedMutator;\n paramsSerializer?: NormalizedMutator;\n paramsSerializerOptions?: NormalizedParamsSerializerOptions;\n namingConvention: {\n enum?: NamingConvention;\n };\n components: {\n schemas: {\n suffix: string;\n itemSuffix: string;\n };\n responses: {\n suffix: string;\n };\n parameters: {\n suffix: string;\n };\n requestBodies: {\n suffix: string;\n };\n };\n hono: NormalizedHonoOptions;\n query: NormalizedQueryOptions;\n angular: Required<AngularOptions>;\n swr: SwrOptions;\n zod: NormalizedZodOptions;\n fetch: NormalizedFetchOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n requestOptions: Record<string, any> | boolean;\n useDates?: boolean;\n coerceTypes?: boolean; // deprecated\n useTypeOverInterfaces?: boolean;\n useDeprecatedOperations?: boolean;\n useBigInt?: boolean;\n useNamedParameters?: boolean;\n enumGenerationType: EnumGeneration;\n suppressReadonlyModifier?: boolean;\n jsDoc: NormalizedJsDocOptions;\n};\n\nexport type NormalizedMutator = {\n path: string;\n name?: string;\n default: boolean;\n alias?: Record<string, string>;\n extension?: string;\n};\n\nexport type NormalizedOperationOptions = {\n transformer?: OutputTransformer;\n mutator?: NormalizedMutator;\n mock?: {\n data?: MockData;\n properties?: MockProperties;\n };\n contentType?: OverrideOutputContentType;\n query?: NormalizedQueryOptions;\n angular?: Required<AngularOptions>;\n swr?: SwrOptions;\n zod?: NormalizedZodOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n fetch?: FetchOptions;\n formData?: NormalizedFormDataType<NormalizedMutator>;\n formUrlEncoded?: boolean | NormalizedMutator;\n paramsSerializer?: NormalizedMutator;\n requestOptions?: object | boolean;\n};\n\nexport type NormalizedInputOptions = {\n target: string | Record<string, unknown> | OpenAPIObject;\n validation: boolean | object;\n override: OverrideInput;\n converterOptions: Partial<ConvertInputOptions>;\n parserOptions: SwaggerParserOptions;\n filters?: InputFiltersOption;\n};\n\nexport type OutputClientFunc = (\n clients: GeneratorClients,\n) => ClientGeneratorsBuilder;\n\nexport type BaseUrlFromSpec = {\n getBaseUrlFromSpecification: true;\n variables?: Record<string, string>;\n index?: number;\n baseUrl?: never;\n};\n\nexport type BaseUrlFromConstant = {\n getBaseUrlFromSpecification: false;\n variables?: never;\n index?: never;\n baseUrl: string;\n};\n\nexport const PropertySortOrder = {\n ALPHABETICAL: 'Alphabetical',\n SPECIFICATION: 'Specification',\n} as const;\n\nexport type PropertySortOrder =\n (typeof PropertySortOrder)[keyof typeof PropertySortOrder];\n\nexport const NamingConvention = {\n CAMEL_CASE: 'camelCase',\n PASCAL_CASE: 'PascalCase',\n SNAKE_CASE: 'snake_case',\n KEBAB_CASE: 'kebab-case',\n} as const;\n\nexport type NamingConvention =\n (typeof NamingConvention)[keyof typeof NamingConvention];\n\nexport const EnumGeneration = {\n CONST: 'const',\n ENUM: 'enum',\n UNION: 'union',\n} as const;\n\nexport type EnumGeneration =\n (typeof EnumGeneration)[keyof typeof EnumGeneration];\n\nexport type OutputOptions = {\n workspace?: string;\n target?: string;\n schemas?: string;\n namingConvention?: NamingConvention;\n fileExtension?: string;\n mode?: OutputMode;\n // If mock is a boolean, it will use the default mock options (type: msw)\n mock?: boolean | GlobalMockOptions | ClientMockBuilder;\n override?: OverrideOutput;\n client?: OutputClient | OutputClientFunc;\n httpClient?: OutputHttpClient;\n clean?: boolean | string[];\n docs?: boolean | OutputDocsOptions;\n prettier?: boolean;\n biome?: boolean;\n tsconfig?: string | Tsconfig;\n packageJson?: string;\n headers?: boolean;\n indexFiles?: boolean;\n baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant;\n allParamsOptional?: boolean;\n urlEncodeParameters?: boolean;\n unionAddMissingProperties?: boolean;\n optionsParamRequired?: boolean;\n propertySortOrder?: PropertySortOrder;\n};\n\nexport type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {\n validate?: boolean;\n};\n\nexport type InputFiltersOption = {\n mode?: 'include' | 'exclude';\n tags?: (string | RegExp)[];\n schemas?: (string | RegExp)[];\n};\n\nexport type InputOptions = {\n target: string | Record<string, unknown> | OpenAPIObject;\n validation?: boolean | object;\n override?: OverrideInput;\n converterOptions?: Partial<ConvertInputOptions>;\n parserOptions?: SwaggerParserOptions;\n filters?: InputFiltersOption;\n};\n\nexport const OutputClient = {\n ANGULAR: 'angular',\n AXIOS: 'axios',\n AXIOS_FUNCTIONS: 'axios-functions',\n REACT_QUERY: 'react-query',\n SVELTE_QUERY: 'svelte-query',\n VUE_QUERY: 'vue-query',\n SWR: 'swr',\n ZOD: 'zod',\n HONO: 'hono',\n FETCH: 'fetch',\n MCP: 'mcp',\n} as const;\n\nexport type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];\n\nexport const OutputHttpClient = {\n AXIOS: 'axios',\n FETCH: 'fetch',\n} as const;\n\nexport type OutputHttpClient =\n (typeof OutputHttpClient)[keyof typeof OutputHttpClient];\n\nexport const OutputMode = {\n SINGLE: 'single',\n SPLIT: 'split',\n TAGS: 'tags',\n TAGS_SPLIT: 'tags-split',\n} as const;\n\nexport type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];\n\nexport type OutputDocsOptions = {\n configPath?: string;\n} & Partial<TypeDocOptions>;\n\n// TODO: add support for other mock types (like cypress or playwright)\nexport const OutputMockType = {\n MSW: 'msw',\n} as const;\n\nexport type OutputMockType =\n (typeof OutputMockType)[keyof typeof OutputMockType];\n\nexport type GlobalMockOptions = {\n // This is the type of the mock that will be generated\n type: OutputMockType;\n // This is the option to use the examples from the openapi specification where possible to generate mock data\n useExamples?: boolean;\n // This is used to generate mocks for all http responses defined in the OpenAPI specification\n generateEachHttpStatus?: boolean;\n // This is used to set the delay to your own custom value, or pass false to disable delay\n delay?: false | number | (() => number);\n // This is used to execute functions that are passed to the 'delay' argument\n // at runtime rather than build time.\n delayFunctionLazyExecute?: boolean;\n // This is used to set the base url to your own custom value\n baseUrl?: string;\n // This is used to set the locale of the faker library\n locale?: keyof typeof allLocales;\n indexMockFiles?: boolean;\n};\n\nexport type OverrideMockOptions = Partial<GlobalMockOptions> & {\n arrayMin?: number;\n arrayMax?: number;\n stringMin?: number;\n stringMax?: number;\n numberMin?: number;\n numberMax?: number;\n required?: boolean;\n properties?: MockProperties;\n format?: Record<string, unknown>;\n fractionDigits?: number;\n};\n\nexport type MockOptions = Omit<OverrideMockOptions, 'properties'> & {\n properties?: Record<string, unknown>;\n operations?: Record<string, { properties: Record<string, unknown> }>;\n tags?: Record<string, { properties: Record<string, unknown> }>;\n};\n\nexport type MockPropertiesObject = Record<string, unknown>;\nexport type MockPropertiesObjectFn = (\n specs: OpenAPIObject,\n) => MockPropertiesObject;\n\nexport type MockProperties = MockPropertiesObject | MockPropertiesObjectFn;\n\nexport type MockDataObject = Record<string, unknown>;\n\nexport type MockDataObjectFn = (specs: OpenAPIObject) => MockDataObject;\n\nexport type MockDataArray = unknown[];\n\nexport type MockDataArrayFn = (specs: OpenAPIObject) => MockDataArray;\n\nexport type MockData =\n | MockDataObject\n | MockDataObjectFn\n | MockDataArray\n | MockDataArrayFn;\n\ntype OutputTransformerFn = (verb: GeneratorVerbOptions) => GeneratorVerbOptions;\n\ntype OutputTransformer = string | OutputTransformerFn;\n\nexport type MutatorObject = {\n path: string;\n name?: string;\n default?: boolean;\n alias?: Record<string, string>;\n extension?: string;\n};\n\nexport type Mutator = string | MutatorObject;\n\nexport type ParamsSerializerOptions = {\n qs?: Record<string, any>;\n};\n\nexport const FormDataArrayHandling = {\n SERIALIZE: 'serialize',\n EXPLODE: 'explode',\n SERIALIZE_WITH_BRACKETS: 'serialize-with-brackets',\n} as const;\n\nexport type FormDataArrayHandling =\n (typeof FormDataArrayHandling)[keyof typeof FormDataArrayHandling];\n\nexport type NormalizedFormDataType<TMutator> =\n | {\n disabled: true;\n mutator?: never;\n arrayHandling: FormDataArrayHandling;\n }\n | {\n disabled: false;\n mutator?: TMutator;\n arrayHandling: FormDataArrayHandling;\n };\nexport type FormDataType<TMutator> =\n | {\n mutator: TMutator;\n arrayHandling?: FormDataArrayHandling;\n }\n | {\n mutator?: TMutator;\n arrayHandling: FormDataArrayHandling;\n };\n\nexport type OverrideOutput = {\n title?: (title: string) => string;\n transformer?: OutputTransformer;\n mutator?: Mutator;\n operations?: Record<string, OperationOptions>;\n tags?: Record<string, OperationOptions>;\n mock?: OverrideMockOptions;\n contentType?: OverrideOutputContentType;\n header?: boolean | ((info: InfoObject) => string[] | string);\n formData?: boolean | Mutator | FormDataType<Mutator>;\n formUrlEncoded?: boolean | Mutator;\n paramsSerializer?: Mutator;\n paramsSerializerOptions?: ParamsSerializerOptions;\n namingConvention?: {\n enum?: NamingConvention;\n };\n components?: {\n schemas?: {\n suffix?: string;\n itemSuffix?: string;\n };\n responses?: {\n suffix?: string;\n };\n parameters?: {\n suffix?: string;\n };\n requestBodies?: {\n suffix?: string;\n };\n };\n hono?: HonoOptions;\n query?: QueryOptions;\n swr?: SwrOptions;\n angular?: AngularOptions;\n zod?: ZodOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n fetch?: FetchOptions;\n requestOptions?: Record<string, any> | boolean;\n useDates?: boolean;\n useTypeOverInterfaces?: boolean;\n useDeprecatedOperations?: boolean;\n useBigInt?: boolean;\n useNamedParameters?: boolean;\n /**\n * @deprecated use 'enumGenerationType=\"enum\"' instead\n */\n useNativeEnums?: boolean;\n enumGenerationType?: EnumGeneration;\n suppressReadonlyModifier?: boolean;\n jsDoc?: JsDocOptions;\n};\n\nexport type JsDocOptions = {\n filter?: (schema: Record<string, any>) => { key: string; value: string }[];\n};\n\nexport type NormalizedJsDocOptions = {\n filter?: (schema: Record<string, any>) => { key: string; value: string }[];\n};\n\nexport type OverrideOutputContentType = {\n include?: string[];\n exclude?: string[];\n};\n\nexport type NormalizedHonoOptions = {\n handlers?: string;\n compositeRoute: string;\n validator: boolean | 'hono';\n validatorOutputPath: string;\n};\n\nexport type ZodDateTimeOptions = {\n offset?: boolean;\n local?: boolean;\n precision?: number;\n};\n\nexport type ZodTimeOptions = {\n precision?: -1 | 0 | 1 | 2 | 3;\n};\n\nexport type ZodOptions = {\n strict?: {\n param?: boolean;\n query?: boolean;\n header?: boolean;\n body?: boolean;\n response?: boolean;\n };\n generate?: {\n param?: boolean;\n query?: boolean;\n header?: boolean;\n body?: boolean;\n response?: boolean;\n };\n coerce?: {\n param?: boolean | ZodCoerceType[];\n query?: boolean | ZodCoerceType[];\n header?: boolean | ZodCoerceType[];\n body?: boolean | ZodCoerceType[];\n response?: boolean | ZodCoerceType[];\n };\n preprocess?: {\n param?: Mutator;\n query?: Mutator;\n header?: Mutator;\n body?: Mutator;\n response?: Mutator;\n };\n dateTimeOptions?: ZodDateTimeOptions;\n timeOptions?: ZodTimeOptions;\n generateEachHttpStatus?: boolean;\n};\n\nexport type ZodCoerceType = 'string' | 'number' | 'boolean' | 'bigint' | 'date';\n\nexport type NormalizedZodOptions = {\n strict: {\n param: boolean;\n query: boolean;\n header: boolean;\n body: boolean;\n response: boolean;\n };\n generate: {\n param: boolean;\n query: boolean;\n header: boolean;\n body: boolean;\n response: boolean;\n };\n coerce: {\n param: boolean | ZodCoerceType[];\n query: boolean | ZodCoerceType[];\n header: boolean | ZodCoerceType[];\n body: boolean | ZodCoerceType[];\n response: boolean | ZodCoerceType[];\n };\n preprocess: {\n param?: NormalizedMutator;\n query?: NormalizedMutator;\n header?: NormalizedMutator;\n body?: NormalizedMutator;\n response?: NormalizedMutator;\n };\n generateEachHttpStatus: boolean;\n dateTimeOptions: ZodDateTimeOptions;\n timeOptions: ZodTimeOptions;\n};\n\nexport type HonoOptions = {\n handlers?: string;\n compositeRoute?: string;\n validator?: boolean | 'hono';\n validatorOutputPath?: string;\n};\n\nexport type NormalizedQueryOptions = {\n useQuery?: boolean;\n useSuspenseQuery?: boolean;\n useMutation?: boolean;\n useInfinite?: boolean;\n useSuspenseInfiniteQuery?: boolean;\n useInfiniteQueryParam?: string;\n usePrefetch?: boolean;\n options?: any;\n queryKey?: NormalizedMutator;\n queryOptions?: NormalizedMutator;\n mutationOptions?: NormalizedMutator;\n shouldExportMutatorHooks?: boolean;\n shouldExportHttpClient?: boolean;\n shouldExportQueryKey?: boolean;\n shouldSplitQueryKey?: boolean;\n signal?: boolean;\n version?: 3 | 4 | 5;\n};\n\nexport type QueryOptions = {\n useQuery?: boolean;\n useSuspenseQuery?: boolean;\n useMutation?: boolean;\n useInfinite?: boolean;\n useSuspenseInfiniteQuery?: boolean;\n useInfiniteQueryParam?: string;\n usePrefetch?: boolean;\n options?: any;\n queryKey?: Mutator;\n queryOptions?: Mutator;\n mutationOptions?: Mutator;\n shouldExportMutatorHooks?: boolean;\n shouldExportHttpClient?: boolean;\n shouldExportQueryKey?: boolean;\n shouldSplitQueryKey?: boolean;\n signal?: boolean;\n version?: 3 | 4 | 5;\n};\n\nexport type AngularOptions = {\n provideIn?: 'root' | 'any' | boolean;\n};\n\nexport type SwrOptions = {\n useInfinite?: boolean;\n useSWRMutationForGet?: boolean;\n swrOptions?: any;\n swrMutationOptions?: any;\n swrInfiniteOptions?: any;\n};\n\nexport type NormalizedFetchOptions = {\n includeHttpResponseReturnType: boolean;\n forceSuccessResponse: boolean;\n explode: boolean;\n jsonReviver?: Mutator;\n};\n\nexport type FetchOptions = {\n includeHttpResponseReturnType?: boolean;\n forceSuccessResponse?: boolean;\n explode?: boolean;\n jsonReviver?: Mutator;\n};\n\nexport type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;\n\ntype InputTransformer = string | InputTransformerFn;\n\nexport type OverrideInput = {\n transformer?: InputTransformer;\n};\n\nexport type OperationOptions = {\n transformer?: OutputTransformer;\n mutator?: Mutator;\n mock?: {\n data?: MockData;\n properties?: MockProperties;\n };\n query?: QueryOptions;\n angular?: Required<AngularOptions>;\n swr?: SwrOptions;\n zod?: ZodOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n fetch?: FetchOptions;\n formData?: boolean | Mutator | FormDataType<Mutator>;\n formUrlEncoded?: boolean | Mutator;\n paramsSerializer?: Mutator;\n requestOptions?: object | boolean;\n};\n\nexport type Hook = 'afterAllFilesWrite';\n\nexport type HookFunction = (...args: any[]) => void | Promise<void>;\n\nexport interface HookOption {\n command: string | HookFunction;\n injectGeneratedDirsAndFiles?: boolean;\n}\n\nexport type HookCommand =\n | string\n | HookFunction\n | HookOption\n | (string | HookFunction | HookOption)[];\n\nexport type NormalizedHookCommand = HookCommand[];\n\nexport type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<\n Record<Hook, T>\n>;\n\nexport type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;\n\nexport type Verbs = 'post' | 'put' | 'get' | 'patch' | 'delete' | 'head';\n\nexport const Verbs = {\n POST: 'post' as Verbs,\n PUT: 'put' as Verbs,\n GET: 'get' as Verbs,\n PATCH: 'patch' as Verbs,\n DELETE: 'delete' as Verbs,\n HEAD: 'head' as Verbs,\n};\n\nexport type ImportOpenApi = {\n data: JSONSchema6 | JSONSchema7 | Record<string, unknown | OpenAPIObject>;\n input: NormalizedInputOptions;\n output: NormalizedOutputOptions;\n target: string;\n workspace: string;\n};\n\nexport interface ContextSpecs {\n specKey: string;\n target: string;\n workspace: string;\n specs: Record<string, OpenAPIObject>;\n parents?: string[];\n output: NormalizedOutputOptions;\n}\n\nexport interface GlobalOptions {\n projectName?: string;\n watch?: boolean | string | (string | boolean)[];\n clean?: boolean | string[];\n prettier?: boolean;\n biome?: boolean;\n mock?: boolean | GlobalMockOptions;\n client?: OutputClient;\n httpClient?: OutputHttpClient;\n mode?: OutputMode;\n tsconfig?: string | Tsconfig;\n packageJson?: string;\n input?: string;\n output?: string;\n}\n\nexport interface Tsconfig {\n baseUrl?: string;\n compilerOptions?: {\n esModuleInterop?: boolean;\n allowSyntheticDefaultImports?: boolean;\n exactOptionalPropertyTypes?: boolean;\n paths?: Record<string, string[]>;\n target?: TsConfigTarget;\n };\n}\n\nexport type TsConfigTarget =\n | 'es3'\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext'; // https://www.typescriptlang.org/tsconfig#target\n\nexport interface PackageJson {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nexport type GeneratorSchema = {\n name: string;\n model: string;\n imports: GeneratorImport[];\n};\n\nexport type GeneratorImport = {\n name: string;\n schemaName?: string;\n isConstant?: boolean;\n alias?: string;\n specKey?: string;\n default?: boolean;\n values?: boolean;\n syntheticDefaultImport?: boolean;\n};\n\nexport type GeneratorDependency = {\n exports: GeneratorImport[];\n dependency: string;\n};\n\nexport type GeneratorApiResponse = {\n operations: GeneratorOperations;\n schemas: GeneratorSchema[];\n};\n\nexport type GeneratorOperations = Record<string, GeneratorOperation>;\n\nexport type GeneratorTarget = {\n imports: GeneratorImport[];\n implementation: string;\n implementationMock: string;\n importsMock: GeneratorImport[];\n mutators?: GeneratorMutator[];\n clientMutators?: GeneratorMutator[];\n formData?: GeneratorMutator[];\n formUrlEncoded?: GeneratorMutator[];\n paramsSerializer?: GeneratorMutator[];\n fetchReviver?: GeneratorMutator[];\n};\n\nexport type GeneratorTargetFull = {\n imports: GeneratorImport[];\n implementation: string;\n implementationMock: {\n function: string;\n handler: string;\n handlerName: string;\n };\n importsMock: GeneratorImport[];\n mutators?: GeneratorMutator[];\n clientMutators?: GeneratorMutator[];\n formData?: GeneratorMutator[];\n formUrlEncoded?: GeneratorMutator[];\n paramsSerializer?: GeneratorMutator[];\n fetchReviver?: GeneratorMutator[];\n};\n\nexport type GeneratorOperation = {\n imports: GeneratorImport[];\n implementation: string;\n implementationMock: {\n function: string;\n handler: string;\n handlerName: string;\n };\n importsMock: GeneratorImport[];\n tags: string[];\n mutator?: GeneratorMutator;\n clientMutators?: GeneratorMutator[];\n formData?: GeneratorMutator;\n formUrlEncoded?: GeneratorMutator;\n paramsSerializer?: GeneratorMutator;\n fetchReviver?: GeneratorMutator;\n operationName: string;\n types?: {\n result: (title?: string) => string;\n };\n};\n\nexport type GeneratorVerbOptions = {\n verb: Verbs;\n route: string;\n pathRoute: string;\n summary?: string;\n doc: string;\n tags: string[];\n operationId: string;\n operationName: string;\n response: GetterResponse;\n body: GetterBody;\n headers?: GetterQueryParam;\n queryParams?: GetterQueryParam;\n params: GetterParams;\n props: GetterProps;\n mutator?: GeneratorMutator;\n formData?: GeneratorMutator;\n formUrlEncoded?: GeneratorMutator;\n paramsSerializer?: GeneratorMutator;\n fetchReviver?: GeneratorMutator;\n override: NormalizedOverrideOutput;\n deprecated?: boolean;\n originalOperation: OperationObject;\n};\n\nexport type GeneratorVerbsOptions = GeneratorVerbOptions[];\n\nexport type GeneratorOptions = {\n route: string;\n pathRoute: string;\n override: NormalizedOverrideOutput;\n context: ContextSpecs;\n mock?: GlobalMockOptions | ClientMockBuilder;\n output: string;\n};\n\nexport type GeneratorClient = {\n implementation: string;\n imports: GeneratorImport[];\n mutators?: GeneratorMutator[];\n};\n\nexport type GeneratorMutatorParsingInfo = {\n numberOfParams: number;\n returnNumberOfParams?: number;\n};\nexport type GeneratorMutator = {\n name: string;\n path: string;\n default: boolean;\n hasErrorType: boolean;\n errorTypeName: string;\n hasSecondArg: boolean;\n hasThirdArg: boolean;\n isHook: boolean;\n bodyTypeName?: string;\n};\n\nexport type ClientBuilder = (\n verbOptions: GeneratorVerbOptions,\n options: GeneratorOptions,\n outputClient: OutputClient | OutputClientFunc,\n output?: NormalizedOutputOptions,\n) => GeneratorClient | Promise<GeneratorClient>;\n\nexport type ClientFileBuilder = {\n path: string;\n content: string;\n};\nexport type ClientExtraFilesBuilder = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => Promise<ClientFileBuilder[]>;\n\nexport type ClientHeaderBuilder = (params: {\n title: string;\n isRequestOptions: boolean;\n isMutator: boolean;\n noFunction?: boolean;\n isGlobalMutator: boolean;\n provideIn: boolean | 'root' | 'any';\n hasAwaitedType: boolean;\n output: NormalizedOutputOptions;\n verbOptions: Record<string, GeneratorVerbOptions>;\n tag?: string;\n clientImplementation: string;\n}) => string;\n\nexport type ClientFooterBuilder = (params: {\n noFunction?: boolean | undefined;\n operationNames: string[];\n title?: string;\n hasAwaitedType: boolean;\n hasMutator: boolean;\n}) => string;\n\nexport type ClientTitleBuilder = (title: string) => string;\n\nexport type ClientDependenciesBuilder = (\n hasGlobalMutator: boolean,\n hasParamsSerializerOptions: boolean,\n packageJson?: PackageJson,\n httpClient?: OutputHttpClient,\n hasTagsMutator?: boolean,\n override?: NormalizedOverrideOutput,\n) => GeneratorDependency[];\n\nexport type ClientMockGeneratorImplementation = {\n function: string;\n handlerName: string;\n handler: string;\n};\n\nexport type ClientMockGeneratorBuilder = {\n imports: GeneratorImport[];\n implementation: ClientMockGeneratorImplementation;\n};\n\nexport type ClientMockBuilder = (\n verbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n) => ClientMockGeneratorBuilder;\n\nexport interface ClientGeneratorsBuilder {\n client: ClientBuilder;\n header?: ClientHeaderBuilder;\n dependencies?: ClientDependenciesBuilder;\n footer?: ClientFooterBuilder;\n title?: ClientTitleBuilder;\n extraFiles?: ClientExtraFilesBuilder;\n}\n\nexport type GeneratorClients = Record<OutputClient, ClientGeneratorsBuilder>;\n\nexport type GetterResponse = {\n imports: GeneratorImport[];\n definition: {\n success: string;\n errors: string;\n };\n isBlob: boolean;\n types: {\n success: ResReqTypesValue[];\n errors: ResReqTypesValue[];\n };\n contentTypes: string[];\n schemas: GeneratorSchema[];\n\n originalSchema?: ResponsesObject;\n};\n\nexport type GetterBody = {\n originalSchema: ReferenceObject | RequestBodyObject;\n imports: GeneratorImport[];\n definition: string;\n implementation: string;\n schemas: GeneratorSchema[];\n formData?: string;\n formUrlEncoded?: string;\n contentType: string;\n isOptional: boolean;\n};\n\nexport type GetterParameters = {\n query: { parameter: ParameterObject; imports: GeneratorImport[] }[];\n path: { parameter: ParameterObject; imports: GeneratorImport[] }[];\n header: { parameter: ParameterObject; imports: GeneratorImport[] }[];\n};\n\nexport type GetterParam = {\n name: string;\n definition: string;\n implementation: string;\n default: boolean;\n required: boolean;\n imports: GeneratorImport[];\n};\n\nexport type GetterParams = GetterParam[];\nexport type GetterQueryParam = {\n schema: GeneratorSchema;\n deps: GeneratorSchema[];\n isOptional: boolean;\n originalSchema?: SchemaObject;\n};\n\nexport type GetterPropType =\n | 'param'\n | 'body'\n | 'queryParam'\n | 'header'\n | 'namedPathParams';\n\nexport const GetterPropType = {\n PARAM: 'param',\n NAMED_PATH_PARAMS: 'namedPathParams',\n BODY: 'body',\n QUERY_PARAM: 'queryParam',\n HEADER: 'header',\n} as const;\n\ntype GetterPropBase = {\n name: string;\n definition: string;\n implementation: string;\n default: boolean;\n required: boolean;\n};\n\nexport type GetterProp = GetterPropBase &\n (\n | { type: 'namedPathParams'; destructured: string; schema: GeneratorSchema }\n | { type: Exclude<GetterPropType, 'namedPathParams'> }\n );\n\nexport type GetterProps = GetterProp[];\n\nexport type SchemaType =\n | 'integer'\n | 'number'\n | 'string'\n | 'boolean'\n | 'object'\n | 'null'\n | 'array'\n | 'enum'\n | 'unknown';\n\nexport const SchemaType = {\n integer: 'integer',\n number: 'number',\n string: 'string',\n boolean: 'boolean',\n object: 'object',\n null: 'null',\n array: 'array',\n enum: 'enum',\n unknown: 'unknown',\n};\n\nexport type ScalarValue = {\n value: string;\n isEnum: boolean;\n hasReadonlyProps: boolean;\n type: SchemaType;\n imports: GeneratorImport[];\n schemas: GeneratorSchema[];\n isRef: boolean;\n example?: any;\n examples?: Record<string, any>;\n};\n\nexport type ResolverValue = ScalarValue & {\n originalSchema: SchemaObject;\n};\n\nexport type ResReqTypesValue = ScalarValue & {\n formData?: string;\n formUrlEncoded?: string;\n isRef?: boolean;\n hasReadonlyProps?: boolean;\n key: string;\n contentType: string;\n originalSchema?: SchemaObject;\n};\n\nexport type WriteSpecsBuilder = {\n operations: GeneratorOperations;\n schemas: Record<string, GeneratorSchema[]>;\n verbOptions: Record<string, GeneratorVerbOptions>;\n title: GeneratorClientTitle;\n header: GeneratorClientHeader;\n footer: GeneratorClientFooter;\n imports: GeneratorClientImports;\n importsMock: GenerateMockImports;\n extraFiles: ClientFileBuilder[];\n info: InfoObject;\n target: string;\n};\n\nexport type WriteModeProps = {\n builder: WriteSpecsBuilder;\n output: NormalizedOutputOptions;\n workspace: string;\n specsName: Record<string, string>;\n header: string;\n needSchema: boolean;\n};\n\nexport type GeneratorApiOperations = {\n verbOptions: Record<string, GeneratorVerbOptions>;\n operations: GeneratorOperations;\n schemas: GeneratorSchema[];\n};\n\nexport type GeneratorClientExtra = {\n implementation: string;\n implementationMock: string;\n};\n\nexport type GeneratorClientTitle = (data: {\n outputClient?: OutputClient | OutputClientFunc;\n title: string;\n customTitleFunc?: (title: string) => string;\n output: NormalizedOutputOptions;\n}) => GeneratorClientExtra;\n\nexport type GeneratorClientHeader = (data: {\n outputClient?: OutputClient | OutputClientFunc;\n isRequestOptions: boolean;\n isMutator: boolean;\n isGlobalMutator: boolean;\n provideIn: boolean | 'root' | 'any';\n hasAwaitedType: boolean;\n titles: GeneratorClientExtra;\n output: NormalizedOutputOptions;\n verbOptions: Record<string, GeneratorVerbOptions>;\n tag?: string;\n clientImplementation: string;\n}) => GeneratorClientExtra;\n\nexport type GeneratorClientFooter = (data: {\n outputClient: OutputClient | OutputClientFunc;\n operationNames: string[];\n hasMutator: boolean;\n hasAwaitedType: boolean;\n titles: GeneratorClientExtra;\n output: NormalizedOutputOptions;\n}) => GeneratorClientExtra;\n\nexport type GeneratorClientImports = (data: {\n client: OutputClient | OutputClientFunc;\n implementation: string;\n imports: {\n exports: GeneratorImport[];\n dependency: string;\n }[];\n specsName: Record<string, string>;\n hasSchemaDir: boolean;\n isAllowSyntheticDefaultImports: boolean;\n hasGlobalMutator: boolean;\n hasTagsMutator: boolean;\n hasParamsSerializerOptions: boolean;\n packageJson?: PackageJson;\n output: NormalizedOutputOptions;\n}) => string;\n\nexport type GenerateMockImports = (data: {\n implementation: string;\n imports: {\n exports: GeneratorImport[];\n dependency: string;\n }[];\n specsName: Record<string, string>;\n hasSchemaDir: boolean;\n isAllowSyntheticDefaultImports: boolean;\n options?: GlobalMockOptions;\n}) => string;\n\nexport type GeneratorApiBuilder = GeneratorApiOperations & {\n title: GeneratorClientTitle;\n header: GeneratorClientHeader;\n footer: GeneratorClientFooter;\n imports: GeneratorClientImports;\n importsMock: GenerateMockImports;\n extraFiles: ClientFileBuilder[];\n};\n\nexport interface SchemaWithConst extends SchemaObject {\n const: string;\n}\n\nexport class ErrorWithTag extends Error {\n tag: string;\n constructor(message: string, tag: string, options?: ErrorOptions) {\n super(message, options);\n this.tag = tag;\n }\n}\n","import { Verbs } from './types';\n\nexport const generalJSTypes = [\n 'number',\n 'string',\n 'null',\n 'unknown',\n 'undefined',\n 'object',\n 'blob',\n];\n\nexport const generalJSTypesWithArray = generalJSTypes.reduce<string[]>(\n (acc, type) => {\n acc.push(type, `Array<${type}>`, `${type}[]`);\n\n return acc;\n },\n [],\n);\n\nexport const VERBS_WITH_BODY = [\n Verbs.POST,\n Verbs.PUT,\n Verbs.PATCH,\n Verbs.DELETE,\n];\n\nexport const URL_REGEX =\n /^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$/;\n\nexport const TEMPLATE_TAG_REGEX = /\\${(.+?)}/g; // For replace of 'thing' ${thing}\n","export const getExtension = (path: string) =>\n path.toLowerCase().includes('.yaml') || path.toLowerCase().includes('.yml')\n ? 'yaml'\n : 'json';\n","import debug from 'debug';\n\nconst filter = process.env.ORVAL_DEBUG_FILTER;\nconst DEBUG = process.env.DEBUG;\n\ninterface DebuggerOptions {\n onlyWhenFocused?: boolean | string;\n}\n\nexport function createDebugger(\n ns: string,\n options: DebuggerOptions = {},\n): debug.Debugger['log'] {\n const log = debug(ns);\n const { onlyWhenFocused } = options;\n const focus = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : ns;\n return (msg: string, ...args: any[]) => {\n if (filter && !msg.includes(filter)) {\n return;\n }\n if (onlyWhenFocused && !DEBUG?.includes(focus)) {\n return;\n }\n log(msg, ...args);\n };\n}\n","import readline from 'node:readline';\n\nimport chalk from 'chalk';\n\nexport const log = console.log;\n\nexport const startMessage = ({\n name,\n version,\n description,\n}: {\n name: string;\n version: string;\n description: string;\n}) =>\n `🍻 ${chalk.cyan.bold(name)} ${chalk.green(`v${version}`)}${\n description ? ` - ${description}` : ''\n }`;\n\nexport const logError = (err: unknown, tag?: string) => {\n log(\n chalk.red(\n [\n '🛑',\n tag ? `${tag} -` : undefined,\n err instanceof Error ? err.stack : err,\n ]\n .filter(Boolean)\n .join(' '),\n ),\n );\n};\n\nexport const mismatchArgsMessage = (mismatchArgs: string[]) => {\n log(\n chalk.yellow(\n `${mismatchArgs.join(', ')} ${\n mismatchArgs.length === 1 ? 'is' : 'are'\n } not defined in your configuration!`,\n ),\n );\n};\n\nexport const createSuccessMessage = (backend?: string) => {\n log(\n `🎉 ${\n backend ? `${chalk.green(backend)} - ` : ''\n }Your OpenAPI spec has been converted into ready to use orval!`,\n );\n};\n\nexport const ibmOpenapiValidatorWarnings = (\n warnings: {\n path: string[];\n message: string;\n }[],\n) => {\n log(chalk.yellow('(!) Warnings'));\n\n for (const i of warnings)\n log(chalk.yellow(`Message : ${i.message}\\nPath : ${i.path.join(', ')}`));\n};\n\nexport const ibmOpenapiValidatorErrors = (\n errors: {\n path: string[];\n message: string;\n }[],\n) => {\n log(chalk.red('(!) Errors'));\n\n for (const i of errors)\n log(chalk.red(`Message : ${i.message}\\nPath : ${i.path.join(', ')}`));\n};\n\nexport type LogType = 'error' | 'warn' | 'info';\nexport type LogLevel = LogType | 'silent';\nexport interface Logger {\n info(msg: string, options?: LogOptions): void;\n warn(msg: string, options?: LogOptions): void;\n warnOnce(msg: string, options?: LogOptions): void;\n error(msg: string, options?: LogOptions): void;\n clearScreen(type: LogType): void;\n hasWarned: boolean;\n}\n\nexport interface LogOptions {\n clear?: boolean;\n timestamp?: boolean;\n}\n\nexport const LogLevels: Record<LogLevel, number> = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n};\n\nlet lastType: LogType | undefined;\nlet lastMsg: string | undefined;\nlet sameCount = 0;\n\nfunction clearScreen() {\n const repeatCount = process.stdout.rows - 2;\n const blank = repeatCount > 0 ? '\\n'.repeat(repeatCount) : '';\n console.log(blank);\n readline.cursorTo(process.stdout, 0, 0);\n readline.clearScreenDown(process.stdout);\n}\n\nexport interface LoggerOptions {\n prefix?: string;\n allowClearScreen?: boolean;\n}\n\nexport function createLogger(\n level: LogLevel = 'info',\n options: LoggerOptions = {},\n): Logger {\n const { prefix = '[vite]', allowClearScreen = true } = options;\n\n const thresh = LogLevels[level];\n const clear =\n allowClearScreen && process.stdout.isTTY && !process.env.CI\n ? clearScreen\n : () => {};\n\n function output(type: LogType, msg: string, options: LogOptions = {}) {\n if (thresh >= LogLevels[type]) {\n const method = type === 'info' ? 'log' : type;\n const format = () => {\n if (options.timestamp) {\n const tag =\n type === 'info'\n ? chalk.cyan.bold(prefix)\n : type === 'warn'\n ? chalk.yellow.bold(prefix)\n : chalk.red.bold(prefix);\n return `${chalk.dim(new Date().toLocaleTimeString())} ${tag} ${msg}`;\n } else {\n return msg;\n }\n };\n if (type === lastType && msg === lastMsg) {\n sameCount++;\n clear();\n console[method](format(), chalk.yellow(`(x${sameCount + 1})`));\n } else {\n sameCount = 0;\n lastMsg = msg;\n lastType = type;\n if (options.clear) {\n clear();\n }\n console[method](format());\n }\n }\n }\n\n const warnedMessages = new Set<string>();\n\n const logger: Logger = {\n hasWarned: false,\n info(msg, opts) {\n output('info', msg, opts);\n },\n warn(msg, opts) {\n logger.hasWarned = true;\n output('warn', msg, opts);\n },\n warnOnce(msg, opts) {\n if (warnedMessages.has(msg)) return;\n logger.hasWarned = true;\n output('warn', msg, opts);\n warnedMessages.add(msg);\n },\n error(msg, opts) {\n logger.hasWarned = true;\n output('error', msg, opts);\n },\n clearScreen(type) {\n if (thresh >= LogLevels[type]) {\n clear();\n }\n },\n };\n\n return logger;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport chalk from 'chalk';\nimport { build, type PluginBuild } from 'esbuild';\nimport glob from 'globby';\nimport mm from 'micromatch';\n\nimport type { Tsconfig } from '../types';\nimport { isDirectory } from './assertion';\nimport { createDebugger } from './debug';\nimport { createLogger, type LogLevel } from './logger';\nimport { joinSafe, normalizeSafe } from './path';\n\nexport const getFileInfo = (\n target = '',\n {\n backupFilename = 'filename',\n extension = '.ts',\n }: { backupFilename?: string; extension?: string } = {},\n) => {\n const isDir = isDirectory(target);\n const filePath = isDir\n ? path.join(target, backupFilename + extension)\n : target;\n const pathWithoutExtension = filePath.replace(/\\.[^/.]+$/, '');\n const dir = path.dirname(filePath);\n const filename = path.basename(\n filePath,\n extension.startsWith('.') ? extension : `.${extension}`,\n );\n\n return {\n path: filePath,\n pathWithoutExtension,\n extension,\n isDirectory: isDir,\n dirname: dir,\n filename,\n };\n};\n\nconst debug = createDebugger('orval:file-load');\n\nconst cache = new Map<string, { file?: any; error?: any }>();\n\nexport async function loadFile<File = any>(\n filePath?: string,\n options?: {\n root?: string;\n defaultFileName?: string;\n logLevel?: LogLevel;\n isDefault?: boolean;\n alias?: Record<string, string>;\n tsconfig?: Tsconfig;\n load?: boolean;\n },\n): Promise<{\n path: string;\n file?: File;\n error?: any;\n cached?: boolean;\n}> {\n const {\n root = process.cwd(),\n isDefault = true,\n defaultFileName,\n logLevel,\n alias,\n tsconfig,\n load = true,\n } = options ?? {};\n const start = Date.now();\n\n let resolvedPath: string | undefined;\n let isTS = false;\n let isMjs = false;\n\n if (filePath) {\n // explicit path is always resolved from cwd\n resolvedPath = path.resolve(filePath);\n isTS = filePath.endsWith('.ts');\n } else if (defaultFileName) {\n // implicit file loaded from inline root (if present)\n // otherwise from cwd\n const jsFile = path.resolve(root, `${defaultFileName}.js`);\n if (fs.existsSync(jsFile)) {\n resolvedPath = jsFile;\n }\n\n if (!resolvedPath) {\n const mjsFile = path.resolve(root, `${defaultFileName}.mjs`);\n if (fs.existsSync(mjsFile)) {\n resolvedPath = mjsFile;\n isMjs = true;\n }\n }\n\n if (!resolvedPath) {\n const cjsFile = path.resolve(root, `${defaultFileName}.cjs`);\n if (fs.existsSync(cjsFile)) {\n resolvedPath = cjsFile;\n }\n }\n\n if (!resolvedPath) {\n const tsFile = path.resolve(root, `${defaultFileName}.ts`);\n if (fs.existsSync(tsFile)) {\n resolvedPath = tsFile;\n isTS = true;\n }\n }\n }\n\n if (!resolvedPath) {\n if (filePath) {\n throw new Error(chalk.red(`File not found => ${filePath}`));\n } else if (defaultFileName) {\n throw new Error(\n chalk.red(`File not found => ${defaultFileName}.{js,mjs,cjs,ts}`),\n );\n } else {\n throw new Error(chalk.red(`File not found`));\n }\n }\n\n const normalizeResolvedPath = normalizeSafe(resolvedPath);\n const cachedData = cache.get(resolvedPath);\n\n if (cachedData) {\n return {\n path: normalizeResolvedPath,\n ...cachedData,\n cached: true,\n };\n }\n\n try {\n let file: File | undefined;\n\n if (!file && !isTS && !isMjs) {\n // 1. try to directly require the module (assuming commonjs)\n try {\n // clear cache in case of server restart\n delete require.cache[require.resolve(resolvedPath)];\n\n file = require(resolvedPath);\n\n debug(`cjs loaded in ${Date.now() - start}ms`);\n } catch (error) {\n const ignored = new RegExp(\n [\n `Cannot use import statement`,\n `Must use import to load ES Module`,\n // #1635, #2050 some Node 12.x versions don't have esm detection\n // so it throws normal syntax errors when encountering esm syntax\n `Unexpected token`,\n `Unexpected identifier`,\n ].join('|'),\n );\n //@ts-ignore\n if (!ignored.test(error.message)) {\n throw error;\n }\n }\n }\n\n if (!file) {\n // 2. if we reach here, the file is ts or using es import syntax, or\n // the user has type: \"module\" in their package.json (#917)\n // transpile es import syntax to require syntax using rollup.\n // lazy require rollup (it's actually in dependencies)\n const { code } = await bundleFile(\n resolvedPath,\n isMjs,\n root || path.dirname(normalizeResolvedPath),\n alias,\n tsconfig?.compilerOptions,\n );\n\n file = load\n ? await loadFromBundledFile<File>(resolvedPath, code, isDefault)\n : (code as any);\n\n debug(`bundled file loaded in ${Date.now() - start}ms`);\n }\n\n cache.set(resolvedPath, { file });\n\n return {\n path: normalizeResolvedPath,\n file,\n };\n } catch (error: any) {\n cache.set(resolvedPath, { error });\n\n return {\n path: normalizeResolvedPath,\n error,\n };\n }\n}\n\nasync function bundleFile(\n fileName: string,\n mjs = false,\n workspace: string,\n alias?: Record<string, string>,\n compilerOptions?: Tsconfig['compilerOptions'],\n): Promise<{ code: string; dependencies: string[] }> {\n const result = await build({\n absWorkingDir: process.cwd(),\n entryPoints: [fileName],\n outfile: 'out.js',\n write: false,\n platform: 'node',\n bundle: true,\n format: mjs ? 'esm' : 'cjs',\n sourcemap: 'inline',\n metafile: true,\n target: compilerOptions?.target || 'es6',\n minify: false,\n minifyIdentifiers: false,\n minifySyntax: false,\n minifyWhitespace: false,\n treeShaking: false,\n keepNames: false,\n plugins: [\n ...(alias || compilerOptions?.paths\n ? [\n {\n name: 'aliasing',\n setup(build: PluginBuild) {\n build.onResolve(\n { filter: /^[\\w@][^:]/ },\n async ({ path: id }) => {\n if (alias) {\n const matchKeys = Object.keys(alias);\n const match = matchKeys.find(\n (key) =>\n id.startsWith(key) || mm.isMatch(id, matchKeys),\n );\n\n if (match) {\n const find = mm.scan(match);\n const replacement = mm.scan(alias[match]);\n\n const base = path.resolve(workspace, replacement.base);\n const newPath = find.base\n ? id.replace(find.base, base)\n : joinSafe(base, id);\n\n const ext = path.extname(newPath);\n\n const aliased = ext ? newPath : `${newPath}.ts`;\n\n if (!fs.existsSync(aliased)) {\n return;\n }\n\n return {\n path: aliased,\n };\n }\n }\n\n if (compilerOptions?.paths) {\n const matchKeys = Object.keys(compilerOptions?.paths);\n const match = matchKeys.find(\n (key) =>\n id.startsWith(key) || mm.isMatch(id, matchKeys),\n );\n\n if (match) {\n const find = mm.scan(match);\n const replacement = mm.scan(\n compilerOptions?.paths[match][0],\n );\n\n const base = path.resolve(workspace, replacement.base);\n const newPath = find.base\n ? id.replace(find.base, base)\n : joinSafe(base, id);\n\n const ext = path.extname(newPath);\n\n const aliased = ext ? newPath : `${newPath}.ts`;\n\n if (!fs.existsSync(aliased)) {\n return;\n }\n\n return {\n path: aliased,\n };\n }\n }\n },\n );\n },\n },\n ]\n : []),\n {\n name: 'externalize-deps',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const id = args.path;\n if (!id.startsWith('.') && !path.isAbsolute(id)) {\n return {\n external: true,\n };\n }\n });\n },\n },\n {\n name: 'replace-import-meta',\n setup(build) {\n build.onLoad({ filter: /\\.[jt]s$/ }, async (args) => {\n const contents = await fs.promises.readFile(args.path, 'utf8');\n return {\n loader: args.path.endsWith('.ts') ? 'ts' : 'js',\n contents: contents\n .replaceAll(\n /\\bimport\\.meta\\.url\\b/g,\n JSON.stringify(`file://${args.path}`),\n )\n .replaceAll(\n /\\b__dirname\\b/g,\n JSON.stringify(path.dirname(args.path)),\n )\n .replaceAll(/\\b__filename\\b/g, JSON.stringify(args.path)),\n };\n });\n },\n },\n ],\n });\n const { text } = result.outputFiles[0];\n return {\n code: text,\n dependencies: result.metafile ? Object.keys(result.metafile.inputs) : [],\n };\n}\n\ninterface NodeModuleWithCompile extends NodeModule {\n _compile(code: string, filename: string): any;\n}\n\nasync function loadFromBundledFile<File = unknown>(\n fileName: string,\n bundledCode: string,\n isDefault: boolean,\n): Promise<File> {\n const extension = path.extname(fileName);\n const defaultLoader = require.extensions[extension]!;\n require.extensions[extension] = (module: NodeModule, filename: string) => {\n if (filename === fileName) {\n (module as NodeModuleWithCompile)._compile(bundledCode, filename);\n } else {\n defaultLoader(module, filename);\n }\n };\n // clear cache in case of server restart\n delete require.cache[require.resolve(fileName)];\n const raw = require(fileName);\n const file = isDefault && raw.__esModule ? raw.default : raw;\n require.extensions[extension] = defaultLoader;\n return file;\n}\n\nexport async function removeFilesAndEmptyFolders(\n patterns: string[],\n dir: string,\n) {\n const files = await glob(patterns, {\n cwd: dir,\n absolute: true,\n });\n\n // Remove files\n await Promise.all(files.map((file) => fs.promises.unlink(file)));\n\n // Find and remove empty directories\n const directories = await glob(['**/*'], {\n cwd: dir,\n absolute: true,\n onlyDirectories: true,\n });\n\n // Sort directories by depth (deepest first) to ensure we can remove nested empty folders\n const sortedDirectories = directories.sort((a, b) => {\n const depthA = a.split('/').length;\n const depthB = b.split('/').length;\n return depthB - depthA;\n });\n\n // Remove empty directories\n for (const directory of sortedDirectories) {\n try {\n const contents = await fs.promises.readdir(directory);\n if (contents.length === 0) {\n await fs.promises.rmdir(directory);\n }\n } catch {\n // Directory might have been removed already or doesn't exist\n // Continue with next directory\n }\n }\n}\n","import basepath from 'node:path';\n\nimport { isUrl } from './assertion';\nimport { getExtension } from './extension';\nimport { getFileInfo } from './file';\n\n// override path to support windows paths\n// https://github.com/anodynos/upath/blob/master/source/code/upath.coffee\ntype Path = typeof basepath;\nconst path = {} as Path;\n\nconst isFunction = (val: any) => typeof val == 'function';\n\nconst isString = (val: any) => {\n if (typeof val === 'string') {\n return true;\n }\n\n if (typeof val === 'object' && val !== null) {\n return Object.toString.call(val) == '[object String]';\n }\n\n return false;\n};\n\nfor (const [propName, propValue] of Object.entries(basepath)) {\n if (isFunction(propValue)) {\n // @ts-ignore\n path[propName] = ((propName) => {\n return (...args: any[]) => {\n args = args.map((p) => {\n return isString(p) ? toUnix(p) : p;\n });\n\n // @ts-ignore\n const result = basepath[propName](...args);\n return isString(result) ? toUnix(result) : result;\n };\n })(propName);\n } else {\n // @ts-ignore\n path[propName] = propValue;\n }\n}\n\nconst { join, resolve, extname, dirname, basename, isAbsolute } = path;\nexport { basename, dirname, extname, isAbsolute, join, resolve };\n\n/**\n * Behaves exactly like `path.relative(from, to)`, but keeps the first meaningful \"./\"\n */\nexport const relativeSafe = (from: string, to: string) => {\n const normalizedRelativePath = path.relative(from, to);\n /**\n * Prepend \"./\" to every path and then use normalizeSafe method to normalize it\n * normalizeSafe doesn't remove meaningful leading \"./\"\n */\n const relativePath = normalizeSafe(`.${separator}${normalizedRelativePath}`);\n return relativePath;\n};\n\nexport const getSpecName = (specKey: string, target: string) => {\n if (isUrl(specKey)) {\n const url = new URL(target);\n return specKey\n .replace(url.origin, '')\n .replace(getFileInfo(url.pathname).dirname, '')\n .replace(`.${getExtension(specKey)}`, '');\n }\n\n return (\n '/' +\n path\n .normalize(path.relative(getFileInfo(target).dirname, specKey))\n .split('../')\n .join('')\n .replace(`.${getExtension(specKey)}`, '')\n );\n};\n\nexport const getSchemaFileName = (path: string) => {\n return path\n .replace(`.${getExtension(path)}`, '')\n .slice(path.lastIndexOf('/') + 1);\n};\n\nexport const separator = '/';\n\nconst toUnix = function (value: string) {\n value = value.replaceAll('\\\\', '/');\n value = value.replaceAll(/(?<!^)\\/+/g, '/'); // replace doubles except beginning for UNC path\n return value;\n};\n\nexport const normalizeSafe = (value: string) => {\n let result;\n value = toUnix(value);\n result = path.normalize(value);\n if (\n value.startsWith('./') &&\n !result.startsWith('./') &&\n !result.startsWith('..')\n ) {\n result = './' + result;\n } else if (value.startsWith('//') && !result.startsWith('//')) {\n result = value.startsWith('//./') ? '//.' + result : '/' + result;\n }\n return result;\n};\n\nexport const joinSafe = function (...values: string[]) {\n let result = path.join(...values);\n\n if (values.length > 0) {\n const firstValue = toUnix(values[0]);\n if (\n firstValue.startsWith('./') &&\n !result.startsWith('./') &&\n !result.startsWith('..')\n ) {\n result = './' + result;\n } else if (firstValue.startsWith('//') && !result.startsWith('//')) {\n result = firstValue.startsWith('//./') ? '//.' + result : '/' + result;\n }\n }\n return result;\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { SchemaType, Verbs } from '../types';\nimport { extname } from './path';\n\n/**\n * Discriminator helper for `ReferenceObject`\n *\n * @param property\n */\nexport const isReference = (property: any): property is ReferenceObject => {\n return Boolean(property?.$ref);\n};\n\nexport const isDirectory = (path: string) => {\n return !extname(path);\n};\n\nexport function isObject(x: any): x is Record<string, unknown> {\n return Object.prototype.toString.call(x) === '[object Object]';\n}\n\nexport function isModule(x: any): x is Record<string, unknown> {\n return Object.prototype.toString.call(x) === '[object Module]';\n}\n\nexport function isString(x: any): x is string {\n return typeof x === 'string';\n}\n\nexport function isNumber(x: any): x is number {\n return typeof x === 'number';\n}\n\nexport function isNumeric(x: any): x is number {\n return /^-?\\d+$/.test(x);\n}\n\nexport function isBoolean(x: any): x is boolean {\n return typeof x === 'boolean';\n}\n\nexport function isFunction(x: any): x is Function {\n return typeof x === 'function';\n}\n\nexport function isUndefined(x: any): x is undefined {\n return x === undefined;\n}\n\nexport function isNull(x: any): x is null {\n return x === null;\n}\n\nexport function isSchema(x: any): x is SchemaObject {\n if (!isObject(x)) {\n return false;\n }\n\n if (isString(x.type) && Object.values(SchemaType).includes(x.type)) {\n return true;\n }\n\n const combine = x.allOf || x.anyOf || x.oneOf;\n if (Array.isArray(combine)) {\n return true;\n }\n\n if (isObject(x.properties)) {\n return true;\n }\n\n return false;\n}\n\nexport const isVerb = (verb: string): verb is Verbs =>\n Object.values(Verbs).includes(verb as Verbs);\n\nexport const isRootKey = (specKey: string, target: string) => {\n return specKey === target;\n};\n\nexport const isUrl = (str: string) => {\n let givenURL;\n try {\n givenURL = new URL(str);\n } catch {\n return false;\n }\n return givenURL.protocol === 'http:' || givenURL.protocol === 'https:';\n};\n","export async function asyncReduce<IterationItem, AccValue>(\n array: IterationItem[],\n reducer: (\n accumulate: AccValue,\n current: IterationItem,\n ) => AccValue | Promise<AccValue>,\n initValue: AccValue,\n): Promise<AccValue> {\n let accumulate =\n typeof initValue === 'object'\n ? Object.create(initValue as unknown as object)\n : initValue;\n\n for (const item of array) {\n accumulate = await reducer(accumulate, item);\n }\n\n return accumulate;\n}\n","import { NamingConvention } from '../types';\n\nconst unicodes = function (s: string, prefix: string) {\n prefix = prefix || '';\n return s\n .replaceAll(/(^|-)/g, String.raw`$1\\u` + prefix)\n .replaceAll(',', String.raw`\\u` + prefix);\n};\n\nconst symbols = unicodes('20-26,28-2F,3A-40,5B-60,7B-7E,A0-BF,D7,F7', '00');\nconst lowers = 'a-z' + unicodes('DF-F6,F8-FF', '00');\nconst uppers = 'A-Z' + unicodes('C0-D6,D8-DE', '00');\nconst impropers = String.raw`A|An|And|As|At|But|By|En|For|If|In|Of|On|Or|The|To|Vs?\\.?|Via`;\n\nconst regexps = {\n capitalize: new RegExp('(^|[' + symbols + '])([' + lowers + '])', 'g'),\n pascal: new RegExp('(^|[' + symbols + '])+([' + lowers + uppers + '])', 'g'),\n fill: new RegExp('[' + symbols + ']+(.|$)', 'g'),\n sentence: new RegExp(\n String.raw`(^\\s*|[\\?\\!\\.]+\"?\\s+\"?|,\\s+\")([` + lowers + '])',\n 'g',\n ),\n improper: new RegExp(String.raw`\\b(` + impropers + String.raw`)\\b`, 'g'),\n relax: new RegExp(\n '([^' +\n uppers +\n '])([' +\n uppers +\n ']*)([' +\n uppers +\n '])(?=[^' +\n uppers +\n ']|$)',\n 'g',\n ),\n upper: new RegExp('^[^' + lowers + ']+$'),\n hole: /[^\\s]\\s[^\\s]/,\n apostrophe: /'/g,\n room: new RegExp('[' + symbols + ']'),\n};\n\nconst deapostrophe = (s: string) => {\n return s.replace(regexps.apostrophe, '');\n};\n\nconst up = String.prototype.toUpperCase;\nconst low = String.prototype.toLowerCase;\n\nconst fill = (s: string, fillWith: string, isDeapostrophe = false) => {\n s = s.replace(regexps.fill, function (m, next) {\n return next ? fillWith + next : '';\n });\n\n if (isDeapostrophe) {\n s = deapostrophe(s);\n }\n return s;\n};\n\nconst decap = (s: string, char = 0) => {\n return low.call(s.charAt(char)) + s.slice(char + 1);\n};\n\nconst relax = (\n m: string,\n before: string,\n acronym: string | undefined,\n caps: string,\n) => {\n return before + ' ' + (acronym ? acronym + ' ' : '') + caps;\n};\n\nconst prep = (s: string, isFill = false, isPascal = false, isUpper = false) => {\n s = s == undefined ? '' : s + ''; // force to string\n if (!isUpper && regexps.upper.test(s)) {\n s = low.call(s);\n }\n if (!isFill && !regexps.hole.test(s)) {\n // eslint-disable-next-line no-var\n var holey = fill(s, ' ');\n if (regexps.hole.test(holey)) {\n s = holey;\n }\n }\n if (!isPascal && !regexps.room.test(s)) {\n s = s.replace(regexps.relax, relax);\n }\n return s;\n};\n\nconst lower = (s: string, fillWith: string, isDeapostrophe: boolean) => {\n return fill(low.call(prep(s, !!fillWith)), fillWith, isDeapostrophe);\n};\n\n// Caches the previously converted strings to improve performance\nconst pascalMemory: Record<string, string> = {};\n\nexport const pascal = (s: string) => {\n if (pascalMemory[s]) {\n return pascalMemory[s];\n }\n\n const isStartWithUnderscore = s?.startsWith('_');\n\n if (regexps.upper.test(s)) {\n s = low.call(s);\n }\n\n const pascalString = (s?.match(/[a-zA-Z0-9\\u00C0-\\u017F]+/g) || [])\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join('');\n\n const pascalWithUnderscore = isStartWithUnderscore\n ? `_${pascalString}`\n : pascalString;\n\n pascalMemory[s] = pascalWithUnderscore;\n\n return pascalWithUnderscore;\n};\n\nexport const camel = (s: string) => {\n const isStartWithUnderscore = s?.startsWith('_');\n const camelString = decap(pascal(s), isStartWithUnderscore ? 1 : 0);\n return isStartWithUnderscore ? `_${camelString}` : camelString;\n};\n\nexport const snake = (s: string) => {\n return lower(s, '_', true);\n};\n\nexport const kebab = (s: string) => {\n return lower(s, '-', true);\n};\n\nexport const upper = (\n s: string,\n fillWith: string,\n isDeapostrophe?: boolean,\n) => {\n return fill(\n up.call(prep(s, !!fillWith, false, true)),\n fillWith,\n isDeapostrophe,\n );\n};\n\nexport const conventionName = (name: string, convention: NamingConvention) => {\n let nameConventionTransform = camel;\n switch (convention) {\n case NamingConvention.PASCAL_CASE: {\n nameConventionTransform = pascal;\n\n break;\n }\n case NamingConvention.SNAKE_CASE: {\n nameConventionTransform = snake;\n\n break;\n }\n case NamingConvention.KEBAB_CASE: {\n nameConventionTransform = kebab;\n\n break;\n }\n // No default\n }\n\n return nameConventionTransform(name);\n};\n","import { compare, type CompareOperator } from 'compare-versions';\n\nexport const compareVersions = (\n firstVersion: string,\n secondVersions: string,\n operator: CompareOperator = '>=',\n) => {\n if (firstVersion === 'latest' || firstVersion === '*') {\n return true;\n }\n\n return compare(\n firstVersion.replace(/(\\s(.*))/, ''),\n secondVersions,\n operator,\n );\n};\n","import type { ContextSpecs } from '../types';\n\nconst search = String.raw`\\*/`; // Find '*/'\nconst replacement = String.raw`*\\/`; // Replace With '*\\/'\n\nconst regex = new RegExp(search, 'g');\n\nexport function jsDoc(\n schema: {\n description?: string[] | string;\n deprecated?: boolean;\n summary?: string;\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: boolean;\n exclusiveMaximum?: boolean;\n minItems?: number;\n maxItems?: number;\n nullable?: boolean;\n pattern?: string;\n },\n tryOneLine = false,\n context?: ContextSpecs,\n): string {\n if (context?.output?.override?.jsDoc) {\n const { filter } = context.output.override.jsDoc;\n if (filter) {\n return keyValuePairsToJsDoc(filter(schema));\n }\n }\n const {\n description,\n deprecated,\n summary,\n minLength,\n maxLength,\n minimum,\n maximum,\n exclusiveMinimum,\n exclusiveMaximum,\n minItems,\n maxItems,\n nullable,\n pattern,\n } = schema;\n // Ensure there aren't any comment terminations in doc\n const lines = (\n Array.isArray(description)\n ? description.filter((d) => !d.includes('eslint-disable'))\n : [description || '']\n ).map((line) => line.replaceAll(regex, replacement));\n\n const count = [\n description,\n deprecated,\n summary,\n minLength?.toString(),\n maxLength?.toString(),\n minimum?.toString(),\n maximum?.toString(),\n exclusiveMinimum?.toString(),\n exclusiveMaximum?.toString(),\n minItems?.toString(),\n maxItems?.toString(),\n nullable?.toString(),\n pattern,\n ].reduce((acc, it) => (it ? acc + 1 : acc), 0);\n\n if (!count) {\n return '';\n }\n\n const oneLine = count === 1 && tryOneLine;\n const eslintDisable = Array.isArray(description)\n ? description\n .find((d) => d.includes('eslint-disable'))\n ?.replaceAll(regex, replacement)\n : undefined;\n let doc = `${eslintDisable ? `/* ${eslintDisable} */\\n` : ''}/**`;\n\n if (description) {\n if (!oneLine) {\n doc += `\\n${tryOneLine ? ' ' : ''} *`;\n }\n doc += ` ${lines.join('\\n * ')}`;\n }\n\n function appendPrefix() {\n if (!oneLine) {\n doc += `\\n${tryOneLine ? ' ' : ''} *`;\n }\n }\n\n function tryAppendStringDocLine(key: string, value?: string) {\n if (value) {\n appendPrefix();\n doc += ` @${key} ${value.replaceAll(regex, replacement)}`;\n }\n }\n\n function tryAppendBooleanDocLine(key: string, value?: boolean) {\n if (value === true) {\n appendPrefix();\n doc += ` @${key}`;\n }\n }\n\n function tryAppendNumberDocLine(key: string, value?: number) {\n if (value !== undefined) {\n appendPrefix();\n doc += ` @${key} ${value}`;\n }\n }\n\n tryAppendBooleanDocLine('deprecated', deprecated);\n tryAppendStringDocLine('summary', summary?.replaceAll(regex, replacement));\n tryAppendNumberDocLine('minLength', minLength);\n tryAppendNumberDocLine('maxLength', maxLength);\n tryAppendNumberDocLine('minimum', minimum);\n tryAppendNumberDocLine('maximum', maximum);\n tryAppendBooleanDocLine('exclusiveMinimum', exclusiveMinimum);\n tryAppendBooleanDocLine('exclusiveMaximum', exclusiveMaximum);\n tryAppendNumberDocLine('minItems', minItems);\n tryAppendNumberDocLine('maxItems', maxItems);\n tryAppendBooleanDocLine('nullable', nullable);\n tryAppendStringDocLine('pattern', pattern);\n\n doc += oneLine ? ' ' : `\\n ${tryOneLine ? ' ' : ''}`;\n\n doc += '*/\\n';\n\n return doc;\n}\n\nexport function keyValuePairsToJsDoc(\n keyValues: {\n key: string;\n value: string;\n }[],\n) {\n if (keyValues.length === 0) return '';\n let doc = '/**\\n';\n for (const { key, value } of keyValues) {\n doc += ` * @${key} ${value}\\n`;\n }\n doc += ' */\\n';\n return doc;\n}\n","import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { isModule, isObject, isString } from './assertion';\n\nexport const dynamicImport = async <T>(\n toImport: T | string,\n from = process.cwd(),\n takeDefault = true,\n): Promise<T> => {\n if (!toImport) {\n return toImport as T;\n }\n\n try {\n if (isString(toImport)) {\n const filePath = path.resolve(from, toImport);\n // use pathToFileURL to solve issue #1332.\n // https://github.com/nodejs/node/issues/31710\n const fileUrl = pathToFileURL(filePath);\n const isJson = path.extname(fileUrl.href) === '.json';\n const data = isJson\n ? await import(fileUrl.href, { with: { type: 'json' } })\n : await import(fileUrl.href);\n if (takeDefault && (isObject(data) || isModule(data)) && data.default) {\n return (data as any).default as T;\n }\n\n return data;\n }\n\n return toImport;\n } catch (error) {\n throw new Error(`Oups... 🍻. Path: ${toImport} => ${error}`);\n }\n};\n","import type { ClientMockBuilder, GlobalMockOptions } from '../types';\nimport { isFunction } from './assertion';\n\nexport const getMockFileExtensionByTypeName = (\n mock: GlobalMockOptions | ClientMockBuilder,\n) => {\n if (isFunction(mock)) {\n return 'msw';\n }\n switch (mock.type) {\n default: {\n // case 'msw':\n return 'msw';\n }\n }\n};\n","import { VERBS_WITH_BODY } from '../constants';\nimport { Verbs } from '../types';\n\nexport const getIsBodyVerb = (verb: Verbs) => VERBS_WITH_BODY.includes(verb);\n","const isObject = (obj: unknown) => obj && typeof obj === 'object';\n\nexport function mergeDeep<\n T extends Record<string, any>,\n U extends Record<string, any>,\n>(source: T, target: U): T & U {\n if (!isObject(target) || !isObject(source)) {\n return source as T & U;\n }\n\n return Object.entries(target).reduce(\n (acc, [key, value]) => {\n const sourceValue = acc[key];\n\n if (Array.isArray(sourceValue) && Array.isArray(value)) {\n (acc[key] as any) = [...sourceValue, ...value];\n } else if (isObject(sourceValue) && isObject(value)) {\n (acc[key] as any) = mergeDeep(sourceValue, value);\n } else {\n (acc[key] as any) = value;\n }\n\n return acc;\n },\n Object.assign({}, source),\n ) as T & U;\n}\n","export const count = (str = '', key: string) => {\n if (!str) {\n return 0;\n }\n\n return (str.match(new RegExp(key, 'g')) ?? []).length;\n};\n","import chalk from 'chalk';\nimport type { OpenAPIObject } from 'openapi3-ts/oas30';\nimport { type ConvertInputOptions, convertObj } from 'swagger2openapi';\n\nimport { log } from './logger';\n\nexport const openApiConverter = async (\n schema: any,\n options: Partial<ConvertInputOptions> = {},\n specKey: string,\n): Promise<OpenAPIObject> => {\n try {\n return new Promise((resolve) => {\n if (!schema.openapi && schema.swagger === '2.0') {\n convertObj(schema, options, (err, value) => {\n if (err) {\n log(chalk.yellow(`${specKey}\\n=> ${err}`));\n resolve(schema);\n } else {\n resolve(value.openapi as OpenAPIObject);\n }\n });\n } else {\n resolve(schema);\n }\n });\n } catch (error) {\n throw new Error(`Oups... 🍻.\\nPath: ${specKey}\\nParsing Error: ${error}`);\n }\n};\n","export const sortByPriority = <T>(\n arr: (T & { default?: boolean; required?: boolean })[],\n) =>\n arr.sort((a, b) => {\n if (a.default) {\n return 1;\n }\n\n if (b.default) {\n return -1;\n }\n\n if (a.required && b.required) {\n return 0;\n }\n\n if (a.required) {\n return -1;\n }\n\n if (b.required) {\n return 1;\n }\n return 0;\n });\n","import { keyword } from 'esutils';\n\nimport {\n isBoolean,\n isFunction,\n isNull,\n isNumber,\n isString,\n isUndefined,\n} from './assertion';\n\nexport const stringify = (\n data?: string | any[] | Record<string, any>,\n): string | undefined => {\n if (isUndefined(data) || isNull(data)) {\n return;\n }\n\n if (isString(data)) {\n return `'${data}'`;\n }\n\n if (isNumber(data) || isBoolean(data) || isFunction(data)) {\n return `${data}`;\n }\n\n if (Array.isArray(data)) {\n return `[${data.map(stringify).join(', ')}]`;\n }\n\n return Object.entries(data).reduce((acc, [key, value], index, arr) => {\n const strValue = stringify(value);\n if (arr.length === 1) {\n return `{ ${key}: ${strValue}, }`;\n }\n\n if (!index) {\n return `{ ${key}: ${strValue}, `;\n }\n\n if (arr.length - 1 === index) {\n return acc + `${key}: ${strValue}, }`;\n }\n\n return acc + `${key}: ${strValue}, `;\n }, '');\n};\n\nexport const sanitize = (\n value: string,\n options?: {\n whitespace?: string | true;\n underscore?: string | true;\n dot?: string | true;\n dash?: string | true;\n es5keyword?: boolean;\n es5IdentifierName?: boolean;\n special?: boolean;\n },\n) => {\n const {\n whitespace = '',\n underscore = '',\n dot = '',\n dash = '',\n es5keyword = false,\n es5IdentifierName = false,\n special = false,\n } = options ?? {};\n let newValue = value;\n\n if (!special) {\n newValue = newValue.replaceAll(\n /[!\"`'#%&,:;<>=@{}~\\$\\(\\)\\*\\+\\/\\\\\\?\\[\\]\\^\\|]/g,\n '',\n );\n }\n\n if (whitespace !== true) {\n newValue = newValue.replaceAll(/[\\s]/g, whitespace);\n }\n\n if (underscore !== true) {\n newValue = newValue.replaceAll(/['_']/g, underscore);\n }\n\n if (dot !== true) {\n newValue = newValue.replaceAll(/[.]/g, dot);\n }\n\n if (dash !== true) {\n newValue = newValue.replaceAll(/[-]/g, dash);\n }\n\n if (es5keyword) {\n newValue = keyword.isKeywordES5(newValue, true) ? `_${newValue}` : newValue;\n }\n\n if (es5IdentifierName) {\n if (/^[0-9]/.test(newValue)) {\n newValue = `N${newValue}`;\n } else {\n newValue = keyword.isIdentifierNameES5(newValue)\n ? newValue\n : `_${newValue}`;\n }\n }\n\n return newValue;\n};\n\nexport const toObjectString = <T>(props: T[], path?: keyof T) => {\n if (props.length === 0) {\n return '';\n }\n\n const arrayOfString =\n typeof path === 'string'\n ? props.map((prop) =>\n path\n .split('.')\n .reduce(\n (obj: any, key: string) =>\n obj && typeof obj === 'object' ? obj[key] : undefined,\n prop,\n ),\n )\n : props;\n\n return arrayOfString.join(',\\n ') + ',';\n};\n\nconst NUMBERS = {\n '0': 'zero',\n '1': 'one',\n '2': 'two',\n '3': 'three',\n '4': 'four',\n '5': 'five',\n '6': 'six',\n '7': 'seven',\n '8': 'eight',\n '9': 'nine',\n};\n\nexport const getNumberWord = (num: number) => {\n const arrayOfNumber = num.toString().split('') as (keyof typeof NUMBERS)[];\n return arrayOfNumber.reduce((acc, n) => acc + NUMBERS[n], '');\n};\n\nexport const escape = (str: string | null, char = \"'\") =>\n str?.replace(char, `\\\\${char}`);\n\n/**\n * Escape all characters not included in SingleStringCharacters and\n * DoubleStringCharacters on\n * http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * Based on https://github.com/joliss/js-string-escape/blob/master/index.js\n *\n * @param input String to escape\n */\nexport const jsStringEscape = (input: string) =>\n input.replaceAll(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\': {\n return '\\\\' + character;\n }\n // Four possible LineTerminator characters need to be escaped:\n case '\\n': {\n return String.raw`\\n`;\n }\n case '\\r': {\n return String.raw`\\r`;\n }\n case '\\u2028': {\n return String.raw`\\u2028`;\n }\n case '\\u2029': {\n return String.raw`\\u2029`;\n }\n default: {\n return '';\n }\n }\n });\n","import type { Tsconfig } from '../types';\n\nexport const isSyntheticDefaultImportsAllow = (config?: Tsconfig) => {\n if (!config) {\n return true;\n }\n\n return !!(\n config?.compilerOptions?.allowSyntheticDefaultImports ??\n config?.compilerOptions?.esModuleInterop\n );\n};\n","// @ts-expect-error no types exists for this package :(\nimport ibmOpenapiRuleset from '@ibm-cloud/openapi-ruleset';\nimport { Spectral } from '@stoplight/spectral-core';\nimport type { OpenAPIObject } from 'openapi3-ts/oas30';\n\nimport {\n ibmOpenapiValidatorErrors,\n ibmOpenapiValidatorWarnings,\n} from './logger';\n\n/**\n * Validate the spec with ibm-openapi-validator (with a custom pretty logger).\n * More information: https://github.com/IBM/openapi-validator/#configuration\n * @param specs openAPI spec\n */\nexport const ibmOpenapiValidator = async (\n specs: OpenAPIObject,\n validation: boolean | object,\n) => {\n const ruleset =\n typeof validation === 'boolean' ? ibmOpenapiRuleset : validation;\n const spectral = new Spectral();\n spectral.setRuleset(ruleset);\n const results = await spectral.run(\n specs as unknown as Record<string, unknown>,\n );\n\n const errors: { message: string; path: string[] }[] = [];\n const warnings: { message: string; path: string[] }[] = [];\n\n for (const { severity, message, path } of results) {\n const entry = { message, path: path.map((x) => x.toString()) };\n // 0: error, 1: \"warning\", see: https://github.com/IBM/openapi-validator/blob/a93e18a156108b6b946727d0b24bbcc69095b72e/packages/validator/src/spectral/spectral-validator.js#L222\n switch (severity) {\n case 0: {\n errors.push(entry);\n break;\n }\n case 1: {\n warnings.push(entry);\n break;\n }\n }\n }\n\n if (warnings.length > 0) {\n ibmOpenapiValidatorWarnings(warnings);\n }\n\n if (errors.length > 0) {\n ibmOpenapiValidatorErrors(errors);\n throw new Error('Spec validation failed');\n }\n};\n","import { keyword } from 'esutils';\nimport type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { EnumGeneration, NamingConvention } from '../types';\nimport { conventionName, isNumeric, sanitize } from '../utils';\n\nexport const getEnumNames = (schemaObject: SchemaObject | undefined) => {\n return (\n schemaObject?.['x-enumNames'] ||\n schemaObject?.['x-enumnames'] ||\n schemaObject?.['x-enum-varnames']\n );\n};\n\nexport const getEnumDescriptions = (schemaObject: SchemaObject | undefined) => {\n return (\n schemaObject?.['x-enumDescriptions'] ||\n schemaObject?.['x-enumdescriptions'] ||\n schemaObject?.['x-enum-descriptions']\n );\n};\n\nexport const getEnum = (\n value: string,\n enumName: string,\n names: string[] | undefined,\n enumGenerationType: EnumGeneration,\n descriptions?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n if (enumGenerationType === EnumGeneration.CONST)\n return getTypeConstEnum(\n value,\n enumName,\n names,\n descriptions,\n enumNamingConvention,\n );\n if (enumGenerationType === EnumGeneration.ENUM)\n return getNativeEnum(value, enumName, names, enumNamingConvention);\n if (enumGenerationType === EnumGeneration.UNION)\n return getUnion(value, enumName);\n throw new Error(`Invalid enumGenerationType: ${enumGenerationType}`);\n};\n\nconst getTypeConstEnum = (\n value: string,\n enumName: string,\n names?: string[],\n descriptions?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n let enumValue = `export type ${enumName} = typeof ${enumName}[keyof typeof ${enumName}]`;\n\n if (value.endsWith(' | null')) {\n value = value.replace(' | null', '');\n enumValue += ' | null';\n }\n\n enumValue += ';\\n';\n\n const implementation = getEnumImplementation(\n value,\n names,\n descriptions,\n enumNamingConvention,\n );\n\n enumValue += '\\n\\n';\n\n enumValue += '// eslint-disable-next-line @typescript-eslint/no-redeclare\\n';\n\n enumValue += `export const ${enumName} = {\\n${implementation}} as const;\\n`;\n\n return enumValue;\n};\n\nexport const getEnumImplementation = (\n value: string,\n names?: string[],\n descriptions?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n // empty enum or null-only enum\n if (value === '') return '';\n\n return [...new Set(value.split(' | '))].reduce((acc, val, index) => {\n const name = names?.[index];\n const description = descriptions?.[index];\n const comment = description ? ` /** ${description} */\\n` : '';\n\n if (name) {\n return (\n acc +\n comment +\n ` ${keyword.isIdentifierNameES5(name) ? name : `'${name}'`}: ${val},\\n`\n );\n }\n\n let key = val.startsWith(\"'\") ? val.slice(1, -1) : val;\n\n const isNumber = isNumeric(key);\n\n if (isNumber) {\n key = toNumberKey(key);\n }\n\n if (key.length > 1) {\n key = sanitize(key, {\n whitespace: '_',\n underscore: true,\n dash: true,\n special: true,\n });\n }\n\n if (enumNamingConvention) {\n key = conventionName(key, enumNamingConvention);\n }\n\n return (\n acc +\n comment +\n ` ${keyword.isIdentifierNameES5(key) ? key : `'${key}'`}: ${val},\\n`\n );\n }, '');\n};\n\nconst getNativeEnum = (\n value: string,\n enumName: string,\n names?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n const enumItems = getNativeEnumItems(value, names, enumNamingConvention);\n const enumValue = `export enum ${enumName} {\\n${enumItems}\\n}`;\n\n return enumValue;\n};\n\nconst getNativeEnumItems = (\n value: string,\n names?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n if (value === '') return '';\n\n return [...new Set(value.split(' | '))].reduce((acc, val, index) => {\n const name = names?.[index];\n if (name) {\n return (\n acc +\n ` ${keyword.isIdentifierNameES5(name) ? name : `'${name}'`}= ${val},\\n`\n );\n }\n\n let key = val.startsWith(\"'\") ? val.slice(1, -1) : val;\n\n const isNumber = isNumeric(key);\n\n if (isNumber) {\n key = toNumberKey(key);\n }\n\n if (key.length > 1) {\n key = sanitize(key, {\n whitespace: '_',\n underscore: true,\n dash: true,\n special: true,\n });\n }\n\n if (enumNamingConvention) {\n key = conventionName(key, enumNamingConvention);\n }\n\n return (\n acc +\n ` ${keyword.isIdentifierNameES5(key) ? key : `'${key}'`}= ${val},\\n`\n );\n }, '');\n};\n\nconst toNumberKey = (value: string) => {\n if (value.startsWith('-')) {\n return `NUMBER_MINUS_${value.slice(1)}`;\n }\n if (value.startsWith('+')) {\n return `NUMBER_PLUS_${value.slice(1)}`;\n }\n return `NUMBER_${value}`;\n};\n\nconst getUnion = (value: string, enumName: string) => {\n return `export type ${enumName} = ${value};`;\n};\n","import type { ReferenceObject } from 'openapi3-ts/oas30';\n\nimport type { ContextSpecs, NormalizedOverrideOutput } from '../types';\nimport { getFileInfo, isUrl, pascal, sanitize, upath } from '../utils';\n\ntype RefComponent = 'schemas' | 'responses' | 'parameters' | 'requestBodies';\n\nconst RefComponent = {\n schemas: 'schemas' as RefComponent,\n responses: 'responses' as RefComponent,\n parameters: 'parameters' as RefComponent,\n requestBodies: 'requestBodies' as RefComponent,\n};\n\nexport const RefComponentSuffix: Record<RefComponent, string> = {\n schemas: '',\n responses: 'Response',\n parameters: 'Parameter',\n requestBodies: 'Body',\n};\n\nconst regex = new RegExp('~1', 'g');\n\nconst resolveUrl = (from: string, to: string): string => {\n const resolvedUrl = new URL(to, new URL(from, 'resolve://'));\n if (resolvedUrl.protocol === 'resolve:') {\n // `from` is a relative URL.\n const { pathname, search, hash } = resolvedUrl;\n return pathname + search + hash;\n }\n return resolvedUrl.toString();\n};\n\nexport interface RefInfo {\n name: string;\n originalName: string;\n refPaths?: string[];\n specKey?: string;\n}\n/**\n * Return the output type from the $ref\n *\n * @param $ref\n */\nexport const getRefInfo = (\n $ref: ReferenceObject['$ref'],\n context: ContextSpecs,\n): RefInfo => {\n const [pathname, ref] = $ref.split('#');\n\n const refPaths = ref\n ?.slice(1)\n .split('/')\n .map((part) => decodeURIComponent(part.replaceAll(regex, '/')));\n\n const getOverrideSuffix = (\n override: NormalizedOverrideOutput,\n paths: string[],\n ) => {\n const firstLevel = override[paths[0] as keyof NormalizedOverrideOutput];\n if (!firstLevel) return '';\n\n const secondLevel = (firstLevel as Record<string, { suffix?: string }>)[\n paths[1]\n ];\n return secondLevel?.suffix ?? '';\n };\n\n const suffix = refPaths\n ? getOverrideSuffix(context.output.override, refPaths)\n : '';\n\n const originalName = ref\n ? refPaths[refPaths.length - 1]\n : upath.getSchemaFileName(pathname);\n\n if (!pathname) {\n return {\n name: sanitize(pascal(originalName) + suffix, {\n es5keyword: true,\n es5IdentifierName: true,\n underscore: true,\n dash: true,\n }),\n originalName,\n refPaths,\n };\n }\n\n const path = isUrl(context.specKey)\n ? resolveUrl(context.specKey, pathname)\n : upath.resolve(getFileInfo(context.specKey).dirname, pathname);\n\n return {\n name: sanitize(pascal(originalName) + suffix, {\n es5keyword: true,\n es5IdentifierName: true,\n underscore: true,\n dash: true,\n }),\n originalName,\n specKey: path,\n refPaths,\n };\n};\n","import type {\n ExampleObject,\n ParameterObject,\n ReferenceObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n} from 'openapi3-ts/oas30';\n\nimport { getRefInfo, type RefInfo } from '../getters/ref';\nimport type { ContextSpecs, GeneratorImport } from '../types';\nimport { isReference } from '../utils';\n\ntype ComponentObject =\n | SchemaObject\n | ResponseObject\n | ParameterObject\n | RequestBodyObject\n | ReferenceObject;\nexport const resolveRef = <Schema extends ComponentObject = ComponentObject>(\n schema: ComponentObject,\n context: ContextSpecs,\n imports: GeneratorImport[] = [],\n): {\n schema: Schema;\n imports: GeneratorImport[];\n} => {\n // the schema is referring to another object\n if ((schema as any)?.schema?.$ref) {\n const resolvedRef = resolveRef<Schema>(\n (schema as any)?.schema,\n context,\n imports,\n );\n if ('examples' in schema) {\n schema.examples = resolveExampleRefs(schema.examples, context);\n }\n if ('examples' in resolvedRef.schema) {\n resolvedRef.schema.examples = resolveExampleRefs(\n resolvedRef.schema.examples,\n context,\n );\n }\n return {\n schema: {\n ...schema,\n schema: resolvedRef.schema,\n } as Schema,\n imports,\n };\n }\n\n if (!isReference(schema)) {\n if ('examples' in schema) {\n schema.examples = resolveExampleRefs(schema.examples, context);\n }\n return { schema: schema as Schema, imports };\n }\n\n const {\n currentSchema,\n refInfo: { specKey, name, originalName },\n } = getSchema(schema, context);\n\n if (!currentSchema) {\n throw new Error(`Oops... 🍻. Ref not found: ${schema.$ref}`);\n }\n\n return resolveRef<Schema>(\n currentSchema,\n { ...context, specKey: specKey || context.specKey },\n [...imports, { name, specKey, schemaName: originalName }],\n );\n};\n\nfunction getSchema<Schema extends ComponentObject = ComponentObject>(\n schema: ReferenceObject,\n context: ContextSpecs,\n): {\n refInfo: RefInfo;\n currentSchema: Schema | undefined;\n} {\n const refInfo = getRefInfo(schema.$ref, context);\n\n const { specKey, refPaths } = refInfo;\n\n let schemaByRefPaths: Schema | undefined =\n refPaths && Array.isArray(refPaths)\n ? refPaths.reduce(\n (obj: any, key: string) => (obj && key in obj ? obj[key] : undefined),\n context.specs[specKey || context.specKey],\n )\n : undefined;\n\n if (!schemaByRefPaths) {\n schemaByRefPaths = context.specs?.[\n specKey || context.specKey\n ] as unknown as Schema;\n }\n\n if (isReference(schemaByRefPaths)) {\n return getSchema(schemaByRefPaths, context);\n }\n const currentSchema = schemaByRefPaths\n ? schemaByRefPaths\n : (context.specs[specKey || context.specKey] as unknown as Schema);\n return {\n currentSchema,\n refInfo,\n };\n}\n\ntype Example = ExampleObject | ReferenceObject;\ntype Examples = Example[] | Record<string, Example> | undefined;\nexport const resolveExampleRefs = (\n examples: Examples,\n context: ContextSpecs,\n): Examples => {\n if (!examples) {\n return undefined;\n }\n return Array.isArray(examples)\n ? examples.map((example) => {\n if (isReference(example)) {\n const { schema } = resolveRef<ExampleObject>(example, context);\n return schema.value;\n }\n return example;\n })\n : Object.entries(examples).reduce((acc, [key, example]) => {\n let schema = example;\n if (isReference(example)) {\n schema = resolveRef<ExampleObject>(example, context).schema.value;\n }\n return {\n ...acc,\n [key]: schema,\n };\n }, {});\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getScalar } from '../getters';\nimport { type ContextSpecs, type ResolverValue, SchemaType } from '../types';\nimport { isReference } from '../utils';\nimport { resolveRef } from './ref';\n\nexport const resolveValue = ({\n schema,\n name,\n context,\n}: {\n schema: SchemaObject | ReferenceObject;\n name?: string;\n context: ContextSpecs;\n}): ResolverValue => {\n if (isReference(schema)) {\n const { schema: schemaObject, imports } = resolveRef<SchemaObject>(\n schema,\n context,\n );\n\n const resolvedImport = imports[0];\n\n const importSpecKey =\n resolvedImport.specKey ||\n (context.specKey === context.target ? undefined : context.specKey);\n\n let hasReadonlyProps = false;\n\n // Avoid infinite loop\n if (!name || !context.parents?.includes(name)) {\n const scalar = getScalar({\n item: schemaObject,\n name: resolvedImport.name,\n context: {\n ...context,\n specKey: importSpecKey || context.specKey,\n ...(name ? { parents: [...(context.parents || []), name] } : {}),\n },\n });\n\n hasReadonlyProps = scalar.hasReadonlyProps;\n }\n\n return {\n value: resolvedImport.name,\n imports: [\n {\n name: resolvedImport.name,\n specKey: importSpecKey,\n schemaName: resolvedImport.schemaName,\n },\n ],\n type: (schemaObject?.type as SchemaType) || 'object',\n schemas: [],\n isEnum: !!schemaObject?.enum,\n originalSchema: schemaObject,\n hasReadonlyProps,\n isRef: true,\n };\n }\n\n const scalar = getScalar({ item: schema, name, context });\n\n return {\n ...scalar,\n originalSchema: schema,\n isRef: false,\n };\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getEnum, getEnumDescriptions, getEnumNames } from '../getters/enum';\nimport type { ContextSpecs, ResolverValue } from '../types';\nimport { jsDoc } from '../utils';\nimport { resolveValue } from './value';\n\nconst resolveObjectOriginal = ({\n schema,\n propName,\n combined = false,\n context,\n}: {\n schema: SchemaObject | ReferenceObject;\n propName?: string;\n combined?: boolean;\n context: ContextSpecs;\n}): ResolverValue => {\n const resolvedValue = resolveValue({\n schema,\n name: propName,\n context,\n });\n const doc = jsDoc(resolvedValue.originalSchema ?? {});\n\n if (\n propName &&\n !resolvedValue.isEnum &&\n resolvedValue?.type === 'object' &&\n new RegExp(/{|&|\\|/).test(resolvedValue.value)\n ) {\n let model = '';\n const isConstant = 'const' in schema;\n const constantIsString =\n 'type' in schema &&\n (schema.type === 'string' ||\n (Array.isArray(schema.type) && schema.type.includes('string')));\n\n model += isConstant\n ? `${doc}export const ${propName} = ${constantIsString ? `'${schema.const}'` : schema.const} as const;\\n`\n : `${doc}export type ${propName} = ${resolvedValue.value};\\n`;\n\n return {\n value: propName,\n imports: [{ name: propName, isConstant }],\n schemas: [\n ...resolvedValue.schemas,\n {\n name: propName,\n model,\n imports: resolvedValue.imports,\n },\n ],\n isEnum: false,\n type: 'object',\n originalSchema: resolvedValue.originalSchema,\n isRef: resolvedValue.isRef,\n hasReadonlyProps: resolvedValue.hasReadonlyProps,\n };\n }\n\n if (propName && resolvedValue.isEnum && !combined && !resolvedValue.isRef) {\n const enumValue = getEnum(\n resolvedValue.value,\n propName,\n getEnumNames(resolvedValue.originalSchema),\n context.output.override.enumGenerationType,\n getEnumDescriptions(resolvedValue.originalSchema),\n context.output.override.namingConvention?.enum,\n );\n\n return {\n value: propName,\n imports: [{ name: propName }],\n schemas: [\n ...resolvedValue.schemas,\n {\n name: propName,\n model: doc + enumValue,\n imports: resolvedValue.imports,\n },\n ],\n isEnum: false,\n type: 'enum',\n originalSchema: resolvedValue.originalSchema,\n isRef: resolvedValue.isRef,\n hasReadonlyProps: resolvedValue.hasReadonlyProps,\n };\n }\n\n return resolvedValue;\n};\n\nconst resolveObjectCacheMap = new Map<string, ResolverValue>();\n\nexport const resolveObject = ({\n schema,\n propName,\n combined = false,\n context,\n}: {\n schema: SchemaObject | ReferenceObject;\n propName?: string;\n combined?: boolean;\n context: ContextSpecs;\n}): ResolverValue => {\n const hashKey = JSON.stringify({\n schema,\n propName,\n combined,\n specKey: context.specKey,\n });\n\n if (resolveObjectCacheMap.has(hashKey)) {\n return resolveObjectCacheMap.get(hashKey)!;\n }\n\n const result = resolveObjectOriginal({\n schema,\n propName,\n combined,\n context,\n });\n\n resolveObjectCacheMap.set(hashKey, result);\n\n return result;\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\nimport type { SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';\n\nimport { resolveExampleRefs } from '../resolvers';\nimport { resolveObject } from '../resolvers/object';\nimport type { ContextSpecs, ScalarValue } from '../types';\nimport { compareVersions } from '../utils';\n\n/**\n * Return the output type from an array\n *\n * @param item item with type === \"array\"\n */\nexport const getArray = ({\n schema,\n name,\n context,\n}: {\n schema: SchemaObject;\n name?: string;\n context: ContextSpecs;\n}): ScalarValue => {\n const schema31 = schema as SchemaObject31;\n if (schema31.prefixItems) {\n const resolvedObjects = schema31.prefixItems.map((item, index) =>\n resolveObject({\n schema: item as SchemaObject | ReferenceObject,\n propName:\n name + context.output.override.components.schemas.itemSuffix + index,\n context,\n }),\n );\n if (schema31.items) {\n const additional = resolveObject({\n schema: schema31.items as SchemaObject | ReferenceObject,\n propName:\n name +\n context.output.override.components.schemas.itemSuffix +\n 'Additional',\n context,\n });\n resolvedObjects.push({\n ...additional,\n value: `...${additional.value}[]`,\n });\n }\n return {\n type: 'array',\n isEnum: false,\n isRef: false,\n value: `[${resolvedObjects.map((o) => o.value).join(', ')}]`,\n imports: resolvedObjects.flatMap((o) => o.imports),\n schemas: resolvedObjects.flatMap((o) => o.schemas),\n hasReadonlyProps: resolvedObjects.some((o) => o.hasReadonlyProps),\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n }\n if (schema.items) {\n const resolvedObject = resolveObject({\n schema: schema.items,\n propName: name + context.output.override.components.schemas.itemSuffix,\n context,\n });\n return {\n value: `${\n schema.readOnly === true &&\n !context.output.override.suppressReadonlyModifier\n ? 'readonly '\n : ''\n }${\n resolvedObject.value.includes('|')\n ? `(${resolvedObject.value})[]`\n : `${resolvedObject.value}[]`\n }`,\n imports: resolvedObject.imports,\n schemas: resolvedObject.schemas,\n isEnum: false,\n type: 'array',\n isRef: false,\n hasReadonlyProps: resolvedObject.hasReadonlyProps,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n } else if (\n compareVersions(context.specs[context.specKey].openapi, '3.1', '>=')\n ) {\n return {\n value: 'unknown[]',\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'array',\n isRef: false,\n hasReadonlyProps: false,\n };\n } else {\n throw new Error(\n `All arrays must have an \\`items\\` key defined (name=${name}, schema=${JSON.stringify(schema)})`,\n );\n }\n};\n","import { keyword } from 'esutils';\nimport type { ValueIteratee } from 'lodash';\nimport uniqBy from 'lodash.uniqby';\nimport type {\n MediaTypeObject,\n ReferenceObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n} from 'openapi3-ts/oas30';\n\nimport { resolveObject } from '../resolvers/object';\nimport { resolveExampleRefs, resolveRef } from '../resolvers/ref';\nimport {\n type ContextSpecs,\n FormDataArrayHandling,\n type GeneratorImport,\n type ResReqTypesValue,\n} from '../types';\nimport { camel } from '../utils';\nimport { isReference } from '../utils/assertion';\nimport { pascal } from '../utils/case';\nimport { getNumberWord } from '../utils/string';\n\nconst formDataContentTypes = new Set(['multipart/form-data']);\n\nconst formUrlEncodedContentTypes = new Set([\n 'application/x-www-form-urlencoded',\n]);\n\nconst getResReqContentTypes = ({\n mediaType,\n propName,\n context,\n}: {\n mediaType: MediaTypeObject;\n propName?: string;\n context: ContextSpecs;\n}) => {\n if (!mediaType.schema) {\n return;\n }\n\n const resolvedObject = resolveObject({\n schema: mediaType.schema,\n propName,\n context,\n });\n\n return resolvedObject;\n};\n\nexport const getResReqTypes = (\n responsesOrRequests: [\n string,\n ResponseObject | ReferenceObject | RequestBodyObject,\n ][],\n name: string,\n context: ContextSpecs,\n defaultType = 'unknown',\n uniqueKey: ValueIteratee<ResReqTypesValue> = 'value',\n): ResReqTypesValue[] => {\n const typesArray = responsesOrRequests\n .filter(([_, res]) => Boolean(res))\n .map(([key, res]) => {\n if (isReference(res)) {\n const {\n schema: bodySchema,\n imports: [{ name, specKey, schemaName }],\n } = resolveRef<RequestBodyObject | ResponseObject>(res, context);\n\n const [contentType, mediaType] =\n Object.entries(bodySchema.content ?? {})[0] ?? [];\n\n const isFormData = formDataContentTypes.has(contentType);\n const isFormUrlEncoded = formUrlEncodedContentTypes.has(contentType);\n\n if ((!isFormData && !isFormUrlEncoded) || !mediaType?.schema) {\n return [\n {\n value: name,\n imports: [{ name, specKey, schemaName }],\n schemas: [],\n type: 'unknown',\n isEnum: false,\n isRef: true,\n hasReadonlyProps: false,\n originalSchema: mediaType?.schema,\n example: mediaType?.example,\n examples: resolveExampleRefs(mediaType?.examples, context),\n key,\n contentType,\n },\n ] as ResReqTypesValue[];\n }\n\n const formData = isFormData\n ? getSchemaFormDataAndUrlEncoded({\n name,\n schemaObject: mediaType?.schema,\n context: {\n ...context,\n specKey: specKey || context.specKey,\n },\n isRequestBodyOptional:\n // Even though required is false by default, we only consider required to be false if specified. (See pull 1277)\n 'required' in bodySchema && bodySchema.required === false,\n isRef: true,\n })\n : undefined;\n\n const formUrlEncoded = isFormUrlEncoded\n ? getSchemaFormDataAndUrlEncoded({\n name,\n schemaObject: mediaType?.schema,\n context: {\n ...context,\n specKey: specKey || context.specKey,\n },\n isRequestBodyOptional:\n 'required' in bodySchema && bodySchema.required === false,\n isUrlEncoded: true,\n isRef: true,\n })\n : undefined;\n\n const additionalImports = getFormDataAdditionalImports({\n schemaObject: mediaType?.schema,\n context: {\n ...context,\n specKey: specKey || context.specKey,\n },\n });\n\n return [\n {\n value: name,\n imports: [{ name, specKey, schemaName }, ...additionalImports],\n schemas: [],\n type: 'unknown',\n isEnum: false,\n hasReadonlyProps: false,\n formData,\n formUrlEncoded,\n isRef: true,\n originalSchema: mediaType?.schema,\n example: mediaType.example,\n examples: resolveExampleRefs(mediaType.examples, context),\n key,\n contentType,\n },\n ] as ResReqTypesValue[];\n }\n\n if (res.content) {\n const contents = Object.entries(res.content).map(\n ([contentType, mediaType], index, arr) => {\n let propName = key ? pascal(name) + pascal(key) : undefined;\n\n if (propName && arr.length > 1) {\n propName = propName + pascal(getNumberWord(index + 1));\n }\n\n const resolvedValue = getResReqContentTypes({\n mediaType,\n propName,\n context,\n });\n\n if (!resolvedValue) {\n return;\n }\n\n const isFormData = formDataContentTypes.has(contentType);\n const isFormUrlEncoded =\n formUrlEncodedContentTypes.has(contentType);\n\n if ((!isFormData && !isFormUrlEncoded) || !propName) {\n return {\n ...resolvedValue,\n imports: resolvedValue.imports,\n contentType,\n example: mediaType.example,\n examples: resolveExampleRefs(mediaType.examples, context),\n };\n }\n\n const formData = isFormData\n ? getSchemaFormDataAndUrlEncoded({\n name: propName,\n schemaObject: mediaType.schema!,\n context,\n isRequestBodyOptional:\n 'required' in res && res.required === false,\n })\n : undefined;\n\n const formUrlEncoded = isFormUrlEncoded\n ? getSchemaFormDataAndUrlEncoded({\n name: propName,\n schemaObject: mediaType.schema!,\n context,\n isUrlEncoded: true,\n isRequestBodyOptional:\n 'required' in res && res.required === false,\n })\n : undefined;\n\n const additionalImports = getFormDataAdditionalImports({\n schemaObject: mediaType.schema!,\n context,\n });\n return {\n ...resolvedValue,\n imports: [...resolvedValue.imports, ...additionalImports],\n formData,\n formUrlEncoded,\n contentType,\n example: mediaType.example,\n examples: resolveExampleRefs(mediaType.examples, context),\n };\n },\n );\n\n return contents\n .filter(Boolean)\n .map((x) => ({ ...x, key })) as ResReqTypesValue[];\n }\n\n return [\n {\n value: defaultType,\n imports: [],\n schemas: [],\n type: defaultType,\n isEnum: false,\n key,\n isRef: false,\n hasReadonlyProps: false,\n contentType: 'application/json',\n },\n ] as ResReqTypesValue[];\n });\n\n return uniqBy(typesArray.flat(), uniqueKey);\n};\n\nconst getFormDataAdditionalImports = ({\n schemaObject,\n context,\n}: {\n schemaObject: SchemaObject | ReferenceObject;\n context: ContextSpecs;\n}): GeneratorImport[] => {\n const { schema } = resolveRef<SchemaObject>(schemaObject, context);\n\n if (schema.type !== 'object') {\n return [];\n }\n\n const combinedSchemas = schema.oneOf || schema.anyOf;\n\n if (!combinedSchemas) {\n return [];\n }\n\n return combinedSchemas\n .map((schema) => resolveRef<SchemaObject>(schema, context).imports[0])\n .filter(Boolean);\n};\n\nconst getSchemaFormDataAndUrlEncoded = ({\n name,\n schemaObject,\n context,\n isRequestBodyOptional,\n isUrlEncoded,\n isRef,\n}: {\n name: string;\n schemaObject: SchemaObject | ReferenceObject;\n context: ContextSpecs;\n isRequestBodyOptional: boolean;\n isUrlEncoded?: boolean;\n isRef?: boolean;\n}): string => {\n const { schema, imports } = resolveRef<SchemaObject>(schemaObject, context);\n const propName = camel(\n !isRef && isReference(schemaObject) ? imports[0].name : name,\n );\n const additionalImports: GeneratorImport[] = [];\n\n const variableName = isUrlEncoded ? 'formUrlEncoded' : 'formData';\n let form = isUrlEncoded\n ? `const ${variableName} = new URLSearchParams();\\n`\n : `const ${variableName} = new FormData();\\n`;\n\n const combinedSchemas = schema.oneOf || schema.anyOf || schema.allOf;\n if (\n schema.type === 'object' ||\n (schema.type === undefined && combinedSchemas)\n ) {\n if (combinedSchemas) {\n const shouldCast = !!schema.oneOf || !!schema.anyOf;\n\n const combinedSchemasFormData = combinedSchemas!\n .map((schema) => {\n const { schema: combinedSchema, imports } = resolveRef<SchemaObject>(\n schema,\n context,\n );\n\n let newPropName = propName;\n let newPropDefinition = '';\n\n // If the schema is a union type (oneOf, anyOf) and includes a reference (has imports),\n // we need to cast the property to the specific type to avoid TypeScript errors.\n if (shouldCast && imports[0]) {\n additionalImports.push(imports[0]);\n newPropName = `${propName}${pascal(imports[0].name)}`;\n newPropDefinition = `const ${newPropName} = (${propName} as ${imports[0].name}${isRequestBodyOptional ? ' | undefined' : ''});\\n`;\n }\n\n return (\n newPropDefinition +\n resolveSchemaPropertiesToFormData({\n schema: combinedSchema,\n variableName,\n propName: newPropName,\n context,\n isRequestBodyOptional,\n })\n );\n })\n .filter(Boolean)\n .join('\\n');\n\n form += combinedSchemasFormData;\n }\n\n if (schema.properties) {\n const formDataValues = resolveSchemaPropertiesToFormData({\n schema,\n variableName,\n propName,\n context,\n isRequestBodyOptional,\n });\n\n form += formDataValues;\n }\n\n return form;\n }\n\n if (schema.type === 'array') {\n let valueStr = 'value';\n if (schema.items) {\n const { schema: itemSchema } = resolveRef<SchemaObject>(\n schema.items,\n context,\n );\n if (itemSchema.type === 'object' || itemSchema.type === 'array') {\n valueStr = 'JSON.stringify(value)';\n } else if (\n itemSchema.type === 'number' ||\n itemSchema.type === 'integer' ||\n itemSchema.type === 'boolean'\n ) {\n valueStr = 'value.toString()';\n }\n }\n\n return `${form}${propName}.forEach(value => ${variableName}.append('data', ${valueStr}))\\n`;\n }\n\n if (\n schema.type === 'number' ||\n schema.type === 'integer' ||\n schema.type === 'boolean'\n ) {\n return `${form}${variableName}.append('data', ${propName}.toString())\\n`;\n }\n\n return `${form}${variableName}.append('data', ${propName})\\n`;\n};\n\nconst resolveSchemaPropertiesToFormData = ({\n schema,\n variableName,\n propName,\n context,\n isRequestBodyOptional,\n keyPrefix = '',\n depth = 0,\n}: {\n schema: SchemaObject;\n variableName: string;\n propName: string;\n context: ContextSpecs;\n isRequestBodyOptional: boolean;\n keyPrefix?: string;\n depth?: number;\n}) => {\n const formDataValues = Object.entries(schema.properties ?? {}).reduce(\n (acc, [key, value]) => {\n const { schema: property } = resolveRef<SchemaObject>(value, context);\n\n // Skip readOnly properties for formData\n if (property.readOnly) {\n return acc;\n }\n\n let formDataValue = '';\n\n const formattedKeyPrefix = isRequestBodyOptional\n ? keyword.isIdentifierNameES5(key)\n ? '?'\n : '?.'\n : '';\n const formattedKey = keyword.isIdentifierNameES5(key)\n ? `.${key}`\n : `['${key}']`;\n\n const valueKey = `${propName}${formattedKeyPrefix}${formattedKey}`;\n const nonOptionalValueKey = `${propName}${formattedKey}`;\n\n if (property.type === 'object') {\n formDataValue =\n context.output.override.formData.arrayHandling ===\n FormDataArrayHandling.EXPLODE\n ? resolveSchemaPropertiesToFormData({\n schema: property,\n variableName,\n propName: nonOptionalValueKey,\n context,\n isRequestBodyOptional,\n keyPrefix: `${keyPrefix}${key}.`,\n depth: depth + 1,\n })\n : `${variableName}.append(\\`${keyPrefix}${key}\\`, JSON.stringify(${nonOptionalValueKey}));\\n`;\n } else if (property.type === 'array') {\n let valueStr = 'value';\n let hasNonPrimitiveChild = false;\n if (property.items) {\n const { schema: itemSchema } = resolveRef<SchemaObject>(\n property.items,\n context,\n );\n if (itemSchema.type === 'object' || itemSchema.type === 'array') {\n if (\n context.output.override.formData.arrayHandling ===\n FormDataArrayHandling.EXPLODE\n ) {\n hasNonPrimitiveChild = true;\n const resolvedValue = resolveSchemaPropertiesToFormData({\n schema: itemSchema,\n variableName,\n propName: 'value',\n context,\n isRequestBodyOptional,\n keyPrefix: `${keyPrefix}${key}[\\${index${depth > 0 ? depth : ''}}].`,\n depth: depth + 1,\n });\n formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ''}) => {\n ${resolvedValue}});\\n`;\n } else {\n valueStr = 'JSON.stringify(value)';\n }\n } else if (\n itemSchema.type === 'number' ||\n itemSchema.type?.includes('number') ||\n itemSchema.type === 'integer' ||\n itemSchema.type?.includes('integer') ||\n itemSchema.type === 'boolean' ||\n itemSchema.type?.includes('boolean')\n ) {\n valueStr = 'value.toString()';\n }\n }\n if (\n context.output.override.formData.arrayHandling ===\n FormDataArrayHandling.EXPLODE\n ) {\n if (!hasNonPrimitiveChild) {\n formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ''}) => ${variableName}.append(\\`${keyPrefix}${key}[\\${index${depth > 0 ? depth : ''}}]\\`, ${valueStr}));\\n`;\n }\n } else {\n formDataValue = `${valueKey}.forEach(value => ${variableName}.append(\\`${keyPrefix}${key}${context.output.override.formData.arrayHandling === FormDataArrayHandling.SERIALIZE_WITH_BRACKETS ? '[]' : ''}\\`, ${valueStr}));\\n`;\n }\n } else if (\n property.type === 'number' ||\n property.type?.includes('number') ||\n property.type === 'integer' ||\n property.type?.includes('integer') ||\n property.type === 'boolean' ||\n property.type?.includes('boolean')\n ) {\n formDataValue = `${variableName}.append(\\`${keyPrefix}${key}\\`, ${nonOptionalValueKey}.toString())\\n`;\n } else {\n formDataValue = `${variableName}.append(\\`${keyPrefix}${key}\\`, ${nonOptionalValueKey})\\n`;\n }\n\n let existSubSchemaNullable = false;\n if (property.allOf || property.anyOf || property.oneOf) {\n const combine = property.allOf || property.anyOf || property.oneOf;\n const subSchemas = combine?.map((c) =>\n resolveObject({ schema: c, combined: true, context: context }),\n );\n if (\n subSchemas?.some((subSchema) => {\n return ['number', 'integer', 'boolean'].includes(subSchema.type);\n })\n ) {\n formDataValue = `${variableName}.append(\\`${key}\\`, ${nonOptionalValueKey}.toString())\\n`;\n }\n\n if (\n subSchemas?.some((subSchema) => {\n return subSchema.type === 'null';\n })\n ) {\n existSubSchemaNullable = true;\n }\n }\n\n const isRequired =\n schema.required?.includes(key) && !isRequestBodyOptional;\n\n if (\n property.nullable ||\n property.type?.includes('null') ||\n existSubSchemaNullable\n ) {\n if (isRequired) {\n return acc + `if(${valueKey} !== null) {\\n ${formDataValue} }\\n`;\n }\n\n return (\n acc +\n `if(${valueKey} !== undefined && ${nonOptionalValueKey} !== null) {\\n ${formDataValue} }\\n`\n );\n }\n\n if (isRequired) {\n return acc + formDataValue;\n }\n\n return acc + `if(${valueKey} !== undefined) {\\n ${formDataValue} }\\n`;\n },\n '',\n );\n\n return formDataValues;\n};\n","import type { ReferenceObject, RequestBodyObject } from 'openapi3-ts/oas30';\n\nimport { generalJSTypesWithArray } from '../constants';\nimport { resolveRef } from '../resolvers';\nimport type {\n ContextSpecs,\n GetterBody,\n OverrideOutputContentType,\n} from '../types';\nimport { camel, isReference, sanitize } from '../utils';\nimport { getResReqTypes } from './res-req-types';\n\nexport const getBody = ({\n requestBody,\n operationName,\n context,\n contentType,\n}: {\n requestBody: ReferenceObject | RequestBodyObject;\n operationName: string;\n context: ContextSpecs;\n contentType?: OverrideOutputContentType;\n}): GetterBody => {\n const allBodyTypes = getResReqTypes(\n [[context.output.override.components.requestBodies.suffix, requestBody]],\n operationName,\n context,\n );\n\n const filteredBodyTypes = contentType\n ? allBodyTypes.filter((type) => {\n let include = true;\n let exclude = false;\n\n if (contentType.include) {\n include = contentType.include.includes(type.contentType);\n }\n\n if (contentType.exclude) {\n exclude = contentType.exclude.includes(type.contentType);\n }\n\n return include && !exclude;\n })\n : allBodyTypes;\n\n const imports = filteredBodyTypes.flatMap(({ imports }) => imports);\n const schemas = filteredBodyTypes.flatMap(({ schemas }) => schemas);\n\n const definition = filteredBodyTypes.map(({ value }) => value).join(' | ');\n const hasReadonlyProps = filteredBodyTypes.some((x) => x.hasReadonlyProps);\n const nonReadonlyDefinition =\n hasReadonlyProps && definition ? `NonReadonly<${definition}>` : definition;\n\n let implementation =\n generalJSTypesWithArray.includes(definition.toLowerCase()) ||\n filteredBodyTypes.length > 1\n ? camel(operationName) +\n context.output.override.components.requestBodies.suffix\n : camel(definition);\n\n let isOptional = false;\n if (implementation) {\n implementation = sanitize(implementation, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n if (isReference(requestBody)) {\n const { schema: bodySchema } = resolveRef<RequestBodyObject>(\n requestBody,\n context,\n );\n if (bodySchema.required !== undefined) {\n isOptional = !bodySchema.required;\n }\n } else if (requestBody.required !== undefined) {\n isOptional = !requestBody.required;\n }\n }\n\n return {\n originalSchema: requestBody,\n definition: nonReadonlyDefinition,\n implementation,\n imports,\n schemas,\n isOptional,\n ...(filteredBodyTypes.length === 1\n ? {\n formData: filteredBodyTypes[0].formData,\n formUrlEncoded: filteredBodyTypes[0].formUrlEncoded,\n contentType: filteredBodyTypes[0].contentType,\n }\n : {\n formData: '',\n formUrlEncoded: '',\n contentType: '',\n }),\n };\n};\n","import type { ContextSpecs, GeneratorImport, ResolverValue } from '../types';\nimport { pascal } from '../utils';\nimport { getSpecName } from '../utils/path';\n\nexport const getAliasedImports = ({\n name,\n resolvedValue,\n existingImports,\n context,\n}: {\n name?: string;\n resolvedValue: ResolverValue;\n existingImports: GeneratorImport[];\n context: ContextSpecs;\n}): GeneratorImport[] =>\n context.output.schemas && resolvedValue.isRef\n ? resolvedValue.imports.map((imp) => {\n if (\n !needCreateImportAlias({\n name,\n imp,\n existingImports,\n })\n ) {\n return imp;\n }\n\n const specName = pascal(\n getSpecName(imp.specKey ?? '', context.specKey),\n );\n\n // for spec starts from digit\n const normalizedSpecName = /^\\d/.test(specName)\n ? `__${specName}`\n : specName;\n\n return {\n ...imp,\n alias: `${normalizedSpecName}__${imp.name}`,\n };\n })\n : resolvedValue.imports;\n\nexport const needCreateImportAlias = ({\n existingImports,\n imp,\n name,\n}: {\n name?: string;\n imp: GeneratorImport;\n existingImports: GeneratorImport[];\n}): boolean =>\n !imp.alias &&\n // !!imp.specKey &&\n (imp.name === name ||\n existingImports.some(\n (existingImport) =>\n imp.name === existingImport.name &&\n imp.specKey !== existingImport.specKey,\n ));\n\nexport const getImportAliasForRefOrValue = ({\n context,\n imports,\n resolvedValue,\n}: {\n resolvedValue: ResolverValue;\n imports: GeneratorImport[];\n context: ContextSpecs;\n}): string => {\n if (!context.output.schemas || !resolvedValue.isRef) {\n return resolvedValue.value;\n }\n const importWithSameName = imports.find(\n (imp) => imp.name === resolvedValue.value,\n );\n return importWithSameName?.alias ?? resolvedValue.value;\n};\n","import { keyword } from 'esutils';\n\nexport const getKey = (key: string) => {\n return keyword.isIdentifierNameES5(key) ? key : `'${key}'`;\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveExampleRefs, resolveValue } from '../resolvers';\nimport { resolveObject } from '../resolvers/object';\nimport {\n type ContextSpecs,\n PropertySortOrder,\n type ScalarValue,\n SchemaType,\n type SchemaWithConst,\n} from '../types';\nimport { isBoolean, isReference, jsDoc, pascal } from '../utils';\nimport { combineSchemas } from './combine';\nimport { getAliasedImports, getImportAliasForRefOrValue } from './imports';\nimport { getKey } from './keys';\nimport { getRefInfo } from './ref';\n\n/**\n * Return the output type from an object\n *\n * @param item item with type === \"object\"\n */\nexport const getObject = ({\n item,\n name,\n context,\n nullable,\n}: {\n item: SchemaObject;\n name?: string;\n context: ContextSpecs;\n nullable: string;\n}): ScalarValue => {\n if (isReference(item)) {\n const { name, specKey } = getRefInfo(item.$ref, context);\n return {\n value: name + nullable,\n imports: [{ name, specKey }],\n schemas: [],\n isEnum: false,\n type: 'object',\n isRef: true,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n if (item.allOf || item.oneOf || item.anyOf) {\n const separator = item.allOf ? 'allOf' : item.oneOf ? 'oneOf' : 'anyOf';\n\n return combineSchemas({\n schema: item,\n name,\n separator,\n context,\n nullable,\n });\n }\n\n if (Array.isArray(item.type)) {\n return combineSchemas({\n schema: {\n anyOf: item.type.map((type) => ({\n ...item,\n type,\n })),\n },\n name,\n separator: 'anyOf',\n context,\n nullable,\n });\n }\n\n if (item.properties && Object.entries(item.properties).length > 0) {\n const entries = Object.entries(item.properties);\n if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n entries.sort((a, b) => {\n return a[0].localeCompare(b[0]);\n });\n }\n return entries.reduce(\n (\n acc,\n [key, schema]: [string, ReferenceObject | SchemaObject],\n index,\n arr,\n ) => {\n const isRequired = (\n Array.isArray(item.required) ? item.required : []\n ).includes(key);\n\n let propName = '';\n\n if (name) {\n const isKeyStartWithUnderscore = key.startsWith('_');\n\n propName += pascal(\n `${isKeyStartWithUnderscore ? '_' : ''}${name}_${key}`,\n );\n }\n\n const allSpecSchemas =\n context.specs[context.target]?.components?.schemas ?? {};\n\n const isNameAlreadyTaken = Object.keys(allSpecSchemas).some(\n (schemaName) => pascal(schemaName) === propName,\n );\n\n if (isNameAlreadyTaken) {\n propName = propName + 'Property';\n }\n\n const resolvedValue = resolveObject({\n schema,\n propName,\n context,\n });\n\n const isReadOnly = item.readOnly || (schema as SchemaObject).readOnly;\n if (!index) {\n acc.value += '{';\n }\n\n const doc = jsDoc(schema as SchemaObject, true, context);\n\n acc.hasReadonlyProps ||= isReadOnly || false;\n\n const aliasedImports = getAliasedImports({\n name,\n context,\n resolvedValue,\n existingImports: acc.imports,\n });\n\n acc.imports.push(...aliasedImports);\n\n const propValue = getImportAliasForRefOrValue({\n context,\n resolvedValue,\n imports: aliasedImports,\n });\n\n acc.value += `\\n ${doc ? `${doc} ` : ''}${\n isReadOnly && !context.output.override.suppressReadonlyModifier\n ? 'readonly '\n : ''\n }${getKey(key)}${isRequired ? '' : '?'}: ${propValue};`;\n acc.schemas.push(...resolvedValue.schemas);\n\n if (arr.length - 1 === index) {\n if (item.additionalProperties) {\n if (isBoolean(item.additionalProperties)) {\n acc.value += `\\n [key: string]: unknown;\\n }`;\n } else {\n const resolvedValue = resolveValue({\n schema: item.additionalProperties,\n name,\n context,\n });\n acc.value += `\\n [key: string]: ${resolvedValue.value};\\n}`;\n }\n } else {\n acc.value += '\\n}';\n }\n\n acc.value += nullable;\n }\n\n return acc;\n },\n {\n imports: [],\n schemas: [],\n value: '',\n isEnum: false,\n type: 'object' as SchemaType,\n isRef: false,\n schema: {},\n hasReadonlyProps: false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n } as ScalarValue,\n );\n }\n\n if (item.additionalProperties) {\n if (isBoolean(item.additionalProperties)) {\n return {\n value: `{ [key: string]: unknown }` + nullable,\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'object',\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n }\n const resolvedValue = resolveValue({\n schema: item.additionalProperties,\n name,\n context,\n });\n return {\n value: `{[key: string]: ${resolvedValue.value}}` + nullable,\n imports: resolvedValue.imports ?? [],\n schemas: resolvedValue.schemas ?? [],\n isEnum: false,\n type: 'object',\n isRef: false,\n hasReadonlyProps: resolvedValue.hasReadonlyProps,\n };\n }\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const) {\n return {\n value: `'${itemWithConst.const}'` + nullable,\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'string',\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n }\n\n return {\n value:\n (item.type === 'object' ? '{ [key: string]: unknown }' : 'unknown') +\n nullable,\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'object',\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n};\n","import type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveExampleRefs } from '../resolvers';\nimport type { ContextSpecs, ScalarValue, SchemaWithConst } from '../types';\nimport { escape, isString } from '../utils';\nimport { getArray } from './array';\nimport { combineSchemas } from './combine';\nimport { getObject } from './object';\n\n/**\n * Return the typescript equivalent of open-api data type\n *\n * @param item\n * @ref https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types\n */\nexport const getScalar = ({\n item,\n name,\n context,\n}: {\n item: SchemaObject;\n name?: string;\n context: ContextSpecs;\n}): ScalarValue => {\n const nullable = item.nullable ? ' | null' : '';\n\n const enumItems = item.enum?.filter((enumItem) => enumItem !== null);\n\n if (!item.type && item.items) {\n item.type = 'array';\n }\n\n switch (item.type) {\n case 'number':\n case 'integer': {\n let value =\n context.output.override.useBigInt &&\n (item.format === 'int64' || item.format === 'uint64')\n ? 'bigint'\n : 'number';\n let isEnum = false;\n\n if (enumItems) {\n value = enumItems\n .map((enumItem: number | null) => `${enumItem}`)\n .join(' | ');\n isEnum = true;\n }\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const !== undefined) {\n value = itemWithConst.const;\n }\n\n return {\n value: value + nullable,\n isEnum,\n type: 'number',\n schemas: [],\n imports: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n case 'boolean': {\n let value = 'boolean';\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const !== undefined) {\n value = itemWithConst.const;\n }\n\n return {\n value: value + nullable,\n type: 'boolean',\n isEnum: false,\n schemas: [],\n imports: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n case 'array': {\n const { value, ...rest } = getArray({\n schema: item,\n name,\n context,\n });\n return {\n value: value + nullable,\n ...rest,\n };\n }\n\n case 'string': {\n let value = 'string';\n let isEnum = false;\n\n if (enumItems) {\n value = enumItems\n .map((enumItem: string | null) =>\n isString(enumItem) ? `'${escape(enumItem)}'` : `${enumItem}`,\n )\n .filter(Boolean)\n .join(` | `);\n\n isEnum = true;\n }\n\n if (item.format === 'binary') {\n value = 'Blob';\n }\n\n if (\n context.output.override.useDates &&\n (item.format === 'date' || item.format === 'date-time')\n ) {\n value = 'Date';\n }\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const) {\n value = `'${itemWithConst.const}'`;\n }\n\n return {\n value: value + nullable,\n isEnum,\n type: 'string',\n imports: [],\n schemas: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n case 'null': {\n return {\n value: 'null',\n isEnum: false,\n type: 'null',\n imports: [],\n schemas: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n }\n\n case 'object':\n default: {\n if (Array.isArray(item.type)) {\n return combineSchemas({\n schema: {\n anyOf: item.type.map((type) => ({\n ...item,\n type,\n })),\n },\n name,\n separator: 'anyOf',\n context,\n nullable,\n });\n }\n\n if (enumItems) {\n const value = enumItems\n .map((enumItem: unknown) =>\n isString(enumItem) ? `'${escape(enumItem)}'` : `${enumItem}`,\n )\n .filter(Boolean)\n .join(` | `);\n\n return {\n value: value + nullable,\n isEnum: true,\n type: 'string',\n imports: [],\n schemas: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n const { value, ...rest } = getObject({\n item,\n name,\n context,\n nullable,\n });\n return { value: value, ...rest };\n }\n }\n};\n","import uniq from 'lodash.uniq';\nimport type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveExampleRefs, resolveObject } from '../resolvers';\nimport {\n type ContextSpecs,\n type GeneratorImport,\n type GeneratorSchema,\n type ScalarValue,\n SchemaType,\n} from '../types';\nimport { getNumberWord, isSchema, pascal } from '../utils';\nimport {\n getEnumDescriptions,\n getEnumImplementation,\n getEnumNames,\n} from './enum';\nimport { getAliasedImports, getImportAliasForRefOrValue } from './imports';\nimport { getScalar } from './scalar';\n\ntype CombinedData = {\n imports: GeneratorImport[];\n schemas: GeneratorSchema[];\n originalSchema: (SchemaObject | undefined)[];\n values: string[];\n isRef: boolean[];\n isEnum: boolean[];\n types: string[];\n hasReadonlyProps: boolean;\n /**\n * List of all properties in all subschemas\n * - used to add missing properties in subschemas to avoid TS error described in @see https://github.com/orval-labs/orval/issues/935\n */\n allProperties: string[];\n requiredProperties: string[];\n};\n\ntype Separator = 'allOf' | 'anyOf' | 'oneOf';\n\nconst combineValues = ({\n resolvedData,\n resolvedValue,\n separator,\n context,\n}: {\n resolvedData: CombinedData;\n resolvedValue?: ScalarValue;\n separator: Separator;\n context: ContextSpecs;\n}) => {\n const isAllEnums = resolvedData.isEnum.every(Boolean);\n\n if (isAllEnums) {\n return `${resolvedData.values.join(` | `)}${\n resolvedValue ? ` | ${resolvedValue.value}` : ''\n }`;\n }\n\n if (separator === 'allOf') {\n let resolvedDataValue = resolvedData.values.join(` & `);\n if (resolvedData.originalSchema.length > 0 && resolvedValue) {\n const discriminatedPropertySchemas = resolvedData.originalSchema.filter(\n (s) =>\n s?.discriminator &&\n resolvedValue.value.includes(` ${s.discriminator.propertyName}:`),\n ) as SchemaObject[];\n if (discriminatedPropertySchemas.length > 0) {\n resolvedDataValue = `Omit<${resolvedDataValue}, '${discriminatedPropertySchemas.map((s) => s.discriminator?.propertyName).join(\"' | '\")}'>`;\n }\n }\n const joined = `${resolvedDataValue}${\n resolvedValue ? ` & ${resolvedValue.value}` : ''\n }`;\n\n // Parent object may have set required properties that only exist in child\n // objects. Make sure the resulting object has these properties as required,\n // but there is no need to override properties that are already required\n const overrideRequiredProperties = resolvedData.requiredProperties.filter(\n (prop) =>\n !resolvedData.originalSchema.some(\n (schema) =>\n schema?.properties?.[prop] && schema.required?.includes(prop),\n ),\n );\n if (overrideRequiredProperties.length > 0) {\n return `${joined} & Required<Pick<${joined}, '${overrideRequiredProperties.join(\"' | '\")}'>>`;\n }\n return joined;\n }\n\n let values = resolvedData.values;\n const hasObjectSubschemas = resolvedData.allProperties.length;\n if (hasObjectSubschemas && context.output.unionAddMissingProperties) {\n values = []; // the list of values will be rebuilt to add missing properties (if exist) in subschemas\n for (let i = 0; i < resolvedData.values.length; i += 1) {\n const subSchema = resolvedData.originalSchema[i];\n if (subSchema?.type !== 'object') {\n values.push(resolvedData.values[i]);\n continue;\n }\n\n const missingProperties = uniq(\n resolvedData.allProperties.filter(\n (p) => !Object.keys(subSchema.properties!).includes(p),\n ),\n );\n values.push(\n `${resolvedData.values[i]}${\n missingProperties.length > 0\n ? ` & {${missingProperties.map((p) => `${p}?: never`).join('; ')}}`\n : ''\n }`,\n );\n }\n }\n\n if (resolvedValue) {\n return `(${values.join(` & ${resolvedValue.value}) | (`)} & ${\n resolvedValue.value\n })`;\n }\n\n return values.join(' | ');\n};\n\nexport const combineSchemas = ({\n name,\n schema,\n separator,\n context,\n nullable,\n}: {\n name?: string;\n schema: SchemaObject;\n separator: Separator;\n context: ContextSpecs;\n nullable: string;\n}): ScalarValue => {\n const items = schema[separator] ?? [];\n\n const resolvedData = items.reduce<CombinedData>(\n (acc, subSchema) => {\n let propName = name ? name + pascal(separator) : undefined;\n if (propName && acc.schemas.length > 0) {\n propName = propName + pascal(getNumberWord(acc.schemas.length + 1));\n }\n\n if (separator === 'allOf' && isSchema(subSchema) && subSchema.required) {\n acc.requiredProperties.push(...subSchema.required);\n }\n\n const resolvedValue = resolveObject({\n schema: subSchema,\n propName,\n combined: true,\n context,\n });\n\n const aliasedImports = getAliasedImports({\n context,\n name,\n resolvedValue,\n existingImports: acc.imports,\n });\n\n const value = getImportAliasForRefOrValue({\n context,\n resolvedValue,\n imports: aliasedImports,\n });\n\n acc.values.push(value);\n acc.imports.push(...aliasedImports);\n acc.schemas.push(...resolvedValue.schemas);\n acc.isEnum.push(resolvedValue.isEnum);\n acc.types.push(resolvedValue.type);\n acc.isRef.push(resolvedValue.isRef);\n acc.originalSchema.push(resolvedValue.originalSchema);\n acc.hasReadonlyProps ||= resolvedValue.hasReadonlyProps;\n\n if (\n resolvedValue.type === 'object' &&\n resolvedValue.originalSchema.properties\n ) {\n acc.allProperties.push(\n ...Object.keys(resolvedValue.originalSchema.properties),\n );\n }\n\n return acc;\n },\n {\n values: [],\n imports: [],\n schemas: [],\n isEnum: [], // check if only enums\n isRef: [],\n types: [],\n originalSchema: [],\n allProperties: [],\n hasReadonlyProps: false,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n requiredProperties: separator === 'allOf' ? (schema.required ?? []) : [],\n } as CombinedData,\n );\n\n const isAllEnums = resolvedData.isEnum.every(Boolean);\n\n if (isAllEnums && name && items.length > 1) {\n const newEnum = `// eslint-disable-next-line @typescript-eslint/no-redeclare\\nexport const ${pascal(\n name,\n )} = ${getCombineEnumValue(resolvedData)}`;\n\n return {\n value: `typeof ${pascal(name)}[keyof typeof ${pascal(name)}] ${nullable}`,\n imports: [\n {\n name: pascal(name),\n },\n ],\n schemas: [\n ...resolvedData.schemas,\n {\n imports: resolvedData.imports.map<GeneratorImport>((toImport) => ({\n ...toImport,\n values: true,\n })),\n model: newEnum,\n name: name,\n },\n ],\n isEnum: false,\n type: 'object' as SchemaType,\n isRef: false,\n hasReadonlyProps: resolvedData.hasReadonlyProps,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n }\n\n let resolvedValue: ScalarValue | undefined;\n\n if (schema.properties) {\n resolvedValue = getScalar({\n item: Object.fromEntries(\n Object.entries(schema).filter(([key]) => key !== separator),\n ),\n name,\n context,\n });\n }\n\n const value = combineValues({\n resolvedData,\n separator,\n resolvedValue,\n context,\n });\n\n return {\n value: value + nullable,\n imports: resolvedValue\n ? [...resolvedData.imports, ...resolvedValue.imports]\n : resolvedData.imports,\n schemas: resolvedValue\n ? [...resolvedData.schemas, ...resolvedValue.schemas]\n : resolvedData.schemas,\n isEnum: false,\n type: 'object' as SchemaType,\n isRef: false,\n hasReadonlyProps:\n resolvedData?.hasReadonlyProps ||\n resolvedValue?.hasReadonlyProps ||\n false,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n};\n\nconst getCombineEnumValue = ({\n values,\n isRef,\n originalSchema,\n}: CombinedData) => {\n if (values.length === 1) {\n if (isRef[0]) {\n return values[0];\n }\n\n return `{${getEnumImplementation(values[0])}} as const`;\n }\n\n const enums = values\n .map((e, i) => {\n if (isRef[i]) {\n return `...${e},`;\n }\n\n const names = getEnumNames(originalSchema[i]);\n const descriptions = getEnumDescriptions(originalSchema[i]);\n\n return getEnumImplementation(e, names, descriptions);\n })\n .join('');\n\n return `{${enums}} as const`;\n};\n","import type { SchemaObject, SchemasObject } from 'openapi3-ts/oas30';\n\nimport type { ContextSpecs } from '../types';\nimport { pascal } from '../utils';\nimport { getRefInfo } from './ref';\n\nexport const resolveDiscriminators = (\n schemas: SchemasObject,\n context: ContextSpecs,\n): SchemasObject => {\n const transformedSchemas = { ...schemas };\n\n for (const schema of Object.values(transformedSchemas)) {\n if (schema.discriminator?.mapping) {\n const { mapping, propertyName } = schema.discriminator;\n\n for (const [mappingKey, mappingValue] of Object.entries(mapping)) {\n let subTypeSchema;\n\n try {\n const { originalName } = getRefInfo(mappingValue, context);\n // name from getRefInfo may contain a suffix, which we don't want\n const name = pascal(originalName);\n subTypeSchema =\n transformedSchemas[name] ?? transformedSchemas[originalName];\n } catch {\n subTypeSchema = transformedSchemas[mappingValue];\n }\n\n if (!subTypeSchema) {\n continue;\n }\n const property = subTypeSchema.properties?.[\n propertyName\n ] as SchemaObject;\n subTypeSchema.properties = {\n ...subTypeSchema.properties,\n [propertyName]: {\n type: 'string',\n enum: [\n ...(property?.enum?.filter((value) => value !== mappingKey) ??\n []),\n mappingKey,\n ],\n },\n };\n subTypeSchema.required = [\n ...(subTypeSchema.required ?? []),\n propertyName,\n ];\n }\n }\n }\n\n return transformedSchemas;\n};\n","import type { OperationObject } from 'openapi3-ts/oas30';\n\nimport { Verbs } from '../types';\nimport { pascal, sanitize } from '../utils';\n\nexport const getOperationId = (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n): string => {\n if (operation.operationId) {\n return operation.operationId;\n }\n\n return pascal(\n [\n verb,\n ...route.split('/').map((p) =>\n sanitize(p, {\n dash: true,\n underscore: '-',\n dot: '-',\n whitespace: '-',\n }),\n ),\n ].join('-'),\n );\n};\n","import type { ParameterObject, ReferenceObject } from 'openapi3-ts/oas30';\n\nimport { resolveRef } from '../resolvers/ref';\nimport type { ContextSpecs, GetterParameters } from '../types';\nimport { isReference } from '../utils';\n\nexport const getParameters = ({\n parameters = [],\n context,\n}: {\n parameters: (ReferenceObject | ParameterObject)[];\n context: ContextSpecs;\n}): GetterParameters => {\n return parameters.reduce<GetterParameters>(\n (acc, p) => {\n if (isReference(p)) {\n const { schema: parameter, imports } = resolveRef<ParameterObject>(\n p,\n context,\n );\n\n if (\n parameter.in === 'path' ||\n parameter.in === 'query' ||\n parameter.in === 'header'\n ) {\n acc[parameter.in].push({ parameter, imports });\n }\n } else {\n if (p.in === 'query' || p.in === 'path' || p.in === 'header') {\n acc[p.in].push({ parameter: p, imports: [] });\n }\n }\n\n return acc;\n },\n {\n path: [],\n query: [],\n header: [],\n },\n );\n};\n","import { resolveValue } from '../resolvers';\nimport type {\n ContextSpecs,\n GetterParameters,\n GetterParams,\n NormalizedOutputOptions,\n} from '../types';\nimport { camel, sanitize, stringify } from '../utils';\n\n/**\n * Return every params in a path\n *\n * @example\n * ```\n * getParamsInPath(\"/pet/{category}/{name}/\");\n * // => [\"category\", \"name\"]\n * ```\n * @param path\n */\nexport const getParamsInPath = (path: string) => {\n let n;\n const output = [];\n const templatePathRegex = /\\{(.*?)\\}/g;\n while ((n = templatePathRegex.exec(path)) !== null) {\n output.push(n[1]);\n }\n\n return output;\n};\n\nexport const getParams = ({\n route,\n pathParams = [],\n operationId,\n context,\n output,\n}: {\n route: string;\n pathParams?: GetterParameters['query'];\n operationId: string;\n context: ContextSpecs;\n output: NormalizedOutputOptions;\n}): GetterParams => {\n const params = getParamsInPath(route);\n return params.map((p) => {\n const pathParam = pathParams.find(\n ({ parameter }) =>\n sanitize(camel(parameter.name), {\n es5keyword: true,\n underscore: true,\n dash: true,\n }) === p,\n );\n\n if (!pathParam) {\n throw new Error(\n `The path params ${p} can't be found in parameters (${operationId})`,\n );\n }\n\n const {\n name: nameWithoutSanitize,\n required = false,\n schema,\n } = pathParam.parameter;\n\n const name = sanitize(camel(nameWithoutSanitize), { es5keyword: true });\n\n if (!schema) {\n return {\n name,\n definition: `${name}${required ? '' : '?'}: unknown`,\n implementation: `${name}${required ? '' : '?'}: unknown`,\n default: false,\n required,\n imports: [],\n };\n }\n\n const resolvedValue = resolveValue({\n schema,\n context: {\n ...context,\n ...(pathParam.imports.length > 0\n ? {\n specKey: pathParam.imports[0].specKey,\n }\n : {}),\n },\n });\n\n let paramType = resolvedValue.value;\n if (output.allParamsOptional) {\n paramType = `${paramType} | undefined | null`; // TODO: maybe check that `paramType` isn't already undefined or null\n }\n\n const definition = `${name}${\n !required || resolvedValue.originalSchema!.default ? '?' : ''\n }: ${paramType}`;\n\n const implementation = `${name}${\n !required && !resolvedValue.originalSchema!.default ? '?' : ''\n }${\n resolvedValue.originalSchema!.default\n ? `: ${paramType} = ${stringify(resolvedValue.originalSchema!.default)}`\n : `: ${paramType}` // FIXME: in Vue if we have `version: MaybeRef<number | undefined | null> = 1` and we don't pass version, the unref(version) will be `undefined` and not `1`, so we need to handle default value somewhere in implementation and not in the definition\n }`;\n\n return {\n name,\n definition,\n implementation,\n default: resolvedValue.originalSchema!.default,\n required,\n imports: resolvedValue.imports,\n originalSchema: resolvedValue.originalSchema,\n };\n });\n};\n","import {\n type ContextSpecs,\n type GetterBody,\n type GetterParams,\n type GetterProps,\n GetterPropType,\n type GetterQueryParam,\n OutputClient,\n} from '../types';\nimport { isUndefined, pascal, sortByPriority } from '../utils';\n\nexport const getProps = ({\n body,\n queryParams,\n params,\n operationName,\n headers,\n context,\n}: {\n body: GetterBody;\n queryParams?: GetterQueryParam;\n params: GetterParams;\n operationName: string;\n headers?: GetterQueryParam;\n context: ContextSpecs;\n}): GetterProps => {\n const bodyProp = {\n name: body.implementation,\n definition: `${body.implementation}${body.isOptional ? '?' : ''}: ${body.definition}`,\n implementation: `${body.implementation}${body.isOptional ? '?' : ''}: ${body.definition}`,\n default: false,\n required: !body.isOptional,\n type: GetterPropType.BODY,\n };\n\n const queryParamsProp = {\n name: 'params',\n definition: getQueryParamDefinition(queryParams, context),\n implementation: getQueryParamDefinition(queryParams, context),\n default: false,\n required: isUndefined(queryParams?.isOptional)\n ? !context.output.allParamsOptional\n : !queryParams?.isOptional && !context.output.allParamsOptional,\n type: GetterPropType.QUERY_PARAM,\n };\n\n const headersProp = {\n name: 'headers',\n definition: `headers${headers?.isOptional ? '?' : ''}: ${\n headers?.schema.name\n }`,\n implementation: `headers${headers?.isOptional ? '?' : ''}: ${\n headers?.schema.name\n }`,\n default: false,\n required: isUndefined(headers?.isOptional) ? false : !headers?.isOptional,\n type: GetterPropType.HEADER,\n };\n\n let paramGetterProps: GetterProps;\n if (context.output.override.useNamedParameters && params.length > 0) {\n const parameterTypeName = `${pascal(operationName)}PathParameters`;\n\n const name = 'pathParams';\n\n // needs a special model\n const namedParametersTypeDefinition = `export type ${parameterTypeName} = {\\n ${params\n .map((property) => property.definition)\n .join(',\\n ')},\\n }`;\n\n const isOptional = params.every((param) => param.default);\n\n const implementation = `{ ${params\n .map((property) =>\n property.default\n ? `${property.name} = ${property.default}` // if we use property.implementation, we will get `{ version: number = 1 }: ListPetsPathParameters = {}` which isn't valid\n : property.name,\n )\n .join(', ')} }: ${parameterTypeName}${isOptional ? ' = {}' : ''}`;\n\n const destructured = `{ ${params\n .map((property) => property.name)\n .join(', ')} }`;\n\n paramGetterProps = [\n {\n type: GetterPropType.NAMED_PATH_PARAMS,\n name,\n definition: `${name}: ${parameterTypeName}`,\n implementation,\n default: false,\n destructured,\n required: true,\n schema: {\n name: parameterTypeName,\n model: namedParametersTypeDefinition,\n imports: params.flatMap((property) => property.imports),\n },\n },\n ];\n } else {\n paramGetterProps = params.map((param) => ({\n ...param,\n type: GetterPropType.PARAM,\n }));\n }\n\n const props = [\n ...paramGetterProps,\n ...(body.definition ? [bodyProp] : []),\n ...(queryParams ? [queryParamsProp] : []),\n ...(headers ? [headersProp] : []),\n ];\n\n const sortedProps = sortByPriority(props);\n\n return sortedProps;\n};\n\nfunction getQueryParamDefinition(\n queryParams: GetterQueryParam | undefined,\n context: ContextSpecs,\n): string {\n let paramType = queryParams?.schema.name;\n if (OutputClient.ANGULAR === context.output.client) {\n paramType = `DeepNonNullable<${paramType}>`;\n }\n return `params${queryParams?.isOptional || context.output.allParamsOptional ? '?' : ''}: ${paramType}`;\n}\n","import type { ContentObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveValue } from '../resolvers';\nimport type {\n ContextSpecs,\n GeneratorImport,\n GeneratorSchema,\n GetterParameters,\n GetterQueryParam,\n} from '../types';\nimport { jsDoc, pascal, sanitize } from '../utils';\nimport { getEnum, getEnumDescriptions, getEnumNames } from './enum';\nimport { getKey } from './keys';\n\ntype QueryParamsType = {\n definition: string;\n imports: GeneratorImport[];\n schemas: GeneratorSchema[];\n originalSchema: SchemaObject;\n};\n\nconst getQueryParamsTypes = (\n queryParams: GetterParameters['query'],\n operationName: string,\n context: ContextSpecs,\n): QueryParamsType[] => {\n return queryParams.map(({ parameter, imports: parameterImports }) => {\n const {\n name,\n required,\n schema: schemaParam,\n content,\n } = parameter as {\n name: string;\n required: boolean;\n schema: SchemaObject;\n content: ContentObject;\n };\n\n const queryName = sanitize(`${pascal(operationName)}${pascal(name)}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n\n const schema = (schemaParam || content['application/json'].schema)!;\n\n const resolvedValue = resolveValue({\n schema,\n context,\n name: queryName,\n });\n\n const key = getKey(name);\n const doc = jsDoc(\n {\n description: parameter.description,\n ...schema,\n },\n void 0,\n context,\n );\n\n if (parameterImports.length > 0) {\n return {\n definition: `${doc}${key}${!required || schema.default ? '?' : ''}: ${\n parameterImports[0].name\n };`,\n imports: parameterImports,\n schemas: [],\n originalSchema: resolvedValue.originalSchema,\n };\n }\n\n if (resolvedValue.isEnum && !resolvedValue.isRef) {\n const enumName = queryName;\n const enumValue = getEnum(\n resolvedValue.value,\n enumName,\n getEnumNames(resolvedValue.originalSchema),\n context.output.override.enumGenerationType,\n getEnumDescriptions(resolvedValue.originalSchema),\n context.output.override.namingConvention?.enum,\n );\n\n return {\n definition: `${doc}${key}${\n !required || schema.default ? '?' : ''\n }: ${enumName};`,\n imports: [{ name: enumName }],\n schemas: [\n ...resolvedValue.schemas,\n { name: enumName, model: enumValue, imports: resolvedValue.imports },\n ],\n originalSchema: resolvedValue.originalSchema,\n };\n }\n\n const definition = `${doc}${key}${\n !required || schema.default ? '?' : ''\n }: ${resolvedValue.value};`;\n\n return {\n definition,\n imports: resolvedValue.imports,\n schemas: resolvedValue.schemas,\n originalSchema: resolvedValue.originalSchema,\n };\n });\n};\n\nexport const getQueryParams = ({\n queryParams = [],\n operationName,\n context,\n suffix = 'params',\n}: {\n queryParams: GetterParameters['query'];\n operationName: string;\n context: ContextSpecs;\n suffix?: string;\n}): GetterQueryParam | undefined => {\n if (queryParams.length === 0) {\n return;\n }\n const types = getQueryParamsTypes(queryParams, operationName, context);\n const imports = types.flatMap(({ imports }) => imports);\n const schemas = types.flatMap(({ schemas }) => schemas);\n const name = `${pascal(operationName)}${pascal(suffix)}`;\n\n const type = types.map(({ definition }) => definition).join('\\n');\n const allOptional = queryParams.every(({ parameter }) => !parameter.required);\n\n const schema = {\n name,\n model: `export type ${name} = {\\n${type}\\n};\\n`,\n imports,\n };\n\n return {\n schema,\n deps: schemas,\n isOptional: allOptional,\n };\n};\n","import type { ResponsesObject } from 'openapi3-ts/oas30';\n\nimport type {\n ContextSpecs,\n GetterResponse,\n OverrideOutputContentType,\n ResReqTypesValue,\n} from '../types';\nimport { getResReqTypes } from './res-req-types';\n\nexport const getResponse = ({\n responses,\n operationName,\n context,\n contentType,\n}: {\n responses: ResponsesObject;\n operationName: string;\n context: ContextSpecs;\n contentType?: OverrideOutputContentType;\n}): GetterResponse => {\n if (!responses) {\n return {\n imports: [],\n definition: {\n success: '',\n errors: '',\n },\n isBlob: false,\n types: { success: [], errors: [] },\n schemas: [],\n contentTypes: [],\n };\n }\n\n const types = getResReqTypes(\n Object.entries(responses),\n operationName,\n context,\n 'void',\n (type) => `${type.key}-${type.value}`,\n );\n\n const filteredTypes = contentType\n ? types.filter((type) => {\n let include = true;\n let exclude = false;\n\n if (contentType.include) {\n include = contentType.include.includes(type.contentType);\n }\n\n if (contentType.exclude) {\n exclude = contentType.exclude.includes(type.contentType);\n }\n\n return include && !exclude;\n })\n : types;\n\n const imports = filteredTypes.flatMap(({ imports }) => imports);\n const schemas = filteredTypes.flatMap(({ schemas }) => schemas);\n\n const contentTypes = [\n ...new Set(filteredTypes.map(({ contentType }) => contentType)),\n ];\n\n const groupedByStatus = filteredTypes.reduce<{\n success: ResReqTypesValue[];\n errors: ResReqTypesValue[];\n }>(\n (acc, type) => {\n if (type.key.startsWith('2')) {\n acc.success.push(type);\n } else {\n acc.errors.push(type);\n }\n return acc;\n },\n { success: [], errors: [] },\n );\n\n const success = groupedByStatus.success\n .map(({ value, formData }) => (formData ? 'Blob' : value))\n .join(' | ');\n const errors = groupedByStatus.errors.map(({ value }) => value).join(' | ');\n\n const defaultType = filteredTypes.find(({ key }) => key === 'default')?.value;\n\n return {\n imports,\n definition: {\n success: success || (defaultType ?? 'unknown'),\n errors: errors || (defaultType ?? 'unknown'),\n },\n isBlob: success === 'Blob',\n types: groupedByStatus,\n contentTypes,\n schemas,\n originalSchema: responses,\n };\n};\n","import type { ServerObject } from 'openapi3-ts/oas31';\n\nimport { TEMPLATE_TAG_REGEX } from '../constants';\nimport type { BaseUrlFromConstant, BaseUrlFromSpec } from '../types';\nimport { camel, sanitize } from '../utils';\n\nconst TEMPLATE_TAG_IN_PATH_REGEX = /\\/([\\w]+)(?:\\$\\{)/g; // all dynamic parts of path\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(camel(matches[2]), {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path)\n ? `${prev}\\${${param}}${next}`\n : `${prev}${param}${next}`;\n};\n\nexport const getRoute = (route: string) => {\n const splittedRoute = route.split('/');\n\n return splittedRoute.reduce((acc, path, i) => {\n if (!path && !i) {\n return acc;\n }\n\n if (!path.includes('{')) {\n return `${acc}/${path}`;\n }\n\n return `${acc}/${getRoutePath(path)}`;\n }, '');\n};\n\nexport const getFullRoute = (\n route: string,\n servers: ServerObject[] | undefined,\n baseUrl: string | BaseUrlFromConstant | BaseUrlFromSpec | undefined,\n): string => {\n const getBaseUrl = (): string => {\n if (!baseUrl) return '';\n if (typeof baseUrl === 'string') return baseUrl;\n if (baseUrl.getBaseUrlFromSpecification) {\n if (!servers) {\n throw new Error(\n \"Orval is configured to use baseUrl from the specifications 'servers' field, but there exist no servers in the specification.\",\n );\n }\n const server = servers.at(\n Math.min(baseUrl.index ?? 0, servers.length - 1),\n );\n if (!server) return '';\n if (!server.variables) return server.url;\n\n let url = server.url;\n const variables = baseUrl.variables;\n for (const variableKey of Object.keys(server.variables)) {\n const variable = server.variables[variableKey];\n if (variables?.[variableKey]) {\n if (\n variable.enum &&\n !variable.enum.some((e) => e == variables[variableKey])\n ) {\n throw new Error(\n `Invalid variable value '${variables[variableKey]}' for variable '${variableKey}' when resolving ${server.url}. Valid values are: ${variable.enum.join(', ')}.`,\n );\n }\n url = url.replaceAll(`{${variableKey}}`, variables[variableKey]);\n } else {\n url = url.replaceAll(`{${variableKey}}`, String(variable.default));\n }\n }\n return url;\n }\n return baseUrl.baseUrl;\n };\n\n let fullRoute = route;\n const base = getBaseUrl();\n if (base) {\n if (base.endsWith('/') && route.startsWith('/')) {\n fullRoute = route.slice(1);\n }\n fullRoute = `${base}${fullRoute}`;\n }\n return fullRoute;\n};\n\n// Creates a mixed use array with path variables and string from template string route\nexport const getRouteAsArray = (route: string): string =>\n route\n .replaceAll(TEMPLATE_TAG_IN_PATH_REGEX, '/$1/${')\n .split('/')\n .filter((i) => i !== '')\n .map((i) =>\n // @note - array is mixed with string and var\n i.includes('${') ? i.replace(TEMPLATE_TAG_REGEX, '$1') : `'${i}'`,\n )\n .join(',')\n .replace(',,', '');\n","import isEmpty from 'lodash.isempty';\nimport type {\n ComponentsObject,\n ReferenceObject,\n RequestBodyObject,\n ResponseObject,\n} from 'openapi3-ts/oas30';\n\nimport { getResReqTypes } from '../getters';\nimport type { ContextSpecs, GeneratorSchema } from '../types';\nimport { jsDoc, pascal, sanitize } from '../utils';\n\nexport const generateComponentDefinition = (\n responses:\n | ComponentsObject['responses']\n | ComponentsObject['requestBodies'] = {},\n context: ContextSpecs,\n suffix: string,\n): GeneratorSchema[] => {\n if (isEmpty(responses)) {\n return [];\n }\n\n return Object.entries(responses).reduce<GeneratorSchema[]>(\n (\n acc,\n [name, response]: [\n string,\n ReferenceObject | RequestBodyObject | ResponseObject,\n ],\n ) => {\n const allResponseTypes = getResReqTypes(\n [[suffix, response]],\n name,\n context,\n 'void',\n );\n\n const imports = allResponseTypes.flatMap(({ imports }) => imports);\n const schemas = allResponseTypes.flatMap(({ schemas }) => schemas);\n\n const type = allResponseTypes.map(({ value }) => value).join(' | ');\n\n const modelName = sanitize(`${pascal(name)}${suffix}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n const doc = jsDoc(response as ResponseObject | RequestBodyObject);\n const model = `${doc}export type ${modelName} = ${type || 'unknown'};\\n`;\n\n acc.push(...schemas);\n\n if (modelName !== type) {\n acc.push({\n name: modelName,\n model,\n imports,\n });\n }\n\n return acc;\n },\n [],\n );\n};\n","import uniq from 'lodash.uniq';\nimport uniqWith from 'lodash.uniqwith';\n\nimport {\n type GeneratorImport,\n type GeneratorMutator,\n type GeneratorVerbOptions,\n GetterPropType,\n NamingConvention,\n} from '../types';\nimport { conventionName, upath } from '../utils';\n\nexport const generateImports = ({\n imports = [],\n target,\n isRootKey,\n specsName,\n specKey: currentSpecKey,\n namingConvention = NamingConvention.CAMEL_CASE,\n}: {\n imports: GeneratorImport[];\n target: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n specKey: string;\n namingConvention?: NamingConvention;\n}) => {\n if (imports.length === 0) {\n return '';\n }\n\n return uniqWith(\n imports,\n (a, b) =>\n a.name === b.name && a.default === b.default && a.specKey === b.specKey,\n )\n .sort()\n .map(({ specKey, name, values, alias, isConstant }) => {\n const isSameSpecKey = currentSpecKey === specKey;\n\n const fileName = conventionName(name, namingConvention);\n\n if (specKey && !isSameSpecKey) {\n const path = specKey === target ? '' : specsName[specKey];\n\n if (!isRootKey && specKey) {\n return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n alias ? ` as ${alias}` : ''\n } } from \\'../${upath.join(path, fileName)}\\';`;\n }\n\n return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n alias ? ` as ${alias}` : ''\n } } from \\'./${upath.join(path, fileName)}\\';`;\n }\n\n return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n alias ? ` as ${alias}` : ''\n } } from \\'./${fileName}\\';`;\n })\n .join('\\n');\n};\n\nexport const generateMutatorImports = ({\n mutators,\n implementation,\n oneMore,\n}: {\n mutators: GeneratorMutator[];\n implementation?: string;\n oneMore?: boolean;\n}) => {\n const imports = uniqWith(\n mutators,\n (a, b) => a.name === b.name && a.default === b.default,\n ).reduce((acc, mutator) => {\n const path = `${oneMore ? '../' : ''}${mutator.path}`;\n const importDefault = mutator.default\n ? mutator.name\n : `{ ${mutator.name} }`;\n\n acc += `import ${importDefault} from '${path}';`;\n acc += '\\n';\n\n if (implementation && (mutator.hasErrorType || mutator.bodyTypeName)) {\n let errorImportName = '';\n const targetErrorImportName = mutator.default\n ? `ErrorType as ${mutator.errorTypeName}`\n : mutator.errorTypeName;\n if (\n mutator.hasErrorType &&\n implementation.includes(mutator.errorTypeName) &&\n !acc.includes(`{ ${targetErrorImportName} `)\n ) {\n errorImportName = targetErrorImportName;\n }\n\n let bodyImportName = '';\n const targetBodyImportName = mutator.default\n ? `BodyType as ${mutator.bodyTypeName}`\n : mutator.bodyTypeName;\n if (\n mutator.bodyTypeName &&\n implementation.includes(mutator.bodyTypeName) &&\n !acc.includes(` ${targetBodyImportName} }`)\n ) {\n bodyImportName = targetBodyImportName!;\n }\n\n if (bodyImportName || errorImportName) {\n acc += `import type { ${errorImportName}${\n errorImportName && bodyImportName ? ' , ' : ''\n }${bodyImportName} } from '${path}';`;\n acc += '\\n';\n }\n }\n\n return acc;\n }, '');\n\n return imports;\n};\n\nconst generateDependency = ({\n deps,\n isAllowSyntheticDefaultImports,\n dependency,\n specsName,\n key,\n onlyTypes,\n}: {\n key: string;\n deps: GeneratorImport[];\n dependency: string;\n specsName: Record<string, string>;\n isAllowSyntheticDefaultImports: boolean;\n onlyTypes: boolean;\n}) => {\n const defaultDep = deps.find(\n (e) =>\n e.default &&\n (isAllowSyntheticDefaultImports || !e.syntheticDefaultImport),\n );\n const syntheticDefaultImportDep = isAllowSyntheticDefaultImports\n ? undefined\n : deps.find((e) => e.syntheticDefaultImport);\n\n const depsString = uniq(\n deps\n .filter((e) => !e.default && !e.syntheticDefaultImport)\n .map(({ name, alias }) => (alias ? `${name} as ${alias}` : name)),\n )\n .sort()\n .join(',\\n ');\n\n let importString = '';\n\n const syntheticDefaultImport = syntheticDefaultImportDep\n ? `import * as ${syntheticDefaultImportDep.name} from '${dependency}';`\n : '';\n\n if (syntheticDefaultImport) {\n if (deps.length === 1) {\n return syntheticDefaultImport;\n }\n importString += `${syntheticDefaultImport}\\n`;\n }\n\n importString += `import ${onlyTypes ? 'type ' : ''}${\n defaultDep ? `${defaultDep.name}${depsString ? ',' : ''}` : ''\n }${depsString ? `{\\n ${depsString}\\n}` : ''} from '${dependency}${\n key !== 'default' && specsName[key] ? `/${specsName[key]}` : ''\n }';`;\n\n return importString;\n};\n\nexport const addDependency = ({\n implementation,\n exports,\n dependency,\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n}: {\n implementation: string;\n exports: GeneratorImport[];\n dependency: string;\n specsName: Record<string, string>;\n hasSchemaDir: boolean;\n isAllowSyntheticDefaultImports: boolean;\n}) => {\n const toAdds = exports.filter((e) => {\n const searchWords = [e.alias, e.name].filter((p) => p?.length).join('|');\n const pattern = new RegExp(`\\\\b(${searchWords})\\\\b`, 'g');\n\n return implementation.match(pattern);\n });\n\n if (toAdds.length === 0) {\n return;\n }\n\n const groupedBySpecKey = toAdds.reduce<\n Record<string, { types: GeneratorImport[]; values: GeneratorImport[] }>\n >((acc, dep) => {\n const key = hasSchemaDir && dep.specKey ? dep.specKey : 'default';\n\n if (\n dep.values &&\n (isAllowSyntheticDefaultImports || !dep.syntheticDefaultImport)\n ) {\n acc[key] = {\n ...acc[key],\n values: [...(acc[key]?.values ?? []), dep],\n };\n\n return acc;\n }\n\n acc[key] = {\n ...acc[key],\n types: [...(acc[key]?.types ?? []), dep],\n };\n\n return acc;\n }, {});\n\n return (\n Object.entries(groupedBySpecKey)\n .map(([key, { values, types }]) => {\n let dep = '';\n\n if (values) {\n dep += generateDependency({\n deps: values,\n isAllowSyntheticDefaultImports,\n dependency,\n specsName,\n key,\n onlyTypes: false,\n });\n }\n\n if (types) {\n let uniqueTypes = types;\n if (values) {\n uniqueTypes = types.filter(\n (t) => !values.some((v) => v.name === t.name),\n );\n dep += '\\n';\n }\n dep += generateDependency({\n deps: uniqueTypes,\n isAllowSyntheticDefaultImports,\n dependency,\n specsName,\n key,\n onlyTypes: true,\n });\n }\n\n return dep;\n })\n .join('\\n') + '\\n'\n );\n};\n\nconst getLibName = (code: string) => {\n const splitString = code.split(' from ');\n return splitString[splitString.length - 1].split(';')[0].trim();\n};\n\nexport const generateDependencyImports = (\n implementation: string,\n imports: {\n exports: GeneratorImport[];\n dependency: string;\n }[],\n specsName: Record<string, string>,\n hasSchemaDir: boolean,\n isAllowSyntheticDefaultImports: boolean,\n): string => {\n const dependencies = imports\n .map((dep) =>\n addDependency({\n ...dep,\n implementation,\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n }),\n )\n .filter(Boolean)\n .sort((a, b) => {\n const aLib = getLibName(a!);\n const bLib = getLibName(b!);\n\n if (aLib === bLib) {\n return 0;\n }\n\n if (aLib.startsWith(\"'.\") && !bLib.startsWith(\"'.\")) {\n return 1;\n }\n return aLib < bLib ? -1 : 1;\n })\n .join('\\n');\n\n return dependencies ? dependencies + '\\n' : '';\n};\n\nexport const generateVerbImports = ({\n response,\n body,\n queryParams,\n props,\n headers,\n params,\n}: GeneratorVerbOptions): GeneratorImport[] => [\n ...response.imports,\n ...body.imports,\n ...props.flatMap((prop) =>\n prop.type === GetterPropType.NAMED_PATH_PARAMS\n ? [{ name: prop.schema.name }]\n : [],\n ),\n ...(queryParams ? [{ name: queryParams.schema.name }] : []),\n ...(headers ? [{ name: headers.schema.name }] : []),\n ...params.flatMap<GeneratorImport>(({ imports }) => imports),\n];\n","import type { GeneratorSchema } from '../types';\n\nexport const generateModelInline = (acc: string, model: string): string =>\n acc + `${model}\\n`;\n\nexport const generateModelsInline = (\n obj: Record<string, GeneratorSchema[]>,\n): string => {\n const schemas = Object.values(obj).flat();\n\n return schemas.reduce<string>(\n (acc, { model }) => generateModelInline(acc, model),\n '',\n );\n};\n","import { type ecmaVersion, Parser } from 'acorn';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\n\nimport type {\n GeneratorMutator,\n GeneratorMutatorParsingInfo,\n NormalizedMutator,\n Tsconfig,\n TsConfigTarget,\n} from '../types';\nimport { createLogger, getFileInfo, loadFile, pascal, upath } from '../utils';\n\nexport const BODY_TYPE_NAME = 'BodyType';\n\nconst getImport = (output: string, mutator: NormalizedMutator) => {\n const outputFileInfo = getFileInfo(output);\n const mutatorFileInfo = getFileInfo(mutator.path);\n const { pathWithoutExtension } = getFileInfo(\n upath.relativeSafe(outputFileInfo.dirname, mutatorFileInfo.path),\n );\n\n return `${pathWithoutExtension}${mutator.extension || ''}`;\n};\n\nexport const generateMutator = async ({\n output,\n mutator,\n name,\n workspace,\n tsconfig,\n}: {\n output?: string;\n mutator?: NormalizedMutator;\n name: string;\n workspace: string;\n tsconfig?: Tsconfig;\n}): Promise<GeneratorMutator | undefined> => {\n if (!mutator || !output) {\n return;\n }\n const isDefault = mutator.default;\n const importName = mutator.name ? mutator.name : `${name}Mutator`;\n const importPath = mutator.path;\n\n let rawFile = await fs.readFile(importPath, 'utf8');\n\n rawFile = removeComments(rawFile);\n\n const hasErrorType =\n rawFile.includes('export type ErrorType') ||\n rawFile.includes('export interface ErrorType');\n\n const hasBodyType =\n rawFile.includes(`export type ${BODY_TYPE_NAME}`) ||\n rawFile.includes(`export interface ${BODY_TYPE_NAME}`);\n\n const errorTypeName = mutator.default\n ? `${pascal(name)}ErrorType`\n : 'ErrorType';\n\n const bodyTypeName = mutator.default\n ? `${pascal(name)}${BODY_TYPE_NAME}`\n : BODY_TYPE_NAME;\n\n const { file, cached } = await loadFile<string>(importPath, {\n isDefault: false,\n root: workspace,\n alias: mutator.alias,\n tsconfig,\n load: false,\n });\n\n if (file) {\n const mutatorInfoName = isDefault ? 'default' : mutator.name!;\n\n const mutatorInfo = parseFile(\n file,\n mutatorInfoName,\n getEcmaVersion(tsconfig?.compilerOptions?.target),\n );\n\n if (!mutatorInfo) {\n throw new Error(\n chalk.red(\n `Your mutator file doesn't have the ${mutatorInfoName} exported function`,\n ),\n );\n }\n\n const path = getImport(output, mutator);\n\n const isHook = mutator.name\n ? !!mutator.name.startsWith('use') && !mutatorInfo.numberOfParams\n : !mutatorInfo.numberOfParams;\n\n return {\n name: mutator.name || !isHook ? importName : `use${pascal(importName)}`,\n path,\n default: isDefault,\n hasErrorType,\n errorTypeName,\n hasSecondArg: isHook\n ? mutatorInfo.returnNumberOfParams! > 1\n : mutatorInfo.numberOfParams > 1,\n hasThirdArg: mutatorInfo.numberOfParams > 2,\n isHook,\n ...(hasBodyType ? { bodyTypeName } : {}),\n };\n } else {\n const path = getImport(output, mutator);\n\n if (!cached) {\n createLogger().warn(\n chalk.yellow(`Failed to parse provided mutator function`),\n );\n }\n\n return {\n name: importName,\n path,\n default: isDefault,\n hasSecondArg: false,\n hasThirdArg: false,\n isHook: false,\n hasErrorType,\n errorTypeName,\n ...(hasBodyType ? { bodyTypeName } : {}),\n };\n }\n};\n\nconst getEcmaVersion = (target?: TsConfigTarget): ecmaVersion | undefined => {\n if (!target) {\n return;\n }\n\n if (target.toLowerCase() === 'esnext') {\n return 'latest';\n }\n\n try {\n return Number(target.toLowerCase().replace('es', '')) as ecmaVersion;\n } catch {\n return;\n }\n};\n\nconst removeComments = (file: string) => {\n // Regular expression to match single-line and multi-line comments\n const commentRegex = /\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\//g;\n\n // Remove comments from the rawFile string\n const cleanedFile = file.replaceAll(commentRegex, '');\n\n return cleanedFile;\n};\n\nconst parseFile = (\n file: string,\n name: string,\n ecmaVersion: ecmaVersion = 6,\n): GeneratorMutatorParsingInfo | undefined => {\n try {\n const ast = Parser.parse(file, { ecmaVersion }) as any;\n\n const node = ast?.body?.find((childNode: any) => {\n if (childNode.type === 'ExpressionStatement') {\n if (\n childNode.expression.arguments?.[1]?.properties?.some(\n (p: any) => p.key?.name === name,\n )\n ) {\n return true;\n }\n\n if (childNode.expression.left?.property?.name === name) {\n return true;\n }\n\n return childNode.expression.right?.properties?.some(\n (p: any) => p.key.name === name,\n );\n }\n });\n\n if (!node) {\n return;\n }\n\n if (node.expression.type === 'AssignmentExpression') {\n if (\n node.expression.right.type === 'FunctionExpression' ||\n node.expression.right.type === 'ArrowFunctionExpression'\n ) {\n return {\n numberOfParams: node.expression.right.params.length,\n };\n }\n\n if (node.expression.right.name) {\n return parseFunction(ast, node.expression.right.name);\n }\n\n const property = node.expression.right?.properties.find(\n (p: any) => p.key.name === name,\n );\n\n if (property.value.name) {\n return parseFunction(ast, property.value.name);\n }\n\n if (\n property.value.type === 'FunctionExpression' ||\n property.value.type === 'ArrowFunctionExpression'\n ) {\n return {\n numberOfParams: property.value.params.length,\n };\n }\n\n return;\n }\n\n const property = node.expression.arguments[1].properties.find(\n (p: any) => p.key?.name === name,\n );\n\n return parseFunction(ast, property.value.body.name);\n } catch {\n return;\n }\n};\n\nconst parseFunction = (\n ast: any,\n name: string,\n): GeneratorMutatorParsingInfo | undefined => {\n const node = ast?.body?.find((childNode: any) => {\n if (childNode.type === 'VariableDeclaration') {\n return childNode.declarations.find((d: any) => d.id.name === name);\n }\n if (\n childNode.type === 'FunctionDeclaration' &&\n childNode.id.name === name\n ) {\n return childNode;\n }\n });\n\n if (!node) {\n return;\n }\n\n if (node.type === 'FunctionDeclaration') {\n const returnStatement = node.body?.body?.find(\n (b: any) => b.type === 'ReturnStatement',\n );\n\n // If the function directly returns an arrow function\n if (returnStatement?.argument?.params) {\n return {\n numberOfParams: node.params.length,\n returnNumberOfParams: returnStatement.argument.params.length,\n };\n // If the function returns a CallExpression (e.g., return useCallback(...))\n } else if (\n returnStatement?.argument?.type === 'CallExpression' &&\n returnStatement.argument.arguments?.[0]?.type ===\n 'ArrowFunctionExpression'\n ) {\n const arrowFn = returnStatement.argument.arguments[0];\n return {\n numberOfParams: node.params.length,\n returnNumberOfParams: arrowFn.params.length,\n };\n }\n return {\n numberOfParams: node.params.length,\n };\n }\n\n const declaration = node.declarations.find((d: any) => d.id.name === name);\n\n if (declaration.init.name) {\n return parseFunction(ast, declaration.init.name);\n }\n\n if (declaration.init.body.type === 'ArrowFunctionExpression') {\n return {\n numberOfParams: declaration.init.params.length,\n returnNumberOfParams: declaration.init.body.params.length,\n };\n }\n\n const returnStatement = declaration.init.body?.body?.find(\n (b: any) => b.type === 'ReturnStatement',\n );\n\n if (returnStatement?.argument?.params) {\n return {\n numberOfParams: declaration.init.params.length,\n returnNumberOfParams: returnStatement.argument.params.length,\n };\n } else if (\n returnStatement?.argument?.type === 'CallExpression' &&\n returnStatement.argument.arguments?.[0]?.type === 'ArrowFunctionExpression'\n ) {\n const arrowFn = returnStatement.argument.arguments[0];\n return {\n numberOfParams: declaration.init.params.length,\n returnNumberOfParams: arrowFn.params.length,\n };\n }\n\n return {\n numberOfParams: declaration.init.params.length,\n };\n};\n","import {\n type GeneratorMutator,\n type GeneratorSchema,\n type GetterBody,\n type GetterQueryParam,\n type GetterResponse,\n type ParamsSerializerOptions,\n Verbs,\n} from '../types';\nimport { getIsBodyVerb, isObject, stringify } from '../utils';\n\nexport const generateBodyOptions = (\n body: GetterBody,\n isFormData: boolean,\n isFormUrlEncoded: boolean,\n) => {\n if (isFormData && body.formData) {\n return '\\n formData,';\n }\n\n if (isFormUrlEncoded && body.formUrlEncoded) {\n return '\\n formUrlEncoded,';\n }\n\n if (body.implementation) {\n return `\\n ${body.implementation},`;\n }\n\n return '';\n};\n\nexport const generateAxiosOptions = ({\n response,\n isExactOptionalPropertyTypes,\n queryParams,\n headers,\n requestOptions,\n hasSignal,\n isVue,\n isAngular,\n paramsSerializer,\n paramsSerializerOptions,\n}: {\n response: GetterResponse;\n isExactOptionalPropertyTypes: boolean;\n queryParams?: GeneratorSchema;\n headers?: GeneratorSchema;\n requestOptions?: object | boolean;\n hasSignal: boolean;\n isVue: boolean;\n isAngular: boolean;\n paramsSerializer?: GeneratorMutator;\n paramsSerializerOptions?: ParamsSerializerOptions;\n}) => {\n const isRequestOptions = requestOptions !== false;\n if (\n !queryParams &&\n !headers &&\n !response.isBlob &&\n response.definition.success !== 'string'\n ) {\n if (isRequestOptions) {\n return 'options';\n }\n if (hasSignal) {\n return isExactOptionalPropertyTypes\n ? '...(signal ? { signal } : {})'\n : 'signal';\n }\n return '';\n }\n\n let value = '';\n\n if (!isRequestOptions) {\n if (queryParams) {\n value += '\\n params,';\n }\n\n if (headers) {\n value += '\\n headers,';\n }\n\n if (hasSignal) {\n value += isExactOptionalPropertyTypes\n ? '\\n ...(signal ? { signal } : {}),'\n : '\\n signal,';\n }\n }\n\n if (\n !isObject(requestOptions) ||\n !requestOptions.hasOwnProperty('responseType')\n ) {\n if (response.isBlob) {\n value += `\\n responseType: 'blob',`;\n } else if (response.definition.success === 'string') {\n value += `\\n responseType: 'text',`;\n }\n }\n\n if (isObject(requestOptions)) {\n value += `\\n ${stringify(requestOptions)?.slice(1, -1)}`;\n }\n\n if (isRequestOptions) {\n value += '\\n ...options,';\n\n if (queryParams) {\n if (isVue) {\n value += '\\n params: {...unref(params), ...options?.params},';\n } else if (isAngular && paramsSerializer) {\n value += `\\n params: ${paramsSerializer.name}({...params, ...options?.params}),`;\n } else {\n value += '\\n params: {...params, ...options?.params},';\n }\n }\n\n if (headers) {\n value += '\\n headers: {...headers, ...options?.headers},';\n }\n }\n\n if (\n !isAngular &&\n queryParams &&\n (paramsSerializer || paramsSerializerOptions?.qs)\n ) {\n value += paramsSerializer\n ? `\\n paramsSerializer: ${paramsSerializer.name},`\n : `\\n paramsSerializer: (params) => qs.stringify(params, ${JSON.stringify(\n paramsSerializerOptions!.qs,\n )}),`;\n }\n\n return value;\n};\n\nexport const generateOptions = ({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n requestOptions,\n isFormData,\n isFormUrlEncoded,\n isAngular,\n isExactOptionalPropertyTypes,\n hasSignal,\n isVue,\n paramsSerializer,\n paramsSerializerOptions,\n}: {\n route: string;\n body: GetterBody;\n headers?: GetterQueryParam;\n queryParams?: GetterQueryParam;\n response: GetterResponse;\n verb: Verbs;\n requestOptions?: object | boolean;\n isFormData: boolean;\n isFormUrlEncoded: boolean;\n isAngular?: boolean;\n isExactOptionalPropertyTypes: boolean;\n hasSignal: boolean;\n isVue?: boolean;\n paramsSerializer?: GeneratorMutator;\n paramsSerializerOptions?: ParamsSerializerOptions;\n}) => {\n const bodyOptions = getIsBodyVerb(verb)\n ? generateBodyOptions(body, isFormData, isFormUrlEncoded)\n : '';\n\n const axiosOptions = generateAxiosOptions({\n response,\n queryParams: queryParams?.schema,\n headers: headers?.schema,\n requestOptions,\n isExactOptionalPropertyTypes,\n hasSignal,\n isVue: isVue ?? false,\n isAngular: isAngular ?? false,\n paramsSerializer,\n paramsSerializerOptions,\n });\n\n const options = axiosOptions ? `{${axiosOptions}}` : '';\n\n if (verb === Verbs.DELETE) {\n if (!bodyOptions) {\n return `\\n \\`${route}\\`,${\n axiosOptions === 'options' ? axiosOptions : options\n }\\n `;\n }\n\n return `\\n \\`${route}\\`,{${\n isAngular ? 'body' : 'data'\n }:${bodyOptions} ${\n axiosOptions === 'options' ? `...${axiosOptions}` : axiosOptions\n }}\\n `;\n }\n\n return `\\n \\`${route}\\`,${\n getIsBodyVerb(verb) ? bodyOptions || 'undefined,' : ''\n }${axiosOptions === 'options' ? axiosOptions : options}\\n `;\n};\n\nexport const generateBodyMutatorConfig = (\n body: GetterBody,\n isFormData: boolean,\n isFormUrlEncoded: boolean,\n) => {\n if (isFormData && body.formData) {\n return ',\\n data: formData';\n }\n\n if (isFormUrlEncoded && body.formUrlEncoded) {\n return ',\\n data: formUrlEncoded';\n }\n\n if (body.implementation) {\n return `,\\n data: ${body.implementation}`;\n }\n\n return '';\n};\n\nexport const generateQueryParamsAxiosConfig = (\n response: GetterResponse,\n isVue: boolean,\n queryParams?: GetterQueryParam,\n) => {\n if (!queryParams && !response.isBlob) {\n return '';\n }\n\n let value = '';\n\n if (queryParams) {\n value += isVue ? ',\\n params: unref(params)' : ',\\n params';\n }\n\n if (response.isBlob) {\n value += `,\\n responseType: 'blob'`;\n }\n\n return value;\n};\n\nexport const generateMutatorConfig = ({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n isFormData,\n isFormUrlEncoded,\n hasSignal,\n isExactOptionalPropertyTypes,\n isVue,\n}: {\n route: string;\n body: GetterBody;\n headers?: GetterQueryParam;\n queryParams?: GetterQueryParam;\n response: GetterResponse;\n verb: Verbs;\n isFormData: boolean;\n isFormUrlEncoded: boolean;\n hasSignal: boolean;\n isExactOptionalPropertyTypes: boolean;\n isVue?: boolean;\n}) => {\n const bodyOptions = getIsBodyVerb(verb)\n ? generateBodyMutatorConfig(body, isFormData, isFormUrlEncoded)\n : '';\n\n const queryParamsOptions = generateQueryParamsAxiosConfig(\n response,\n isVue ?? false,\n queryParams,\n );\n\n const headerOptions = body.contentType\n ? `,\\n headers: {'Content-Type': '${body.contentType}', ${\n headers ? '...headers' : ''\n }}`\n : headers\n ? ',\\n headers'\n : '';\n\n return `{url: \\`${route}\\`, method: '${verb.toUpperCase()}'${headerOptions}${bodyOptions}${queryParamsOptions}${\n hasSignal\n ? `, ${\n isExactOptionalPropertyTypes\n ? '...(signal ? { signal }: {})'\n : 'signal'\n }`\n : ''\n }\\n }`;\n};\n\nexport const generateMutatorRequestOptions = (\n requestOptions: boolean | object | undefined,\n hasSecondArgument: boolean,\n) => {\n if (!hasSecondArgument) {\n return isObject(requestOptions)\n ? `{${stringify(requestOptions)?.slice(1, -1)}}`\n : '';\n }\n\n if (isObject(requestOptions)) {\n return `{${stringify(requestOptions)?.slice(1, -1)} ...options}`;\n }\n\n return 'options';\n};\n\nexport const generateFormDataAndUrlEncodedFunction = ({\n body,\n formData,\n formUrlEncoded,\n isFormData,\n isFormUrlEncoded,\n}: {\n body: GetterBody;\n formData?: GeneratorMutator;\n formUrlEncoded?: GeneratorMutator;\n isFormData: boolean;\n isFormUrlEncoded: boolean;\n}) => {\n if (isFormData && body.formData) {\n if (formData) {\n return `const formData = ${formData.name}(${body.implementation})`;\n }\n\n return body.formData;\n }\n\n if (isFormUrlEncoded && body.formUrlEncoded) {\n if (formUrlEncoded) {\n return `const formUrlEncoded = ${formUrlEncoded.name}(${body.implementation})`;\n }\n\n return body.formUrlEncoded;\n }\n\n return '';\n};\n","import type { ComponentsObject, ParameterObject } from 'openapi3-ts/oas30';\n\nimport { resolveObject, resolveRef } from '../resolvers';\nimport type { ContextSpecs, GeneratorSchema } from '../types';\nimport { jsDoc, pascal, sanitize } from '../utils';\n\nexport const generateParameterDefinition = (\n parameters: ComponentsObject['parameters'] = {},\n context: ContextSpecs,\n suffix: string,\n): GeneratorSchema[] => {\n return Object.entries(parameters).reduce<GeneratorSchema[]>(\n (acc, [parameterName, parameter]) => {\n const modelName = sanitize(`${pascal(parameterName)}${suffix}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n const { schema, imports } = resolveRef<ParameterObject>(\n parameter,\n context,\n );\n\n if (schema.in !== 'query' && schema.in !== 'header') {\n return acc;\n }\n\n if (!schema.schema || imports.length > 0) {\n acc.push({\n name: modelName,\n imports:\n imports.length > 0\n ? [\n {\n name: imports[0].name,\n specKey: imports[0].specKey,\n schemaName: imports[0].schemaName,\n },\n ]\n : [],\n model: `export type ${modelName} = ${\n imports.length > 0 ? imports[0].name : 'unknown'\n };\\n`,\n });\n\n return acc;\n }\n\n const resolvedObject = resolveObject({\n schema: schema.schema,\n propName: modelName,\n context,\n });\n\n const doc = jsDoc(parameter as ParameterObject);\n\n const model = `${doc}export type ${modelName} = ${\n resolvedObject.value || 'unknown'\n };\\n`;\n\n acc.push(...resolvedObject.schemas);\n\n if (modelName !== resolvedObject.value) {\n acc.push({\n name: modelName,\n model,\n imports: resolvedObject.imports,\n });\n }\n\n return acc;\n },\n [],\n );\n};\n","import type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getScalar } from '../getters';\nimport type { ContextSpecs } from '../types';\nimport { jsDoc } from '../utils';\n\n/**\n * Generate the interface string\n * An eslint comment is insert if the resulted object is empty\n *\n * @param name interface name\n * @param schema\n */\nexport const generateInterface = ({\n name,\n schema,\n context,\n suffix,\n}: {\n name: string;\n schema: SchemaObject;\n context: ContextSpecs;\n suffix: string;\n}) => {\n const scalar = getScalar({\n item: schema,\n name,\n context,\n });\n const isEmptyObject = scalar.value === '{}';\n\n let model = '';\n\n model += jsDoc(schema);\n\n if (isEmptyObject) {\n model +=\n '// eslint-disable-next-line @typescript-eslint/no-empty-interface\\n';\n }\n\n if (\n scalar.type === 'object' &&\n !context?.output.override?.useTypeOverInterfaces\n ) {\n if (\n scalar.type === 'object' &&\n schema.properties &&\n Object.values(schema.properties).length > 0 &&\n Object.values(schema.properties).every((item) => 'const' in item)\n ) {\n const mappedScalarValue = scalar.value\n .replaceAll(';', ',')\n .replaceAll('?:', ':');\n\n model += `export const ${name}Value = ${mappedScalarValue} as const;\\nexport type ${name} = typeof ${name}Value;\\n`;\n } else {\n const blankInterfaceValue =\n scalar.value === 'unknown' ? '{}' : scalar.value;\n\n model += `export interface ${name} ${blankInterfaceValue}\\n`;\n }\n } else {\n model += `export type ${name} = ${scalar.value};\\n`;\n }\n\n // Filter out imports that refer to the type defined in current file (OpenAPI recursive schema definitions)\n const externalModulesImportsOnly = scalar.imports.filter((importName) =>\n importName.alias ? importName.alias !== name : importName.name !== name,\n );\n\n return [\n ...scalar.schemas,\n {\n name,\n model,\n imports: externalModulesImportsOnly,\n },\n ];\n};\n","import isEmpty from 'lodash.isempty';\nimport type { SchemaObject, SchemasObject } from 'openapi3-ts/oas30';\n\nimport {\n getEnum,\n getEnumDescriptions,\n getEnumNames,\n resolveDiscriminators,\n} from '../getters';\nimport { resolveRef, resolveValue } from '../resolvers';\nimport type {\n ContextSpecs,\n GeneratorSchema,\n InputFiltersOption,\n} from '../types';\nimport {\n isReference,\n isString,\n jsDoc,\n pascal,\n sanitize,\n upath,\n} from '../utils';\nimport { generateInterface } from './interface';\n\n/**\n * Extract all types from #/components/schemas\n *\n * @param schemas\n */\nexport const generateSchemasDefinition = (\n schemas: SchemasObject = {},\n context: ContextSpecs,\n suffix: string,\n filters?: InputFiltersOption,\n): GeneratorSchema[] => {\n if (isEmpty(schemas)) {\n return [];\n }\n\n const transformedSchemas = resolveDiscriminators(schemas, context);\n\n let generateSchemas = Object.entries(transformedSchemas);\n if (filters?.schemas) {\n const schemasFilters = filters.schemas;\n const mode = filters.mode || 'include';\n\n generateSchemas = generateSchemas.filter(([schemaName]) => {\n const isMatch = schemasFilters.some((filter) =>\n isString(filter) ? filter === schemaName : filter.test(schemaName),\n );\n\n return mode === 'include' ? isMatch : !isMatch;\n });\n }\n\n const models = generateSchemas.reduce<GeneratorSchema[]>(\n (acc, [name, schema]) => {\n const schemaName = sanitize(`${pascal(name)}${suffix}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n if (shouldCreateInterface(schema)) {\n acc.push(\n ...generateInterface({\n name: schemaName,\n schema,\n context,\n suffix,\n }),\n );\n\n return acc;\n } else {\n const resolvedValue = resolveValue({\n schema,\n name: schemaName,\n context,\n });\n\n let output = '';\n\n let imports = resolvedValue.imports;\n\n output += jsDoc(schema);\n\n if (resolvedValue.isEnum && !resolvedValue.isRef) {\n output += getEnum(\n resolvedValue.value,\n schemaName,\n getEnumNames(resolvedValue.originalSchema),\n context.output.override.enumGenerationType,\n getEnumDescriptions(resolvedValue.originalSchema),\n context.output.override.namingConvention?.enum,\n );\n } else if (schemaName === resolvedValue.value && resolvedValue.isRef) {\n // Don't add type if schema has same name and the referred schema will be an interface\n const { schema: referredSchema } = resolveRef(schema, context);\n if (!shouldCreateInterface(referredSchema as SchemaObject)) {\n const imp = resolvedValue.imports.find(\n (imp) => imp.name === schemaName,\n );\n\n if (imp) {\n const alias = imp?.specKey\n ? `${pascal(upath.getSpecName(imp.specKey, context.specKey))}${\n resolvedValue.value\n }`\n : `${resolvedValue.value}Bis`;\n\n output += `export type ${schemaName} = ${alias};\\n`;\n\n imports = imports.map((imp) =>\n imp.name === schemaName ? { ...imp, alias } : imp,\n );\n } else {\n output += `export type ${schemaName} = ${resolvedValue.value};\\n`;\n }\n }\n } else {\n resolvedValue.schemas = resolvedValue.schemas.filter((schema) => {\n if (schema.name !== schemaName) {\n return true;\n }\n\n output += `${schema.model}\\n`;\n imports = imports.concat(schema.imports);\n\n return false;\n });\n output += `export type ${schemaName} = ${resolvedValue.value};\\n`;\n }\n\n acc.push(...resolvedValue.schemas, {\n name: schemaName,\n model: output,\n imports,\n });\n\n return acc;\n }\n },\n [],\n );\n\n return models;\n};\n\nfunction shouldCreateInterface(schema: SchemaObject) {\n return (\n (!schema.type || schema.type === 'object') &&\n !schema.allOf &&\n !schema.oneOf &&\n !schema.anyOf &&\n !isReference(schema) &&\n !schema.nullable &&\n !schema.enum\n );\n}\n","import type {\n ComponentsObject,\n OperationObject,\n ParameterObject,\n PathItemObject,\n ReferenceObject,\n} from 'openapi3-ts/oas30';\n\nimport {\n getBody,\n getOperationId,\n getParameters,\n getParams,\n getProps,\n getQueryParams,\n getResponse,\n} from '../getters';\nimport type {\n ContextSpecs,\n GeneratorVerbOptions,\n GeneratorVerbsOptions,\n NormalizedInputOptions,\n NormalizedMutator,\n NormalizedOperationOptions,\n NormalizedOutputOptions,\n Verbs,\n} from '../types';\nimport {\n asyncReduce,\n camel,\n dynamicImport,\n isObject,\n isString,\n isVerb,\n jsDoc,\n mergeDeep,\n sanitize,\n} from '../utils';\nimport { generateMutator } from './mutator';\n\nconst generateVerbOptions = async ({\n verb,\n output,\n operation,\n route,\n pathRoute,\n verbParameters = [],\n context,\n}: {\n verb: Verbs;\n output: NormalizedOutputOptions;\n operation: OperationObject;\n route: string;\n pathRoute: string;\n verbParameters?: (ReferenceObject | ParameterObject)[];\n components?: ComponentsObject;\n context: ContextSpecs;\n}): Promise<GeneratorVerbOptions> => {\n const {\n responses,\n requestBody,\n parameters: operationParameters,\n tags = [],\n deprecated,\n description,\n summary,\n } = operation;\n const operationId = getOperationId(operation, route, verb);\n const overrideOperation = output.override.operations[operation.operationId!];\n const overrideTag = Object.entries(\n output.override.tags,\n ).reduce<NormalizedOperationOptions>(\n (acc, [tag, options]) =>\n tags.includes(tag) ? mergeDeep(acc, options) : acc,\n {},\n );\n\n const override = mergeDeep(\n mergeDeep(output.override, overrideTag),\n overrideOperation,\n );\n\n const overrideOperationName =\n overrideOperation?.operationName || output.override?.operationName;\n const operationName = overrideOperationName\n ? overrideOperationName(operation, route, verb)\n : sanitize(camel(operationId), { es5keyword: true });\n\n const response = getResponse({\n responses,\n operationName,\n context,\n contentType: override.contentType,\n });\n\n const body = getBody({\n requestBody: requestBody!,\n operationName,\n context,\n contentType: override.contentType,\n });\n\n const parameters = getParameters({\n parameters: [...verbParameters, ...(operationParameters ?? [])],\n context,\n });\n\n const queryParams = getQueryParams({\n queryParams: parameters.query,\n operationName,\n context,\n });\n\n const headers = output.headers\n ? await getQueryParams({\n queryParams: parameters.header,\n operationName,\n context,\n suffix: 'headers',\n })\n : undefined;\n\n const params = getParams({\n route,\n pathParams: parameters.path,\n operationId: operationId!,\n context,\n output,\n });\n\n const props = getProps({\n body,\n queryParams,\n params,\n headers,\n operationName,\n context,\n });\n\n const mutator = await generateMutator({\n output: output.target,\n name: operationName,\n mutator: override?.mutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n });\n\n const formData =\n !override.formData.disabled && body.formData\n ? await generateMutator({\n output: output.target,\n name: operationName,\n mutator: override.formData.mutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n\n const formUrlEncoded =\n isString(override?.formUrlEncoded) || isObject(override?.formUrlEncoded)\n ? await generateMutator({\n output: output.target,\n name: operationName,\n mutator: override.formUrlEncoded,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n\n const paramsSerializer =\n isString(override?.paramsSerializer) || isObject(override?.paramsSerializer)\n ? await generateMutator({\n output: output.target,\n name: 'paramsSerializer',\n mutator: override.paramsSerializer as NormalizedMutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n\n const fetchReviver =\n isString(override?.fetch.jsonReviver) ||\n isObject(override?.fetch.jsonReviver)\n ? await generateMutator({\n output: output.target,\n name: 'fetchReviver',\n mutator: override.fetch.jsonReviver as NormalizedMutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n const doc = jsDoc({ description, deprecated, summary });\n\n const verbOption: GeneratorVerbOptions = {\n verb: verb as Verbs,\n tags,\n route,\n pathRoute,\n summary: operation.summary,\n operationId: operationId!,\n operationName,\n response,\n body,\n headers,\n queryParams,\n params,\n props,\n mutator,\n formData,\n formUrlEncoded,\n paramsSerializer,\n fetchReviver,\n override,\n doc,\n deprecated,\n originalOperation: operation,\n };\n\n const transformer = await dynamicImport(\n override?.transformer,\n context.workspace,\n );\n\n return transformer ? transformer(verbOption) : verbOption;\n};\n\nexport const generateVerbsOptions = ({\n verbs,\n input,\n output,\n route,\n pathRoute,\n context,\n}: {\n verbs: PathItemObject;\n input: NormalizedInputOptions;\n output: NormalizedOutputOptions;\n route: string;\n pathRoute: string;\n context: ContextSpecs;\n}): Promise<GeneratorVerbsOptions> =>\n asyncReduce(\n _filteredVerbs(verbs, input.filters),\n async (acc, [verb, operation]: [string, OperationObject]) => {\n if (isVerb(verb)) {\n const verbOptions = await generateVerbOptions({\n verb,\n output,\n verbParameters: verbs.parameters,\n route,\n pathRoute,\n operation,\n context,\n });\n\n acc.push(verbOptions);\n }\n\n return acc;\n },\n [] as GeneratorVerbsOptions,\n );\n\nexport const _filteredVerbs = (\n verbs: PathItemObject,\n filters: NormalizedInputOptions['filters'],\n) => {\n if (filters?.tags === undefined) {\n return Object.entries(verbs);\n }\n\n const filterTags = filters.tags || [];\n const filterMode = filters.mode || 'include';\n\n return Object.entries(verbs).filter(\n ([_verb, operation]: [string, OperationObject]) => {\n const operationTags = operation.tags || [];\n\n const isMatch = operationTags.some((tag) =>\n filterTags.some((filterTag) =>\n filterTag instanceof RegExp ? filterTag.test(tag) : filterTag === tag,\n ),\n );\n\n return filterMode === 'exclude' ? !isMatch : isMatch;\n },\n );\n};\n","import fs from 'fs-extra';\n\nimport { generateImports } from '../generators';\nimport { type GeneratorSchema, NamingConvention } from '../types';\nimport { conventionName, upath } from '../utils';\n\nconst getSchema = ({\n schema: { imports, model },\n target,\n isRootKey,\n specsName,\n header,\n specKey,\n namingConvention = NamingConvention.CAMEL_CASE,\n}: {\n schema: GeneratorSchema;\n target: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n header: string;\n specKey: string;\n namingConvention?: NamingConvention;\n}): string => {\n let file = header;\n file += generateImports({\n imports: imports.filter(\n (imp) =>\n !model.includes(`type ${imp.alias || imp.name} =`) &&\n !model.includes(`interface ${imp.alias || imp.name} {`),\n ),\n target,\n isRootKey,\n specsName,\n specKey,\n namingConvention,\n });\n file += imports.length > 0 ? '\\n\\n' : '\\n';\n file += model;\n return file;\n};\n\nconst getPath = (path: string, name: string, fileExtension: string): string =>\n upath.join(path, `/${name}${fileExtension}`);\n\nexport const writeModelInline = (acc: string, model: string): string =>\n acc + `${model}\\n`;\n\nexport const writeModelsInline = (array: GeneratorSchema[]): string =>\n array.reduce((acc, { model }) => writeModelInline(acc, model), '');\n\nexport const writeSchema = async ({\n path,\n schema,\n target,\n namingConvention,\n fileExtension,\n specKey,\n isRootKey,\n specsName,\n header,\n}: {\n path: string;\n schema: GeneratorSchema;\n target: string;\n namingConvention: NamingConvention;\n fileExtension: string;\n specKey: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n header: string;\n}) => {\n const name = conventionName(schema.name, namingConvention);\n\n try {\n await fs.outputFile(\n getPath(path, name, fileExtension),\n getSchema({\n schema,\n target,\n isRootKey,\n specsName,\n header,\n specKey,\n namingConvention,\n }),\n );\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing schema ${name} => ${error}`,\n );\n }\n};\n\nexport const writeSchemas = async ({\n schemaPath,\n schemas,\n target,\n namingConvention,\n fileExtension,\n specKey,\n isRootKey,\n specsName,\n header,\n indexFiles,\n}: {\n schemaPath: string;\n schemas: GeneratorSchema[];\n target: string;\n namingConvention: NamingConvention;\n fileExtension: string;\n specKey: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n header: string;\n indexFiles: boolean;\n}) => {\n await Promise.all(\n schemas.map((schema) =>\n writeSchema({\n path: schemaPath,\n schema,\n target,\n namingConvention,\n fileExtension,\n specKey,\n isRootKey,\n specsName,\n header,\n }),\n ),\n );\n\n if (indexFiles) {\n const schemaFilePath = upath.join(schemaPath, `/index${fileExtension}`);\n await fs.ensureFile(schemaFilePath);\n\n // Ensure separate files are used for parallel schema writing.\n // Throw an exception, which list all duplicates, before attempting\n // multiple writes on the same file.\n const schemaNamesSet = new Set<string>();\n const duplicateNamesMap = new Map<string, number>();\n for (const schema of schemas) {\n if (schemaNamesSet.has(schema.name)) {\n duplicateNamesMap.set(\n schema.name,\n (duplicateNamesMap.get(schema.name) || 1) + 1,\n );\n } else {\n schemaNamesSet.add(schema.name);\n }\n }\n if (duplicateNamesMap.size > 0) {\n throw new Error(\n 'Duplicate schema names detected:\\n' +\n [...duplicateNamesMap]\n .map((duplicate) => ` ${duplicate[1]}x ${duplicate[0]}`)\n .join('\\n'),\n );\n }\n\n try {\n const data = await fs.readFile(schemaFilePath);\n\n const stringData = data.toString();\n\n const ext = fileExtension.endsWith('.ts')\n ? fileExtension.slice(0, -3)\n : fileExtension;\n\n const importStatements = schemas\n .filter((schema) => {\n const name = conventionName(schema.name, namingConvention);\n\n return (\n !stringData.includes(`export * from './${name}${ext}'`) &&\n !stringData.includes(`export * from \"./${name}${ext}\"`)\n );\n })\n .map(\n (schema) =>\n `export * from './${conventionName(schema.name, namingConvention)}${ext}';`,\n );\n\n const currentFileExports = (stringData\n .match(/export \\* from(.*)('|\")/g)\n ?.map((s) => s + ';') ?? []) as string[];\n\n const exports = [...currentFileExports, ...importStatements]\n .sort()\n .join('\\n');\n\n const fileContent = `${header}\\n${exports}`;\n\n await fs.writeFile(schemaFilePath, fileContent);\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing schema index file ${schemaFilePath} => ${error}`,\n );\n }\n }\n};\n","import uniqBy from 'lodash.uniqby';\n\nimport type { GeneratorImport, NormalizedOutputOptions } from '../types';\nimport { conventionName, upath } from '../utils';\n\nexport const generateImportsForBuilder = (\n output: NormalizedOutputOptions,\n imports: GeneratorImport[],\n relativeSchemasPath: string,\n) => {\n return output.schemas && !output.indexFiles\n ? uniqBy(imports, 'name').map((i) => {\n const name = conventionName(i.name, output.namingConvention);\n return {\n exports: [i],\n dependency: upath.joinSafe(relativeSchemasPath, name),\n };\n })\n : [{ exports: imports, dependency: relativeSchemasPath }];\n};\n","import {\n type GeneratorTarget,\n type GeneratorTargetFull,\n type NormalizedOutputOptions,\n OutputClient,\n type WriteSpecsBuilder,\n} from '../types';\nimport { compareVersions, pascal } from '../utils';\n\nexport const generateTarget = (\n builder: WriteSpecsBuilder,\n options: NormalizedOutputOptions,\n): GeneratorTarget => {\n const operationNames = Object.values(builder.operations).map(\n ({ operationName }) => operationName,\n );\n const isAngularClient = options?.client === OutputClient.ANGULAR;\n\n const titles = builder.title({\n outputClient: options.client,\n title: pascal(builder.info.title),\n customTitleFunc: options.override.title,\n output: options,\n });\n\n const target = Object.values(builder.operations).reduce<\n Required<GeneratorTargetFull>\n >(\n (acc, operation, index, arr) => {\n acc.imports.push(...operation.imports);\n acc.importsMock.push(...operation.importsMock);\n acc.implementation += operation.implementation + '\\n';\n acc.implementationMock.function += operation.implementationMock.function;\n acc.implementationMock.handler += operation.implementationMock.handler;\n\n const handlerNameSeparator =\n acc.implementationMock.handlerName.length > 0 ? ',\\n ' : ' ';\n acc.implementationMock.handlerName +=\n handlerNameSeparator + operation.implementationMock.handlerName + '()';\n\n if (operation.mutator) {\n acc.mutators.push(operation.mutator);\n }\n\n if (operation.formData) {\n acc.formData.push(operation.formData);\n }\n if (operation.formUrlEncoded) {\n acc.formUrlEncoded.push(operation.formUrlEncoded);\n }\n if (operation.paramsSerializer) {\n acc.paramsSerializer.push(operation.paramsSerializer);\n }\n\n if (operation.clientMutators) {\n acc.clientMutators.push(...operation.clientMutators);\n }\n\n if (operation.fetchReviver) {\n acc.fetchReviver.push(operation.fetchReviver);\n }\n\n if (index === arr.length - 1) {\n const isMutator = acc.mutators.some((mutator) =>\n isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n );\n\n const typescriptVersion =\n options.packageJson?.dependencies?.typescript ??\n options.packageJson?.devDependencies?.typescript ??\n '4.4.0';\n\n const hasAwaitedType = compareVersions(typescriptVersion, '4.5.0');\n\n const header = builder.header({\n outputClient: options.client,\n isRequestOptions: options.override.requestOptions !== false,\n isMutator,\n isGlobalMutator: !!options.override.mutator,\n provideIn: options.override.angular.provideIn,\n hasAwaitedType,\n titles,\n output: options,\n verbOptions: builder.verbOptions,\n clientImplementation: acc.implementation,\n });\n\n acc.implementation = header.implementation + acc.implementation;\n acc.implementationMock.handler =\n acc.implementationMock.handler +\n header.implementationMock +\n acc.implementationMock.handlerName;\n\n const footer = builder.footer({\n outputClient: options?.client,\n operationNames,\n hasMutator: acc.mutators.length > 0,\n hasAwaitedType,\n titles,\n output: options,\n });\n acc.implementation += footer.implementation;\n acc.implementationMock.handler += footer.implementationMock;\n }\n return acc;\n },\n {\n imports: [],\n implementation: '',\n implementationMock: {\n function: '',\n handler: '',\n handlerName: '',\n },\n importsMock: [],\n mutators: [],\n clientMutators: [],\n formData: [],\n formUrlEncoded: [],\n paramsSerializer: [],\n fetchReviver: [],\n },\n );\n\n return {\n ...target,\n implementationMock:\n target.implementationMock.function + target.implementationMock.handler,\n };\n};\n","export const getOrvalGeneratedTypes = () => `\n// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497\ntype IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <\nT,\n>() => T extends Y ? 1 : 2\n? A\n: B;\n\ntype WritableKeys<T> = {\n[P in keyof T]-?: IfEquals<\n { [Q in P]: T[P] },\n { -readonly [Q in P]: T[P] },\n P\n>;\n}[keyof T];\n\ntype UnionToIntersection<U> =\n (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;\ntype DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;\n\ntype Writable<T> = Pick<T, WritableKeys<T>>;\ntype NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {\n [P in keyof Writable<T>]: T[P] extends object\n ? NonReadonly<NonNullable<T[P]>>\n : T[P];\n} : DistributeReadOnlyOverUnions<T>;\n`;\n\nexport const getTypedResponse = () => `\ninterface TypedResponse<T> extends Response {\n json(): Promise<T>;\n}\n`;\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport type { WriteModeProps } from '../types';\nimport {\n conventionName,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n upath,\n} from '../utils';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTarget } from './target';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeSingleMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n try {\n const { path, dirname } = getFileInfo(output.target, {\n backupFilename: conventionName(\n builder.info.title,\n output.namingConvention,\n ),\n extension: output.fileExtension,\n });\n\n const {\n imports,\n importsMock,\n implementation,\n implementationMock,\n mutators,\n clientMutators,\n formData,\n formUrlEncoded,\n paramsSerializer,\n fetchReviver,\n } = generateTarget(builder, output);\n\n let data = header;\n\n const schemasPath = output.schemas\n ? upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : undefined;\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const importsForBuilder = schemasPath\n ? generateImportsForBuilder(\n output,\n imports.filter(\n (imp) => !importsMock.some((impMock) => imp.name === impMock.name),\n ),\n schemasPath,\n )\n : [];\n\n data += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n if (output.mock) {\n const importsMockForBuilder = schemasPath\n ? generateImportsForBuilder(output, importsMock, schemasPath)\n : [];\n data += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n }\n\n if (mutators) {\n data += generateMutatorImports({ mutators, implementation });\n }\n\n if (clientMutators) {\n data += generateMutatorImports({ mutators: clientMutators });\n }\n\n if (formData) {\n data += generateMutatorImports({ mutators: formData });\n }\n\n if (formUrlEncoded) {\n data += generateMutatorImports({ mutators: formUrlEncoded });\n }\n\n if (paramsSerializer) {\n data += generateMutatorImports({ mutators: paramsSerializer });\n }\n\n if (fetchReviver) {\n data += generateMutatorImports({ mutators: fetchReviver });\n }\n\n if (implementation.includes('NonReadonly<')) {\n data += getOrvalGeneratedTypes();\n data += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n data += getTypedResponse();\n data += '\\n';\n }\n\n if (!output.schemas && needSchema) {\n data += generateModelsInline(builder.schemas);\n }\n\n data += `${implementation.trim()}\\n`;\n\n if (output.mock) {\n data += '\\n\\n';\n data += implementationMock;\n }\n\n await fs.outputFile(path, data);\n\n return [path];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing file => ${error}`,\n );\n }\n};\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport { OutputClient, type WriteModeProps } from '../types';\nimport {\n conventionName,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTarget } from './target';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeSplitMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n try {\n const { filename, dirname, extension } = getFileInfo(output.target, {\n backupFilename: conventionName(\n builder.info.title,\n output.namingConvention,\n ),\n extension: output.fileExtension,\n });\n\n const {\n imports,\n implementation,\n implementationMock,\n importsMock,\n mutators,\n clientMutators,\n formData,\n formUrlEncoded,\n paramsSerializer,\n fetchReviver,\n } = generateTarget(builder, output);\n\n let implementationData = header;\n let mockData = header;\n\n const relativeSchemasPath = output.schemas\n ? upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : './' + filename + '.schemas';\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const importsForBuilder = generateImportsForBuilder(\n output,\n imports,\n relativeSchemasPath,\n );\n\n implementationData += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n const importsMockForBuilder = generateImportsForBuilder(\n output,\n importsMock,\n relativeSchemasPath,\n );\n\n mockData += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n\n const schemasPath = output.schemas\n ? undefined\n : upath.join(dirname, filename + '.schemas' + extension);\n\n if (schemasPath && needSchema) {\n const schemasData = header + generateModelsInline(builder.schemas);\n\n await fs.outputFile(\n upath.join(dirname, filename + '.schemas' + extension),\n schemasData,\n );\n }\n\n if (mutators) {\n implementationData += generateMutatorImports({\n mutators,\n implementation,\n });\n }\n\n if (clientMutators) {\n implementationData += generateMutatorImports({\n mutators: clientMutators,\n });\n }\n\n if (formData) {\n implementationData += generateMutatorImports({ mutators: formData });\n }\n\n if (formUrlEncoded) {\n implementationData += generateMutatorImports({\n mutators: formUrlEncoded,\n });\n }\n\n if (paramsSerializer) {\n implementationData += generateMutatorImports({\n mutators: paramsSerializer,\n });\n }\n\n if (fetchReviver) {\n implementationData += generateMutatorImports({\n mutators: fetchReviver,\n });\n }\n\n if (implementation.includes('NonReadonly<')) {\n implementationData += getOrvalGeneratedTypes();\n implementationData += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n implementationData += getTypedResponse();\n implementationData += '\\n';\n }\n\n implementationData += `\\n${implementation}`;\n mockData += `\\n${implementationMock}`;\n\n const implementationFilename =\n filename +\n (OutputClient.ANGULAR === output.client ? '.service' : '') +\n extension;\n\n const implementationPath = upath.join(dirname, implementationFilename);\n await fs.outputFile(\n upath.join(dirname, implementationFilename),\n implementationData,\n );\n\n const mockPath = output.mock\n ? upath.join(\n dirname,\n filename +\n '.' +\n getMockFileExtensionByTypeName(output.mock) +\n extension,\n )\n : undefined;\n\n if (mockPath) {\n await fs.outputFile(mockPath, mockData);\n }\n\n return [\n implementationPath,\n ...(schemasPath ? [schemasPath] : []),\n ...(mockPath ? [mockPath] : []),\n ];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while splitting => ${error}`,\n );\n }\n};\n","import {\n type GeneratorOperation,\n type GeneratorTarget,\n type GeneratorTargetFull,\n type NormalizedOutputOptions,\n OutputClient,\n type WriteSpecsBuilder,\n} from '../types';\nimport { compareVersions, kebab, pascal } from '../utils';\n\nconst addDefaultTagIfEmpty = (operation: GeneratorOperation) => ({\n ...operation,\n tags: operation.tags.length > 0 ? operation.tags : ['default'],\n});\n\nconst generateTargetTags = (\n currentAcc: Record<string, GeneratorTargetFull>,\n operation: GeneratorOperation,\n): Record<string, GeneratorTargetFull> => {\n const tag = kebab(operation.tags[0]);\n const currentOperation = currentAcc[tag];\n\n if (!currentOperation) {\n currentAcc[tag] = {\n imports: operation.imports,\n importsMock: operation.importsMock,\n mutators: operation.mutator ? [operation.mutator] : [],\n clientMutators: operation.clientMutators ?? [],\n formData: operation.formData ? [operation.formData] : [],\n formUrlEncoded: operation.formUrlEncoded\n ? [operation.formUrlEncoded]\n : [],\n paramsSerializer: operation.paramsSerializer\n ? [operation.paramsSerializer]\n : [],\n fetchReviver: operation.fetchReviver ? [operation.fetchReviver] : [],\n implementation: operation.implementation,\n implementationMock: {\n function: operation.implementationMock.function,\n handler: operation.implementationMock.handler,\n handlerName: ' ' + operation.implementationMock.handlerName + '()',\n },\n };\n\n return currentAcc;\n }\n\n currentAcc[tag] = {\n implementation: currentOperation.implementation + operation.implementation,\n imports: [...currentOperation.imports, ...operation.imports],\n importsMock: [...currentOperation.importsMock, ...operation.importsMock],\n implementationMock: {\n function:\n currentOperation.implementationMock.function +\n operation.implementationMock.function,\n handler:\n currentOperation.implementationMock.handler +\n operation.implementationMock.handler,\n handlerName:\n currentOperation.implementationMock.handlerName +\n ',\\n ' +\n operation.implementationMock.handlerName +\n '()',\n },\n mutators: operation.mutator\n ? [...(currentOperation.mutators ?? []), operation.mutator]\n : currentOperation.mutators,\n clientMutators: operation.clientMutators\n ? [\n ...(currentOperation.clientMutators ?? []),\n ...operation.clientMutators,\n ]\n : currentOperation.clientMutators,\n formData: operation.formData\n ? [...(currentOperation.formData ?? []), operation.formData]\n : currentOperation.formData,\n formUrlEncoded: operation.formUrlEncoded\n ? [...(currentOperation.formUrlEncoded ?? []), operation.formUrlEncoded]\n : currentOperation.formUrlEncoded,\n paramsSerializer: operation.paramsSerializer\n ? [\n ...(currentOperation.paramsSerializer ?? []),\n operation.paramsSerializer,\n ]\n : currentOperation.paramsSerializer,\n fetchReviver: operation.fetchReviver\n ? [...(currentOperation.fetchReviver ?? []), operation.fetchReviver]\n : currentOperation.fetchReviver,\n };\n return currentAcc;\n};\n\nexport const generateTargetForTags = (\n builder: WriteSpecsBuilder,\n options: NormalizedOutputOptions,\n) => {\n const isAngularClient = options.client === OutputClient.ANGULAR;\n\n const allTargetTags = Object.values(builder.operations)\n .map(addDefaultTagIfEmpty)\n .reduce<Record<string, GeneratorTargetFull>>(\n (acc, operation, index, arr) => {\n const targetTags = generateTargetTags(acc, operation);\n\n if (index === arr.length - 1) {\n return Object.entries(targetTags).reduce<\n Record<string, GeneratorTargetFull>\n >((acc, [tag, target]) => {\n const isMutator = !!target.mutators?.some((mutator) =>\n isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n );\n const operationNames = Object.values(builder.operations)\n // Operations can have multiple tags, but they are grouped by the first\n // tag, therefore we only want to handle the case where the tag\n // is the first in the list of tags.\n .filter(({ tags }) => tags.map(kebab).indexOf(kebab(tag)) === 0)\n .map(({ operationName }) => operationName);\n\n const typescriptVersion =\n options.packageJson?.dependencies?.typescript ??\n options.packageJson?.devDependencies?.typescript ??\n '4.4.0';\n\n const hasAwaitedType = compareVersions(typescriptVersion, '4.5.0');\n\n const titles = builder.title({\n outputClient: options.client,\n title: pascal(tag),\n customTitleFunc: options.override.title,\n output: options,\n });\n\n const footer = builder.footer({\n outputClient: options?.client,\n operationNames,\n hasMutator: !!target.mutators?.length,\n hasAwaitedType,\n titles,\n output: options,\n });\n\n const header = builder.header({\n outputClient: options.client,\n isRequestOptions: options.override.requestOptions !== false,\n isMutator,\n isGlobalMutator: !!options.override.mutator,\n provideIn: options.override.angular.provideIn,\n hasAwaitedType,\n titles,\n output: options,\n verbOptions: builder.verbOptions,\n tag,\n clientImplementation: target.implementation,\n });\n\n acc[tag] = {\n implementation:\n header.implementation +\n target.implementation +\n footer.implementation,\n implementationMock: {\n function: target.implementationMock.function,\n handler:\n target.implementationMock.handler +\n header.implementationMock +\n target.implementationMock.handlerName +\n footer.implementationMock,\n handlerName: target.implementationMock.handlerName,\n },\n imports: target.imports,\n importsMock: target.importsMock,\n mutators: target.mutators,\n clientMutators: target.clientMutators,\n formData: target.formData,\n formUrlEncoded: target.formUrlEncoded,\n paramsSerializer: target.paramsSerializer,\n fetchReviver: target.fetchReviver,\n };\n\n return acc;\n }, {});\n }\n\n return targetTags;\n },\n {},\n );\n\n return Object.entries(allTargetTags).reduce<Record<string, GeneratorTarget>>(\n (acc, [tag, target]) => {\n acc[tag] = {\n ...target,\n implementationMock:\n target.implementationMock.function +\n target.implementationMock.handler,\n };\n\n return acc;\n },\n {},\n );\n};\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport { OutputClient, type WriteModeProps } from '../types';\nimport {\n camel,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n pascal,\n upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTargetForTags } from './target-tags';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeSplitTagsMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n const { filename, dirname, extension } = getFileInfo(output.target, {\n backupFilename: camel(builder.info.title),\n extension: output.fileExtension,\n });\n\n const target = generateTargetForTags(builder, output);\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const indexFilePath =\n output.mock && !isFunction(output.mock) && output.mock.indexMockFiles\n ? upath.join(\n dirname,\n 'index.' + getMockFileExtensionByTypeName(output.mock!) + extension,\n )\n : undefined;\n if (indexFilePath) {\n await fs.outputFile(indexFilePath, '');\n }\n\n const generatedFilePathsArray = await Promise.all(\n Object.entries(target).map(async ([tag, target]) => {\n try {\n const {\n imports,\n implementation,\n implementationMock,\n importsMock,\n mutators,\n clientMutators,\n formData,\n fetchReviver,\n formUrlEncoded,\n paramsSerializer,\n } = target;\n\n let implementationData = header;\n let mockData = header;\n\n const relativeSchemasPath = output.schemas\n ? '../' +\n upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : '../' + filename + '.schemas';\n\n const importsForBuilder = generateImportsForBuilder(\n output,\n imports,\n relativeSchemasPath,\n );\n\n implementationData += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n const importsMockForBuilder = generateImportsForBuilder(\n output,\n importsMock,\n relativeSchemasPath,\n );\n\n mockData += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n\n const schemasPath = output.schemas\n ? undefined\n : upath.join(dirname, filename + '.schemas' + extension);\n\n if (schemasPath && needSchema) {\n const schemasData = header + generateModelsInline(builder.schemas);\n\n await fs.outputFile(schemasPath, schemasData);\n }\n\n if (mutators) {\n implementationData += generateMutatorImports({\n mutators,\n implementation,\n oneMore: true,\n });\n }\n\n if (clientMutators) {\n implementationData += generateMutatorImports({\n mutators: clientMutators,\n oneMore: true,\n });\n }\n\n if (formData) {\n implementationData += generateMutatorImports({\n mutators: formData,\n oneMore: true,\n });\n }\n if (formUrlEncoded) {\n implementationData += generateMutatorImports({\n mutators: formUrlEncoded,\n oneMore: true,\n });\n }\n if (paramsSerializer) {\n implementationData += generateMutatorImports({\n mutators: paramsSerializer,\n oneMore: true,\n });\n }\n\n if (fetchReviver) {\n implementationData += generateMutatorImports({\n mutators: fetchReviver,\n oneMore: true,\n });\n }\n\n if (implementation.includes('NonReadonly<')) {\n implementationData += getOrvalGeneratedTypes();\n implementationData += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n implementationData += getTypedResponse();\n implementationData += '\\n';\n }\n\n implementationData += `\\n${implementation}`;\n mockData += `\\n${implementationMock}`;\n\n const implementationFilename =\n tag +\n (OutputClient.ANGULAR === output.client ? '.service' : '') +\n extension;\n\n const implementationPath = upath.join(\n dirname,\n tag,\n implementationFilename,\n );\n await fs.outputFile(implementationPath, implementationData);\n\n const mockPath = output.mock\n ? upath.join(\n dirname,\n tag,\n tag +\n '.' +\n getMockFileExtensionByTypeName(output.mock) +\n extension,\n )\n : undefined;\n\n if (mockPath) {\n await fs.outputFile(mockPath, mockData);\n if (indexFilePath) {\n const localMockPath = upath.joinSafe(\n './',\n tag,\n tag + '.' + getMockFileExtensionByTypeName(output.mock!),\n );\n fs.appendFile(\n indexFilePath,\n `export { get${pascal(tag)}Mock } from '${localMockPath}'\\n`,\n );\n }\n }\n\n return [\n implementationPath,\n ...(schemasPath ? [schemasPath] : []),\n ...(mockPath ? [mockPath] : []),\n ];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while splitting tag ${tag} => ${error}`,\n );\n }\n }),\n );\n\n return generatedFilePathsArray.flat();\n};\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport type { WriteModeProps } from '../types';\nimport {\n camel,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n kebab,\n upath,\n} from '../utils';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTargetForTags } from './target-tags';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeTagsMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n const { filename, dirname, extension } = getFileInfo(output.target, {\n backupFilename: camel(builder.info.title),\n extension: output.fileExtension,\n });\n\n const target = generateTargetForTags(builder, output);\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const generatedFilePathsArray = await Promise.all(\n Object.entries(target).map(async ([tag, target]) => {\n try {\n const {\n imports,\n implementation,\n implementationMock,\n importsMock,\n mutators,\n clientMutators,\n formData,\n formUrlEncoded,\n fetchReviver,\n paramsSerializer,\n } = target;\n\n let data = header;\n\n const schemasPathRelative = output.schemas\n ? upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : './' + filename + '.schemas';\n\n const importsForBuilder = generateImportsForBuilder(\n output,\n imports.filter(\n (imp) => !importsMock.some((impMock) => imp.name === impMock.name),\n ),\n schemasPathRelative,\n );\n\n data += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n if (output.mock) {\n const importsMockForBuilder = generateImportsForBuilder(\n output,\n importsMock,\n schemasPathRelative,\n );\n\n data += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n }\n\n const schemasPath = output.schemas\n ? undefined\n : upath.join(dirname, filename + '.schemas' + extension);\n\n if (schemasPath && needSchema) {\n const schemasData = header + generateModelsInline(builder.schemas);\n\n await fs.outputFile(schemasPath, schemasData);\n }\n\n if (mutators) {\n data += generateMutatorImports({ mutators, implementation });\n }\n\n if (clientMutators) {\n data += generateMutatorImports({\n mutators: clientMutators,\n });\n }\n\n if (formData) {\n data += generateMutatorImports({ mutators: formData });\n }\n\n if (formUrlEncoded) {\n data += generateMutatorImports({ mutators: formUrlEncoded });\n }\n\n if (paramsSerializer) {\n data += generateMutatorImports({ mutators: paramsSerializer });\n }\n\n if (fetchReviver) {\n data += generateMutatorImports({ mutators: fetchReviver });\n }\n\n data += '\\n\\n';\n\n if (implementation.includes('NonReadonly<')) {\n data += getOrvalGeneratedTypes();\n data += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n data += getTypedResponse();\n data += '\\n';\n }\n\n data += implementation;\n\n if (output.mock) {\n data += '\\n\\n';\n\n data += implementationMock;\n }\n\n const implementationPath = upath.join(\n dirname,\n `${kebab(tag)}${extension}`,\n );\n await fs.outputFile(implementationPath, data);\n\n return [implementationPath, ...(schemasPath ? [schemasPath] : [])];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing tag ${tag} => ${error}`,\n );\n }\n }),\n );\n\n return generatedFilePathsArray.flat();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsLA,MAAa,oBAAoB;CAC/B,cAAc;CACd,eAAe;CAChB;AAKD,MAAa,mBAAmB;CAC9B,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,YAAY;CACb;AAKD,MAAa,iBAAiB;CAC5B,OAAO;CACP,MAAM;CACN,OAAO;CACR;AAoDD,MAAa,eAAe;CAC1B,SAAS;CACT,OAAO;CACP,iBAAiB;CACjB,aAAa;CACb,cAAc;CACd,WAAW;CACX,KAAK;CACL,KAAK;CACL,MAAM;CACN,OAAO;CACP,KAAK;CACN;AAID,MAAa,mBAAmB;CAC9B,OAAO;CACP,OAAO;CACR;AAKD,MAAa,aAAa;CACxB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,YAAY;CACb;AASD,MAAa,iBAAiB,EAC5B,KAAK,OACN;AAkFD,MAAa,wBAAwB;CACnC,WAAW;CACX,SAAS;CACT,yBAA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GJ,MAAM,cAAc,OAAO,UACvB,SACAC,KAAWF,WAAS,WAAW,aAAa,UAAU;AAE1D,OAAI,eAAe,YAAY;IAC7B,MAAM,cAAc,SAAS,qBAAqB,QAAQ,QAAQ;AAElE,UAAMG,iBAAG,WAAW,aAAa,YAAY;;AAG/C,OAAI,SACF,SAAQ,uBAAuB;IAAE;IAAU;IAAgB,CAAC;AAG9D,OAAI,eACF,SAAQ,uBAAuB,EAC7B,UAAU,gBACX,CAAC;AAGJ,OAAI,SACF,SAAQ,uBAAuB,EAAE,UAAU,UAAU,CAAC;AAGxD,OAAI,eACF,SAAQ,uBAAuB,EAAE,UAAU,gBAAgB,CAAC;AAG9D,OAAI,iBACF,SAAQ,uBAAuB,EAAE,UAAU,kBAAkB,CAAC;AAGhE,OAAI,aACF,SAAQ,uBAAuB,EAAE,UAAU,cAAc,CAAC;AAG5D,WAAQ;AAER,OAAI,eAAe,SAAS,eAAe,EAAE;AAC3C,YAAQ,wBAAwB;AAChC,YAAQ;;AAGV,OAAI,eAAe,SAAS,iBAAiB,EAAE;AAC7C,YAAQ,kBAAkB;AAC1B,YAAQ;;AAGV,WAAQ;AAER,OAAI,OAAO,MAAM;AACf,YAAQ;AAER,YAAQ;;GAGV,MAAM,qBAAqBD,KACzBF,WACA,GAAG,MAAM,IAAI,GAAG,YACjB;AACD,SAAMG,iBAAG,WAAW,oBAAoB,KAAK;AAE7C,UAAO,CAAC,oBAAoB,GAAI,cAAc,CAAC,YAAY,GAAG,EAAE,CAAE;WAC3D,OAAO;AACd,SAAM,IAAI,MACR,mDAAmD,IAAI,MAAM,QAC9D;;GAEH,CACH,EAE8B,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["path","log","LogLevels: Record<LogLevel, number>","lastType: LogType | undefined","lastMsg: string | undefined","options","logger: Logger","path","debug","resolvedPath: string | undefined","fs","file: File | undefined","error: any","mm","replacement","module","path","isFunction","isString","basepath","propName","path","pascalMemory: Record<string, string>","regex","filter","count","path","isObject","keyword","path","ibmOpenapiRuleset","Spectral","errors: { message: string; path: string[] }[]","warnings: { message: string; path: string[] }[]","path","keyword","RefComponentSuffix: Record<RefComponent, string>","search","upath.getSchemaFileName","path","upath.resolve","getSchema","schemaByRefPaths: Schema | undefined","name","schema","additionalImports: GeneratorImport[]","imports","keyword","imports","schemas","keyword","name","separator","resolvedValue","separator","resolvedValue","resolvedValue: ScalarValue | undefined","path","paramGetterProps: GetterProps","imports","schemas","imports","schemas","contentType","path","imports","schemas","path","isRootKey","upath.join","exports","upath.relativeSafe","fs","path","Parser","property","returnStatement","filter","imp","upath.getSpecName","schema","verbOption: GeneratorVerbOptions","upath.join","path","fs","exports","upath.joinSafe","upath.relativeSafe","dirname","fs","path","upath.relativeSafe","dirname","upath.join","fs","acc","upath.join","dirname","fs","target","upath.relativeSafe","tag","upath.joinSafe","target","upath.relativeSafe","dirname","tag","upath.join","fs"],"sources":["../src/types.ts","../src/constants.ts","../src/utils/extension.ts","../src/utils/debug.ts","../src/utils/logger.ts","../src/utils/file.ts","../src/utils/path.ts","../src/utils/assertion.ts","../src/utils/async-reduce.ts","../src/utils/case.ts","../src/utils/compare-version.ts","../src/utils/doc.ts","../src/utils/dynamic-import.ts","../src/utils/file-extensions.ts","../src/utils/is-body-verb.ts","../src/utils/merge-deep.ts","../src/utils/occurrence.ts","../src/utils/open-api-converter.ts","../src/utils/sort.ts","../src/utils/string.ts","../src/utils/tsconfig.ts","../src/utils/validator.ts","../src/getters/enum.ts","../src/getters/ref.ts","../src/resolvers/ref.ts","../src/resolvers/value.ts","../src/resolvers/object.ts","../src/getters/array.ts","../src/getters/res-req-types.ts","../src/getters/body.ts","../src/getters/imports.ts","../src/getters/keys.ts","../src/getters/object.ts","../src/getters/scalar.ts","../src/getters/combine.ts","../src/getters/discriminators.ts","../src/getters/operation.ts","../src/getters/parameters.ts","../src/getters/params.ts","../src/getters/props.ts","../src/getters/query-params.ts","../src/getters/response.ts","../src/getters/route.ts","../src/generators/component-definition.ts","../src/generators/imports.ts","../src/generators/models-inline.ts","../src/generators/mutator.ts","../src/generators/options.ts","../src/generators/parameter-definition.ts","../src/generators/interface.ts","../src/generators/schema-definition.ts","../src/generators/verbs-options.ts","../src/writers/schemas.ts","../src/writers/generate-imports-for-builder.ts","../src/writers/target.ts","../src/writers/types.ts","../src/writers/single-mode.ts","../src/writers/split-mode.ts","../src/writers/target-tags.ts","../src/writers/split-tags-mode.ts","../src/writers/tags-mode.ts"],"sourcesContent":["import type SwaggerParser from '@apidevtools/swagger-parser';\nimport type { allLocales } from '@faker-js/faker';\nimport type { JSONSchema6, JSONSchema7 } from 'json-schema';\nimport type {\n InfoObject,\n OpenAPIObject,\n OperationObject,\n ParameterObject,\n ReferenceObject,\n RequestBodyObject,\n ResponsesObject,\n SchemaObject,\n} from 'openapi3-ts/oas30';\nimport type { ConvertInputOptions } from 'swagger2openapi';\nimport type { TypeDocOptions } from 'typedoc';\n\nexport interface Options {\n output?: string | OutputOptions;\n input?: string | InputOptions;\n hooks?: Partial<HooksOptions>;\n}\n\nexport type OptionsFn = () => Options | Promise<Options>;\nexport type OptionsExport = Options | Promise<Options> | OptionsFn;\n\nexport type Config = Record<string, OptionsExport>;\nexport type ConfigFn = () => Config | Promise<Config>;\n\nexport type ConfigExternal = Config | Promise<Config> | ConfigFn;\n\nexport type NormalizedConfig = Record<string, NormalizedOptions | undefined>;\n\nexport interface NormalizedOptions {\n output: NormalizedOutputOptions;\n input: NormalizedInputOptions;\n hooks: NormalizedHookOptions;\n}\n\nexport type NormalizedOutputOptions = {\n workspace?: string;\n target?: string;\n schemas?: string;\n namingConvention: NamingConvention;\n fileExtension: string;\n mode: OutputMode;\n mock?: GlobalMockOptions | ClientMockBuilder;\n override: NormalizedOverrideOutput;\n client: OutputClient | OutputClientFunc;\n httpClient: OutputHttpClient;\n clean: boolean | string[];\n docs: boolean | OutputDocsOptions;\n prettier: boolean;\n biome: boolean;\n tsconfig?: Tsconfig;\n packageJson?: PackageJson;\n headers: boolean;\n indexFiles: boolean;\n baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant;\n allParamsOptional: boolean;\n urlEncodeParameters: boolean;\n unionAddMissingProperties: boolean;\n optionsParamRequired: boolean;\n propertySortOrder: PropertySortOrder;\n};\n\nexport type NormalizedParamsSerializerOptions = {\n qs?: Record<string, any>;\n};\n\nexport type NormalizedOverrideOutput = {\n title?: (title: string) => string;\n transformer?: OutputTransformer;\n mutator?: NormalizedMutator;\n operations: Record<string, NormalizedOperationOptions>;\n tags: Record<string, NormalizedOperationOptions>;\n mock?: OverrideMockOptions;\n contentType?: OverrideOutputContentType;\n header: false | ((info: InfoObject) => string[] | string);\n formData: NormalizedFormDataType<NormalizedMutator>;\n formUrlEncoded: boolean | NormalizedMutator;\n paramsSerializer?: NormalizedMutator;\n paramsSerializerOptions?: NormalizedParamsSerializerOptions;\n namingConvention: {\n enum?: NamingConvention;\n };\n components: {\n schemas: {\n suffix: string;\n itemSuffix: string;\n };\n responses: {\n suffix: string;\n };\n parameters: {\n suffix: string;\n };\n requestBodies: {\n suffix: string;\n };\n };\n hono: NormalizedHonoOptions;\n query: NormalizedQueryOptions;\n angular: Required<AngularOptions>;\n swr: SwrOptions;\n zod: NormalizedZodOptions;\n fetch: NormalizedFetchOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n requestOptions: Record<string, any> | boolean;\n useDates?: boolean;\n coerceTypes?: boolean; // deprecated\n useTypeOverInterfaces?: boolean;\n useDeprecatedOperations?: boolean;\n useBigInt?: boolean;\n useNamedParameters?: boolean;\n enumGenerationType: EnumGeneration;\n suppressReadonlyModifier?: boolean;\n jsDoc: NormalizedJsDocOptions;\n};\n\nexport type NormalizedMutator = {\n path: string;\n name?: string;\n default: boolean;\n alias?: Record<string, string>;\n extension?: string;\n};\n\nexport type NormalizedOperationOptions = {\n transformer?: OutputTransformer;\n mutator?: NormalizedMutator;\n mock?: {\n data?: MockData;\n properties?: MockProperties;\n };\n contentType?: OverrideOutputContentType;\n query?: NormalizedQueryOptions;\n angular?: Required<AngularOptions>;\n swr?: SwrOptions;\n zod?: NormalizedZodOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n fetch?: FetchOptions;\n formData?: NormalizedFormDataType<NormalizedMutator>;\n formUrlEncoded?: boolean | NormalizedMutator;\n paramsSerializer?: NormalizedMutator;\n requestOptions?: object | boolean;\n};\n\nexport type NormalizedInputOptions = {\n target: string | Record<string, unknown> | OpenAPIObject;\n validation: boolean | object;\n override: OverrideInput;\n converterOptions: Partial<ConvertInputOptions>;\n parserOptions: SwaggerParserOptions;\n filters?: InputFiltersOption;\n};\n\nexport type OutputClientFunc = (\n clients: GeneratorClients,\n) => ClientGeneratorsBuilder;\n\nexport type BaseUrlFromSpec = {\n getBaseUrlFromSpecification: true;\n variables?: Record<string, string>;\n index?: number;\n baseUrl?: never;\n};\n\nexport type BaseUrlFromConstant = {\n getBaseUrlFromSpecification: false;\n variables?: never;\n index?: never;\n baseUrl: string;\n};\n\nexport const PropertySortOrder = {\n ALPHABETICAL: 'Alphabetical',\n SPECIFICATION: 'Specification',\n} as const;\n\nexport type PropertySortOrder =\n (typeof PropertySortOrder)[keyof typeof PropertySortOrder];\n\nexport const NamingConvention = {\n CAMEL_CASE: 'camelCase',\n PASCAL_CASE: 'PascalCase',\n SNAKE_CASE: 'snake_case',\n KEBAB_CASE: 'kebab-case',\n} as const;\n\nexport type NamingConvention =\n (typeof NamingConvention)[keyof typeof NamingConvention];\n\nexport const EnumGeneration = {\n CONST: 'const',\n ENUM: 'enum',\n UNION: 'union',\n} as const;\n\nexport type EnumGeneration =\n (typeof EnumGeneration)[keyof typeof EnumGeneration];\n\nexport type OutputOptions = {\n workspace?: string;\n target?: string;\n schemas?: string;\n namingConvention?: NamingConvention;\n fileExtension?: string;\n mode?: OutputMode;\n // If mock is a boolean, it will use the default mock options (type: msw)\n mock?: boolean | GlobalMockOptions | ClientMockBuilder;\n override?: OverrideOutput;\n client?: OutputClient | OutputClientFunc;\n httpClient?: OutputHttpClient;\n clean?: boolean | string[];\n docs?: boolean | OutputDocsOptions;\n prettier?: boolean;\n biome?: boolean;\n tsconfig?: string | Tsconfig;\n packageJson?: string;\n headers?: boolean;\n indexFiles?: boolean;\n baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant;\n allParamsOptional?: boolean;\n urlEncodeParameters?: boolean;\n unionAddMissingProperties?: boolean;\n optionsParamRequired?: boolean;\n propertySortOrder?: PropertySortOrder;\n};\n\nexport type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {\n validate?: boolean;\n};\n\nexport type InputFiltersOption = {\n mode?: 'include' | 'exclude';\n tags?: (string | RegExp)[];\n schemas?: (string | RegExp)[];\n};\n\nexport type InputOptions = {\n target: string | Record<string, unknown> | OpenAPIObject;\n validation?: boolean | object;\n override?: OverrideInput;\n converterOptions?: Partial<ConvertInputOptions>;\n parserOptions?: SwaggerParserOptions;\n filters?: InputFiltersOption;\n};\n\nexport const OutputClient = {\n ANGULAR: 'angular',\n AXIOS: 'axios',\n AXIOS_FUNCTIONS: 'axios-functions',\n REACT_QUERY: 'react-query',\n SVELTE_QUERY: 'svelte-query',\n VUE_QUERY: 'vue-query',\n SWR: 'swr',\n ZOD: 'zod',\n HONO: 'hono',\n FETCH: 'fetch',\n MCP: 'mcp',\n} as const;\n\nexport type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];\n\nexport const OutputHttpClient = {\n AXIOS: 'axios',\n FETCH: 'fetch',\n} as const;\n\nexport type OutputHttpClient =\n (typeof OutputHttpClient)[keyof typeof OutputHttpClient];\n\nexport const OutputMode = {\n SINGLE: 'single',\n SPLIT: 'split',\n TAGS: 'tags',\n TAGS_SPLIT: 'tags-split',\n} as const;\n\nexport type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];\n\nexport type OutputDocsOptions = {\n configPath?: string;\n} & Partial<TypeDocOptions>;\n\n// TODO: add support for other mock types (like cypress or playwright)\nexport const OutputMockType = {\n MSW: 'msw',\n} as const;\n\nexport type OutputMockType =\n (typeof OutputMockType)[keyof typeof OutputMockType];\n\nexport type GlobalMockOptions = {\n // This is the type of the mock that will be generated\n type: OutputMockType;\n // This is the option to use the examples from the openapi specification where possible to generate mock data\n useExamples?: boolean;\n // This is used to generate mocks for all http responses defined in the OpenAPI specification\n generateEachHttpStatus?: boolean;\n // This is used to set the delay to your own custom value, or pass false to disable delay\n delay?: false | number | (() => number);\n // This is used to execute functions that are passed to the 'delay' argument\n // at runtime rather than build time.\n delayFunctionLazyExecute?: boolean;\n // This is used to set the base url to your own custom value\n baseUrl?: string;\n // This is used to set the locale of the faker library\n locale?: keyof typeof allLocales;\n indexMockFiles?: boolean;\n};\n\nexport type OverrideMockOptions = Partial<GlobalMockOptions> & {\n arrayMin?: number;\n arrayMax?: number;\n stringMin?: number;\n stringMax?: number;\n numberMin?: number;\n numberMax?: number;\n required?: boolean;\n properties?: MockProperties;\n format?: Record<string, unknown>;\n fractionDigits?: number;\n};\n\nexport type MockOptions = Omit<OverrideMockOptions, 'properties'> & {\n properties?: Record<string, unknown>;\n operations?: Record<string, { properties: Record<string, unknown> }>;\n tags?: Record<string, { properties: Record<string, unknown> }>;\n};\n\nexport type MockPropertiesObject = Record<string, unknown>;\nexport type MockPropertiesObjectFn = (\n specs: OpenAPIObject,\n) => MockPropertiesObject;\n\nexport type MockProperties = MockPropertiesObject | MockPropertiesObjectFn;\n\nexport type MockDataObject = Record<string, unknown>;\n\nexport type MockDataObjectFn = (specs: OpenAPIObject) => MockDataObject;\n\nexport type MockDataArray = unknown[];\n\nexport type MockDataArrayFn = (specs: OpenAPIObject) => MockDataArray;\n\nexport type MockData =\n | MockDataObject\n | MockDataObjectFn\n | MockDataArray\n | MockDataArrayFn;\n\ntype OutputTransformerFn = (verb: GeneratorVerbOptions) => GeneratorVerbOptions;\n\ntype OutputTransformer = string | OutputTransformerFn;\n\nexport type MutatorObject = {\n path: string;\n name?: string;\n default?: boolean;\n alias?: Record<string, string>;\n extension?: string;\n};\n\nexport type Mutator = string | MutatorObject;\n\nexport type ParamsSerializerOptions = {\n qs?: Record<string, any>;\n};\n\nexport const FormDataArrayHandling = {\n SERIALIZE: 'serialize',\n EXPLODE: 'explode',\n SERIALIZE_WITH_BRACKETS: 'serialize-with-brackets',\n} as const;\n\nexport type FormDataArrayHandling =\n (typeof FormDataArrayHandling)[keyof typeof FormDataArrayHandling];\n\nexport type NormalizedFormDataType<TMutator> =\n | {\n disabled: true;\n mutator?: never;\n arrayHandling: FormDataArrayHandling;\n }\n | {\n disabled: false;\n mutator?: TMutator;\n arrayHandling: FormDataArrayHandling;\n };\nexport type FormDataType<TMutator> =\n | {\n mutator: TMutator;\n arrayHandling?: FormDataArrayHandling;\n }\n | {\n mutator?: TMutator;\n arrayHandling: FormDataArrayHandling;\n };\n\nexport type OverrideOutput = {\n title?: (title: string) => string;\n transformer?: OutputTransformer;\n mutator?: Mutator;\n operations?: Record<string, OperationOptions>;\n tags?: Record<string, OperationOptions>;\n mock?: OverrideMockOptions;\n contentType?: OverrideOutputContentType;\n header?: boolean | ((info: InfoObject) => string[] | string);\n formData?: boolean | Mutator | FormDataType<Mutator>;\n formUrlEncoded?: boolean | Mutator;\n paramsSerializer?: Mutator;\n paramsSerializerOptions?: ParamsSerializerOptions;\n namingConvention?: {\n enum?: NamingConvention;\n };\n components?: {\n schemas?: {\n suffix?: string;\n itemSuffix?: string;\n };\n responses?: {\n suffix?: string;\n };\n parameters?: {\n suffix?: string;\n };\n requestBodies?: {\n suffix?: string;\n };\n };\n hono?: HonoOptions;\n query?: QueryOptions;\n swr?: SwrOptions;\n angular?: AngularOptions;\n zod?: ZodOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n fetch?: FetchOptions;\n requestOptions?: Record<string, any> | boolean;\n useDates?: boolean;\n useTypeOverInterfaces?: boolean;\n useDeprecatedOperations?: boolean;\n useBigInt?: boolean;\n useNamedParameters?: boolean;\n /**\n * @deprecated use 'enumGenerationType=\"enum\"' instead\n */\n useNativeEnums?: boolean;\n enumGenerationType?: EnumGeneration;\n suppressReadonlyModifier?: boolean;\n jsDoc?: JsDocOptions;\n};\n\nexport type JsDocOptions = {\n filter?: (schema: Record<string, any>) => { key: string; value: string }[];\n};\n\nexport type NormalizedJsDocOptions = {\n filter?: (schema: Record<string, any>) => { key: string; value: string }[];\n};\n\nexport type OverrideOutputContentType = {\n include?: string[];\n exclude?: string[];\n};\n\nexport type NormalizedHonoOptions = {\n handlers?: string;\n compositeRoute: string;\n validator: boolean | 'hono';\n validatorOutputPath: string;\n};\n\nexport type ZodDateTimeOptions = {\n offset?: boolean;\n local?: boolean;\n precision?: number;\n};\n\nexport type ZodTimeOptions = {\n precision?: -1 | 0 | 1 | 2 | 3;\n};\n\nexport type ZodOptions = {\n strict?: {\n param?: boolean;\n query?: boolean;\n header?: boolean;\n body?: boolean;\n response?: boolean;\n };\n generate?: {\n param?: boolean;\n query?: boolean;\n header?: boolean;\n body?: boolean;\n response?: boolean;\n };\n coerce?: {\n param?: boolean | ZodCoerceType[];\n query?: boolean | ZodCoerceType[];\n header?: boolean | ZodCoerceType[];\n body?: boolean | ZodCoerceType[];\n response?: boolean | ZodCoerceType[];\n };\n preprocess?: {\n param?: Mutator;\n query?: Mutator;\n header?: Mutator;\n body?: Mutator;\n response?: Mutator;\n };\n dateTimeOptions?: ZodDateTimeOptions;\n timeOptions?: ZodTimeOptions;\n generateEachHttpStatus?: boolean;\n};\n\nexport type ZodCoerceType = 'string' | 'number' | 'boolean' | 'bigint' | 'date';\n\nexport type NormalizedZodOptions = {\n strict: {\n param: boolean;\n query: boolean;\n header: boolean;\n body: boolean;\n response: boolean;\n };\n generate: {\n param: boolean;\n query: boolean;\n header: boolean;\n body: boolean;\n response: boolean;\n };\n coerce: {\n param: boolean | ZodCoerceType[];\n query: boolean | ZodCoerceType[];\n header: boolean | ZodCoerceType[];\n body: boolean | ZodCoerceType[];\n response: boolean | ZodCoerceType[];\n };\n preprocess: {\n param?: NormalizedMutator;\n query?: NormalizedMutator;\n header?: NormalizedMutator;\n body?: NormalizedMutator;\n response?: NormalizedMutator;\n };\n generateEachHttpStatus: boolean;\n dateTimeOptions: ZodDateTimeOptions;\n timeOptions: ZodTimeOptions;\n};\n\nexport type HonoOptions = {\n handlers?: string;\n compositeRoute?: string;\n validator?: boolean | 'hono';\n validatorOutputPath?: string;\n};\n\nexport type NormalizedQueryOptions = {\n useQuery?: boolean;\n useSuspenseQuery?: boolean;\n useMutation?: boolean;\n useInfinite?: boolean;\n useSuspenseInfiniteQuery?: boolean;\n useInfiniteQueryParam?: string;\n usePrefetch?: boolean;\n options?: any;\n queryKey?: NormalizedMutator;\n queryOptions?: NormalizedMutator;\n mutationOptions?: NormalizedMutator;\n shouldExportMutatorHooks?: boolean;\n shouldExportHttpClient?: boolean;\n shouldExportQueryKey?: boolean;\n shouldSplitQueryKey?: boolean;\n useOperationIdAsQueryKey?: boolean;\n signal?: boolean;\n version?: 3 | 4 | 5;\n};\n\nexport type QueryOptions = {\n useQuery?: boolean;\n useSuspenseQuery?: boolean;\n useMutation?: boolean;\n useInfinite?: boolean;\n useSuspenseInfiniteQuery?: boolean;\n useInfiniteQueryParam?: string;\n usePrefetch?: boolean;\n options?: any;\n queryKey?: Mutator;\n queryOptions?: Mutator;\n mutationOptions?: Mutator;\n shouldExportMutatorHooks?: boolean;\n shouldExportHttpClient?: boolean;\n shouldExportQueryKey?: boolean;\n shouldSplitQueryKey?: boolean;\n useOperationIdAsQueryKey?: boolean;\n signal?: boolean;\n version?: 3 | 4 | 5;\n};\n\nexport type AngularOptions = {\n provideIn?: 'root' | 'any' | boolean;\n};\n\nexport type SwrOptions = {\n useInfinite?: boolean;\n useSWRMutationForGet?: boolean;\n swrOptions?: any;\n swrMutationOptions?: any;\n swrInfiniteOptions?: any;\n};\n\nexport type NormalizedFetchOptions = {\n includeHttpResponseReturnType: boolean;\n forceSuccessResponse: boolean;\n explode: boolean;\n jsonReviver?: Mutator;\n};\n\nexport type FetchOptions = {\n includeHttpResponseReturnType?: boolean;\n forceSuccessResponse?: boolean;\n explode?: boolean;\n jsonReviver?: Mutator;\n};\n\nexport type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;\n\ntype InputTransformer = string | InputTransformerFn;\n\nexport type OverrideInput = {\n transformer?: InputTransformer;\n};\n\nexport type OperationOptions = {\n transformer?: OutputTransformer;\n mutator?: Mutator;\n mock?: {\n data?: MockData;\n properties?: MockProperties;\n };\n query?: QueryOptions;\n angular?: Required<AngularOptions>;\n swr?: SwrOptions;\n zod?: ZodOptions;\n operationName?: (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n ) => string;\n fetch?: FetchOptions;\n formData?: boolean | Mutator | FormDataType<Mutator>;\n formUrlEncoded?: boolean | Mutator;\n paramsSerializer?: Mutator;\n requestOptions?: object | boolean;\n};\n\nexport type Hook = 'afterAllFilesWrite';\n\nexport type HookFunction = (...args: any[]) => void | Promise<void>;\n\nexport interface HookOption {\n command: string | HookFunction;\n injectGeneratedDirsAndFiles?: boolean;\n}\n\nexport type HookCommand =\n | string\n | HookFunction\n | HookOption\n | (string | HookFunction | HookOption)[];\n\nexport type NormalizedHookCommand = HookCommand[];\n\nexport type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<\n Record<Hook, T>\n>;\n\nexport type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;\n\nexport type Verbs = 'post' | 'put' | 'get' | 'patch' | 'delete' | 'head';\n\nexport const Verbs = {\n POST: 'post' as Verbs,\n PUT: 'put' as Verbs,\n GET: 'get' as Verbs,\n PATCH: 'patch' as Verbs,\n DELETE: 'delete' as Verbs,\n HEAD: 'head' as Verbs,\n};\n\nexport type ImportOpenApi = {\n data: JSONSchema6 | JSONSchema7 | Record<string, unknown | OpenAPIObject>;\n input: NormalizedInputOptions;\n output: NormalizedOutputOptions;\n target: string;\n workspace: string;\n};\n\nexport interface ContextSpecs {\n specKey: string;\n target: string;\n workspace: string;\n specs: Record<string, OpenAPIObject>;\n parents?: string[];\n output: NormalizedOutputOptions;\n}\n\nexport interface GlobalOptions {\n projectName?: string;\n watch?: boolean | string | (string | boolean)[];\n clean?: boolean | string[];\n prettier?: boolean;\n biome?: boolean;\n mock?: boolean | GlobalMockOptions;\n client?: OutputClient;\n httpClient?: OutputHttpClient;\n mode?: OutputMode;\n tsconfig?: string | Tsconfig;\n packageJson?: string;\n input?: string;\n output?: string;\n}\n\nexport interface Tsconfig {\n baseUrl?: string;\n compilerOptions?: {\n esModuleInterop?: boolean;\n allowSyntheticDefaultImports?: boolean;\n exactOptionalPropertyTypes?: boolean;\n paths?: Record<string, string[]>;\n target?: TsConfigTarget;\n };\n}\n\nexport type TsConfigTarget =\n | 'es3'\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext'; // https://www.typescriptlang.org/tsconfig#target\n\nexport interface PackageJson {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nexport type GeneratorSchema = {\n name: string;\n model: string;\n imports: GeneratorImport[];\n};\n\nexport type GeneratorImport = {\n name: string;\n schemaName?: string;\n isConstant?: boolean;\n alias?: string;\n specKey?: string;\n default?: boolean;\n values?: boolean;\n syntheticDefaultImport?: boolean;\n};\n\nexport type GeneratorDependency = {\n exports: GeneratorImport[];\n dependency: string;\n};\n\nexport type GeneratorApiResponse = {\n operations: GeneratorOperations;\n schemas: GeneratorSchema[];\n};\n\nexport type GeneratorOperations = Record<string, GeneratorOperation>;\n\nexport type GeneratorTarget = {\n imports: GeneratorImport[];\n implementation: string;\n implementationMock: string;\n importsMock: GeneratorImport[];\n mutators?: GeneratorMutator[];\n clientMutators?: GeneratorMutator[];\n formData?: GeneratorMutator[];\n formUrlEncoded?: GeneratorMutator[];\n paramsSerializer?: GeneratorMutator[];\n fetchReviver?: GeneratorMutator[];\n};\n\nexport type GeneratorTargetFull = {\n imports: GeneratorImport[];\n implementation: string;\n implementationMock: {\n function: string;\n handler: string;\n handlerName: string;\n };\n importsMock: GeneratorImport[];\n mutators?: GeneratorMutator[];\n clientMutators?: GeneratorMutator[];\n formData?: GeneratorMutator[];\n formUrlEncoded?: GeneratorMutator[];\n paramsSerializer?: GeneratorMutator[];\n fetchReviver?: GeneratorMutator[];\n};\n\nexport type GeneratorOperation = {\n imports: GeneratorImport[];\n implementation: string;\n implementationMock: {\n function: string;\n handler: string;\n handlerName: string;\n };\n importsMock: GeneratorImport[];\n tags: string[];\n mutator?: GeneratorMutator;\n clientMutators?: GeneratorMutator[];\n formData?: GeneratorMutator;\n formUrlEncoded?: GeneratorMutator;\n paramsSerializer?: GeneratorMutator;\n fetchReviver?: GeneratorMutator;\n operationName: string;\n types?: {\n result: (title?: string) => string;\n };\n};\n\nexport type GeneratorVerbOptions = {\n verb: Verbs;\n route: string;\n pathRoute: string;\n summary?: string;\n doc: string;\n tags: string[];\n operationId: string;\n operationName: string;\n response: GetterResponse;\n body: GetterBody;\n headers?: GetterQueryParam;\n queryParams?: GetterQueryParam;\n params: GetterParams;\n props: GetterProps;\n mutator?: GeneratorMutator;\n formData?: GeneratorMutator;\n formUrlEncoded?: GeneratorMutator;\n paramsSerializer?: GeneratorMutator;\n fetchReviver?: GeneratorMutator;\n override: NormalizedOverrideOutput;\n deprecated?: boolean;\n originalOperation: OperationObject;\n};\n\nexport type GeneratorVerbsOptions = GeneratorVerbOptions[];\n\nexport type GeneratorOptions = {\n route: string;\n pathRoute: string;\n override: NormalizedOverrideOutput;\n context: ContextSpecs;\n mock?: GlobalMockOptions | ClientMockBuilder;\n output: string;\n};\n\nexport type GeneratorClient = {\n implementation: string;\n imports: GeneratorImport[];\n mutators?: GeneratorMutator[];\n};\n\nexport type GeneratorMutatorParsingInfo = {\n numberOfParams: number;\n returnNumberOfParams?: number;\n};\nexport type GeneratorMutator = {\n name: string;\n path: string;\n default: boolean;\n hasErrorType: boolean;\n errorTypeName: string;\n hasSecondArg: boolean;\n hasThirdArg: boolean;\n isHook: boolean;\n bodyTypeName?: string;\n};\n\nexport type ClientBuilder = (\n verbOptions: GeneratorVerbOptions,\n options: GeneratorOptions,\n outputClient: OutputClient | OutputClientFunc,\n output?: NormalizedOutputOptions,\n) => GeneratorClient | Promise<GeneratorClient>;\n\nexport type ClientFileBuilder = {\n path: string;\n content: string;\n};\nexport type ClientExtraFilesBuilder = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => Promise<ClientFileBuilder[]>;\n\nexport type ClientHeaderBuilder = (params: {\n title: string;\n isRequestOptions: boolean;\n isMutator: boolean;\n noFunction?: boolean;\n isGlobalMutator: boolean;\n provideIn: boolean | 'root' | 'any';\n hasAwaitedType: boolean;\n output: NormalizedOutputOptions;\n verbOptions: Record<string, GeneratorVerbOptions>;\n tag?: string;\n clientImplementation: string;\n}) => string;\n\nexport type ClientFooterBuilder = (params: {\n noFunction?: boolean | undefined;\n operationNames: string[];\n title?: string;\n hasAwaitedType: boolean;\n hasMutator: boolean;\n}) => string;\n\nexport type ClientTitleBuilder = (title: string) => string;\n\nexport type ClientDependenciesBuilder = (\n hasGlobalMutator: boolean,\n hasParamsSerializerOptions: boolean,\n packageJson?: PackageJson,\n httpClient?: OutputHttpClient,\n hasTagsMutator?: boolean,\n override?: NormalizedOverrideOutput,\n) => GeneratorDependency[];\n\nexport type ClientMockGeneratorImplementation = {\n function: string;\n handlerName: string;\n handler: string;\n};\n\nexport type ClientMockGeneratorBuilder = {\n imports: GeneratorImport[];\n implementation: ClientMockGeneratorImplementation;\n};\n\nexport type ClientMockBuilder = (\n verbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n) => ClientMockGeneratorBuilder;\n\nexport interface ClientGeneratorsBuilder {\n client: ClientBuilder;\n header?: ClientHeaderBuilder;\n dependencies?: ClientDependenciesBuilder;\n footer?: ClientFooterBuilder;\n title?: ClientTitleBuilder;\n extraFiles?: ClientExtraFilesBuilder;\n}\n\nexport type GeneratorClients = Record<OutputClient, ClientGeneratorsBuilder>;\n\nexport type GetterResponse = {\n imports: GeneratorImport[];\n definition: {\n success: string;\n errors: string;\n };\n isBlob: boolean;\n types: {\n success: ResReqTypesValue[];\n errors: ResReqTypesValue[];\n };\n contentTypes: string[];\n schemas: GeneratorSchema[];\n\n originalSchema?: ResponsesObject;\n};\n\nexport type GetterBody = {\n originalSchema: ReferenceObject | RequestBodyObject;\n imports: GeneratorImport[];\n definition: string;\n implementation: string;\n schemas: GeneratorSchema[];\n formData?: string;\n formUrlEncoded?: string;\n contentType: string;\n isOptional: boolean;\n};\n\nexport type GetterParameters = {\n query: { parameter: ParameterObject; imports: GeneratorImport[] }[];\n path: { parameter: ParameterObject; imports: GeneratorImport[] }[];\n header: { parameter: ParameterObject; imports: GeneratorImport[] }[];\n};\n\nexport type GetterParam = {\n name: string;\n definition: string;\n implementation: string;\n default: boolean;\n required: boolean;\n imports: GeneratorImport[];\n};\n\nexport type GetterParams = GetterParam[];\nexport type GetterQueryParam = {\n schema: GeneratorSchema;\n deps: GeneratorSchema[];\n isOptional: boolean;\n originalSchema?: SchemaObject;\n};\n\nexport type GetterPropType =\n | 'param'\n | 'body'\n | 'queryParam'\n | 'header'\n | 'namedPathParams';\n\nexport const GetterPropType = {\n PARAM: 'param',\n NAMED_PATH_PARAMS: 'namedPathParams',\n BODY: 'body',\n QUERY_PARAM: 'queryParam',\n HEADER: 'header',\n} as const;\n\ntype GetterPropBase = {\n name: string;\n definition: string;\n implementation: string;\n default: boolean;\n required: boolean;\n};\n\nexport type GetterProp = GetterPropBase &\n (\n | { type: 'namedPathParams'; destructured: string; schema: GeneratorSchema }\n | { type: Exclude<GetterPropType, 'namedPathParams'> }\n );\n\nexport type GetterProps = GetterProp[];\n\nexport type SchemaType =\n | 'integer'\n | 'number'\n | 'string'\n | 'boolean'\n | 'object'\n | 'null'\n | 'array'\n | 'enum'\n | 'unknown';\n\nexport const SchemaType = {\n integer: 'integer',\n number: 'number',\n string: 'string',\n boolean: 'boolean',\n object: 'object',\n null: 'null',\n array: 'array',\n enum: 'enum',\n unknown: 'unknown',\n};\n\nexport type ScalarValue = {\n value: string;\n isEnum: boolean;\n hasReadonlyProps: boolean;\n type: SchemaType;\n imports: GeneratorImport[];\n schemas: GeneratorSchema[];\n isRef: boolean;\n example?: any;\n examples?: Record<string, any>;\n};\n\nexport type ResolverValue = ScalarValue & {\n originalSchema: SchemaObject;\n};\n\nexport type ResReqTypesValue = ScalarValue & {\n formData?: string;\n formUrlEncoded?: string;\n isRef?: boolean;\n hasReadonlyProps?: boolean;\n key: string;\n contentType: string;\n originalSchema?: SchemaObject;\n};\n\nexport type WriteSpecsBuilder = {\n operations: GeneratorOperations;\n schemas: Record<string, GeneratorSchema[]>;\n verbOptions: Record<string, GeneratorVerbOptions>;\n title: GeneratorClientTitle;\n header: GeneratorClientHeader;\n footer: GeneratorClientFooter;\n imports: GeneratorClientImports;\n importsMock: GenerateMockImports;\n extraFiles: ClientFileBuilder[];\n info: InfoObject;\n target: string;\n};\n\nexport type WriteModeProps = {\n builder: WriteSpecsBuilder;\n output: NormalizedOutputOptions;\n workspace: string;\n specsName: Record<string, string>;\n header: string;\n needSchema: boolean;\n};\n\nexport type GeneratorApiOperations = {\n verbOptions: Record<string, GeneratorVerbOptions>;\n operations: GeneratorOperations;\n schemas: GeneratorSchema[];\n};\n\nexport type GeneratorClientExtra = {\n implementation: string;\n implementationMock: string;\n};\n\nexport type GeneratorClientTitle = (data: {\n outputClient?: OutputClient | OutputClientFunc;\n title: string;\n customTitleFunc?: (title: string) => string;\n output: NormalizedOutputOptions;\n}) => GeneratorClientExtra;\n\nexport type GeneratorClientHeader = (data: {\n outputClient?: OutputClient | OutputClientFunc;\n isRequestOptions: boolean;\n isMutator: boolean;\n isGlobalMutator: boolean;\n provideIn: boolean | 'root' | 'any';\n hasAwaitedType: boolean;\n titles: GeneratorClientExtra;\n output: NormalizedOutputOptions;\n verbOptions: Record<string, GeneratorVerbOptions>;\n tag?: string;\n clientImplementation: string;\n}) => GeneratorClientExtra;\n\nexport type GeneratorClientFooter = (data: {\n outputClient: OutputClient | OutputClientFunc;\n operationNames: string[];\n hasMutator: boolean;\n hasAwaitedType: boolean;\n titles: GeneratorClientExtra;\n output: NormalizedOutputOptions;\n}) => GeneratorClientExtra;\n\nexport type GeneratorClientImports = (data: {\n client: OutputClient | OutputClientFunc;\n implementation: string;\n imports: {\n exports: GeneratorImport[];\n dependency: string;\n }[];\n specsName: Record<string, string>;\n hasSchemaDir: boolean;\n isAllowSyntheticDefaultImports: boolean;\n hasGlobalMutator: boolean;\n hasTagsMutator: boolean;\n hasParamsSerializerOptions: boolean;\n packageJson?: PackageJson;\n output: NormalizedOutputOptions;\n}) => string;\n\nexport type GenerateMockImports = (data: {\n implementation: string;\n imports: {\n exports: GeneratorImport[];\n dependency: string;\n }[];\n specsName: Record<string, string>;\n hasSchemaDir: boolean;\n isAllowSyntheticDefaultImports: boolean;\n options?: GlobalMockOptions;\n}) => string;\n\nexport type GeneratorApiBuilder = GeneratorApiOperations & {\n title: GeneratorClientTitle;\n header: GeneratorClientHeader;\n footer: GeneratorClientFooter;\n imports: GeneratorClientImports;\n importsMock: GenerateMockImports;\n extraFiles: ClientFileBuilder[];\n};\n\nexport interface SchemaWithConst extends SchemaObject {\n const: string;\n}\n\nexport class ErrorWithTag extends Error {\n tag: string;\n constructor(message: string, tag: string, options?: ErrorOptions) {\n super(message, options);\n this.tag = tag;\n }\n}\n","import { Verbs } from './types';\n\nexport const generalJSTypes = [\n 'number',\n 'string',\n 'null',\n 'unknown',\n 'undefined',\n 'object',\n 'blob',\n];\n\nexport const generalJSTypesWithArray = generalJSTypes.reduce<string[]>(\n (acc, type) => {\n acc.push(type, `Array<${type}>`, `${type}[]`);\n\n return acc;\n },\n [],\n);\n\nexport const VERBS_WITH_BODY = [\n Verbs.POST,\n Verbs.PUT,\n Verbs.PATCH,\n Verbs.DELETE,\n];\n\nexport const URL_REGEX =\n /^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$/;\n\nexport const TEMPLATE_TAG_REGEX = /\\${(.+?)}/g; // For replace of 'thing' ${thing}\n","export const getExtension = (path: string) =>\n path.toLowerCase().includes('.yaml') || path.toLowerCase().includes('.yml')\n ? 'yaml'\n : 'json';\n","import debug from 'debug';\n\nconst filter = process.env.ORVAL_DEBUG_FILTER;\nconst DEBUG = process.env.DEBUG;\n\ninterface DebuggerOptions {\n onlyWhenFocused?: boolean | string;\n}\n\nexport function createDebugger(\n ns: string,\n options: DebuggerOptions = {},\n): debug.Debugger['log'] {\n const log = debug(ns);\n const { onlyWhenFocused } = options;\n const focus = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : ns;\n return (msg: string, ...args: any[]) => {\n if (filter && !msg.includes(filter)) {\n return;\n }\n if (onlyWhenFocused && !DEBUG?.includes(focus)) {\n return;\n }\n log(msg, ...args);\n };\n}\n","import readline from 'node:readline';\n\nimport chalk from 'chalk';\n\nexport const log = console.log;\n\nexport const startMessage = ({\n name,\n version,\n description,\n}: {\n name: string;\n version: string;\n description: string;\n}) =>\n `🍻 ${chalk.cyan.bold(name)} ${chalk.green(`v${version}`)}${\n description ? ` - ${description}` : ''\n }`;\n\nexport const logError = (err: unknown, tag?: string) => {\n log(\n chalk.red(\n [\n '🛑',\n tag ? `${tag} -` : undefined,\n err instanceof Error ? err.stack : err,\n ]\n .filter(Boolean)\n .join(' '),\n ),\n );\n};\n\nexport const mismatchArgsMessage = (mismatchArgs: string[]) => {\n log(\n chalk.yellow(\n `${mismatchArgs.join(', ')} ${\n mismatchArgs.length === 1 ? 'is' : 'are'\n } not defined in your configuration!`,\n ),\n );\n};\n\nexport const createSuccessMessage = (backend?: string) => {\n log(\n `🎉 ${\n backend ? `${chalk.green(backend)} - ` : ''\n }Your OpenAPI spec has been converted into ready to use orval!`,\n );\n};\n\nexport const ibmOpenapiValidatorWarnings = (\n warnings: {\n path: string[];\n message: string;\n }[],\n) => {\n log(chalk.yellow('(!) Warnings'));\n\n for (const i of warnings)\n log(chalk.yellow(`Message : ${i.message}\\nPath : ${i.path.join(', ')}`));\n};\n\nexport const ibmOpenapiValidatorErrors = (\n errors: {\n path: string[];\n message: string;\n }[],\n) => {\n log(chalk.red('(!) Errors'));\n\n for (const i of errors)\n log(chalk.red(`Message : ${i.message}\\nPath : ${i.path.join(', ')}`));\n};\n\nexport type LogType = 'error' | 'warn' | 'info';\nexport type LogLevel = LogType | 'silent';\nexport interface Logger {\n info(msg: string, options?: LogOptions): void;\n warn(msg: string, options?: LogOptions): void;\n warnOnce(msg: string, options?: LogOptions): void;\n error(msg: string, options?: LogOptions): void;\n clearScreen(type: LogType): void;\n hasWarned: boolean;\n}\n\nexport interface LogOptions {\n clear?: boolean;\n timestamp?: boolean;\n}\n\nexport const LogLevels: Record<LogLevel, number> = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n};\n\nlet lastType: LogType | undefined;\nlet lastMsg: string | undefined;\nlet sameCount = 0;\n\nfunction clearScreen() {\n const repeatCount = process.stdout.rows - 2;\n const blank = repeatCount > 0 ? '\\n'.repeat(repeatCount) : '';\n console.log(blank);\n readline.cursorTo(process.stdout, 0, 0);\n readline.clearScreenDown(process.stdout);\n}\n\nexport interface LoggerOptions {\n prefix?: string;\n allowClearScreen?: boolean;\n}\n\nexport function createLogger(\n level: LogLevel = 'info',\n options: LoggerOptions = {},\n): Logger {\n const { prefix = '[vite]', allowClearScreen = true } = options;\n\n const thresh = LogLevels[level];\n const clear =\n allowClearScreen && process.stdout.isTTY && !process.env.CI\n ? clearScreen\n : () => {};\n\n function output(type: LogType, msg: string, options: LogOptions = {}) {\n if (thresh >= LogLevels[type]) {\n const method = type === 'info' ? 'log' : type;\n const format = () => {\n if (options.timestamp) {\n const tag =\n type === 'info'\n ? chalk.cyan.bold(prefix)\n : type === 'warn'\n ? chalk.yellow.bold(prefix)\n : chalk.red.bold(prefix);\n return `${chalk.dim(new Date().toLocaleTimeString())} ${tag} ${msg}`;\n } else {\n return msg;\n }\n };\n if (type === lastType && msg === lastMsg) {\n sameCount++;\n clear();\n console[method](format(), chalk.yellow(`(x${sameCount + 1})`));\n } else {\n sameCount = 0;\n lastMsg = msg;\n lastType = type;\n if (options.clear) {\n clear();\n }\n console[method](format());\n }\n }\n }\n\n const warnedMessages = new Set<string>();\n\n const logger: Logger = {\n hasWarned: false,\n info(msg, opts) {\n output('info', msg, opts);\n },\n warn(msg, opts) {\n logger.hasWarned = true;\n output('warn', msg, opts);\n },\n warnOnce(msg, opts) {\n if (warnedMessages.has(msg)) return;\n logger.hasWarned = true;\n output('warn', msg, opts);\n warnedMessages.add(msg);\n },\n error(msg, opts) {\n logger.hasWarned = true;\n output('error', msg, opts);\n },\n clearScreen(type) {\n if (thresh >= LogLevels[type]) {\n clear();\n }\n },\n };\n\n return logger;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport chalk from 'chalk';\nimport { build, type PluginBuild } from 'esbuild';\nimport glob from 'globby';\nimport mm from 'micromatch';\n\nimport type { Tsconfig } from '../types';\nimport { isDirectory } from './assertion';\nimport { createDebugger } from './debug';\nimport { createLogger, type LogLevel } from './logger';\nimport { joinSafe, normalizeSafe } from './path';\n\nexport const getFileInfo = (\n target = '',\n {\n backupFilename = 'filename',\n extension = '.ts',\n }: { backupFilename?: string; extension?: string } = {},\n) => {\n const isDir = isDirectory(target);\n const filePath = isDir\n ? path.join(target, backupFilename + extension)\n : target;\n const pathWithoutExtension = filePath.replace(/\\.[^/.]+$/, '');\n const dir = path.dirname(filePath);\n const filename = path.basename(\n filePath,\n extension.startsWith('.') ? extension : `.${extension}`,\n );\n\n return {\n path: filePath,\n pathWithoutExtension,\n extension,\n isDirectory: isDir,\n dirname: dir,\n filename,\n };\n};\n\nconst debug = createDebugger('orval:file-load');\n\nconst cache = new Map<string, { file?: any; error?: any }>();\n\nexport async function loadFile<File = any>(\n filePath?: string,\n options?: {\n root?: string;\n defaultFileName?: string;\n logLevel?: LogLevel;\n isDefault?: boolean;\n alias?: Record<string, string>;\n tsconfig?: Tsconfig;\n load?: boolean;\n },\n): Promise<{\n path: string;\n file?: File;\n error?: any;\n cached?: boolean;\n}> {\n const {\n root = process.cwd(),\n isDefault = true,\n defaultFileName,\n logLevel,\n alias,\n tsconfig,\n load = true,\n } = options ?? {};\n const start = Date.now();\n\n let resolvedPath: string | undefined;\n let isTS = false;\n let isMjs = false;\n\n if (filePath) {\n // explicit path is always resolved from cwd\n resolvedPath = path.resolve(filePath);\n isTS = filePath.endsWith('.ts');\n } else if (defaultFileName) {\n // implicit file loaded from inline root (if present)\n // otherwise from cwd\n const jsFile = path.resolve(root, `${defaultFileName}.js`);\n if (fs.existsSync(jsFile)) {\n resolvedPath = jsFile;\n }\n\n if (!resolvedPath) {\n const mjsFile = path.resolve(root, `${defaultFileName}.mjs`);\n if (fs.existsSync(mjsFile)) {\n resolvedPath = mjsFile;\n isMjs = true;\n }\n }\n\n if (!resolvedPath) {\n const cjsFile = path.resolve(root, `${defaultFileName}.cjs`);\n if (fs.existsSync(cjsFile)) {\n resolvedPath = cjsFile;\n }\n }\n\n if (!resolvedPath) {\n const tsFile = path.resolve(root, `${defaultFileName}.ts`);\n if (fs.existsSync(tsFile)) {\n resolvedPath = tsFile;\n isTS = true;\n }\n }\n }\n\n if (!resolvedPath) {\n if (filePath) {\n throw new Error(chalk.red(`File not found => ${filePath}`));\n } else if (defaultFileName) {\n throw new Error(\n chalk.red(`File not found => ${defaultFileName}.{js,mjs,cjs,ts}`),\n );\n } else {\n throw new Error(chalk.red(`File not found`));\n }\n }\n\n const normalizeResolvedPath = normalizeSafe(resolvedPath);\n const cachedData = cache.get(resolvedPath);\n\n if (cachedData) {\n return {\n path: normalizeResolvedPath,\n ...cachedData,\n cached: true,\n };\n }\n\n try {\n let file: File | undefined;\n\n if (!file && !isTS && !isMjs) {\n // 1. try to directly require the module (assuming commonjs)\n try {\n // clear cache in case of server restart\n delete require.cache[require.resolve(resolvedPath)];\n\n file = require(resolvedPath);\n\n debug(`cjs loaded in ${Date.now() - start}ms`);\n } catch (error) {\n const ignored = new RegExp(\n [\n `Cannot use import statement`,\n `Must use import to load ES Module`,\n // #1635, #2050 some Node 12.x versions don't have esm detection\n // so it throws normal syntax errors when encountering esm syntax\n `Unexpected token`,\n `Unexpected identifier`,\n ].join('|'),\n );\n //@ts-ignore\n if (!ignored.test(error.message)) {\n throw error;\n }\n }\n }\n\n if (!file) {\n // 2. if we reach here, the file is ts or using es import syntax, or\n // the user has type: \"module\" in their package.json (#917)\n // transpile es import syntax to require syntax using rollup.\n // lazy require rollup (it's actually in dependencies)\n const { code } = await bundleFile(\n resolvedPath,\n isMjs,\n root || path.dirname(normalizeResolvedPath),\n alias,\n tsconfig?.compilerOptions,\n );\n\n file = load\n ? await loadFromBundledFile<File>(resolvedPath, code, isDefault)\n : (code as any);\n\n debug(`bundled file loaded in ${Date.now() - start}ms`);\n }\n\n cache.set(resolvedPath, { file });\n\n return {\n path: normalizeResolvedPath,\n file,\n };\n } catch (error: any) {\n cache.set(resolvedPath, { error });\n\n return {\n path: normalizeResolvedPath,\n error,\n };\n }\n}\n\nasync function bundleFile(\n fileName: string,\n mjs = false,\n workspace: string,\n alias?: Record<string, string>,\n compilerOptions?: Tsconfig['compilerOptions'],\n): Promise<{ code: string; dependencies: string[] }> {\n const result = await build({\n absWorkingDir: process.cwd(),\n entryPoints: [fileName],\n outfile: 'out.js',\n write: false,\n platform: 'node',\n bundle: true,\n format: mjs ? 'esm' : 'cjs',\n sourcemap: 'inline',\n metafile: true,\n target: compilerOptions?.target || 'es6',\n minify: false,\n minifyIdentifiers: false,\n minifySyntax: false,\n minifyWhitespace: false,\n treeShaking: false,\n keepNames: false,\n plugins: [\n ...(alias || compilerOptions?.paths\n ? [\n {\n name: 'aliasing',\n setup(build: PluginBuild) {\n build.onResolve(\n { filter: /^[\\w@][^:]/ },\n async ({ path: id }) => {\n if (alias) {\n const matchKeys = Object.keys(alias);\n const match = matchKeys.find(\n (key) =>\n id.startsWith(key) || mm.isMatch(id, matchKeys),\n );\n\n if (match) {\n const find = mm.scan(match);\n const replacement = mm.scan(alias[match]);\n\n const base = path.resolve(workspace, replacement.base);\n const newPath = find.base\n ? id.replace(find.base, base)\n : joinSafe(base, id);\n\n const ext = path.extname(newPath);\n\n const aliased = ext ? newPath : `${newPath}.ts`;\n\n if (!fs.existsSync(aliased)) {\n return;\n }\n\n return {\n path: aliased,\n };\n }\n }\n\n if (compilerOptions?.paths) {\n const matchKeys = Object.keys(compilerOptions?.paths);\n const match = matchKeys.find(\n (key) =>\n id.startsWith(key) || mm.isMatch(id, matchKeys),\n );\n\n if (match) {\n const find = mm.scan(match);\n const replacement = mm.scan(\n compilerOptions?.paths[match][0],\n );\n\n const base = path.resolve(workspace, replacement.base);\n const newPath = find.base\n ? id.replace(find.base, base)\n : joinSafe(base, id);\n\n const ext = path.extname(newPath);\n\n const aliased = ext ? newPath : `${newPath}.ts`;\n\n if (!fs.existsSync(aliased)) {\n return;\n }\n\n return {\n path: aliased,\n };\n }\n }\n },\n );\n },\n },\n ]\n : []),\n {\n name: 'externalize-deps',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const id = args.path;\n if (!id.startsWith('.') && !path.isAbsolute(id)) {\n return {\n external: true,\n };\n }\n });\n },\n },\n {\n name: 'replace-import-meta',\n setup(build) {\n build.onLoad({ filter: /\\.[jt]s$/ }, async (args) => {\n const contents = await fs.promises.readFile(args.path, 'utf8');\n return {\n loader: args.path.endsWith('.ts') ? 'ts' : 'js',\n contents: contents\n .replaceAll(\n /\\bimport\\.meta\\.url\\b/g,\n JSON.stringify(`file://${args.path}`),\n )\n .replaceAll(\n /\\b__dirname\\b/g,\n JSON.stringify(path.dirname(args.path)),\n )\n .replaceAll(/\\b__filename\\b/g, JSON.stringify(args.path)),\n };\n });\n },\n },\n ],\n });\n const { text } = result.outputFiles[0];\n return {\n code: text,\n dependencies: result.metafile ? Object.keys(result.metafile.inputs) : [],\n };\n}\n\ninterface NodeModuleWithCompile extends NodeModule {\n _compile(code: string, filename: string): any;\n}\n\nasync function loadFromBundledFile<File = unknown>(\n fileName: string,\n bundledCode: string,\n isDefault: boolean,\n): Promise<File> {\n const extension = path.extname(fileName);\n const defaultLoader = require.extensions[extension]!;\n require.extensions[extension] = (module: NodeModule, filename: string) => {\n if (filename === fileName) {\n (module as NodeModuleWithCompile)._compile(bundledCode, filename);\n } else {\n defaultLoader(module, filename);\n }\n };\n // clear cache in case of server restart\n delete require.cache[require.resolve(fileName)];\n const raw = require(fileName);\n const file = isDefault && raw.__esModule ? raw.default : raw;\n require.extensions[extension] = defaultLoader;\n return file;\n}\n\nexport async function removeFilesAndEmptyFolders(\n patterns: string[],\n dir: string,\n) {\n const files = await glob(patterns, {\n cwd: dir,\n absolute: true,\n });\n\n // Remove files\n await Promise.all(files.map((file) => fs.promises.unlink(file)));\n\n // Find and remove empty directories\n const directories = await glob(['**/*'], {\n cwd: dir,\n absolute: true,\n onlyDirectories: true,\n });\n\n // Sort directories by depth (deepest first) to ensure we can remove nested empty folders\n const sortedDirectories = directories.sort((a, b) => {\n const depthA = a.split('/').length;\n const depthB = b.split('/').length;\n return depthB - depthA;\n });\n\n // Remove empty directories\n for (const directory of sortedDirectories) {\n try {\n const contents = await fs.promises.readdir(directory);\n if (contents.length === 0) {\n await fs.promises.rmdir(directory);\n }\n } catch {\n // Directory might have been removed already or doesn't exist\n // Continue with next directory\n }\n }\n}\n","import basepath from 'node:path';\n\nimport { isUrl } from './assertion';\nimport { getExtension } from './extension';\nimport { getFileInfo } from './file';\n\n// override path to support windows paths\n// https://github.com/anodynos/upath/blob/master/source/code/upath.coffee\ntype Path = typeof basepath;\nconst path = {} as Path;\n\nconst isFunction = (val: any) => typeof val == 'function';\n\nconst isString = (val: any) => {\n if (typeof val === 'string') {\n return true;\n }\n\n if (typeof val === 'object' && val !== null) {\n return Object.toString.call(val) == '[object String]';\n }\n\n return false;\n};\n\nfor (const [propName, propValue] of Object.entries(basepath)) {\n if (isFunction(propValue)) {\n // @ts-ignore\n path[propName] = ((propName) => {\n return (...args: any[]) => {\n args = args.map((p) => {\n return isString(p) ? toUnix(p) : p;\n });\n\n // @ts-ignore\n const result = basepath[propName](...args);\n return isString(result) ? toUnix(result) : result;\n };\n })(propName);\n } else {\n // @ts-ignore\n path[propName] = propValue;\n }\n}\n\nconst { join, resolve, extname, dirname, basename, isAbsolute } = path;\nexport { basename, dirname, extname, isAbsolute, join, resolve };\n\n/**\n * Behaves exactly like `path.relative(from, to)`, but keeps the first meaningful \"./\"\n */\nexport const relativeSafe = (from: string, to: string) => {\n const normalizedRelativePath = path.relative(from, to);\n /**\n * Prepend \"./\" to every path and then use normalizeSafe method to normalize it\n * normalizeSafe doesn't remove meaningful leading \"./\"\n */\n const relativePath = normalizeSafe(`.${separator}${normalizedRelativePath}`);\n return relativePath;\n};\n\nexport const getSpecName = (specKey: string, target: string) => {\n if (isUrl(specKey)) {\n const url = new URL(target);\n return specKey\n .replace(url.origin, '')\n .replace(getFileInfo(url.pathname).dirname, '')\n .replace(`.${getExtension(specKey)}`, '');\n }\n\n return (\n '/' +\n path\n .normalize(path.relative(getFileInfo(target).dirname, specKey))\n .split('../')\n .join('')\n .replace(`.${getExtension(specKey)}`, '')\n );\n};\n\nexport const getSchemaFileName = (path: string) => {\n return path\n .replace(`.${getExtension(path)}`, '')\n .slice(path.lastIndexOf('/') + 1);\n};\n\nexport const separator = '/';\n\nconst toUnix = function (value: string) {\n value = value.replaceAll('\\\\', '/');\n value = value.replaceAll(/(?<!^)\\/+/g, '/'); // replace doubles except beginning for UNC path\n return value;\n};\n\nexport const normalizeSafe = (value: string) => {\n let result;\n value = toUnix(value);\n result = path.normalize(value);\n if (\n value.startsWith('./') &&\n !result.startsWith('./') &&\n !result.startsWith('..')\n ) {\n result = './' + result;\n } else if (value.startsWith('//') && !result.startsWith('//')) {\n result = value.startsWith('//./') ? '//.' + result : '/' + result;\n }\n return result;\n};\n\nexport const joinSafe = function (...values: string[]) {\n let result = path.join(...values);\n\n if (values.length > 0) {\n const firstValue = toUnix(values[0]);\n if (\n firstValue.startsWith('./') &&\n !result.startsWith('./') &&\n !result.startsWith('..')\n ) {\n result = './' + result;\n } else if (firstValue.startsWith('//') && !result.startsWith('//')) {\n result = firstValue.startsWith('//./') ? '//.' + result : '/' + result;\n }\n }\n return result;\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { SchemaType, Verbs } from '../types';\nimport { extname } from './path';\n\n/**\n * Discriminator helper for `ReferenceObject`\n *\n * @param property\n */\nexport const isReference = (property: any): property is ReferenceObject => {\n return Boolean(property?.$ref);\n};\n\nexport const isDirectory = (path: string) => {\n return !extname(path);\n};\n\nexport function isObject(x: any): x is Record<string, unknown> {\n return Object.prototype.toString.call(x) === '[object Object]';\n}\n\nexport function isModule(x: any): x is Record<string, unknown> {\n return Object.prototype.toString.call(x) === '[object Module]';\n}\n\nexport function isString(x: any): x is string {\n return typeof x === 'string';\n}\n\nexport function isNumber(x: any): x is number {\n return typeof x === 'number';\n}\n\nexport function isNumeric(x: any): x is number {\n return /^-?\\d+$/.test(x);\n}\n\nexport function isBoolean(x: any): x is boolean {\n return typeof x === 'boolean';\n}\n\nexport function isFunction(x: any): x is Function {\n return typeof x === 'function';\n}\n\nexport function isUndefined(x: any): x is undefined {\n return x === undefined;\n}\n\nexport function isNull(x: any): x is null {\n return x === null;\n}\n\nexport function isSchema(x: any): x is SchemaObject {\n if (!isObject(x)) {\n return false;\n }\n\n if (isString(x.type) && Object.values(SchemaType).includes(x.type)) {\n return true;\n }\n\n const combine = x.allOf || x.anyOf || x.oneOf;\n if (Array.isArray(combine)) {\n return true;\n }\n\n if (isObject(x.properties)) {\n return true;\n }\n\n return false;\n}\n\nexport const isVerb = (verb: string): verb is Verbs =>\n Object.values(Verbs).includes(verb as Verbs);\n\nexport const isRootKey = (specKey: string, target: string) => {\n return specKey === target;\n};\n\nexport const isUrl = (str: string) => {\n let givenURL;\n try {\n givenURL = new URL(str);\n } catch {\n return false;\n }\n return givenURL.protocol === 'http:' || givenURL.protocol === 'https:';\n};\n","export async function asyncReduce<IterationItem, AccValue>(\n array: IterationItem[],\n reducer: (\n accumulate: AccValue,\n current: IterationItem,\n ) => AccValue | Promise<AccValue>,\n initValue: AccValue,\n): Promise<AccValue> {\n let accumulate =\n typeof initValue === 'object'\n ? Object.create(initValue as unknown as object)\n : initValue;\n\n for (const item of array) {\n accumulate = await reducer(accumulate, item);\n }\n\n return accumulate;\n}\n","import { NamingConvention } from '../types';\n\nconst unicodes = function (s: string, prefix: string) {\n prefix = prefix || '';\n return s\n .replaceAll(/(^|-)/g, String.raw`$1\\u` + prefix)\n .replaceAll(',', String.raw`\\u` + prefix);\n};\n\nconst symbols = unicodes('20-26,28-2F,3A-40,5B-60,7B-7E,A0-BF,D7,F7', '00');\nconst lowers = 'a-z' + unicodes('DF-F6,F8-FF', '00');\nconst uppers = 'A-Z' + unicodes('C0-D6,D8-DE', '00');\nconst impropers = String.raw`A|An|And|As|At|But|By|En|For|If|In|Of|On|Or|The|To|Vs?\\.?|Via`;\n\nconst regexps = {\n capitalize: new RegExp('(^|[' + symbols + '])([' + lowers + '])', 'g'),\n pascal: new RegExp('(^|[' + symbols + '])+([' + lowers + uppers + '])', 'g'),\n fill: new RegExp('[' + symbols + ']+(.|$)', 'g'),\n sentence: new RegExp(\n String.raw`(^\\s*|[\\?\\!\\.]+\"?\\s+\"?|,\\s+\")([` + lowers + '])',\n 'g',\n ),\n improper: new RegExp(String.raw`\\b(` + impropers + String.raw`)\\b`, 'g'),\n relax: new RegExp(\n '([^' +\n uppers +\n '])([' +\n uppers +\n ']*)([' +\n uppers +\n '])(?=[^' +\n uppers +\n ']|$)',\n 'g',\n ),\n upper: new RegExp('^[^' + lowers + ']+$'),\n hole: /[^\\s]\\s[^\\s]/,\n apostrophe: /'/g,\n room: new RegExp('[' + symbols + ']'),\n};\n\nconst deapostrophe = (s: string) => {\n return s.replace(regexps.apostrophe, '');\n};\n\nconst up = String.prototype.toUpperCase;\nconst low = String.prototype.toLowerCase;\n\nconst fill = (s: string, fillWith: string, isDeapostrophe = false) => {\n s = s.replace(regexps.fill, function (m, next) {\n return next ? fillWith + next : '';\n });\n\n if (isDeapostrophe) {\n s = deapostrophe(s);\n }\n return s;\n};\n\nconst decap = (s: string, char = 0) => {\n return low.call(s.charAt(char)) + s.slice(char + 1);\n};\n\nconst relax = (\n m: string,\n before: string,\n acronym: string | undefined,\n caps: string,\n) => {\n return before + ' ' + (acronym ? acronym + ' ' : '') + caps;\n};\n\nconst prep = (s: string, isFill = false, isPascal = false, isUpper = false) => {\n s = s == undefined ? '' : s + ''; // force to string\n if (!isUpper && regexps.upper.test(s)) {\n s = low.call(s);\n }\n if (!isFill && !regexps.hole.test(s)) {\n // eslint-disable-next-line no-var\n var holey = fill(s, ' ');\n if (regexps.hole.test(holey)) {\n s = holey;\n }\n }\n if (!isPascal && !regexps.room.test(s)) {\n s = s.replace(regexps.relax, relax);\n }\n return s;\n};\n\nconst lower = (s: string, fillWith: string, isDeapostrophe: boolean) => {\n return fill(low.call(prep(s, !!fillWith)), fillWith, isDeapostrophe);\n};\n\n// Caches the previously converted strings to improve performance\nconst pascalMemory: Record<string, string> = {};\n\nexport const pascal = (s: string) => {\n if (pascalMemory[s]) {\n return pascalMemory[s];\n }\n\n const isStartWithUnderscore = s?.startsWith('_');\n\n if (regexps.upper.test(s)) {\n s = low.call(s);\n }\n\n const pascalString = (s?.match(/[a-zA-Z0-9\\u00C0-\\u017F]+/g) || [])\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join('');\n\n const pascalWithUnderscore = isStartWithUnderscore\n ? `_${pascalString}`\n : pascalString;\n\n pascalMemory[s] = pascalWithUnderscore;\n\n return pascalWithUnderscore;\n};\n\nexport const camel = (s: string) => {\n const isStartWithUnderscore = s?.startsWith('_');\n const camelString = decap(pascal(s), isStartWithUnderscore ? 1 : 0);\n return isStartWithUnderscore ? `_${camelString}` : camelString;\n};\n\nexport const snake = (s: string) => {\n return lower(s, '_', true);\n};\n\nexport const kebab = (s: string) => {\n return lower(s, '-', true);\n};\n\nexport const upper = (\n s: string,\n fillWith: string,\n isDeapostrophe?: boolean,\n) => {\n return fill(\n up.call(prep(s, !!fillWith, false, true)),\n fillWith,\n isDeapostrophe,\n );\n};\n\nexport const conventionName = (name: string, convention: NamingConvention) => {\n let nameConventionTransform = camel;\n switch (convention) {\n case NamingConvention.PASCAL_CASE: {\n nameConventionTransform = pascal;\n\n break;\n }\n case NamingConvention.SNAKE_CASE: {\n nameConventionTransform = snake;\n\n break;\n }\n case NamingConvention.KEBAB_CASE: {\n nameConventionTransform = kebab;\n\n break;\n }\n // No default\n }\n\n return nameConventionTransform(name);\n};\n","import { compare, type CompareOperator } from 'compare-versions';\n\nexport const compareVersions = (\n firstVersion: string,\n secondVersions: string,\n operator: CompareOperator = '>=',\n) => {\n if (firstVersion === 'latest' || firstVersion === '*') {\n return true;\n }\n\n return compare(\n firstVersion.replace(/(\\s(.*))/, ''),\n secondVersions,\n operator,\n );\n};\n","import type { ContextSpecs } from '../types';\n\nconst search = String.raw`\\*/`; // Find '*/'\nconst replacement = String.raw`*\\/`; // Replace With '*\\/'\n\nconst regex = new RegExp(search, 'g');\n\nexport function jsDoc(\n schema: {\n description?: string[] | string;\n deprecated?: boolean;\n summary?: string;\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: boolean;\n exclusiveMaximum?: boolean;\n minItems?: number;\n maxItems?: number;\n nullable?: boolean;\n pattern?: string;\n },\n tryOneLine = false,\n context?: ContextSpecs,\n): string {\n if (context?.output?.override?.jsDoc) {\n const { filter } = context.output.override.jsDoc;\n if (filter) {\n return keyValuePairsToJsDoc(filter(schema));\n }\n }\n const {\n description,\n deprecated,\n summary,\n minLength,\n maxLength,\n minimum,\n maximum,\n exclusiveMinimum,\n exclusiveMaximum,\n minItems,\n maxItems,\n nullable,\n pattern,\n } = schema;\n // Ensure there aren't any comment terminations in doc\n const lines = (\n Array.isArray(description)\n ? description.filter((d) => !d.includes('eslint-disable'))\n : [description || '']\n ).map((line) => line.replaceAll(regex, replacement));\n\n const count = [\n description,\n deprecated,\n summary,\n minLength?.toString(),\n maxLength?.toString(),\n minimum?.toString(),\n maximum?.toString(),\n exclusiveMinimum?.toString(),\n exclusiveMaximum?.toString(),\n minItems?.toString(),\n maxItems?.toString(),\n nullable?.toString(),\n pattern,\n ].reduce((acc, it) => (it ? acc + 1 : acc), 0);\n\n if (!count) {\n return '';\n }\n\n const oneLine = count === 1 && tryOneLine;\n const eslintDisable = Array.isArray(description)\n ? description\n .find((d) => d.includes('eslint-disable'))\n ?.replaceAll(regex, replacement)\n : undefined;\n let doc = `${eslintDisable ? `/* ${eslintDisable} */\\n` : ''}/**`;\n\n if (description) {\n if (!oneLine) {\n doc += `\\n${tryOneLine ? ' ' : ''} *`;\n }\n doc += ` ${lines.join('\\n * ')}`;\n }\n\n function appendPrefix() {\n if (!oneLine) {\n doc += `\\n${tryOneLine ? ' ' : ''} *`;\n }\n }\n\n function tryAppendStringDocLine(key: string, value?: string) {\n if (value) {\n appendPrefix();\n doc += ` @${key} ${value.replaceAll(regex, replacement)}`;\n }\n }\n\n function tryAppendBooleanDocLine(key: string, value?: boolean) {\n if (value === true) {\n appendPrefix();\n doc += ` @${key}`;\n }\n }\n\n function tryAppendNumberDocLine(key: string, value?: number) {\n if (value !== undefined) {\n appendPrefix();\n doc += ` @${key} ${value}`;\n }\n }\n\n tryAppendBooleanDocLine('deprecated', deprecated);\n tryAppendStringDocLine('summary', summary?.replaceAll(regex, replacement));\n tryAppendNumberDocLine('minLength', minLength);\n tryAppendNumberDocLine('maxLength', maxLength);\n tryAppendNumberDocLine('minimum', minimum);\n tryAppendNumberDocLine('maximum', maximum);\n tryAppendBooleanDocLine('exclusiveMinimum', exclusiveMinimum);\n tryAppendBooleanDocLine('exclusiveMaximum', exclusiveMaximum);\n tryAppendNumberDocLine('minItems', minItems);\n tryAppendNumberDocLine('maxItems', maxItems);\n tryAppendBooleanDocLine('nullable', nullable);\n tryAppendStringDocLine('pattern', pattern);\n\n doc += oneLine ? ' ' : `\\n ${tryOneLine ? ' ' : ''}`;\n\n doc += '*/\\n';\n\n return doc;\n}\n\nexport function keyValuePairsToJsDoc(\n keyValues: {\n key: string;\n value: string;\n }[],\n) {\n if (keyValues.length === 0) return '';\n let doc = '/**\\n';\n for (const { key, value } of keyValues) {\n doc += ` * @${key} ${value}\\n`;\n }\n doc += ' */\\n';\n return doc;\n}\n","import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { isModule, isObject, isString } from './assertion';\n\nexport const dynamicImport = async <T>(\n toImport: T | string,\n from = process.cwd(),\n takeDefault = true,\n): Promise<T> => {\n if (!toImport) {\n return toImport as T;\n }\n\n try {\n if (isString(toImport)) {\n const filePath = path.resolve(from, toImport);\n // use pathToFileURL to solve issue #1332.\n // https://github.com/nodejs/node/issues/31710\n const fileUrl = pathToFileURL(filePath);\n const isJson = path.extname(fileUrl.href) === '.json';\n const data = isJson\n ? await import(fileUrl.href, { with: { type: 'json' } })\n : await import(fileUrl.href);\n if (takeDefault && (isObject(data) || isModule(data)) && data.default) {\n return (data as any).default as T;\n }\n\n return data;\n }\n\n return toImport;\n } catch (error) {\n throw new Error(`Oups... 🍻. Path: ${toImport} => ${error}`);\n }\n};\n","import type { ClientMockBuilder, GlobalMockOptions } from '../types';\nimport { isFunction } from './assertion';\n\nexport const getMockFileExtensionByTypeName = (\n mock: GlobalMockOptions | ClientMockBuilder,\n) => {\n if (isFunction(mock)) {\n return 'msw';\n }\n switch (mock.type) {\n default: {\n // case 'msw':\n return 'msw';\n }\n }\n};\n","import { VERBS_WITH_BODY } from '../constants';\nimport { Verbs } from '../types';\n\nexport const getIsBodyVerb = (verb: Verbs) => VERBS_WITH_BODY.includes(verb);\n","const isObject = (obj: unknown) => obj && typeof obj === 'object';\n\nexport function mergeDeep<\n T extends Record<string, any>,\n U extends Record<string, any>,\n>(source: T, target: U): T & U {\n if (!isObject(target) || !isObject(source)) {\n return source as T & U;\n }\n\n return Object.entries(target).reduce(\n (acc, [key, value]) => {\n const sourceValue = acc[key];\n\n if (Array.isArray(sourceValue) && Array.isArray(value)) {\n (acc[key] as any) = [...sourceValue, ...value];\n } else if (isObject(sourceValue) && isObject(value)) {\n (acc[key] as any) = mergeDeep(sourceValue, value);\n } else {\n (acc[key] as any) = value;\n }\n\n return acc;\n },\n Object.assign({}, source),\n ) as T & U;\n}\n","export const count = (str = '', key: string) => {\n if (!str) {\n return 0;\n }\n\n return (str.match(new RegExp(key, 'g')) ?? []).length;\n};\n","import chalk from 'chalk';\nimport type { OpenAPIObject } from 'openapi3-ts/oas30';\nimport { type ConvertInputOptions, convertObj } from 'swagger2openapi';\n\nimport { log } from './logger';\n\nexport const openApiConverter = async (\n schema: any,\n options: Partial<ConvertInputOptions> = {},\n specKey: string,\n): Promise<OpenAPIObject> => {\n try {\n return new Promise((resolve) => {\n if (!schema.openapi && schema.swagger === '2.0') {\n convertObj(schema, options, (err, value) => {\n if (err) {\n log(chalk.yellow(`${specKey}\\n=> ${err}`));\n resolve(schema);\n } else {\n resolve(value.openapi as OpenAPIObject);\n }\n });\n } else {\n resolve(schema);\n }\n });\n } catch (error) {\n throw new Error(`Oups... 🍻.\\nPath: ${specKey}\\nParsing Error: ${error}`);\n }\n};\n","export const sortByPriority = <T>(\n arr: (T & { default?: boolean; required?: boolean })[],\n) =>\n arr.sort((a, b) => {\n if (a.default) {\n return 1;\n }\n\n if (b.default) {\n return -1;\n }\n\n if (a.required && b.required) {\n return 0;\n }\n\n if (a.required) {\n return -1;\n }\n\n if (b.required) {\n return 1;\n }\n return 0;\n });\n","import { keyword } from 'esutils';\n\nimport {\n isBoolean,\n isFunction,\n isNull,\n isNumber,\n isString,\n isUndefined,\n} from './assertion';\n\nexport const stringify = (\n data?: string | any[] | Record<string, any>,\n): string | undefined => {\n if (isUndefined(data) || isNull(data)) {\n return;\n }\n\n if (isString(data)) {\n return `'${data}'`;\n }\n\n if (isNumber(data) || isBoolean(data) || isFunction(data)) {\n return `${data}`;\n }\n\n if (Array.isArray(data)) {\n return `[${data.map(stringify).join(', ')}]`;\n }\n\n return Object.entries(data).reduce((acc, [key, value], index, arr) => {\n const strValue = stringify(value);\n if (arr.length === 1) {\n return `{ ${key}: ${strValue}, }`;\n }\n\n if (!index) {\n return `{ ${key}: ${strValue}, `;\n }\n\n if (arr.length - 1 === index) {\n return acc + `${key}: ${strValue}, }`;\n }\n\n return acc + `${key}: ${strValue}, `;\n }, '');\n};\n\nexport const sanitize = (\n value: string,\n options?: {\n whitespace?: string | true;\n underscore?: string | true;\n dot?: string | true;\n dash?: string | true;\n es5keyword?: boolean;\n es5IdentifierName?: boolean;\n special?: boolean;\n },\n) => {\n const {\n whitespace = '',\n underscore = '',\n dot = '',\n dash = '',\n es5keyword = false,\n es5IdentifierName = false,\n special = false,\n } = options ?? {};\n let newValue = value;\n\n if (!special) {\n newValue = newValue.replaceAll(\n /[!\"`'#%&,:;<>=@{}~\\$\\(\\)\\*\\+\\/\\\\\\?\\[\\]\\^\\|]/g,\n '',\n );\n }\n\n if (whitespace !== true) {\n newValue = newValue.replaceAll(/[\\s]/g, whitespace);\n }\n\n if (underscore !== true) {\n newValue = newValue.replaceAll(/['_']/g, underscore);\n }\n\n if (dot !== true) {\n newValue = newValue.replaceAll(/[.]/g, dot);\n }\n\n if (dash !== true) {\n newValue = newValue.replaceAll(/[-]/g, dash);\n }\n\n if (es5keyword) {\n newValue = keyword.isKeywordES5(newValue, true) ? `_${newValue}` : newValue;\n }\n\n if (es5IdentifierName) {\n if (/^[0-9]/.test(newValue)) {\n newValue = `N${newValue}`;\n } else {\n newValue = keyword.isIdentifierNameES5(newValue)\n ? newValue\n : `_${newValue}`;\n }\n }\n\n return newValue;\n};\n\nexport const toObjectString = <T>(props: T[], path?: keyof T) => {\n if (props.length === 0) {\n return '';\n }\n\n const arrayOfString =\n typeof path === 'string'\n ? props.map((prop) =>\n path\n .split('.')\n .reduce(\n (obj: any, key: string) =>\n obj && typeof obj === 'object' ? obj[key] : undefined,\n prop,\n ),\n )\n : props;\n\n return arrayOfString.join(',\\n ') + ',';\n};\n\nconst NUMBERS = {\n '0': 'zero',\n '1': 'one',\n '2': 'two',\n '3': 'three',\n '4': 'four',\n '5': 'five',\n '6': 'six',\n '7': 'seven',\n '8': 'eight',\n '9': 'nine',\n};\n\nexport const getNumberWord = (num: number) => {\n const arrayOfNumber = num.toString().split('') as (keyof typeof NUMBERS)[];\n return arrayOfNumber.reduce((acc, n) => acc + NUMBERS[n], '');\n};\n\nexport const escape = (str: string | null, char = \"'\") =>\n str?.replace(char, `\\\\${char}`);\n\n/**\n * Escape all characters not included in SingleStringCharacters and\n * DoubleStringCharacters on\n * http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * Based on https://github.com/joliss/js-string-escape/blob/master/index.js\n *\n * @param input String to escape\n */\nexport const jsStringEscape = (input: string) =>\n input.replaceAll(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\': {\n return '\\\\' + character;\n }\n // Four possible LineTerminator characters need to be escaped:\n case '\\n': {\n return String.raw`\\n`;\n }\n case '\\r': {\n return String.raw`\\r`;\n }\n case '\\u2028': {\n return String.raw`\\u2028`;\n }\n case '\\u2029': {\n return String.raw`\\u2029`;\n }\n default: {\n return '';\n }\n }\n });\n","import type { Tsconfig } from '../types';\n\nexport const isSyntheticDefaultImportsAllow = (config?: Tsconfig) => {\n if (!config) {\n return true;\n }\n\n return !!(\n config?.compilerOptions?.allowSyntheticDefaultImports ??\n config?.compilerOptions?.esModuleInterop\n );\n};\n","// @ts-expect-error no types exists for this package :(\nimport ibmOpenapiRuleset from '@ibm-cloud/openapi-ruleset';\nimport { Spectral } from '@stoplight/spectral-core';\nimport type { OpenAPIObject } from 'openapi3-ts/oas30';\n\nimport {\n ibmOpenapiValidatorErrors,\n ibmOpenapiValidatorWarnings,\n} from './logger';\n\n/**\n * Validate the spec with ibm-openapi-validator (with a custom pretty logger).\n * More information: https://github.com/IBM/openapi-validator/#configuration\n * @param specs openAPI spec\n */\nexport const ibmOpenapiValidator = async (\n specs: OpenAPIObject,\n validation: boolean | object,\n) => {\n const ruleset =\n typeof validation === 'boolean' ? ibmOpenapiRuleset : validation;\n const spectral = new Spectral();\n spectral.setRuleset(ruleset);\n const results = await spectral.run(\n specs as unknown as Record<string, unknown>,\n );\n\n const errors: { message: string; path: string[] }[] = [];\n const warnings: { message: string; path: string[] }[] = [];\n\n for (const { severity, message, path } of results) {\n const entry = { message, path: path.map((x) => x.toString()) };\n // 0: error, 1: \"warning\", see: https://github.com/IBM/openapi-validator/blob/a93e18a156108b6b946727d0b24bbcc69095b72e/packages/validator/src/spectral/spectral-validator.js#L222\n switch (severity) {\n case 0: {\n errors.push(entry);\n break;\n }\n case 1: {\n warnings.push(entry);\n break;\n }\n }\n }\n\n if (warnings.length > 0) {\n ibmOpenapiValidatorWarnings(warnings);\n }\n\n if (errors.length > 0) {\n ibmOpenapiValidatorErrors(errors);\n throw new Error('Spec validation failed');\n }\n};\n","import { keyword } from 'esutils';\nimport type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { EnumGeneration, NamingConvention } from '../types';\nimport { conventionName, isNumeric, sanitize } from '../utils';\n\nexport const getEnumNames = (schemaObject: SchemaObject | undefined) => {\n return (\n schemaObject?.['x-enumNames'] ||\n schemaObject?.['x-enumnames'] ||\n schemaObject?.['x-enum-varnames']\n );\n};\n\nexport const getEnumDescriptions = (schemaObject: SchemaObject | undefined) => {\n return (\n schemaObject?.['x-enumDescriptions'] ||\n schemaObject?.['x-enumdescriptions'] ||\n schemaObject?.['x-enum-descriptions']\n );\n};\n\nexport const getEnum = (\n value: string,\n enumName: string,\n names: string[] | undefined,\n enumGenerationType: EnumGeneration,\n descriptions?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n if (enumGenerationType === EnumGeneration.CONST)\n return getTypeConstEnum(\n value,\n enumName,\n names,\n descriptions,\n enumNamingConvention,\n );\n if (enumGenerationType === EnumGeneration.ENUM)\n return getNativeEnum(value, enumName, names, enumNamingConvention);\n if (enumGenerationType === EnumGeneration.UNION)\n return getUnion(value, enumName);\n throw new Error(`Invalid enumGenerationType: ${enumGenerationType}`);\n};\n\nconst getTypeConstEnum = (\n value: string,\n enumName: string,\n names?: string[],\n descriptions?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n let enumValue = `export type ${enumName} = typeof ${enumName}[keyof typeof ${enumName}]`;\n\n if (value.endsWith(' | null')) {\n value = value.replace(' | null', '');\n enumValue += ' | null';\n }\n\n enumValue += ';\\n';\n\n const implementation = getEnumImplementation(\n value,\n names,\n descriptions,\n enumNamingConvention,\n );\n\n enumValue += '\\n\\n';\n\n enumValue += '// eslint-disable-next-line @typescript-eslint/no-redeclare\\n';\n\n enumValue += `export const ${enumName} = {\\n${implementation}} as const;\\n`;\n\n return enumValue;\n};\n\nexport const getEnumImplementation = (\n value: string,\n names?: string[],\n descriptions?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n // empty enum or null-only enum\n if (value === '') return '';\n\n return [...new Set(value.split(' | '))].reduce((acc, val, index) => {\n const name = names?.[index];\n const description = descriptions?.[index];\n const comment = description ? ` /** ${description} */\\n` : '';\n\n if (name) {\n return (\n acc +\n comment +\n ` ${keyword.isIdentifierNameES5(name) ? name : `'${name}'`}: ${val},\\n`\n );\n }\n\n let key = val.startsWith(\"'\") ? val.slice(1, -1) : val;\n\n const isNumber = isNumeric(key);\n\n if (isNumber) {\n key = toNumberKey(key);\n }\n\n if (key.length > 1) {\n key = sanitize(key, {\n whitespace: '_',\n underscore: true,\n dash: true,\n special: true,\n });\n }\n\n if (enumNamingConvention) {\n key = conventionName(key, enumNamingConvention);\n }\n\n return (\n acc +\n comment +\n ` ${keyword.isIdentifierNameES5(key) ? key : `'${key}'`}: ${val},\\n`\n );\n }, '');\n};\n\nconst getNativeEnum = (\n value: string,\n enumName: string,\n names?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n const enumItems = getNativeEnumItems(value, names, enumNamingConvention);\n const enumValue = `export enum ${enumName} {\\n${enumItems}\\n}`;\n\n return enumValue;\n};\n\nconst getNativeEnumItems = (\n value: string,\n names?: string[],\n enumNamingConvention?: NamingConvention,\n) => {\n if (value === '') return '';\n\n return [...new Set(value.split(' | '))].reduce((acc, val, index) => {\n const name = names?.[index];\n if (name) {\n return (\n acc +\n ` ${keyword.isIdentifierNameES5(name) ? name : `'${name}'`}= ${val},\\n`\n );\n }\n\n let key = val.startsWith(\"'\") ? val.slice(1, -1) : val;\n\n const isNumber = isNumeric(key);\n\n if (isNumber) {\n key = toNumberKey(key);\n }\n\n if (key.length > 1) {\n key = sanitize(key, {\n whitespace: '_',\n underscore: true,\n dash: true,\n special: true,\n });\n }\n\n if (enumNamingConvention) {\n key = conventionName(key, enumNamingConvention);\n }\n\n return (\n acc +\n ` ${keyword.isIdentifierNameES5(key) ? key : `'${key}'`}= ${val},\\n`\n );\n }, '');\n};\n\nconst toNumberKey = (value: string) => {\n if (value.startsWith('-')) {\n return `NUMBER_MINUS_${value.slice(1)}`;\n }\n if (value.startsWith('+')) {\n return `NUMBER_PLUS_${value.slice(1)}`;\n }\n return `NUMBER_${value}`;\n};\n\nconst getUnion = (value: string, enumName: string) => {\n return `export type ${enumName} = ${value};`;\n};\n","import type { ReferenceObject } from 'openapi3-ts/oas30';\n\nimport type { ContextSpecs, NormalizedOverrideOutput } from '../types';\nimport { getFileInfo, isUrl, pascal, sanitize, upath } from '../utils';\n\ntype RefComponent = 'schemas' | 'responses' | 'parameters' | 'requestBodies';\n\nconst RefComponent = {\n schemas: 'schemas' as RefComponent,\n responses: 'responses' as RefComponent,\n parameters: 'parameters' as RefComponent,\n requestBodies: 'requestBodies' as RefComponent,\n};\n\nexport const RefComponentSuffix: Record<RefComponent, string> = {\n schemas: '',\n responses: 'Response',\n parameters: 'Parameter',\n requestBodies: 'Body',\n};\n\nconst regex = new RegExp('~1', 'g');\n\nconst resolveUrl = (from: string, to: string): string => {\n const resolvedUrl = new URL(to, new URL(from, 'resolve://'));\n if (resolvedUrl.protocol === 'resolve:') {\n // `from` is a relative URL.\n const { pathname, search, hash } = resolvedUrl;\n return pathname + search + hash;\n }\n return resolvedUrl.toString();\n};\n\nexport interface RefInfo {\n name: string;\n originalName: string;\n refPaths?: string[];\n specKey?: string;\n}\n/**\n * Return the output type from the $ref\n *\n * @param $ref\n */\nexport const getRefInfo = (\n $ref: ReferenceObject['$ref'],\n context: ContextSpecs,\n): RefInfo => {\n const [pathname, ref] = $ref.split('#');\n\n const refPaths = ref\n ?.slice(1)\n .split('/')\n .map((part) => decodeURIComponent(part.replaceAll(regex, '/')));\n\n const getOverrideSuffix = (\n override: NormalizedOverrideOutput,\n paths: string[],\n ) => {\n const firstLevel = override[paths[0] as keyof NormalizedOverrideOutput];\n if (!firstLevel) return '';\n\n const secondLevel = (firstLevel as Record<string, { suffix?: string }>)[\n paths[1]\n ];\n return secondLevel?.suffix ?? '';\n };\n\n const suffix = refPaths\n ? getOverrideSuffix(context.output.override, refPaths)\n : '';\n\n const originalName = ref\n ? refPaths[refPaths.length - 1]\n : upath.getSchemaFileName(pathname);\n\n if (!pathname) {\n return {\n name: sanitize(pascal(originalName) + suffix, {\n es5keyword: true,\n es5IdentifierName: true,\n underscore: true,\n dash: true,\n }),\n originalName,\n refPaths,\n };\n }\n\n const path = isUrl(context.specKey)\n ? resolveUrl(context.specKey, pathname)\n : upath.resolve(getFileInfo(context.specKey).dirname, pathname);\n\n return {\n name: sanitize(pascal(originalName) + suffix, {\n es5keyword: true,\n es5IdentifierName: true,\n underscore: true,\n dash: true,\n }),\n originalName,\n specKey: path,\n refPaths,\n };\n};\n","import type {\n ExampleObject,\n ParameterObject,\n ReferenceObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n} from 'openapi3-ts/oas30';\n\nimport { getRefInfo, type RefInfo } from '../getters/ref';\nimport type { ContextSpecs, GeneratorImport } from '../types';\nimport { isReference } from '../utils';\n\ntype ComponentObject =\n | SchemaObject\n | ResponseObject\n | ParameterObject\n | RequestBodyObject\n | ReferenceObject;\nexport const resolveRef = <Schema extends ComponentObject = ComponentObject>(\n schema: ComponentObject,\n context: ContextSpecs,\n imports: GeneratorImport[] = [],\n): {\n schema: Schema;\n imports: GeneratorImport[];\n} => {\n // the schema is referring to another object\n if ((schema as any)?.schema?.$ref) {\n const resolvedRef = resolveRef<Schema>(\n (schema as any)?.schema,\n context,\n imports,\n );\n if ('examples' in schema) {\n schema.examples = resolveExampleRefs(schema.examples, context);\n }\n if ('examples' in resolvedRef.schema) {\n resolvedRef.schema.examples = resolveExampleRefs(\n resolvedRef.schema.examples,\n context,\n );\n }\n return {\n schema: {\n ...schema,\n schema: resolvedRef.schema,\n } as Schema,\n imports,\n };\n }\n\n if (!isReference(schema)) {\n if ('examples' in schema) {\n schema.examples = resolveExampleRefs(schema.examples, context);\n }\n return { schema: schema as Schema, imports };\n }\n\n const {\n currentSchema,\n refInfo: { specKey, name, originalName },\n } = getSchema(schema, context);\n\n if (!currentSchema) {\n throw new Error(`Oops... 🍻. Ref not found: ${schema.$ref}`);\n }\n\n return resolveRef<Schema>(\n currentSchema,\n { ...context, specKey: specKey || context.specKey },\n [...imports, { name, specKey, schemaName: originalName }],\n );\n};\n\nfunction getSchema<Schema extends ComponentObject = ComponentObject>(\n schema: ReferenceObject,\n context: ContextSpecs,\n): {\n refInfo: RefInfo;\n currentSchema: Schema | undefined;\n} {\n const refInfo = getRefInfo(schema.$ref, context);\n\n const { specKey, refPaths } = refInfo;\n\n let schemaByRefPaths: Schema | undefined =\n refPaths && Array.isArray(refPaths)\n ? refPaths.reduce(\n (obj: any, key: string) => (obj && key in obj ? obj[key] : undefined),\n context.specs[specKey || context.specKey],\n )\n : undefined;\n\n if (!schemaByRefPaths) {\n schemaByRefPaths = context.specs?.[\n specKey || context.specKey\n ] as unknown as Schema;\n }\n\n if (isReference(schemaByRefPaths)) {\n return getSchema(schemaByRefPaths, context);\n }\n const currentSchema = schemaByRefPaths\n ? schemaByRefPaths\n : (context.specs[specKey || context.specKey] as unknown as Schema);\n return {\n currentSchema,\n refInfo,\n };\n}\n\ntype Example = ExampleObject | ReferenceObject;\ntype Examples = Example[] | Record<string, Example> | undefined;\nexport const resolveExampleRefs = (\n examples: Examples,\n context: ContextSpecs,\n): Examples => {\n if (!examples) {\n return undefined;\n }\n return Array.isArray(examples)\n ? examples.map((example) => {\n if (isReference(example)) {\n const { schema } = resolveRef<ExampleObject>(example, context);\n return schema.value;\n }\n return example;\n })\n : Object.entries(examples).reduce((acc, [key, example]) => {\n let schema = example;\n if (isReference(example)) {\n schema = resolveRef<ExampleObject>(example, context).schema.value;\n }\n return {\n ...acc,\n [key]: schema,\n };\n }, {});\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getScalar } from '../getters';\nimport { type ContextSpecs, type ResolverValue, SchemaType } from '../types';\nimport { isReference } from '../utils';\nimport { resolveRef } from './ref';\n\nexport const resolveValue = ({\n schema,\n name,\n context,\n}: {\n schema: SchemaObject | ReferenceObject;\n name?: string;\n context: ContextSpecs;\n}): ResolverValue => {\n if (isReference(schema)) {\n const { schema: schemaObject, imports } = resolveRef<SchemaObject>(\n schema,\n context,\n );\n\n const resolvedImport = imports[0];\n\n const importSpecKey =\n resolvedImport.specKey ||\n (context.specKey === context.target ? undefined : context.specKey);\n\n let hasReadonlyProps = false;\n\n // Avoid infinite loop\n if (!name || !context.parents?.includes(name)) {\n const scalar = getScalar({\n item: schemaObject,\n name: resolvedImport.name,\n context: {\n ...context,\n specKey: importSpecKey || context.specKey,\n ...(name ? { parents: [...(context.parents || []), name] } : {}),\n },\n });\n\n hasReadonlyProps = scalar.hasReadonlyProps;\n }\n\n return {\n value: resolvedImport.name,\n imports: [\n {\n name: resolvedImport.name,\n specKey: importSpecKey,\n schemaName: resolvedImport.schemaName,\n },\n ],\n type: (schemaObject?.type as SchemaType) || 'object',\n schemas: [],\n isEnum: !!schemaObject?.enum,\n originalSchema: schemaObject,\n hasReadonlyProps,\n isRef: true,\n };\n }\n\n const scalar = getScalar({ item: schema, name, context });\n\n return {\n ...scalar,\n originalSchema: schema,\n isRef: false,\n };\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getEnum, getEnumDescriptions, getEnumNames } from '../getters/enum';\nimport type { ContextSpecs, ResolverValue } from '../types';\nimport { jsDoc } from '../utils';\nimport { resolveValue } from './value';\n\nconst resolveObjectOriginal = ({\n schema,\n propName,\n combined = false,\n context,\n}: {\n schema: SchemaObject | ReferenceObject;\n propName?: string;\n combined?: boolean;\n context: ContextSpecs;\n}): ResolverValue => {\n const resolvedValue = resolveValue({\n schema,\n name: propName,\n context,\n });\n const doc = jsDoc(resolvedValue.originalSchema ?? {});\n\n if (\n propName &&\n !resolvedValue.isEnum &&\n resolvedValue?.type === 'object' &&\n new RegExp(/{|&|\\|/).test(resolvedValue.value)\n ) {\n let model = '';\n const isConstant = 'const' in schema;\n const constantIsString =\n 'type' in schema &&\n (schema.type === 'string' ||\n (Array.isArray(schema.type) && schema.type.includes('string')));\n\n model += isConstant\n ? `${doc}export const ${propName} = ${constantIsString ? `'${schema.const}'` : schema.const} as const;\\n`\n : `${doc}export type ${propName} = ${resolvedValue.value};\\n`;\n\n return {\n value: propName,\n imports: [{ name: propName, isConstant }],\n schemas: [\n ...resolvedValue.schemas,\n {\n name: propName,\n model,\n imports: resolvedValue.imports,\n },\n ],\n isEnum: false,\n type: 'object',\n originalSchema: resolvedValue.originalSchema,\n isRef: resolvedValue.isRef,\n hasReadonlyProps: resolvedValue.hasReadonlyProps,\n };\n }\n\n if (propName && resolvedValue.isEnum && !combined && !resolvedValue.isRef) {\n const enumValue = getEnum(\n resolvedValue.value,\n propName,\n getEnumNames(resolvedValue.originalSchema),\n context.output.override.enumGenerationType,\n getEnumDescriptions(resolvedValue.originalSchema),\n context.output.override.namingConvention?.enum,\n );\n\n return {\n value: propName,\n imports: [{ name: propName }],\n schemas: [\n ...resolvedValue.schemas,\n {\n name: propName,\n model: doc + enumValue,\n imports: resolvedValue.imports,\n },\n ],\n isEnum: false,\n type: 'enum',\n originalSchema: resolvedValue.originalSchema,\n isRef: resolvedValue.isRef,\n hasReadonlyProps: resolvedValue.hasReadonlyProps,\n };\n }\n\n return resolvedValue;\n};\n\nconst resolveObjectCacheMap = new Map<string, ResolverValue>();\n\nexport const resolveObject = ({\n schema,\n propName,\n combined = false,\n context,\n}: {\n schema: SchemaObject | ReferenceObject;\n propName?: string;\n combined?: boolean;\n context: ContextSpecs;\n}): ResolverValue => {\n const hashKey = JSON.stringify({\n schema,\n propName,\n combined,\n specKey: context.specKey,\n });\n\n if (resolveObjectCacheMap.has(hashKey)) {\n return resolveObjectCacheMap.get(hashKey)!;\n }\n\n const result = resolveObjectOriginal({\n schema,\n propName,\n combined,\n context,\n });\n\n resolveObjectCacheMap.set(hashKey, result);\n\n return result;\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\nimport type { SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';\n\nimport { resolveExampleRefs } from '../resolvers';\nimport { resolveObject } from '../resolvers/object';\nimport type { ContextSpecs, ScalarValue } from '../types';\nimport { compareVersions } from '../utils';\n\n/**\n * Return the output type from an array\n *\n * @param item item with type === \"array\"\n */\nexport const getArray = ({\n schema,\n name,\n context,\n}: {\n schema: SchemaObject;\n name?: string;\n context: ContextSpecs;\n}): ScalarValue => {\n const schema31 = schema as SchemaObject31;\n if (schema31.prefixItems) {\n const resolvedObjects = schema31.prefixItems.map((item, index) =>\n resolveObject({\n schema: item as SchemaObject | ReferenceObject,\n propName:\n name + context.output.override.components.schemas.itemSuffix + index,\n context,\n }),\n );\n if (schema31.items) {\n const additional = resolveObject({\n schema: schema31.items as SchemaObject | ReferenceObject,\n propName:\n name +\n context.output.override.components.schemas.itemSuffix +\n 'Additional',\n context,\n });\n resolvedObjects.push({\n ...additional,\n value: `...${additional.value}[]`,\n });\n }\n return {\n type: 'array',\n isEnum: false,\n isRef: false,\n value: `[${resolvedObjects.map((o) => o.value).join(', ')}]`,\n imports: resolvedObjects.flatMap((o) => o.imports),\n schemas: resolvedObjects.flatMap((o) => o.schemas),\n hasReadonlyProps: resolvedObjects.some((o) => o.hasReadonlyProps),\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n }\n if (schema.items) {\n const resolvedObject = resolveObject({\n schema: schema.items,\n propName: name + context.output.override.components.schemas.itemSuffix,\n context,\n });\n return {\n value: `${\n schema.readOnly === true &&\n !context.output.override.suppressReadonlyModifier\n ? 'readonly '\n : ''\n }${\n resolvedObject.value.includes('|')\n ? `(${resolvedObject.value})[]`\n : `${resolvedObject.value}[]`\n }`,\n imports: resolvedObject.imports,\n schemas: resolvedObject.schemas,\n isEnum: false,\n type: 'array',\n isRef: false,\n hasReadonlyProps: resolvedObject.hasReadonlyProps,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n } else if (\n compareVersions(context.specs[context.specKey].openapi, '3.1', '>=')\n ) {\n return {\n value: 'unknown[]',\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'array',\n isRef: false,\n hasReadonlyProps: false,\n };\n } else {\n throw new Error(\n `All arrays must have an \\`items\\` key defined (name=${name}, schema=${JSON.stringify(schema)})`,\n );\n }\n};\n","import { keyword } from 'esutils';\nimport type { ValueIteratee } from 'lodash';\nimport uniqBy from 'lodash.uniqby';\nimport type {\n MediaTypeObject,\n ReferenceObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n} from 'openapi3-ts/oas30';\n\nimport { resolveObject } from '../resolvers/object';\nimport { resolveExampleRefs, resolveRef } from '../resolvers/ref';\nimport {\n type ContextSpecs,\n FormDataArrayHandling,\n type GeneratorImport,\n type ResReqTypesValue,\n} from '../types';\nimport { camel } from '../utils';\nimport { isReference } from '../utils/assertion';\nimport { pascal } from '../utils/case';\nimport { getNumberWord } from '../utils/string';\n\nconst formDataContentTypes = new Set(['multipart/form-data']);\n\nconst formUrlEncodedContentTypes = new Set([\n 'application/x-www-form-urlencoded',\n]);\n\nconst getResReqContentTypes = ({\n mediaType,\n propName,\n context,\n}: {\n mediaType: MediaTypeObject;\n propName?: string;\n context: ContextSpecs;\n}) => {\n if (!mediaType.schema) {\n return;\n }\n\n const resolvedObject = resolveObject({\n schema: mediaType.schema,\n propName,\n context,\n });\n\n return resolvedObject;\n};\n\nexport const getResReqTypes = (\n responsesOrRequests: [\n string,\n ResponseObject | ReferenceObject | RequestBodyObject,\n ][],\n name: string,\n context: ContextSpecs,\n defaultType = 'unknown',\n uniqueKey: ValueIteratee<ResReqTypesValue> = 'value',\n): ResReqTypesValue[] => {\n const typesArray = responsesOrRequests\n .filter(([_, res]) => Boolean(res))\n .map(([key, res]) => {\n if (isReference(res)) {\n const {\n schema: bodySchema,\n imports: [{ name, specKey, schemaName }],\n } = resolveRef<RequestBodyObject | ResponseObject>(res, context);\n\n const [contentType, mediaType] =\n Object.entries(bodySchema.content ?? {})[0] ?? [];\n\n const isFormData = formDataContentTypes.has(contentType);\n const isFormUrlEncoded = formUrlEncodedContentTypes.has(contentType);\n\n if ((!isFormData && !isFormUrlEncoded) || !mediaType?.schema) {\n return [\n {\n value: name,\n imports: [{ name, specKey, schemaName }],\n schemas: [],\n type: 'unknown',\n isEnum: false,\n isRef: true,\n hasReadonlyProps: false,\n originalSchema: mediaType?.schema,\n example: mediaType?.example,\n examples: resolveExampleRefs(mediaType?.examples, context),\n key,\n contentType,\n },\n ] as ResReqTypesValue[];\n }\n\n const formData = isFormData\n ? getSchemaFormDataAndUrlEncoded({\n name,\n schemaObject: mediaType?.schema,\n context: {\n ...context,\n specKey: specKey || context.specKey,\n },\n isRequestBodyOptional:\n // Even though required is false by default, we only consider required to be false if specified. (See pull 1277)\n 'required' in bodySchema && bodySchema.required === false,\n isRef: true,\n })\n : undefined;\n\n const formUrlEncoded = isFormUrlEncoded\n ? getSchemaFormDataAndUrlEncoded({\n name,\n schemaObject: mediaType?.schema,\n context: {\n ...context,\n specKey: specKey || context.specKey,\n },\n isRequestBodyOptional:\n 'required' in bodySchema && bodySchema.required === false,\n isUrlEncoded: true,\n isRef: true,\n })\n : undefined;\n\n const additionalImports = getFormDataAdditionalImports({\n schemaObject: mediaType?.schema,\n context: {\n ...context,\n specKey: specKey || context.specKey,\n },\n });\n\n return [\n {\n value: name,\n imports: [{ name, specKey, schemaName }, ...additionalImports],\n schemas: [],\n type: 'unknown',\n isEnum: false,\n hasReadonlyProps: false,\n formData,\n formUrlEncoded,\n isRef: true,\n originalSchema: mediaType?.schema,\n example: mediaType.example,\n examples: resolveExampleRefs(mediaType.examples, context),\n key,\n contentType,\n },\n ] as ResReqTypesValue[];\n }\n\n if (res.content) {\n const contents = Object.entries(res.content).map(\n ([contentType, mediaType], index, arr) => {\n let propName = key ? pascal(name) + pascal(key) : undefined;\n\n if (propName && arr.length > 1) {\n propName = propName + pascal(getNumberWord(index + 1));\n }\n\n const resolvedValue = getResReqContentTypes({\n mediaType,\n propName,\n context,\n });\n\n if (!resolvedValue) {\n return;\n }\n\n const isFormData = formDataContentTypes.has(contentType);\n const isFormUrlEncoded =\n formUrlEncodedContentTypes.has(contentType);\n\n if ((!isFormData && !isFormUrlEncoded) || !propName) {\n return {\n ...resolvedValue,\n imports: resolvedValue.imports,\n contentType,\n example: mediaType.example,\n examples: resolveExampleRefs(mediaType.examples, context),\n };\n }\n\n const formData = isFormData\n ? getSchemaFormDataAndUrlEncoded({\n name: propName,\n schemaObject: mediaType.schema!,\n context,\n isRequestBodyOptional:\n 'required' in res && res.required === false,\n })\n : undefined;\n\n const formUrlEncoded = isFormUrlEncoded\n ? getSchemaFormDataAndUrlEncoded({\n name: propName,\n schemaObject: mediaType.schema!,\n context,\n isUrlEncoded: true,\n isRequestBodyOptional:\n 'required' in res && res.required === false,\n })\n : undefined;\n\n const additionalImports = getFormDataAdditionalImports({\n schemaObject: mediaType.schema!,\n context,\n });\n return {\n ...resolvedValue,\n imports: [...resolvedValue.imports, ...additionalImports],\n formData,\n formUrlEncoded,\n contentType,\n example: mediaType.example,\n examples: resolveExampleRefs(mediaType.examples, context),\n };\n },\n );\n\n return contents\n .filter(Boolean)\n .map((x) => ({ ...x, key })) as ResReqTypesValue[];\n }\n\n return [\n {\n value: defaultType,\n imports: [],\n schemas: [],\n type: defaultType,\n isEnum: false,\n key,\n isRef: false,\n hasReadonlyProps: false,\n contentType: 'application/json',\n },\n ] as ResReqTypesValue[];\n });\n\n return uniqBy(typesArray.flat(), uniqueKey);\n};\n\nconst getFormDataAdditionalImports = ({\n schemaObject,\n context,\n}: {\n schemaObject: SchemaObject | ReferenceObject;\n context: ContextSpecs;\n}): GeneratorImport[] => {\n const { schema } = resolveRef<SchemaObject>(schemaObject, context);\n\n if (schema.type !== 'object') {\n return [];\n }\n\n const combinedSchemas = schema.oneOf || schema.anyOf;\n\n if (!combinedSchemas) {\n return [];\n }\n\n return combinedSchemas\n .map((schema) => resolveRef<SchemaObject>(schema, context).imports[0])\n .filter(Boolean);\n};\n\nconst getSchemaFormDataAndUrlEncoded = ({\n name,\n schemaObject,\n context,\n isRequestBodyOptional,\n isUrlEncoded,\n isRef,\n}: {\n name: string;\n schemaObject: SchemaObject | ReferenceObject;\n context: ContextSpecs;\n isRequestBodyOptional: boolean;\n isUrlEncoded?: boolean;\n isRef?: boolean;\n}): string => {\n const { schema, imports } = resolveRef<SchemaObject>(schemaObject, context);\n const propName = camel(\n !isRef && isReference(schemaObject) ? imports[0].name : name,\n );\n const additionalImports: GeneratorImport[] = [];\n\n const variableName = isUrlEncoded ? 'formUrlEncoded' : 'formData';\n let form = isUrlEncoded\n ? `const ${variableName} = new URLSearchParams();\\n`\n : `const ${variableName} = new FormData();\\n`;\n\n const combinedSchemas = schema.oneOf || schema.anyOf || schema.allOf;\n if (\n schema.type === 'object' ||\n (schema.type === undefined && combinedSchemas)\n ) {\n if (combinedSchemas) {\n const shouldCast = !!schema.oneOf || !!schema.anyOf;\n\n const combinedSchemasFormData = combinedSchemas!\n .map((schema) => {\n const { schema: combinedSchema, imports } = resolveRef<SchemaObject>(\n schema,\n context,\n );\n\n let newPropName = propName;\n let newPropDefinition = '';\n\n // If the schema is a union type (oneOf, anyOf) and includes a reference (has imports),\n // we need to cast the property to the specific type to avoid TypeScript errors.\n if (shouldCast && imports[0]) {\n additionalImports.push(imports[0]);\n newPropName = `${propName}${pascal(imports[0].name)}`;\n newPropDefinition = `const ${newPropName} = (${propName} as ${imports[0].name}${isRequestBodyOptional ? ' | undefined' : ''});\\n`;\n }\n\n return (\n newPropDefinition +\n resolveSchemaPropertiesToFormData({\n schema: combinedSchema,\n variableName,\n propName: newPropName,\n context,\n isRequestBodyOptional,\n })\n );\n })\n .filter(Boolean)\n .join('\\n');\n\n form += combinedSchemasFormData;\n }\n\n if (schema.properties) {\n const formDataValues = resolveSchemaPropertiesToFormData({\n schema,\n variableName,\n propName,\n context,\n isRequestBodyOptional,\n });\n\n form += formDataValues;\n }\n\n return form;\n }\n\n if (schema.type === 'array') {\n let valueStr = 'value';\n if (schema.items) {\n const { schema: itemSchema } = resolveRef<SchemaObject>(\n schema.items,\n context,\n );\n if (itemSchema.type === 'object' || itemSchema.type === 'array') {\n valueStr = 'JSON.stringify(value)';\n } else if (\n itemSchema.type === 'number' ||\n itemSchema.type === 'integer' ||\n itemSchema.type === 'boolean'\n ) {\n valueStr = 'value.toString()';\n }\n }\n\n return `${form}${propName}.forEach(value => ${variableName}.append('data', ${valueStr}))\\n`;\n }\n\n if (\n schema.type === 'number' ||\n schema.type === 'integer' ||\n schema.type === 'boolean'\n ) {\n return `${form}${variableName}.append('data', ${propName}.toString())\\n`;\n }\n\n return `${form}${variableName}.append('data', ${propName})\\n`;\n};\n\nconst resolveSchemaPropertiesToFormData = ({\n schema,\n variableName,\n propName,\n context,\n isRequestBodyOptional,\n keyPrefix = '',\n depth = 0,\n}: {\n schema: SchemaObject;\n variableName: string;\n propName: string;\n context: ContextSpecs;\n isRequestBodyOptional: boolean;\n keyPrefix?: string;\n depth?: number;\n}) => {\n const formDataValues = Object.entries(schema.properties ?? {}).reduce(\n (acc, [key, value]) => {\n const { schema: property } = resolveRef<SchemaObject>(value, context);\n\n // Skip readOnly properties for formData\n if (property.readOnly) {\n return acc;\n }\n\n let formDataValue = '';\n\n const formattedKeyPrefix = isRequestBodyOptional\n ? keyword.isIdentifierNameES5(key)\n ? '?'\n : '?.'\n : '';\n const formattedKey = keyword.isIdentifierNameES5(key)\n ? `.${key}`\n : `['${key}']`;\n\n const valueKey = `${propName}${formattedKeyPrefix}${formattedKey}`;\n const nonOptionalValueKey = `${propName}${formattedKey}`;\n\n if (property.type === 'object') {\n formDataValue =\n context.output.override.formData.arrayHandling ===\n FormDataArrayHandling.EXPLODE\n ? resolveSchemaPropertiesToFormData({\n schema: property,\n variableName,\n propName: nonOptionalValueKey,\n context,\n isRequestBodyOptional,\n keyPrefix: `${keyPrefix}${key}.`,\n depth: depth + 1,\n })\n : `${variableName}.append(\\`${keyPrefix}${key}\\`, JSON.stringify(${nonOptionalValueKey}));\\n`;\n } else if (property.type === 'array') {\n let valueStr = 'value';\n let hasNonPrimitiveChild = false;\n if (property.items) {\n const { schema: itemSchema } = resolveRef<SchemaObject>(\n property.items,\n context,\n );\n if (itemSchema.type === 'object' || itemSchema.type === 'array') {\n if (\n context.output.override.formData.arrayHandling ===\n FormDataArrayHandling.EXPLODE\n ) {\n hasNonPrimitiveChild = true;\n const resolvedValue = resolveSchemaPropertiesToFormData({\n schema: itemSchema,\n variableName,\n propName: 'value',\n context,\n isRequestBodyOptional,\n keyPrefix: `${keyPrefix}${key}[\\${index${depth > 0 ? depth : ''}}].`,\n depth: depth + 1,\n });\n formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ''}) => {\n ${resolvedValue}});\\n`;\n } else {\n valueStr = 'JSON.stringify(value)';\n }\n } else if (\n itemSchema.type === 'number' ||\n itemSchema.type?.includes('number') ||\n itemSchema.type === 'integer' ||\n itemSchema.type?.includes('integer') ||\n itemSchema.type === 'boolean' ||\n itemSchema.type?.includes('boolean')\n ) {\n valueStr = 'value.toString()';\n }\n }\n if (\n context.output.override.formData.arrayHandling ===\n FormDataArrayHandling.EXPLODE\n ) {\n if (!hasNonPrimitiveChild) {\n formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ''}) => ${variableName}.append(\\`${keyPrefix}${key}[\\${index${depth > 0 ? depth : ''}}]\\`, ${valueStr}));\\n`;\n }\n } else {\n formDataValue = `${valueKey}.forEach(value => ${variableName}.append(\\`${keyPrefix}${key}${context.output.override.formData.arrayHandling === FormDataArrayHandling.SERIALIZE_WITH_BRACKETS ? '[]' : ''}\\`, ${valueStr}));\\n`;\n }\n } else if (\n property.type === 'number' ||\n property.type?.includes('number') ||\n property.type === 'integer' ||\n property.type?.includes('integer') ||\n property.type === 'boolean' ||\n property.type?.includes('boolean')\n ) {\n formDataValue = `${variableName}.append(\\`${keyPrefix}${key}\\`, ${nonOptionalValueKey}.toString())\\n`;\n } else {\n formDataValue = `${variableName}.append(\\`${keyPrefix}${key}\\`, ${nonOptionalValueKey})\\n`;\n }\n\n let existSubSchemaNullable = false;\n if (property.allOf || property.anyOf || property.oneOf) {\n const combine = property.allOf || property.anyOf || property.oneOf;\n const subSchemas = combine?.map((c) =>\n resolveObject({ schema: c, combined: true, context: context }),\n );\n if (\n subSchemas?.some((subSchema) => {\n return ['number', 'integer', 'boolean'].includes(subSchema.type);\n })\n ) {\n formDataValue = `${variableName}.append(\\`${key}\\`, ${nonOptionalValueKey}.toString())\\n`;\n }\n\n if (\n subSchemas?.some((subSchema) => {\n return subSchema.type === 'null';\n })\n ) {\n existSubSchemaNullable = true;\n }\n }\n\n const isRequired =\n schema.required?.includes(key) && !isRequestBodyOptional;\n\n if (\n property.nullable ||\n property.type?.includes('null') ||\n existSubSchemaNullable\n ) {\n if (isRequired) {\n return acc + `if(${valueKey} !== null) {\\n ${formDataValue} }\\n`;\n }\n\n return (\n acc +\n `if(${valueKey} !== undefined && ${nonOptionalValueKey} !== null) {\\n ${formDataValue} }\\n`\n );\n }\n\n if (isRequired) {\n return acc + formDataValue;\n }\n\n return acc + `if(${valueKey} !== undefined) {\\n ${formDataValue} }\\n`;\n },\n '',\n );\n\n return formDataValues;\n};\n","import type { ReferenceObject, RequestBodyObject } from 'openapi3-ts/oas30';\n\nimport { generalJSTypesWithArray } from '../constants';\nimport { resolveRef } from '../resolvers';\nimport type {\n ContextSpecs,\n GetterBody,\n OverrideOutputContentType,\n} from '../types';\nimport { camel, isReference, sanitize } from '../utils';\nimport { getResReqTypes } from './res-req-types';\n\nexport const getBody = ({\n requestBody,\n operationName,\n context,\n contentType,\n}: {\n requestBody: ReferenceObject | RequestBodyObject;\n operationName: string;\n context: ContextSpecs;\n contentType?: OverrideOutputContentType;\n}): GetterBody => {\n const allBodyTypes = getResReqTypes(\n [[context.output.override.components.requestBodies.suffix, requestBody]],\n operationName,\n context,\n );\n\n const filteredBodyTypes = contentType\n ? allBodyTypes.filter((type) => {\n let include = true;\n let exclude = false;\n\n if (contentType.include) {\n include = contentType.include.includes(type.contentType);\n }\n\n if (contentType.exclude) {\n exclude = contentType.exclude.includes(type.contentType);\n }\n\n return include && !exclude;\n })\n : allBodyTypes;\n\n const imports = filteredBodyTypes.flatMap(({ imports }) => imports);\n const schemas = filteredBodyTypes.flatMap(({ schemas }) => schemas);\n\n const definition = filteredBodyTypes.map(({ value }) => value).join(' | ');\n const hasReadonlyProps = filteredBodyTypes.some((x) => x.hasReadonlyProps);\n const nonReadonlyDefinition =\n hasReadonlyProps && definition ? `NonReadonly<${definition}>` : definition;\n\n let implementation =\n generalJSTypesWithArray.includes(definition.toLowerCase()) ||\n filteredBodyTypes.length > 1\n ? camel(operationName) +\n context.output.override.components.requestBodies.suffix\n : camel(definition);\n\n let isOptional = false;\n if (implementation) {\n implementation = sanitize(implementation, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n if (isReference(requestBody)) {\n const { schema: bodySchema } = resolveRef<RequestBodyObject>(\n requestBody,\n context,\n );\n if (bodySchema.required !== undefined) {\n isOptional = !bodySchema.required;\n }\n } else if (requestBody.required !== undefined) {\n isOptional = !requestBody.required;\n }\n }\n\n return {\n originalSchema: requestBody,\n definition: nonReadonlyDefinition,\n implementation,\n imports,\n schemas,\n isOptional,\n ...(filteredBodyTypes.length === 1\n ? {\n formData: filteredBodyTypes[0].formData,\n formUrlEncoded: filteredBodyTypes[0].formUrlEncoded,\n contentType: filteredBodyTypes[0].contentType,\n }\n : {\n formData: '',\n formUrlEncoded: '',\n contentType: '',\n }),\n };\n};\n","import type { ContextSpecs, GeneratorImport, ResolverValue } from '../types';\nimport { pascal } from '../utils';\nimport { getSpecName } from '../utils/path';\n\nexport const getAliasedImports = ({\n name,\n resolvedValue,\n existingImports,\n context,\n}: {\n name?: string;\n resolvedValue: ResolverValue;\n existingImports: GeneratorImport[];\n context: ContextSpecs;\n}): GeneratorImport[] =>\n context.output.schemas && resolvedValue.isRef\n ? resolvedValue.imports.map((imp) => {\n if (\n !needCreateImportAlias({\n name,\n imp,\n existingImports,\n })\n ) {\n return imp;\n }\n\n const specName = pascal(\n getSpecName(imp.specKey ?? '', context.specKey),\n );\n\n // for spec starts from digit\n const normalizedSpecName = /^\\d/.test(specName)\n ? `__${specName}`\n : specName;\n\n return {\n ...imp,\n alias: `${normalizedSpecName}__${imp.name}`,\n };\n })\n : resolvedValue.imports;\n\nexport const needCreateImportAlias = ({\n existingImports,\n imp,\n name,\n}: {\n name?: string;\n imp: GeneratorImport;\n existingImports: GeneratorImport[];\n}): boolean =>\n !imp.alias &&\n // !!imp.specKey &&\n (imp.name === name ||\n existingImports.some(\n (existingImport) =>\n imp.name === existingImport.name &&\n imp.specKey !== existingImport.specKey,\n ));\n\nexport const getImportAliasForRefOrValue = ({\n context,\n imports,\n resolvedValue,\n}: {\n resolvedValue: ResolverValue;\n imports: GeneratorImport[];\n context: ContextSpecs;\n}): string => {\n if (!context.output.schemas || !resolvedValue.isRef) {\n return resolvedValue.value;\n }\n const importWithSameName = imports.find(\n (imp) => imp.name === resolvedValue.value,\n );\n return importWithSameName?.alias ?? resolvedValue.value;\n};\n","import { keyword } from 'esutils';\n\nexport const getKey = (key: string) => {\n return keyword.isIdentifierNameES5(key) ? key : `'${key}'`;\n};\n","import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveExampleRefs, resolveValue } from '../resolvers';\nimport { resolveObject } from '../resolvers/object';\nimport {\n type ContextSpecs,\n PropertySortOrder,\n type ScalarValue,\n SchemaType,\n type SchemaWithConst,\n} from '../types';\nimport { isBoolean, isReference, jsDoc, pascal } from '../utils';\nimport { combineSchemas } from './combine';\nimport { getAliasedImports, getImportAliasForRefOrValue } from './imports';\nimport { getKey } from './keys';\nimport { getRefInfo } from './ref';\n\n/**\n * Return the output type from an object\n *\n * @param item item with type === \"object\"\n */\nexport const getObject = ({\n item,\n name,\n context,\n nullable,\n}: {\n item: SchemaObject;\n name?: string;\n context: ContextSpecs;\n nullable: string;\n}): ScalarValue => {\n if (isReference(item)) {\n const { name, specKey } = getRefInfo(item.$ref, context);\n return {\n value: name + nullable,\n imports: [{ name, specKey }],\n schemas: [],\n isEnum: false,\n type: 'object',\n isRef: true,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n if (item.allOf || item.oneOf || item.anyOf) {\n const separator = item.allOf ? 'allOf' : item.oneOf ? 'oneOf' : 'anyOf';\n\n return combineSchemas({\n schema: item,\n name,\n separator,\n context,\n nullable,\n });\n }\n\n if (Array.isArray(item.type)) {\n return combineSchemas({\n schema: {\n anyOf: item.type.map((type) => ({\n ...item,\n type,\n })),\n },\n name,\n separator: 'anyOf',\n context,\n nullable,\n });\n }\n\n if (item.properties && Object.entries(item.properties).length > 0) {\n const entries = Object.entries(item.properties);\n if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n entries.sort((a, b) => {\n return a[0].localeCompare(b[0]);\n });\n }\n return entries.reduce(\n (\n acc,\n [key, schema]: [string, ReferenceObject | SchemaObject],\n index,\n arr,\n ) => {\n const isRequired = (\n Array.isArray(item.required) ? item.required : []\n ).includes(key);\n\n let propName = '';\n\n if (name) {\n const isKeyStartWithUnderscore = key.startsWith('_');\n\n propName += pascal(\n `${isKeyStartWithUnderscore ? '_' : ''}${name}_${key}`,\n );\n }\n\n const allSpecSchemas =\n context.specs[context.target]?.components?.schemas ?? {};\n\n const isNameAlreadyTaken = Object.keys(allSpecSchemas).some(\n (schemaName) => pascal(schemaName) === propName,\n );\n\n if (isNameAlreadyTaken) {\n propName = propName + 'Property';\n }\n\n const resolvedValue = resolveObject({\n schema,\n propName,\n context,\n });\n\n const isReadOnly = item.readOnly || (schema as SchemaObject).readOnly;\n if (!index) {\n acc.value += '{';\n }\n\n const doc = jsDoc(schema as SchemaObject, true, context);\n\n acc.hasReadonlyProps ||= isReadOnly || false;\n\n const aliasedImports = getAliasedImports({\n name,\n context,\n resolvedValue,\n existingImports: acc.imports,\n });\n\n acc.imports.push(...aliasedImports);\n\n const propValue = getImportAliasForRefOrValue({\n context,\n resolvedValue,\n imports: aliasedImports,\n });\n\n acc.value += `\\n ${doc ? `${doc} ` : ''}${\n isReadOnly && !context.output.override.suppressReadonlyModifier\n ? 'readonly '\n : ''\n }${getKey(key)}${isRequired ? '' : '?'}: ${propValue};`;\n acc.schemas.push(...resolvedValue.schemas);\n\n if (arr.length - 1 === index) {\n if (item.additionalProperties) {\n if (isBoolean(item.additionalProperties)) {\n acc.value += `\\n [key: string]: unknown;\\n }`;\n } else {\n const resolvedValue = resolveValue({\n schema: item.additionalProperties,\n name,\n context,\n });\n acc.value += `\\n [key: string]: ${resolvedValue.value};\\n}`;\n }\n } else {\n acc.value += '\\n}';\n }\n\n acc.value += nullable;\n }\n\n return acc;\n },\n {\n imports: [],\n schemas: [],\n value: '',\n isEnum: false,\n type: 'object' as SchemaType,\n isRef: false,\n schema: {},\n hasReadonlyProps: false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n } as ScalarValue,\n );\n }\n\n if (item.additionalProperties) {\n if (isBoolean(item.additionalProperties)) {\n return {\n value: `{ [key: string]: unknown }` + nullable,\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'object',\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n }\n const resolvedValue = resolveValue({\n schema: item.additionalProperties,\n name,\n context,\n });\n return {\n value: `{[key: string]: ${resolvedValue.value}}` + nullable,\n imports: resolvedValue.imports ?? [],\n schemas: resolvedValue.schemas ?? [],\n isEnum: false,\n type: 'object',\n isRef: false,\n hasReadonlyProps: resolvedValue.hasReadonlyProps,\n };\n }\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const) {\n return {\n value: `'${itemWithConst.const}'` + nullable,\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'string',\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n }\n\n return {\n value:\n (item.type === 'object' ? '{ [key: string]: unknown }' : 'unknown') +\n nullable,\n imports: [],\n schemas: [],\n isEnum: false,\n type: 'object',\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n};\n","import type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveExampleRefs } from '../resolvers';\nimport type { ContextSpecs, ScalarValue, SchemaWithConst } from '../types';\nimport { escape, isString } from '../utils';\nimport { getArray } from './array';\nimport { combineSchemas } from './combine';\nimport { getObject } from './object';\n\n/**\n * Return the typescript equivalent of open-api data type\n *\n * @param item\n * @ref https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types\n */\nexport const getScalar = ({\n item,\n name,\n context,\n}: {\n item: SchemaObject;\n name?: string;\n context: ContextSpecs;\n}): ScalarValue => {\n const nullable = item.nullable ? ' | null' : '';\n\n const enumItems = item.enum?.filter((enumItem) => enumItem !== null);\n\n if (!item.type && item.items) {\n item.type = 'array';\n }\n\n switch (item.type) {\n case 'number':\n case 'integer': {\n let value =\n context.output.override.useBigInt &&\n (item.format === 'int64' || item.format === 'uint64')\n ? 'bigint'\n : 'number';\n let isEnum = false;\n\n if (enumItems) {\n value = enumItems\n .map((enumItem: number | null) => `${enumItem}`)\n .join(' | ');\n isEnum = true;\n }\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const !== undefined) {\n value = itemWithConst.const;\n }\n\n return {\n value: value + nullable,\n isEnum,\n type: 'number',\n schemas: [],\n imports: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n case 'boolean': {\n let value = 'boolean';\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const !== undefined) {\n value = itemWithConst.const;\n }\n\n return {\n value: value + nullable,\n type: 'boolean',\n isEnum: false,\n schemas: [],\n imports: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n case 'array': {\n const { value, ...rest } = getArray({\n schema: item,\n name,\n context,\n });\n return {\n value: value + nullable,\n ...rest,\n };\n }\n\n case 'string': {\n let value = 'string';\n let isEnum = false;\n\n if (enumItems) {\n value = enumItems\n .map((enumItem: string | null) =>\n isString(enumItem) ? `'${escape(enumItem)}'` : `${enumItem}`,\n )\n .filter(Boolean)\n .join(` | `);\n\n isEnum = true;\n }\n\n if (item.format === 'binary') {\n value = 'Blob';\n }\n\n if (\n context.output.override.useDates &&\n (item.format === 'date' || item.format === 'date-time')\n ) {\n value = 'Date';\n }\n\n const itemWithConst = item as SchemaWithConst;\n if (itemWithConst.const) {\n value = `'${itemWithConst.const}'`;\n }\n\n return {\n value: value + nullable,\n isEnum,\n type: 'string',\n imports: [],\n schemas: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n case 'null': {\n return {\n value: 'null',\n isEnum: false,\n type: 'null',\n imports: [],\n schemas: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n };\n }\n\n case 'object':\n default: {\n if (Array.isArray(item.type)) {\n return combineSchemas({\n schema: {\n anyOf: item.type.map((type) => ({\n ...item,\n type,\n })),\n },\n name,\n separator: 'anyOf',\n context,\n nullable,\n });\n }\n\n if (enumItems) {\n const value = enumItems\n .map((enumItem: unknown) =>\n isString(enumItem) ? `'${escape(enumItem)}'` : `${enumItem}`,\n )\n .filter(Boolean)\n .join(` | `);\n\n return {\n value: value + nullable,\n isEnum: true,\n type: 'string',\n imports: [],\n schemas: [],\n isRef: false,\n hasReadonlyProps: item.readOnly || false,\n example: item.example,\n examples: resolveExampleRefs(item.examples, context),\n };\n }\n\n const { value, ...rest } = getObject({\n item,\n name,\n context,\n nullable,\n });\n return { value: value, ...rest };\n }\n }\n};\n","import uniq from 'lodash.uniq';\nimport type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveExampleRefs, resolveObject } from '../resolvers';\nimport {\n type ContextSpecs,\n type GeneratorImport,\n type GeneratorSchema,\n type ScalarValue,\n SchemaType,\n} from '../types';\nimport { getNumberWord, isSchema, pascal } from '../utils';\nimport {\n getEnumDescriptions,\n getEnumImplementation,\n getEnumNames,\n} from './enum';\nimport { getAliasedImports, getImportAliasForRefOrValue } from './imports';\nimport { getScalar } from './scalar';\n\ntype CombinedData = {\n imports: GeneratorImport[];\n schemas: GeneratorSchema[];\n originalSchema: (SchemaObject | undefined)[];\n values: string[];\n isRef: boolean[];\n isEnum: boolean[];\n types: string[];\n hasReadonlyProps: boolean;\n /**\n * List of all properties in all subschemas\n * - used to add missing properties in subschemas to avoid TS error described in @see https://github.com/orval-labs/orval/issues/935\n */\n allProperties: string[];\n requiredProperties: string[];\n};\n\ntype Separator = 'allOf' | 'anyOf' | 'oneOf';\n\nconst combineValues = ({\n resolvedData,\n resolvedValue,\n separator,\n context,\n}: {\n resolvedData: CombinedData;\n resolvedValue?: ScalarValue;\n separator: Separator;\n context: ContextSpecs;\n}) => {\n const isAllEnums = resolvedData.isEnum.every(Boolean);\n\n if (isAllEnums) {\n return `${resolvedData.values.join(` | `)}${\n resolvedValue ? ` | ${resolvedValue.value}` : ''\n }`;\n }\n\n if (separator === 'allOf') {\n let resolvedDataValue = resolvedData.values.join(` & `);\n if (resolvedData.originalSchema.length > 0 && resolvedValue) {\n const discriminatedPropertySchemas = resolvedData.originalSchema.filter(\n (s) =>\n s?.discriminator &&\n resolvedValue.value.includes(` ${s.discriminator.propertyName}:`),\n ) as SchemaObject[];\n if (discriminatedPropertySchemas.length > 0) {\n resolvedDataValue = `Omit<${resolvedDataValue}, '${discriminatedPropertySchemas.map((s) => s.discriminator?.propertyName).join(\"' | '\")}'>`;\n }\n }\n const joined = `${resolvedDataValue}${\n resolvedValue ? ` & ${resolvedValue.value}` : ''\n }`;\n\n // Parent object may have set required properties that only exist in child\n // objects. Make sure the resulting object has these properties as required,\n // but there is no need to override properties that are already required\n const overrideRequiredProperties = resolvedData.requiredProperties.filter(\n (prop) =>\n !resolvedData.originalSchema.some(\n (schema) =>\n schema?.properties?.[prop] && schema.required?.includes(prop),\n ),\n );\n if (overrideRequiredProperties.length > 0) {\n return `${joined} & Required<Pick<${joined}, '${overrideRequiredProperties.join(\"' | '\")}'>>`;\n }\n return joined;\n }\n\n let values = resolvedData.values;\n const hasObjectSubschemas = resolvedData.allProperties.length;\n if (hasObjectSubschemas && context.output.unionAddMissingProperties) {\n values = []; // the list of values will be rebuilt to add missing properties (if exist) in subschemas\n for (let i = 0; i < resolvedData.values.length; i += 1) {\n const subSchema = resolvedData.originalSchema[i];\n if (subSchema?.type !== 'object') {\n values.push(resolvedData.values[i]);\n continue;\n }\n\n const missingProperties = uniq(\n resolvedData.allProperties.filter(\n (p) => !Object.keys(subSchema.properties!).includes(p),\n ),\n );\n values.push(\n `${resolvedData.values[i]}${\n missingProperties.length > 0\n ? ` & {${missingProperties.map((p) => `${p}?: never`).join('; ')}}`\n : ''\n }`,\n );\n }\n }\n\n if (resolvedValue) {\n return `(${values.join(` & ${resolvedValue.value}) | (`)} & ${\n resolvedValue.value\n })`;\n }\n\n return values.join(' | ');\n};\n\nexport const combineSchemas = ({\n name,\n schema,\n separator,\n context,\n nullable,\n}: {\n name?: string;\n schema: SchemaObject;\n separator: Separator;\n context: ContextSpecs;\n nullable: string;\n}): ScalarValue => {\n const items = schema[separator] ?? [];\n\n const resolvedData = items.reduce<CombinedData>(\n (acc, subSchema) => {\n let propName = name ? name + pascal(separator) : undefined;\n if (propName && acc.schemas.length > 0) {\n propName = propName + pascal(getNumberWord(acc.schemas.length + 1));\n }\n\n if (separator === 'allOf' && isSchema(subSchema) && subSchema.required) {\n acc.requiredProperties.push(...subSchema.required);\n }\n\n const resolvedValue = resolveObject({\n schema: subSchema,\n propName,\n combined: true,\n context,\n });\n\n const aliasedImports = getAliasedImports({\n context,\n name,\n resolvedValue,\n existingImports: acc.imports,\n });\n\n const value = getImportAliasForRefOrValue({\n context,\n resolvedValue,\n imports: aliasedImports,\n });\n\n acc.values.push(value);\n acc.imports.push(...aliasedImports);\n acc.schemas.push(...resolvedValue.schemas);\n acc.isEnum.push(resolvedValue.isEnum);\n acc.types.push(resolvedValue.type);\n acc.isRef.push(resolvedValue.isRef);\n acc.originalSchema.push(resolvedValue.originalSchema);\n acc.hasReadonlyProps ||= resolvedValue.hasReadonlyProps;\n\n if (\n resolvedValue.type === 'object' &&\n resolvedValue.originalSchema.properties\n ) {\n acc.allProperties.push(\n ...Object.keys(resolvedValue.originalSchema.properties),\n );\n }\n\n return acc;\n },\n {\n values: [],\n imports: [],\n schemas: [],\n isEnum: [], // check if only enums\n isRef: [],\n types: [],\n originalSchema: [],\n allProperties: [],\n hasReadonlyProps: false,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n requiredProperties: separator === 'allOf' ? (schema.required ?? []) : [],\n } as CombinedData,\n );\n\n const isAllEnums = resolvedData.isEnum.every(Boolean);\n\n if (isAllEnums && name && items.length > 1) {\n const newEnum = `// eslint-disable-next-line @typescript-eslint/no-redeclare\\nexport const ${pascal(\n name,\n )} = ${getCombineEnumValue(resolvedData)}`;\n\n return {\n value: `typeof ${pascal(name)}[keyof typeof ${pascal(name)}] ${nullable}`,\n imports: [\n {\n name: pascal(name),\n },\n ],\n schemas: [\n ...resolvedData.schemas,\n {\n imports: resolvedData.imports.map<GeneratorImport>((toImport) => ({\n ...toImport,\n values: true,\n })),\n model: newEnum,\n name: name,\n },\n ],\n isEnum: false,\n type: 'object' as SchemaType,\n isRef: false,\n hasReadonlyProps: resolvedData.hasReadonlyProps,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n }\n\n let resolvedValue: ScalarValue | undefined;\n\n if (schema.properties) {\n resolvedValue = getScalar({\n item: Object.fromEntries(\n Object.entries(schema).filter(([key]) => key !== separator),\n ),\n name,\n context,\n });\n }\n\n const value = combineValues({\n resolvedData,\n separator,\n resolvedValue,\n context,\n });\n\n return {\n value: value + nullable,\n imports: resolvedValue\n ? [...resolvedData.imports, ...resolvedValue.imports]\n : resolvedData.imports,\n schemas: resolvedValue\n ? [...resolvedData.schemas, ...resolvedValue.schemas]\n : resolvedData.schemas,\n isEnum: false,\n type: 'object' as SchemaType,\n isRef: false,\n hasReadonlyProps:\n resolvedData?.hasReadonlyProps ||\n resolvedValue?.hasReadonlyProps ||\n false,\n example: schema.example,\n examples: resolveExampleRefs(schema.examples, context),\n };\n};\n\nconst getCombineEnumValue = ({\n values,\n isRef,\n originalSchema,\n}: CombinedData) => {\n if (values.length === 1) {\n if (isRef[0]) {\n return values[0];\n }\n\n return `{${getEnumImplementation(values[0])}} as const`;\n }\n\n const enums = values\n .map((e, i) => {\n if (isRef[i]) {\n return `...${e},`;\n }\n\n const names = getEnumNames(originalSchema[i]);\n const descriptions = getEnumDescriptions(originalSchema[i]);\n\n return getEnumImplementation(e, names, descriptions);\n })\n .join('');\n\n return `{${enums}} as const`;\n};\n","import type { SchemaObject, SchemasObject } from 'openapi3-ts/oas30';\n\nimport type { ContextSpecs } from '../types';\nimport { pascal } from '../utils';\nimport { getRefInfo } from './ref';\n\nexport const resolveDiscriminators = (\n schemas: SchemasObject,\n context: ContextSpecs,\n): SchemasObject => {\n const transformedSchemas = { ...schemas };\n\n for (const schema of Object.values(transformedSchemas)) {\n if (schema.discriminator?.mapping) {\n const { mapping, propertyName } = schema.discriminator;\n\n for (const [mappingKey, mappingValue] of Object.entries(mapping)) {\n let subTypeSchema;\n\n try {\n const { originalName } = getRefInfo(mappingValue, context);\n // name from getRefInfo may contain a suffix, which we don't want\n const name = pascal(originalName);\n subTypeSchema =\n transformedSchemas[name] ?? transformedSchemas[originalName];\n } catch {\n subTypeSchema = transformedSchemas[mappingValue];\n }\n\n if (!subTypeSchema) {\n continue;\n }\n const property = subTypeSchema.properties?.[\n propertyName\n ] as SchemaObject;\n subTypeSchema.properties = {\n ...subTypeSchema.properties,\n [propertyName]: {\n type: 'string',\n enum: [\n ...(property?.enum?.filter((value) => value !== mappingKey) ??\n []),\n mappingKey,\n ],\n },\n };\n subTypeSchema.required = [\n ...(subTypeSchema.required ?? []),\n propertyName,\n ];\n }\n }\n }\n\n return transformedSchemas;\n};\n","import type { OperationObject } from 'openapi3-ts/oas30';\n\nimport { Verbs } from '../types';\nimport { pascal, sanitize } from '../utils';\n\nexport const getOperationId = (\n operation: OperationObject,\n route: string,\n verb: Verbs,\n): string => {\n if (operation.operationId) {\n return operation.operationId;\n }\n\n return pascal(\n [\n verb,\n ...route.split('/').map((p) =>\n sanitize(p, {\n dash: true,\n underscore: '-',\n dot: '-',\n whitespace: '-',\n }),\n ),\n ].join('-'),\n );\n};\n","import type { ParameterObject, ReferenceObject } from 'openapi3-ts/oas30';\n\nimport { resolveRef } from '../resolvers/ref';\nimport type { ContextSpecs, GetterParameters } from '../types';\nimport { isReference } from '../utils';\n\nexport const getParameters = ({\n parameters = [],\n context,\n}: {\n parameters: (ReferenceObject | ParameterObject)[];\n context: ContextSpecs;\n}): GetterParameters => {\n return parameters.reduce<GetterParameters>(\n (acc, p) => {\n if (isReference(p)) {\n const { schema: parameter, imports } = resolveRef<ParameterObject>(\n p,\n context,\n );\n\n if (\n parameter.in === 'path' ||\n parameter.in === 'query' ||\n parameter.in === 'header'\n ) {\n acc[parameter.in].push({ parameter, imports });\n }\n } else {\n if (p.in === 'query' || p.in === 'path' || p.in === 'header') {\n acc[p.in].push({ parameter: p, imports: [] });\n }\n }\n\n return acc;\n },\n {\n path: [],\n query: [],\n header: [],\n },\n );\n};\n","import { resolveValue } from '../resolvers';\nimport type {\n ContextSpecs,\n GetterParameters,\n GetterParams,\n NormalizedOutputOptions,\n} from '../types';\nimport { camel, sanitize, stringify } from '../utils';\n\n/**\n * Return every params in a path\n *\n * @example\n * ```\n * getParamsInPath(\"/pet/{category}/{name}/\");\n * // => [\"category\", \"name\"]\n * ```\n * @param path\n */\nexport const getParamsInPath = (path: string) => {\n let n;\n const output = [];\n const templatePathRegex = /\\{(.*?)\\}/g;\n while ((n = templatePathRegex.exec(path)) !== null) {\n output.push(n[1]);\n }\n\n return output;\n};\n\nexport const getParams = ({\n route,\n pathParams = [],\n operationId,\n context,\n output,\n}: {\n route: string;\n pathParams?: GetterParameters['query'];\n operationId: string;\n context: ContextSpecs;\n output: NormalizedOutputOptions;\n}): GetterParams => {\n const params = getParamsInPath(route);\n return params.map((p) => {\n const pathParam = pathParams.find(\n ({ parameter }) =>\n sanitize(camel(parameter.name), {\n es5keyword: true,\n underscore: true,\n dash: true,\n }) === p,\n );\n\n if (!pathParam) {\n throw new Error(\n `The path params ${p} can't be found in parameters (${operationId})`,\n );\n }\n\n const {\n name: nameWithoutSanitize,\n required = false,\n schema,\n } = pathParam.parameter;\n\n const name = sanitize(camel(nameWithoutSanitize), { es5keyword: true });\n\n if (!schema) {\n return {\n name,\n definition: `${name}${required ? '' : '?'}: unknown`,\n implementation: `${name}${required ? '' : '?'}: unknown`,\n default: false,\n required,\n imports: [],\n };\n }\n\n const resolvedValue = resolveValue({\n schema,\n context: {\n ...context,\n ...(pathParam.imports.length > 0\n ? {\n specKey: pathParam.imports[0].specKey,\n }\n : {}),\n },\n });\n\n let paramType = resolvedValue.value;\n if (output.allParamsOptional) {\n paramType = `${paramType} | undefined | null`; // TODO: maybe check that `paramType` isn't already undefined or null\n }\n\n const definition = `${name}${\n !required || resolvedValue.originalSchema!.default ? '?' : ''\n }: ${paramType}`;\n\n const implementation = `${name}${\n !required && !resolvedValue.originalSchema!.default ? '?' : ''\n }${\n resolvedValue.originalSchema!.default\n ? `: ${paramType} = ${stringify(resolvedValue.originalSchema!.default)}`\n : `: ${paramType}` // FIXME: in Vue if we have `version: MaybeRef<number | undefined | null> = 1` and we don't pass version, the unref(version) will be `undefined` and not `1`, so we need to handle default value somewhere in implementation and not in the definition\n }`;\n\n return {\n name,\n definition,\n implementation,\n default: resolvedValue.originalSchema!.default,\n required,\n imports: resolvedValue.imports,\n originalSchema: resolvedValue.originalSchema,\n };\n });\n};\n","import {\n type ContextSpecs,\n type GetterBody,\n type GetterParams,\n type GetterProps,\n GetterPropType,\n type GetterQueryParam,\n OutputClient,\n} from '../types';\nimport { isUndefined, pascal, sortByPriority } from '../utils';\n\nexport const getProps = ({\n body,\n queryParams,\n params,\n operationName,\n headers,\n context,\n}: {\n body: GetterBody;\n queryParams?: GetterQueryParam;\n params: GetterParams;\n operationName: string;\n headers?: GetterQueryParam;\n context: ContextSpecs;\n}): GetterProps => {\n const bodyProp = {\n name: body.implementation,\n definition: `${body.implementation}${body.isOptional ? '?' : ''}: ${body.definition}`,\n implementation: `${body.implementation}${body.isOptional ? '?' : ''}: ${body.definition}`,\n default: false,\n required: !body.isOptional,\n type: GetterPropType.BODY,\n };\n\n const queryParamsProp = {\n name: 'params',\n definition: getQueryParamDefinition(queryParams, context),\n implementation: getQueryParamDefinition(queryParams, context),\n default: false,\n required: isUndefined(queryParams?.isOptional)\n ? !context.output.allParamsOptional\n : !queryParams?.isOptional && !context.output.allParamsOptional,\n type: GetterPropType.QUERY_PARAM,\n };\n\n const headersProp = {\n name: 'headers',\n definition: `headers${headers?.isOptional ? '?' : ''}: ${\n headers?.schema.name\n }`,\n implementation: `headers${headers?.isOptional ? '?' : ''}: ${\n headers?.schema.name\n }`,\n default: false,\n required: isUndefined(headers?.isOptional) ? false : !headers?.isOptional,\n type: GetterPropType.HEADER,\n };\n\n let paramGetterProps: GetterProps;\n if (context.output.override.useNamedParameters && params.length > 0) {\n const parameterTypeName = `${pascal(operationName)}PathParameters`;\n\n const name = 'pathParams';\n\n // needs a special model\n const namedParametersTypeDefinition = `export type ${parameterTypeName} = {\\n ${params\n .map((property) => property.definition)\n .join(',\\n ')},\\n }`;\n\n const isOptional = params.every((param) => param.default);\n\n const implementation = `{ ${params\n .map((property) =>\n property.default\n ? `${property.name} = ${property.default}` // if we use property.implementation, we will get `{ version: number = 1 }: ListPetsPathParameters = {}` which isn't valid\n : property.name,\n )\n .join(', ')} }: ${parameterTypeName}${isOptional ? ' = {}' : ''}`;\n\n const destructured = `{ ${params\n .map((property) => property.name)\n .join(', ')} }`;\n\n paramGetterProps = [\n {\n type: GetterPropType.NAMED_PATH_PARAMS,\n name,\n definition: `${name}: ${parameterTypeName}`,\n implementation,\n default: false,\n destructured,\n required: true,\n schema: {\n name: parameterTypeName,\n model: namedParametersTypeDefinition,\n imports: params.flatMap((property) => property.imports),\n },\n },\n ];\n } else {\n paramGetterProps = params.map((param) => ({\n ...param,\n type: GetterPropType.PARAM,\n }));\n }\n\n const props = [\n ...paramGetterProps,\n ...(body.definition ? [bodyProp] : []),\n ...(queryParams ? [queryParamsProp] : []),\n ...(headers ? [headersProp] : []),\n ];\n\n const sortedProps = sortByPriority(props);\n\n return sortedProps;\n};\n\nfunction getQueryParamDefinition(\n queryParams: GetterQueryParam | undefined,\n context: ContextSpecs,\n): string {\n let paramType = queryParams?.schema.name;\n if (OutputClient.ANGULAR === context.output.client) {\n paramType = `DeepNonNullable<${paramType}>`;\n }\n return `params${queryParams?.isOptional || context.output.allParamsOptional ? '?' : ''}: ${paramType}`;\n}\n","import type { ContentObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { resolveValue } from '../resolvers';\nimport type {\n ContextSpecs,\n GeneratorImport,\n GeneratorSchema,\n GetterParameters,\n GetterQueryParam,\n} from '../types';\nimport { jsDoc, pascal, sanitize } from '../utils';\nimport { getEnum, getEnumDescriptions, getEnumNames } from './enum';\nimport { getKey } from './keys';\n\ntype QueryParamsType = {\n definition: string;\n imports: GeneratorImport[];\n schemas: GeneratorSchema[];\n originalSchema: SchemaObject;\n};\n\nconst getQueryParamsTypes = (\n queryParams: GetterParameters['query'],\n operationName: string,\n context: ContextSpecs,\n): QueryParamsType[] => {\n return queryParams.map(({ parameter, imports: parameterImports }) => {\n const {\n name,\n required,\n schema: schemaParam,\n content,\n } = parameter as {\n name: string;\n required: boolean;\n schema: SchemaObject;\n content: ContentObject;\n };\n\n const queryName = sanitize(`${pascal(operationName)}${pascal(name)}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n\n const schema = (schemaParam || content['application/json'].schema)!;\n\n const resolvedValue = resolveValue({\n schema,\n context,\n name: queryName,\n });\n\n const key = getKey(name);\n const doc = jsDoc(\n {\n description: parameter.description,\n ...schema,\n },\n void 0,\n context,\n );\n\n if (parameterImports.length > 0) {\n return {\n definition: `${doc}${key}${!required || schema.default ? '?' : ''}: ${\n parameterImports[0].name\n };`,\n imports: parameterImports,\n schemas: [],\n originalSchema: resolvedValue.originalSchema,\n };\n }\n\n if (resolvedValue.isEnum && !resolvedValue.isRef) {\n const enumName = queryName;\n const enumValue = getEnum(\n resolvedValue.value,\n enumName,\n getEnumNames(resolvedValue.originalSchema),\n context.output.override.enumGenerationType,\n getEnumDescriptions(resolvedValue.originalSchema),\n context.output.override.namingConvention?.enum,\n );\n\n return {\n definition: `${doc}${key}${\n !required || schema.default ? '?' : ''\n }: ${enumName};`,\n imports: [{ name: enumName }],\n schemas: [\n ...resolvedValue.schemas,\n { name: enumName, model: enumValue, imports: resolvedValue.imports },\n ],\n originalSchema: resolvedValue.originalSchema,\n };\n }\n\n const definition = `${doc}${key}${\n !required || schema.default ? '?' : ''\n }: ${resolvedValue.value};`;\n\n return {\n definition,\n imports: resolvedValue.imports,\n schemas: resolvedValue.schemas,\n originalSchema: resolvedValue.originalSchema,\n };\n });\n};\n\nexport const getQueryParams = ({\n queryParams = [],\n operationName,\n context,\n suffix = 'params',\n}: {\n queryParams: GetterParameters['query'];\n operationName: string;\n context: ContextSpecs;\n suffix?: string;\n}): GetterQueryParam | undefined => {\n if (queryParams.length === 0) {\n return;\n }\n const types = getQueryParamsTypes(queryParams, operationName, context);\n const imports = types.flatMap(({ imports }) => imports);\n const schemas = types.flatMap(({ schemas }) => schemas);\n const name = `${pascal(operationName)}${pascal(suffix)}`;\n\n const type = types.map(({ definition }) => definition).join('\\n');\n const allOptional = queryParams.every(({ parameter }) => !parameter.required);\n\n const schema = {\n name,\n model: `export type ${name} = {\\n${type}\\n};\\n`,\n imports,\n };\n\n return {\n schema,\n deps: schemas,\n isOptional: allOptional,\n };\n};\n","import type { ResponsesObject } from 'openapi3-ts/oas30';\n\nimport type {\n ContextSpecs,\n GetterResponse,\n OverrideOutputContentType,\n ResReqTypesValue,\n} from '../types';\nimport { getResReqTypes } from './res-req-types';\n\nexport const getResponse = ({\n responses,\n operationName,\n context,\n contentType,\n}: {\n responses: ResponsesObject;\n operationName: string;\n context: ContextSpecs;\n contentType?: OverrideOutputContentType;\n}): GetterResponse => {\n if (!responses) {\n return {\n imports: [],\n definition: {\n success: '',\n errors: '',\n },\n isBlob: false,\n types: { success: [], errors: [] },\n schemas: [],\n contentTypes: [],\n };\n }\n\n const types = getResReqTypes(\n Object.entries(responses),\n operationName,\n context,\n 'void',\n (type) => `${type.key}-${type.value}`,\n );\n\n const filteredTypes = contentType\n ? types.filter((type) => {\n let include = true;\n let exclude = false;\n\n if (contentType.include) {\n include = contentType.include.includes(type.contentType);\n }\n\n if (contentType.exclude) {\n exclude = contentType.exclude.includes(type.contentType);\n }\n\n return include && !exclude;\n })\n : types;\n\n const imports = filteredTypes.flatMap(({ imports }) => imports);\n const schemas = filteredTypes.flatMap(({ schemas }) => schemas);\n\n const contentTypes = [\n ...new Set(filteredTypes.map(({ contentType }) => contentType)),\n ];\n\n const groupedByStatus = filteredTypes.reduce<{\n success: ResReqTypesValue[];\n errors: ResReqTypesValue[];\n }>(\n (acc, type) => {\n if (type.key.startsWith('2')) {\n acc.success.push(type);\n } else {\n acc.errors.push(type);\n }\n return acc;\n },\n { success: [], errors: [] },\n );\n\n const success = groupedByStatus.success\n .map(({ value, formData }) => (formData ? 'Blob' : value))\n .join(' | ');\n const errors = groupedByStatus.errors.map(({ value }) => value).join(' | ');\n\n const defaultType = filteredTypes.find(({ key }) => key === 'default')?.value;\n\n return {\n imports,\n definition: {\n success: success || (defaultType ?? 'unknown'),\n errors: errors || (defaultType ?? 'unknown'),\n },\n isBlob: success === 'Blob',\n types: groupedByStatus,\n contentTypes,\n schemas,\n originalSchema: responses,\n };\n};\n","import type { ServerObject } from 'openapi3-ts/oas31';\n\nimport { TEMPLATE_TAG_REGEX } from '../constants';\nimport type { BaseUrlFromConstant, BaseUrlFromSpec } from '../types';\nimport { camel, sanitize } from '../utils';\n\nconst TEMPLATE_TAG_IN_PATH_REGEX = /\\/([\\w]+)(?:\\$\\{)/g; // all dynamic parts of path\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(camel(matches[2]), {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path)\n ? `${prev}\\${${param}}${next}`\n : `${prev}${param}${next}`;\n};\n\nexport const getRoute = (route: string) => {\n const splittedRoute = route.split('/');\n\n return splittedRoute.reduce((acc, path, i) => {\n if (!path && !i) {\n return acc;\n }\n\n if (!path.includes('{')) {\n return `${acc}/${path}`;\n }\n\n return `${acc}/${getRoutePath(path)}`;\n }, '');\n};\n\nexport const getFullRoute = (\n route: string,\n servers: ServerObject[] | undefined,\n baseUrl: string | BaseUrlFromConstant | BaseUrlFromSpec | undefined,\n): string => {\n const getBaseUrl = (): string => {\n if (!baseUrl) return '';\n if (typeof baseUrl === 'string') return baseUrl;\n if (baseUrl.getBaseUrlFromSpecification) {\n if (!servers) {\n throw new Error(\n \"Orval is configured to use baseUrl from the specifications 'servers' field, but there exist no servers in the specification.\",\n );\n }\n const server = servers.at(\n Math.min(baseUrl.index ?? 0, servers.length - 1),\n );\n if (!server) return '';\n if (!server.variables) return server.url;\n\n let url = server.url;\n const variables = baseUrl.variables;\n for (const variableKey of Object.keys(server.variables)) {\n const variable = server.variables[variableKey];\n if (variables?.[variableKey]) {\n if (\n variable.enum &&\n !variable.enum.some((e) => e == variables[variableKey])\n ) {\n throw new Error(\n `Invalid variable value '${variables[variableKey]}' for variable '${variableKey}' when resolving ${server.url}. Valid values are: ${variable.enum.join(', ')}.`,\n );\n }\n url = url.replaceAll(`{${variableKey}}`, variables[variableKey]);\n } else {\n url = url.replaceAll(`{${variableKey}}`, String(variable.default));\n }\n }\n return url;\n }\n return baseUrl.baseUrl;\n };\n\n let fullRoute = route;\n const base = getBaseUrl();\n if (base) {\n if (base.endsWith('/') && route.startsWith('/')) {\n fullRoute = route.slice(1);\n }\n fullRoute = `${base}${fullRoute}`;\n }\n return fullRoute;\n};\n\n// Creates a mixed use array with path variables and string from template string route\nexport const getRouteAsArray = (route: string): string =>\n route\n .replaceAll(TEMPLATE_TAG_IN_PATH_REGEX, '/$1/${')\n .split('/')\n .filter((i) => i !== '')\n .map((i) =>\n // @note - array is mixed with string and var\n i.includes('${') ? i.replace(TEMPLATE_TAG_REGEX, '$1') : `'${i}'`,\n )\n .join(',')\n .replace(',,', '');\n","import isEmpty from 'lodash.isempty';\nimport type {\n ComponentsObject,\n ReferenceObject,\n RequestBodyObject,\n ResponseObject,\n} from 'openapi3-ts/oas30';\n\nimport { getResReqTypes } from '../getters';\nimport type { ContextSpecs, GeneratorSchema } from '../types';\nimport { jsDoc, pascal, sanitize } from '../utils';\n\nexport const generateComponentDefinition = (\n responses:\n | ComponentsObject['responses']\n | ComponentsObject['requestBodies'] = {},\n context: ContextSpecs,\n suffix: string,\n): GeneratorSchema[] => {\n if (isEmpty(responses)) {\n return [];\n }\n\n return Object.entries(responses).reduce<GeneratorSchema[]>(\n (\n acc,\n [name, response]: [\n string,\n ReferenceObject | RequestBodyObject | ResponseObject,\n ],\n ) => {\n const allResponseTypes = getResReqTypes(\n [[suffix, response]],\n name,\n context,\n 'void',\n );\n\n const imports = allResponseTypes.flatMap(({ imports }) => imports);\n const schemas = allResponseTypes.flatMap(({ schemas }) => schemas);\n\n const type = allResponseTypes.map(({ value }) => value).join(' | ');\n\n const modelName = sanitize(`${pascal(name)}${suffix}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n const doc = jsDoc(response as ResponseObject | RequestBodyObject);\n const model = `${doc}export type ${modelName} = ${type || 'unknown'};\\n`;\n\n acc.push(...schemas);\n\n if (modelName !== type) {\n acc.push({\n name: modelName,\n model,\n imports,\n });\n }\n\n return acc;\n },\n [],\n );\n};\n","import uniq from 'lodash.uniq';\nimport uniqWith from 'lodash.uniqwith';\n\nimport {\n type GeneratorImport,\n type GeneratorMutator,\n type GeneratorVerbOptions,\n GetterPropType,\n NamingConvention,\n} from '../types';\nimport { conventionName, upath } from '../utils';\n\nexport const generateImports = ({\n imports = [],\n target,\n isRootKey,\n specsName,\n specKey: currentSpecKey,\n namingConvention = NamingConvention.CAMEL_CASE,\n}: {\n imports: GeneratorImport[];\n target: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n specKey: string;\n namingConvention?: NamingConvention;\n}) => {\n if (imports.length === 0) {\n return '';\n }\n\n return uniqWith(\n imports,\n (a, b) =>\n a.name === b.name && a.default === b.default && a.specKey === b.specKey,\n )\n .sort()\n .map(({ specKey, name, values, alias, isConstant }) => {\n const isSameSpecKey = currentSpecKey === specKey;\n\n const fileName = conventionName(name, namingConvention);\n\n if (specKey && !isSameSpecKey) {\n const path = specKey === target ? '' : specsName[specKey];\n\n if (!isRootKey && specKey) {\n return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n alias ? ` as ${alias}` : ''\n } } from \\'../${upath.join(path, fileName)}\\';`;\n }\n\n return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n alias ? ` as ${alias}` : ''\n } } from \\'./${upath.join(path, fileName)}\\';`;\n }\n\n return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n alias ? ` as ${alias}` : ''\n } } from \\'./${fileName}\\';`;\n })\n .join('\\n');\n};\n\nexport const generateMutatorImports = ({\n mutators,\n implementation,\n oneMore,\n}: {\n mutators: GeneratorMutator[];\n implementation?: string;\n oneMore?: boolean;\n}) => {\n const imports = uniqWith(\n mutators,\n (a, b) => a.name === b.name && a.default === b.default,\n ).reduce((acc, mutator) => {\n const path = `${oneMore ? '../' : ''}${mutator.path}`;\n const importDefault = mutator.default\n ? mutator.name\n : `{ ${mutator.name} }`;\n\n acc += `import ${importDefault} from '${path}';`;\n acc += '\\n';\n\n if (implementation && (mutator.hasErrorType || mutator.bodyTypeName)) {\n let errorImportName = '';\n const targetErrorImportName = mutator.default\n ? `ErrorType as ${mutator.errorTypeName}`\n : mutator.errorTypeName;\n if (\n mutator.hasErrorType &&\n implementation.includes(mutator.errorTypeName) &&\n !acc.includes(`{ ${targetErrorImportName} `)\n ) {\n errorImportName = targetErrorImportName;\n }\n\n let bodyImportName = '';\n const targetBodyImportName = mutator.default\n ? `BodyType as ${mutator.bodyTypeName}`\n : mutator.bodyTypeName;\n if (\n mutator.bodyTypeName &&\n implementation.includes(mutator.bodyTypeName) &&\n !acc.includes(` ${targetBodyImportName} }`)\n ) {\n bodyImportName = targetBodyImportName!;\n }\n\n if (bodyImportName || errorImportName) {\n acc += `import type { ${errorImportName}${\n errorImportName && bodyImportName ? ' , ' : ''\n }${bodyImportName} } from '${path}';`;\n acc += '\\n';\n }\n }\n\n return acc;\n }, '');\n\n return imports;\n};\n\nconst generateDependency = ({\n deps,\n isAllowSyntheticDefaultImports,\n dependency,\n specsName,\n key,\n onlyTypes,\n}: {\n key: string;\n deps: GeneratorImport[];\n dependency: string;\n specsName: Record<string, string>;\n isAllowSyntheticDefaultImports: boolean;\n onlyTypes: boolean;\n}) => {\n const defaultDep = deps.find(\n (e) =>\n e.default &&\n (isAllowSyntheticDefaultImports || !e.syntheticDefaultImport),\n );\n const syntheticDefaultImportDep = isAllowSyntheticDefaultImports\n ? undefined\n : deps.find((e) => e.syntheticDefaultImport);\n\n const depsString = uniq(\n deps\n .filter((e) => !e.default && !e.syntheticDefaultImport)\n .map(({ name, alias }) => (alias ? `${name} as ${alias}` : name)),\n )\n .sort()\n .join(',\\n ');\n\n let importString = '';\n\n const syntheticDefaultImport = syntheticDefaultImportDep\n ? `import * as ${syntheticDefaultImportDep.name} from '${dependency}';`\n : '';\n\n if (syntheticDefaultImport) {\n if (deps.length === 1) {\n return syntheticDefaultImport;\n }\n importString += `${syntheticDefaultImport}\\n`;\n }\n\n importString += `import ${onlyTypes ? 'type ' : ''}${\n defaultDep ? `${defaultDep.name}${depsString ? ',' : ''}` : ''\n }${depsString ? `{\\n ${depsString}\\n}` : ''} from '${dependency}${\n key !== 'default' && specsName[key] ? `/${specsName[key]}` : ''\n }';`;\n\n return importString;\n};\n\nexport const addDependency = ({\n implementation,\n exports,\n dependency,\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n}: {\n implementation: string;\n exports: GeneratorImport[];\n dependency: string;\n specsName: Record<string, string>;\n hasSchemaDir: boolean;\n isAllowSyntheticDefaultImports: boolean;\n}) => {\n const toAdds = exports.filter((e) => {\n const searchWords = [e.alias, e.name].filter((p) => p?.length).join('|');\n const pattern = new RegExp(`\\\\b(${searchWords})\\\\b`, 'g');\n\n return implementation.match(pattern);\n });\n\n if (toAdds.length === 0) {\n return;\n }\n\n const groupedBySpecKey = toAdds.reduce<\n Record<string, { types: GeneratorImport[]; values: GeneratorImport[] }>\n >((acc, dep) => {\n const key = hasSchemaDir && dep.specKey ? dep.specKey : 'default';\n\n if (\n dep.values &&\n (isAllowSyntheticDefaultImports || !dep.syntheticDefaultImport)\n ) {\n acc[key] = {\n ...acc[key],\n values: [...(acc[key]?.values ?? []), dep],\n };\n\n return acc;\n }\n\n acc[key] = {\n ...acc[key],\n types: [...(acc[key]?.types ?? []), dep],\n };\n\n return acc;\n }, {});\n\n return (\n Object.entries(groupedBySpecKey)\n .map(([key, { values, types }]) => {\n let dep = '';\n\n if (values) {\n dep += generateDependency({\n deps: values,\n isAllowSyntheticDefaultImports,\n dependency,\n specsName,\n key,\n onlyTypes: false,\n });\n }\n\n if (types) {\n let uniqueTypes = types;\n if (values) {\n uniqueTypes = types.filter(\n (t) => !values.some((v) => v.name === t.name),\n );\n dep += '\\n';\n }\n dep += generateDependency({\n deps: uniqueTypes,\n isAllowSyntheticDefaultImports,\n dependency,\n specsName,\n key,\n onlyTypes: true,\n });\n }\n\n return dep;\n })\n .join('\\n') + '\\n'\n );\n};\n\nconst getLibName = (code: string) => {\n const splitString = code.split(' from ');\n return splitString[splitString.length - 1].split(';')[0].trim();\n};\n\nexport const generateDependencyImports = (\n implementation: string,\n imports: {\n exports: GeneratorImport[];\n dependency: string;\n }[],\n specsName: Record<string, string>,\n hasSchemaDir: boolean,\n isAllowSyntheticDefaultImports: boolean,\n): string => {\n const dependencies = imports\n .map((dep) =>\n addDependency({\n ...dep,\n implementation,\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n }),\n )\n .filter(Boolean)\n .sort((a, b) => {\n const aLib = getLibName(a!);\n const bLib = getLibName(b!);\n\n if (aLib === bLib) {\n return 0;\n }\n\n if (aLib.startsWith(\"'.\") && !bLib.startsWith(\"'.\")) {\n return 1;\n }\n return aLib < bLib ? -1 : 1;\n })\n .join('\\n');\n\n return dependencies ? dependencies + '\\n' : '';\n};\n\nexport const generateVerbImports = ({\n response,\n body,\n queryParams,\n props,\n headers,\n params,\n}: GeneratorVerbOptions): GeneratorImport[] => [\n ...response.imports,\n ...body.imports,\n ...props.flatMap((prop) =>\n prop.type === GetterPropType.NAMED_PATH_PARAMS\n ? [{ name: prop.schema.name }]\n : [],\n ),\n ...(queryParams ? [{ name: queryParams.schema.name }] : []),\n ...(headers ? [{ name: headers.schema.name }] : []),\n ...params.flatMap<GeneratorImport>(({ imports }) => imports),\n];\n","import type { GeneratorSchema } from '../types';\n\nexport const generateModelInline = (acc: string, model: string): string =>\n acc + `${model}\\n`;\n\nexport const generateModelsInline = (\n obj: Record<string, GeneratorSchema[]>,\n): string => {\n const schemas = Object.values(obj).flat();\n\n return schemas.reduce<string>(\n (acc, { model }) => generateModelInline(acc, model),\n '',\n );\n};\n","import { type ecmaVersion, Parser } from 'acorn';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\n\nimport type {\n GeneratorMutator,\n GeneratorMutatorParsingInfo,\n NormalizedMutator,\n Tsconfig,\n TsConfigTarget,\n} from '../types';\nimport { createLogger, getFileInfo, loadFile, pascal, upath } from '../utils';\n\nexport const BODY_TYPE_NAME = 'BodyType';\n\nconst getImport = (output: string, mutator: NormalizedMutator) => {\n const outputFileInfo = getFileInfo(output);\n const mutatorFileInfo = getFileInfo(mutator.path);\n const { pathWithoutExtension } = getFileInfo(\n upath.relativeSafe(outputFileInfo.dirname, mutatorFileInfo.path),\n );\n\n return `${pathWithoutExtension}${mutator.extension || ''}`;\n};\n\nexport const generateMutator = async ({\n output,\n mutator,\n name,\n workspace,\n tsconfig,\n}: {\n output?: string;\n mutator?: NormalizedMutator;\n name: string;\n workspace: string;\n tsconfig?: Tsconfig;\n}): Promise<GeneratorMutator | undefined> => {\n if (!mutator || !output) {\n return;\n }\n const isDefault = mutator.default;\n const importName = mutator.name ? mutator.name : `${name}Mutator`;\n const importPath = mutator.path;\n\n let rawFile = await fs.readFile(importPath, 'utf8');\n\n rawFile = removeComments(rawFile);\n\n const hasErrorType =\n rawFile.includes('export type ErrorType') ||\n rawFile.includes('export interface ErrorType');\n\n const hasBodyType =\n rawFile.includes(`export type ${BODY_TYPE_NAME}`) ||\n rawFile.includes(`export interface ${BODY_TYPE_NAME}`);\n\n const errorTypeName = mutator.default\n ? `${pascal(name)}ErrorType`\n : 'ErrorType';\n\n const bodyTypeName = mutator.default\n ? `${pascal(name)}${BODY_TYPE_NAME}`\n : BODY_TYPE_NAME;\n\n const { file, cached } = await loadFile<string>(importPath, {\n isDefault: false,\n root: workspace,\n alias: mutator.alias,\n tsconfig,\n load: false,\n });\n\n if (file) {\n const mutatorInfoName = isDefault ? 'default' : mutator.name!;\n\n const mutatorInfo = parseFile(\n file,\n mutatorInfoName,\n getEcmaVersion(tsconfig?.compilerOptions?.target),\n );\n\n if (!mutatorInfo) {\n throw new Error(\n chalk.red(\n `Your mutator file doesn't have the ${mutatorInfoName} exported function`,\n ),\n );\n }\n\n const path = getImport(output, mutator);\n\n const isHook = mutator.name\n ? !!mutator.name.startsWith('use') && !mutatorInfo.numberOfParams\n : !mutatorInfo.numberOfParams;\n\n return {\n name: mutator.name || !isHook ? importName : `use${pascal(importName)}`,\n path,\n default: isDefault,\n hasErrorType,\n errorTypeName,\n hasSecondArg: isHook\n ? mutatorInfo.returnNumberOfParams! > 1\n : mutatorInfo.numberOfParams > 1,\n hasThirdArg: mutatorInfo.numberOfParams > 2,\n isHook,\n ...(hasBodyType ? { bodyTypeName } : {}),\n };\n } else {\n const path = getImport(output, mutator);\n\n if (!cached) {\n createLogger().warn(\n chalk.yellow(`Failed to parse provided mutator function`),\n );\n }\n\n return {\n name: importName,\n path,\n default: isDefault,\n hasSecondArg: false,\n hasThirdArg: false,\n isHook: false,\n hasErrorType,\n errorTypeName,\n ...(hasBodyType ? { bodyTypeName } : {}),\n };\n }\n};\n\nconst getEcmaVersion = (target?: TsConfigTarget): ecmaVersion | undefined => {\n if (!target) {\n return;\n }\n\n if (target.toLowerCase() === 'esnext') {\n return 'latest';\n }\n\n try {\n return Number(target.toLowerCase().replace('es', '')) as ecmaVersion;\n } catch {\n return;\n }\n};\n\nconst removeComments = (file: string) => {\n // Regular expression to match single-line and multi-line comments\n const commentRegex = /\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\//g;\n\n // Remove comments from the rawFile string\n const cleanedFile = file.replaceAll(commentRegex, '');\n\n return cleanedFile;\n};\n\nconst parseFile = (\n file: string,\n name: string,\n ecmaVersion: ecmaVersion = 6,\n): GeneratorMutatorParsingInfo | undefined => {\n try {\n const ast = Parser.parse(file, { ecmaVersion }) as any;\n\n const node = ast?.body?.find((childNode: any) => {\n if (childNode.type === 'ExpressionStatement') {\n if (\n childNode.expression.arguments?.[1]?.properties?.some(\n (p: any) => p.key?.name === name,\n )\n ) {\n return true;\n }\n\n if (childNode.expression.left?.property?.name === name) {\n return true;\n }\n\n return childNode.expression.right?.properties?.some(\n (p: any) => p.key.name === name,\n );\n }\n });\n\n if (!node) {\n return;\n }\n\n if (node.expression.type === 'AssignmentExpression') {\n if (\n node.expression.right.type === 'FunctionExpression' ||\n node.expression.right.type === 'ArrowFunctionExpression'\n ) {\n return {\n numberOfParams: node.expression.right.params.length,\n };\n }\n\n if (node.expression.right.name) {\n return parseFunction(ast, node.expression.right.name);\n }\n\n const property = node.expression.right?.properties.find(\n (p: any) => p.key.name === name,\n );\n\n if (property.value.name) {\n return parseFunction(ast, property.value.name);\n }\n\n if (\n property.value.type === 'FunctionExpression' ||\n property.value.type === 'ArrowFunctionExpression'\n ) {\n return {\n numberOfParams: property.value.params.length,\n };\n }\n\n return;\n }\n\n const property = node.expression.arguments[1].properties.find(\n (p: any) => p.key?.name === name,\n );\n\n return parseFunction(ast, property.value.body.name);\n } catch {\n return;\n }\n};\n\nconst parseFunction = (\n ast: any,\n name: string,\n): GeneratorMutatorParsingInfo | undefined => {\n const node = ast?.body?.find((childNode: any) => {\n if (childNode.type === 'VariableDeclaration') {\n return childNode.declarations.find((d: any) => d.id.name === name);\n }\n if (\n childNode.type === 'FunctionDeclaration' &&\n childNode.id.name === name\n ) {\n return childNode;\n }\n });\n\n if (!node) {\n return;\n }\n\n if (node.type === 'FunctionDeclaration') {\n const returnStatement = node.body?.body?.find(\n (b: any) => b.type === 'ReturnStatement',\n );\n\n // If the function directly returns an arrow function\n if (returnStatement?.argument?.params) {\n return {\n numberOfParams: node.params.length,\n returnNumberOfParams: returnStatement.argument.params.length,\n };\n // If the function returns a CallExpression (e.g., return useCallback(...))\n } else if (\n returnStatement?.argument?.type === 'CallExpression' &&\n returnStatement.argument.arguments?.[0]?.type ===\n 'ArrowFunctionExpression'\n ) {\n const arrowFn = returnStatement.argument.arguments[0];\n return {\n numberOfParams: node.params.length,\n returnNumberOfParams: arrowFn.params.length,\n };\n }\n return {\n numberOfParams: node.params.length,\n };\n }\n\n const declaration = node.declarations.find((d: any) => d.id.name === name);\n\n if (declaration.init.name) {\n return parseFunction(ast, declaration.init.name);\n }\n\n if (declaration.init.body.type === 'ArrowFunctionExpression') {\n return {\n numberOfParams: declaration.init.params.length,\n returnNumberOfParams: declaration.init.body.params.length,\n };\n }\n\n const returnStatement = declaration.init.body?.body?.find(\n (b: any) => b.type === 'ReturnStatement',\n );\n\n if (returnStatement?.argument?.params) {\n return {\n numberOfParams: declaration.init.params.length,\n returnNumberOfParams: returnStatement.argument.params.length,\n };\n } else if (\n returnStatement?.argument?.type === 'CallExpression' &&\n returnStatement.argument.arguments?.[0]?.type === 'ArrowFunctionExpression'\n ) {\n const arrowFn = returnStatement.argument.arguments[0];\n return {\n numberOfParams: declaration.init.params.length,\n returnNumberOfParams: arrowFn.params.length,\n };\n }\n\n return {\n numberOfParams: declaration.init.params.length,\n };\n};\n","import {\n type GeneratorMutator,\n type GeneratorSchema,\n type GetterBody,\n type GetterQueryParam,\n type GetterResponse,\n type ParamsSerializerOptions,\n Verbs,\n} from '../types';\nimport { getIsBodyVerb, isObject, stringify } from '../utils';\n\nexport const generateBodyOptions = (\n body: GetterBody,\n isFormData: boolean,\n isFormUrlEncoded: boolean,\n) => {\n if (isFormData && body.formData) {\n return '\\n formData,';\n }\n\n if (isFormUrlEncoded && body.formUrlEncoded) {\n return '\\n formUrlEncoded,';\n }\n\n if (body.implementation) {\n return `\\n ${body.implementation},`;\n }\n\n return '';\n};\n\nexport const generateAxiosOptions = ({\n response,\n isExactOptionalPropertyTypes,\n queryParams,\n headers,\n requestOptions,\n hasSignal,\n isVue,\n isAngular,\n paramsSerializer,\n paramsSerializerOptions,\n}: {\n response: GetterResponse;\n isExactOptionalPropertyTypes: boolean;\n queryParams?: GeneratorSchema;\n headers?: GeneratorSchema;\n requestOptions?: object | boolean;\n hasSignal: boolean;\n isVue: boolean;\n isAngular: boolean;\n paramsSerializer?: GeneratorMutator;\n paramsSerializerOptions?: ParamsSerializerOptions;\n}) => {\n const isRequestOptions = requestOptions !== false;\n if (\n !queryParams &&\n !headers &&\n !response.isBlob &&\n response.definition.success !== 'string'\n ) {\n if (isRequestOptions) {\n return 'options';\n }\n if (hasSignal) {\n return isExactOptionalPropertyTypes\n ? '...(signal ? { signal } : {})'\n : 'signal';\n }\n return '';\n }\n\n let value = '';\n\n if (!isRequestOptions) {\n if (queryParams) {\n value += '\\n params,';\n }\n\n if (headers) {\n value += '\\n headers,';\n }\n\n if (hasSignal) {\n value += isExactOptionalPropertyTypes\n ? '\\n ...(signal ? { signal } : {}),'\n : '\\n signal,';\n }\n }\n\n if (\n !isObject(requestOptions) ||\n !requestOptions.hasOwnProperty('responseType')\n ) {\n if (response.isBlob) {\n value += `\\n responseType: 'blob',`;\n } else if (response.definition.success === 'string') {\n value += `\\n responseType: 'text',`;\n }\n }\n\n if (isObject(requestOptions)) {\n value += `\\n ${stringify(requestOptions)?.slice(1, -1)}`;\n }\n\n if (isRequestOptions) {\n value += '\\n ...options,';\n\n if (queryParams) {\n if (isVue) {\n value += '\\n params: {...unref(params), ...options?.params},';\n } else if (isAngular && paramsSerializer) {\n value += `\\n params: ${paramsSerializer.name}({...params, ...options?.params}),`;\n } else {\n value += '\\n params: {...params, ...options?.params},';\n }\n }\n\n if (headers) {\n value += '\\n headers: {...headers, ...options?.headers},';\n }\n }\n\n if (\n !isAngular &&\n queryParams &&\n (paramsSerializer || paramsSerializerOptions?.qs)\n ) {\n value += paramsSerializer\n ? `\\n paramsSerializer: ${paramsSerializer.name},`\n : `\\n paramsSerializer: (params) => qs.stringify(params, ${JSON.stringify(\n paramsSerializerOptions!.qs,\n )}),`;\n }\n\n return value;\n};\n\nexport const generateOptions = ({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n requestOptions,\n isFormData,\n isFormUrlEncoded,\n isAngular,\n isExactOptionalPropertyTypes,\n hasSignal,\n isVue,\n paramsSerializer,\n paramsSerializerOptions,\n}: {\n route: string;\n body: GetterBody;\n headers?: GetterQueryParam;\n queryParams?: GetterQueryParam;\n response: GetterResponse;\n verb: Verbs;\n requestOptions?: object | boolean;\n isFormData: boolean;\n isFormUrlEncoded: boolean;\n isAngular?: boolean;\n isExactOptionalPropertyTypes: boolean;\n hasSignal: boolean;\n isVue?: boolean;\n paramsSerializer?: GeneratorMutator;\n paramsSerializerOptions?: ParamsSerializerOptions;\n}) => {\n const bodyOptions = getIsBodyVerb(verb)\n ? generateBodyOptions(body, isFormData, isFormUrlEncoded)\n : '';\n\n const axiosOptions = generateAxiosOptions({\n response,\n queryParams: queryParams?.schema,\n headers: headers?.schema,\n requestOptions,\n isExactOptionalPropertyTypes,\n hasSignal,\n isVue: isVue ?? false,\n isAngular: isAngular ?? false,\n paramsSerializer,\n paramsSerializerOptions,\n });\n\n const options = axiosOptions ? `{${axiosOptions}}` : '';\n\n if (verb === Verbs.DELETE) {\n if (!bodyOptions) {\n return `\\n \\`${route}\\`,${\n axiosOptions === 'options' ? axiosOptions : options\n }\\n `;\n }\n\n return `\\n \\`${route}\\`,{${\n isAngular ? 'body' : 'data'\n }:${bodyOptions} ${\n axiosOptions === 'options' ? `...${axiosOptions}` : axiosOptions\n }}\\n `;\n }\n\n return `\\n \\`${route}\\`,${\n getIsBodyVerb(verb) ? bodyOptions || 'undefined,' : ''\n }${axiosOptions === 'options' ? axiosOptions : options}\\n `;\n};\n\nexport const generateBodyMutatorConfig = (\n body: GetterBody,\n isFormData: boolean,\n isFormUrlEncoded: boolean,\n) => {\n if (isFormData && body.formData) {\n return ',\\n data: formData';\n }\n\n if (isFormUrlEncoded && body.formUrlEncoded) {\n return ',\\n data: formUrlEncoded';\n }\n\n if (body.implementation) {\n return `,\\n data: ${body.implementation}`;\n }\n\n return '';\n};\n\nexport const generateQueryParamsAxiosConfig = (\n response: GetterResponse,\n isVue: boolean,\n queryParams?: GetterQueryParam,\n) => {\n if (!queryParams && !response.isBlob) {\n return '';\n }\n\n let value = '';\n\n if (queryParams) {\n value += isVue ? ',\\n params: unref(params)' : ',\\n params';\n }\n\n if (response.isBlob) {\n value += `,\\n responseType: 'blob'`;\n }\n\n return value;\n};\n\nexport const generateMutatorConfig = ({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n isFormData,\n isFormUrlEncoded,\n hasSignal,\n isExactOptionalPropertyTypes,\n isVue,\n}: {\n route: string;\n body: GetterBody;\n headers?: GetterQueryParam;\n queryParams?: GetterQueryParam;\n response: GetterResponse;\n verb: Verbs;\n isFormData: boolean;\n isFormUrlEncoded: boolean;\n hasSignal: boolean;\n isExactOptionalPropertyTypes: boolean;\n isVue?: boolean;\n}) => {\n const bodyOptions = getIsBodyVerb(verb)\n ? generateBodyMutatorConfig(body, isFormData, isFormUrlEncoded)\n : '';\n\n const queryParamsOptions = generateQueryParamsAxiosConfig(\n response,\n isVue ?? false,\n queryParams,\n );\n\n const headerOptions = body.contentType\n ? `,\\n headers: {'Content-Type': '${body.contentType}', ${\n headers ? '...headers' : ''\n }}`\n : headers\n ? ',\\n headers'\n : '';\n\n return `{url: \\`${route}\\`, method: '${verb.toUpperCase()}'${headerOptions}${bodyOptions}${queryParamsOptions}${\n hasSignal\n ? `, ${\n isExactOptionalPropertyTypes\n ? '...(signal ? { signal }: {})'\n : 'signal'\n }`\n : ''\n }\\n }`;\n};\n\nexport const generateMutatorRequestOptions = (\n requestOptions: boolean | object | undefined,\n hasSecondArgument: boolean,\n) => {\n if (!hasSecondArgument) {\n return isObject(requestOptions)\n ? `{${stringify(requestOptions)?.slice(1, -1)}}`\n : '';\n }\n\n if (isObject(requestOptions)) {\n return `{${stringify(requestOptions)?.slice(1, -1)} ...options}`;\n }\n\n return 'options';\n};\n\nexport const generateFormDataAndUrlEncodedFunction = ({\n body,\n formData,\n formUrlEncoded,\n isFormData,\n isFormUrlEncoded,\n}: {\n body: GetterBody;\n formData?: GeneratorMutator;\n formUrlEncoded?: GeneratorMutator;\n isFormData: boolean;\n isFormUrlEncoded: boolean;\n}) => {\n if (isFormData && body.formData) {\n if (formData) {\n return `const formData = ${formData.name}(${body.implementation})`;\n }\n\n return body.formData;\n }\n\n if (isFormUrlEncoded && body.formUrlEncoded) {\n if (formUrlEncoded) {\n return `const formUrlEncoded = ${formUrlEncoded.name}(${body.implementation})`;\n }\n\n return body.formUrlEncoded;\n }\n\n return '';\n};\n","import type { ComponentsObject, ParameterObject } from 'openapi3-ts/oas30';\n\nimport { resolveObject, resolveRef } from '../resolvers';\nimport type { ContextSpecs, GeneratorSchema } from '../types';\nimport { jsDoc, pascal, sanitize } from '../utils';\n\nexport const generateParameterDefinition = (\n parameters: ComponentsObject['parameters'] = {},\n context: ContextSpecs,\n suffix: string,\n): GeneratorSchema[] => {\n return Object.entries(parameters).reduce<GeneratorSchema[]>(\n (acc, [parameterName, parameter]) => {\n const modelName = sanitize(`${pascal(parameterName)}${suffix}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n const { schema, imports } = resolveRef<ParameterObject>(\n parameter,\n context,\n );\n\n if (schema.in !== 'query' && schema.in !== 'header') {\n return acc;\n }\n\n if (!schema.schema || imports.length > 0) {\n acc.push({\n name: modelName,\n imports:\n imports.length > 0\n ? [\n {\n name: imports[0].name,\n specKey: imports[0].specKey,\n schemaName: imports[0].schemaName,\n },\n ]\n : [],\n model: `export type ${modelName} = ${\n imports.length > 0 ? imports[0].name : 'unknown'\n };\\n`,\n });\n\n return acc;\n }\n\n const resolvedObject = resolveObject({\n schema: schema.schema,\n propName: modelName,\n context,\n });\n\n const doc = jsDoc(parameter as ParameterObject);\n\n const model = `${doc}export type ${modelName} = ${\n resolvedObject.value || 'unknown'\n };\\n`;\n\n acc.push(...resolvedObject.schemas);\n\n if (modelName !== resolvedObject.value) {\n acc.push({\n name: modelName,\n model,\n imports: resolvedObject.imports,\n });\n }\n\n return acc;\n },\n [],\n );\n};\n","import type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getScalar } from '../getters';\nimport type { ContextSpecs } from '../types';\nimport { jsDoc } from '../utils';\n\n/**\n * Generate the interface string\n * An eslint comment is insert if the resulted object is empty\n *\n * @param name interface name\n * @param schema\n */\nexport const generateInterface = ({\n name,\n schema,\n context,\n suffix,\n}: {\n name: string;\n schema: SchemaObject;\n context: ContextSpecs;\n suffix: string;\n}) => {\n const scalar = getScalar({\n item: schema,\n name,\n context,\n });\n const isEmptyObject = scalar.value === '{}';\n\n let model = '';\n\n model += jsDoc(schema);\n\n if (isEmptyObject) {\n model +=\n '// eslint-disable-next-line @typescript-eslint/no-empty-interface\\n';\n }\n\n if (\n scalar.type === 'object' &&\n !context?.output.override?.useTypeOverInterfaces\n ) {\n if (\n scalar.type === 'object' &&\n schema.properties &&\n Object.values(schema.properties).length > 0 &&\n Object.values(schema.properties).every((item) => 'const' in item)\n ) {\n const mappedScalarValue = scalar.value\n .replaceAll(';', ',')\n .replaceAll('?:', ':');\n\n model += `export const ${name}Value = ${mappedScalarValue} as const;\\nexport type ${name} = typeof ${name}Value;\\n`;\n } else {\n const blankInterfaceValue =\n scalar.value === 'unknown' ? '{}' : scalar.value;\n\n model += `export interface ${name} ${blankInterfaceValue}\\n`;\n }\n } else {\n model += `export type ${name} = ${scalar.value};\\n`;\n }\n\n // Filter out imports that refer to the type defined in current file (OpenAPI recursive schema definitions)\n const externalModulesImportsOnly = scalar.imports.filter((importName) =>\n importName.alias ? importName.alias !== name : importName.name !== name,\n );\n\n return [\n ...scalar.schemas,\n {\n name,\n model,\n imports: externalModulesImportsOnly,\n },\n ];\n};\n","import isEmpty from 'lodash.isempty';\nimport type { SchemaObject, SchemasObject } from 'openapi3-ts/oas30';\n\nimport {\n getEnum,\n getEnumDescriptions,\n getEnumNames,\n resolveDiscriminators,\n} from '../getters';\nimport { resolveRef, resolveValue } from '../resolvers';\nimport type {\n ContextSpecs,\n GeneratorSchema,\n InputFiltersOption,\n} from '../types';\nimport {\n isReference,\n isString,\n jsDoc,\n pascal,\n sanitize,\n upath,\n} from '../utils';\nimport { generateInterface } from './interface';\n\n/**\n * Extract all types from #/components/schemas\n *\n * @param schemas\n */\nexport const generateSchemasDefinition = (\n schemas: SchemasObject = {},\n context: ContextSpecs,\n suffix: string,\n filters?: InputFiltersOption,\n): GeneratorSchema[] => {\n if (isEmpty(schemas)) {\n return [];\n }\n\n const transformedSchemas = resolveDiscriminators(schemas, context);\n\n let generateSchemas = Object.entries(transformedSchemas);\n if (filters?.schemas) {\n const schemasFilters = filters.schemas;\n const mode = filters.mode || 'include';\n\n generateSchemas = generateSchemas.filter(([schemaName]) => {\n const isMatch = schemasFilters.some((filter) =>\n isString(filter) ? filter === schemaName : filter.test(schemaName),\n );\n\n return mode === 'include' ? isMatch : !isMatch;\n });\n }\n\n const models = generateSchemas.reduce<GeneratorSchema[]>(\n (acc, [name, schema]) => {\n const schemaName = sanitize(`${pascal(name)}${suffix}`, {\n underscore: '_',\n whitespace: '_',\n dash: true,\n es5keyword: true,\n es5IdentifierName: true,\n });\n if (shouldCreateInterface(schema)) {\n acc.push(\n ...generateInterface({\n name: schemaName,\n schema,\n context,\n suffix,\n }),\n );\n\n return acc;\n } else {\n const resolvedValue = resolveValue({\n schema,\n name: schemaName,\n context,\n });\n\n let output = '';\n\n let imports = resolvedValue.imports;\n\n output += jsDoc(schema);\n\n if (resolvedValue.isEnum && !resolvedValue.isRef) {\n output += getEnum(\n resolvedValue.value,\n schemaName,\n getEnumNames(resolvedValue.originalSchema),\n context.output.override.enumGenerationType,\n getEnumDescriptions(resolvedValue.originalSchema),\n context.output.override.namingConvention?.enum,\n );\n } else if (schemaName === resolvedValue.value && resolvedValue.isRef) {\n // Don't add type if schema has same name and the referred schema will be an interface\n const { schema: referredSchema } = resolveRef(schema, context);\n if (!shouldCreateInterface(referredSchema as SchemaObject)) {\n const imp = resolvedValue.imports.find(\n (imp) => imp.name === schemaName,\n );\n\n if (imp) {\n const alias = imp?.specKey\n ? `${pascal(upath.getSpecName(imp.specKey, context.specKey))}${\n resolvedValue.value\n }`\n : `${resolvedValue.value}Bis`;\n\n output += `export type ${schemaName} = ${alias};\\n`;\n\n imports = imports.map((imp) =>\n imp.name === schemaName ? { ...imp, alias } : imp,\n );\n } else {\n output += `export type ${schemaName} = ${resolvedValue.value};\\n`;\n }\n }\n } else {\n resolvedValue.schemas = resolvedValue.schemas.filter((schema) => {\n if (schema.name !== schemaName) {\n return true;\n }\n\n output += `${schema.model}\\n`;\n imports = imports.concat(schema.imports);\n\n return false;\n });\n output += `export type ${schemaName} = ${resolvedValue.value};\\n`;\n }\n\n acc.push(...resolvedValue.schemas, {\n name: schemaName,\n model: output,\n imports,\n });\n\n return acc;\n }\n },\n [],\n );\n\n return models;\n};\n\nfunction shouldCreateInterface(schema: SchemaObject) {\n return (\n (!schema.type || schema.type === 'object') &&\n !schema.allOf &&\n !schema.oneOf &&\n !schema.anyOf &&\n !isReference(schema) &&\n !schema.nullable &&\n !schema.enum\n );\n}\n","import type {\n ComponentsObject,\n OperationObject,\n ParameterObject,\n PathItemObject,\n ReferenceObject,\n} from 'openapi3-ts/oas30';\n\nimport {\n getBody,\n getOperationId,\n getParameters,\n getParams,\n getProps,\n getQueryParams,\n getResponse,\n} from '../getters';\nimport type {\n ContextSpecs,\n GeneratorVerbOptions,\n GeneratorVerbsOptions,\n NormalizedInputOptions,\n NormalizedMutator,\n NormalizedOperationOptions,\n NormalizedOutputOptions,\n Verbs,\n} from '../types';\nimport {\n asyncReduce,\n camel,\n dynamicImport,\n isObject,\n isString,\n isVerb,\n jsDoc,\n mergeDeep,\n sanitize,\n} from '../utils';\nimport { generateMutator } from './mutator';\n\nconst generateVerbOptions = async ({\n verb,\n output,\n operation,\n route,\n pathRoute,\n verbParameters = [],\n context,\n}: {\n verb: Verbs;\n output: NormalizedOutputOptions;\n operation: OperationObject;\n route: string;\n pathRoute: string;\n verbParameters?: (ReferenceObject | ParameterObject)[];\n components?: ComponentsObject;\n context: ContextSpecs;\n}): Promise<GeneratorVerbOptions> => {\n const {\n responses,\n requestBody,\n parameters: operationParameters,\n tags = [],\n deprecated,\n description,\n summary,\n } = operation;\n const operationId = getOperationId(operation, route, verb);\n const overrideOperation = output.override.operations[operation.operationId!];\n const overrideTag = Object.entries(\n output.override.tags,\n ).reduce<NormalizedOperationOptions>(\n (acc, [tag, options]) =>\n tags.includes(tag) ? mergeDeep(acc, options) : acc,\n {},\n );\n\n const override = mergeDeep(\n mergeDeep(output.override, overrideTag),\n overrideOperation,\n );\n\n const overrideOperationName =\n overrideOperation?.operationName || output.override?.operationName;\n const operationName = overrideOperationName\n ? overrideOperationName(operation, route, verb)\n : sanitize(camel(operationId), { es5keyword: true });\n\n const response = getResponse({\n responses,\n operationName,\n context,\n contentType: override.contentType,\n });\n\n const body = getBody({\n requestBody: requestBody!,\n operationName,\n context,\n contentType: override.contentType,\n });\n\n const parameters = getParameters({\n parameters: [...verbParameters, ...(operationParameters ?? [])],\n context,\n });\n\n const queryParams = getQueryParams({\n queryParams: parameters.query,\n operationName,\n context,\n });\n\n const headers = output.headers\n ? await getQueryParams({\n queryParams: parameters.header,\n operationName,\n context,\n suffix: 'headers',\n })\n : undefined;\n\n const params = getParams({\n route,\n pathParams: parameters.path,\n operationId: operationId!,\n context,\n output,\n });\n\n const props = getProps({\n body,\n queryParams,\n params,\n headers,\n operationName,\n context,\n });\n\n const mutator = await generateMutator({\n output: output.target,\n name: operationName,\n mutator: override?.mutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n });\n\n const formData =\n !override.formData.disabled && body.formData\n ? await generateMutator({\n output: output.target,\n name: operationName,\n mutator: override.formData.mutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n\n const formUrlEncoded =\n isString(override?.formUrlEncoded) || isObject(override?.formUrlEncoded)\n ? await generateMutator({\n output: output.target,\n name: operationName,\n mutator: override.formUrlEncoded,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n\n const paramsSerializer =\n isString(override?.paramsSerializer) || isObject(override?.paramsSerializer)\n ? await generateMutator({\n output: output.target,\n name: 'paramsSerializer',\n mutator: override.paramsSerializer as NormalizedMutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n\n const fetchReviver =\n isString(override?.fetch.jsonReviver) ||\n isObject(override?.fetch.jsonReviver)\n ? await generateMutator({\n output: output.target,\n name: 'fetchReviver',\n mutator: override.fetch.jsonReviver as NormalizedMutator,\n workspace: context.workspace,\n tsconfig: context.output.tsconfig,\n })\n : undefined;\n const doc = jsDoc({ description, deprecated, summary });\n\n const verbOption: GeneratorVerbOptions = {\n verb: verb as Verbs,\n tags,\n route,\n pathRoute,\n summary: operation.summary,\n operationId: operationId!,\n operationName,\n response,\n body,\n headers,\n queryParams,\n params,\n props,\n mutator,\n formData,\n formUrlEncoded,\n paramsSerializer,\n fetchReviver,\n override,\n doc,\n deprecated,\n originalOperation: operation,\n };\n\n const transformer = await dynamicImport(\n override?.transformer,\n context.workspace,\n );\n\n return transformer ? transformer(verbOption) : verbOption;\n};\n\nexport const generateVerbsOptions = ({\n verbs,\n input,\n output,\n route,\n pathRoute,\n context,\n}: {\n verbs: PathItemObject;\n input: NormalizedInputOptions;\n output: NormalizedOutputOptions;\n route: string;\n pathRoute: string;\n context: ContextSpecs;\n}): Promise<GeneratorVerbsOptions> =>\n asyncReduce(\n _filteredVerbs(verbs, input.filters),\n async (acc, [verb, operation]: [string, OperationObject]) => {\n if (isVerb(verb)) {\n const verbOptions = await generateVerbOptions({\n verb,\n output,\n verbParameters: verbs.parameters,\n route,\n pathRoute,\n operation,\n context,\n });\n\n acc.push(verbOptions);\n }\n\n return acc;\n },\n [] as GeneratorVerbsOptions,\n );\n\nexport const _filteredVerbs = (\n verbs: PathItemObject,\n filters: NormalizedInputOptions['filters'],\n) => {\n if (filters?.tags === undefined) {\n return Object.entries(verbs);\n }\n\n const filterTags = filters.tags || [];\n const filterMode = filters.mode || 'include';\n\n return Object.entries(verbs).filter(\n ([_verb, operation]: [string, OperationObject]) => {\n const operationTags = operation.tags || [];\n\n const isMatch = operationTags.some((tag) =>\n filterTags.some((filterTag) =>\n filterTag instanceof RegExp ? filterTag.test(tag) : filterTag === tag,\n ),\n );\n\n return filterMode === 'exclude' ? !isMatch : isMatch;\n },\n );\n};\n","import fs from 'fs-extra';\n\nimport { generateImports } from '../generators';\nimport { type GeneratorSchema, NamingConvention } from '../types';\nimport { conventionName, upath } from '../utils';\n\nconst getSchema = ({\n schema: { imports, model },\n target,\n isRootKey,\n specsName,\n header,\n specKey,\n namingConvention = NamingConvention.CAMEL_CASE,\n}: {\n schema: GeneratorSchema;\n target: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n header: string;\n specKey: string;\n namingConvention?: NamingConvention;\n}): string => {\n let file = header;\n file += generateImports({\n imports: imports.filter(\n (imp) =>\n !model.includes(`type ${imp.alias || imp.name} =`) &&\n !model.includes(`interface ${imp.alias || imp.name} {`),\n ),\n target,\n isRootKey,\n specsName,\n specKey,\n namingConvention,\n });\n file += imports.length > 0 ? '\\n\\n' : '\\n';\n file += model;\n return file;\n};\n\nconst getPath = (path: string, name: string, fileExtension: string): string =>\n upath.join(path, `/${name}${fileExtension}`);\n\nexport const writeModelInline = (acc: string, model: string): string =>\n acc + `${model}\\n`;\n\nexport const writeModelsInline = (array: GeneratorSchema[]): string =>\n array.reduce((acc, { model }) => writeModelInline(acc, model), '');\n\nexport const writeSchema = async ({\n path,\n schema,\n target,\n namingConvention,\n fileExtension,\n specKey,\n isRootKey,\n specsName,\n header,\n}: {\n path: string;\n schema: GeneratorSchema;\n target: string;\n namingConvention: NamingConvention;\n fileExtension: string;\n specKey: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n header: string;\n}) => {\n const name = conventionName(schema.name, namingConvention);\n\n try {\n await fs.outputFile(\n getPath(path, name, fileExtension),\n getSchema({\n schema,\n target,\n isRootKey,\n specsName,\n header,\n specKey,\n namingConvention,\n }),\n );\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing schema ${name} => ${error}`,\n );\n }\n};\n\nexport const writeSchemas = async ({\n schemaPath,\n schemas,\n target,\n namingConvention,\n fileExtension,\n specKey,\n isRootKey,\n specsName,\n header,\n indexFiles,\n}: {\n schemaPath: string;\n schemas: GeneratorSchema[];\n target: string;\n namingConvention: NamingConvention;\n fileExtension: string;\n specKey: string;\n isRootKey: boolean;\n specsName: Record<string, string>;\n header: string;\n indexFiles: boolean;\n}) => {\n await Promise.all(\n schemas.map((schema) =>\n writeSchema({\n path: schemaPath,\n schema,\n target,\n namingConvention,\n fileExtension,\n specKey,\n isRootKey,\n specsName,\n header,\n }),\n ),\n );\n\n if (indexFiles) {\n const schemaFilePath = upath.join(schemaPath, `/index${fileExtension}`);\n await fs.ensureFile(schemaFilePath);\n\n // Ensure separate files are used for parallel schema writing.\n // Throw an exception, which list all duplicates, before attempting\n // multiple writes on the same file.\n const schemaNamesSet = new Set<string>();\n const duplicateNamesMap = new Map<string, number>();\n for (const schema of schemas) {\n if (schemaNamesSet.has(schema.name)) {\n duplicateNamesMap.set(\n schema.name,\n (duplicateNamesMap.get(schema.name) || 1) + 1,\n );\n } else {\n schemaNamesSet.add(schema.name);\n }\n }\n if (duplicateNamesMap.size > 0) {\n throw new Error(\n 'Duplicate schema names detected:\\n' +\n [...duplicateNamesMap]\n .map((duplicate) => ` ${duplicate[1]}x ${duplicate[0]}`)\n .join('\\n'),\n );\n }\n\n try {\n const data = await fs.readFile(schemaFilePath);\n\n const stringData = data.toString();\n\n const ext = fileExtension.endsWith('.ts')\n ? fileExtension.slice(0, -3)\n : fileExtension;\n\n const importStatements = schemas\n .filter((schema) => {\n const name = conventionName(schema.name, namingConvention);\n\n return (\n !stringData.includes(`export * from './${name}${ext}'`) &&\n !stringData.includes(`export * from \"./${name}${ext}\"`)\n );\n })\n .map(\n (schema) =>\n `export * from './${conventionName(schema.name, namingConvention)}${ext}';`,\n );\n\n const currentFileExports = (stringData\n .match(/export \\* from(.*)('|\")/g)\n ?.map((s) => s + ';') ?? []) as string[];\n\n const exports = [...currentFileExports, ...importStatements]\n .sort()\n .join('\\n');\n\n const fileContent = `${header}\\n${exports}`;\n\n await fs.writeFile(schemaFilePath, fileContent);\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing schema index file ${schemaFilePath} => ${error}`,\n );\n }\n }\n};\n","import uniqBy from 'lodash.uniqby';\n\nimport type { GeneratorImport, NormalizedOutputOptions } from '../types';\nimport { conventionName, upath } from '../utils';\n\nexport const generateImportsForBuilder = (\n output: NormalizedOutputOptions,\n imports: GeneratorImport[],\n relativeSchemasPath: string,\n) => {\n return output.schemas && !output.indexFiles\n ? uniqBy(imports, 'name').map((i) => {\n const name = conventionName(i.name, output.namingConvention);\n return {\n exports: [i],\n dependency: upath.joinSafe(relativeSchemasPath, name),\n };\n })\n : [{ exports: imports, dependency: relativeSchemasPath }];\n};\n","import {\n type GeneratorTarget,\n type GeneratorTargetFull,\n type NormalizedOutputOptions,\n OutputClient,\n type WriteSpecsBuilder,\n} from '../types';\nimport { compareVersions, pascal } from '../utils';\n\nexport const generateTarget = (\n builder: WriteSpecsBuilder,\n options: NormalizedOutputOptions,\n): GeneratorTarget => {\n const operationNames = Object.values(builder.operations).map(\n ({ operationName }) => operationName,\n );\n const isAngularClient = options?.client === OutputClient.ANGULAR;\n\n const titles = builder.title({\n outputClient: options.client,\n title: pascal(builder.info.title),\n customTitleFunc: options.override.title,\n output: options,\n });\n\n const target = Object.values(builder.operations).reduce<\n Required<GeneratorTargetFull>\n >(\n (acc, operation, index, arr) => {\n acc.imports.push(...operation.imports);\n acc.importsMock.push(...operation.importsMock);\n acc.implementation += operation.implementation + '\\n';\n acc.implementationMock.function += operation.implementationMock.function;\n acc.implementationMock.handler += operation.implementationMock.handler;\n\n const handlerNameSeparator =\n acc.implementationMock.handlerName.length > 0 ? ',\\n ' : ' ';\n acc.implementationMock.handlerName +=\n handlerNameSeparator + operation.implementationMock.handlerName + '()';\n\n if (operation.mutator) {\n acc.mutators.push(operation.mutator);\n }\n\n if (operation.formData) {\n acc.formData.push(operation.formData);\n }\n if (operation.formUrlEncoded) {\n acc.formUrlEncoded.push(operation.formUrlEncoded);\n }\n if (operation.paramsSerializer) {\n acc.paramsSerializer.push(operation.paramsSerializer);\n }\n\n if (operation.clientMutators) {\n acc.clientMutators.push(...operation.clientMutators);\n }\n\n if (operation.fetchReviver) {\n acc.fetchReviver.push(operation.fetchReviver);\n }\n\n if (index === arr.length - 1) {\n const isMutator = acc.mutators.some((mutator) =>\n isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n );\n\n const typescriptVersion =\n options.packageJson?.dependencies?.typescript ??\n options.packageJson?.devDependencies?.typescript ??\n '4.4.0';\n\n const hasAwaitedType = compareVersions(typescriptVersion, '4.5.0');\n\n const header = builder.header({\n outputClient: options.client,\n isRequestOptions: options.override.requestOptions !== false,\n isMutator,\n isGlobalMutator: !!options.override.mutator,\n provideIn: options.override.angular.provideIn,\n hasAwaitedType,\n titles,\n output: options,\n verbOptions: builder.verbOptions,\n clientImplementation: acc.implementation,\n });\n\n acc.implementation = header.implementation + acc.implementation;\n acc.implementationMock.handler =\n acc.implementationMock.handler +\n header.implementationMock +\n acc.implementationMock.handlerName;\n\n const footer = builder.footer({\n outputClient: options?.client,\n operationNames,\n hasMutator: acc.mutators.length > 0,\n hasAwaitedType,\n titles,\n output: options,\n });\n acc.implementation += footer.implementation;\n acc.implementationMock.handler += footer.implementationMock;\n }\n return acc;\n },\n {\n imports: [],\n implementation: '',\n implementationMock: {\n function: '',\n handler: '',\n handlerName: '',\n },\n importsMock: [],\n mutators: [],\n clientMutators: [],\n formData: [],\n formUrlEncoded: [],\n paramsSerializer: [],\n fetchReviver: [],\n },\n );\n\n return {\n ...target,\n implementationMock:\n target.implementationMock.function + target.implementationMock.handler,\n };\n};\n","export const getOrvalGeneratedTypes = () => `\n// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497\ntype IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <\nT,\n>() => T extends Y ? 1 : 2\n? A\n: B;\n\ntype WritableKeys<T> = {\n[P in keyof T]-?: IfEquals<\n { [Q in P]: T[P] },\n { -readonly [Q in P]: T[P] },\n P\n>;\n}[keyof T];\n\ntype UnionToIntersection<U> =\n (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;\ntype DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;\n\ntype Writable<T> = Pick<T, WritableKeys<T>>;\ntype NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {\n [P in keyof Writable<T>]: T[P] extends object\n ? NonReadonly<NonNullable<T[P]>>\n : T[P];\n} : DistributeReadOnlyOverUnions<T>;\n`;\n\nexport const getTypedResponse = () => `\ninterface TypedResponse<T> extends Response {\n json(): Promise<T>;\n}\n`;\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport type { WriteModeProps } from '../types';\nimport {\n conventionName,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n upath,\n} from '../utils';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTarget } from './target';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeSingleMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n try {\n const { path, dirname } = getFileInfo(output.target, {\n backupFilename: conventionName(\n builder.info.title,\n output.namingConvention,\n ),\n extension: output.fileExtension,\n });\n\n const {\n imports,\n importsMock,\n implementation,\n implementationMock,\n mutators,\n clientMutators,\n formData,\n formUrlEncoded,\n paramsSerializer,\n fetchReviver,\n } = generateTarget(builder, output);\n\n let data = header;\n\n const schemasPath = output.schemas\n ? upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : undefined;\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const importsForBuilder = schemasPath\n ? generateImportsForBuilder(\n output,\n imports.filter(\n (imp) => !importsMock.some((impMock) => imp.name === impMock.name),\n ),\n schemasPath,\n )\n : [];\n\n data += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n if (output.mock) {\n const importsMockForBuilder = schemasPath\n ? generateImportsForBuilder(output, importsMock, schemasPath)\n : [];\n data += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n }\n\n if (mutators) {\n data += generateMutatorImports({ mutators, implementation });\n }\n\n if (clientMutators) {\n data += generateMutatorImports({ mutators: clientMutators });\n }\n\n if (formData) {\n data += generateMutatorImports({ mutators: formData });\n }\n\n if (formUrlEncoded) {\n data += generateMutatorImports({ mutators: formUrlEncoded });\n }\n\n if (paramsSerializer) {\n data += generateMutatorImports({ mutators: paramsSerializer });\n }\n\n if (fetchReviver) {\n data += generateMutatorImports({ mutators: fetchReviver });\n }\n\n if (implementation.includes('NonReadonly<')) {\n data += getOrvalGeneratedTypes();\n data += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n data += getTypedResponse();\n data += '\\n';\n }\n\n if (!output.schemas && needSchema) {\n data += generateModelsInline(builder.schemas);\n }\n\n data += `${implementation.trim()}\\n`;\n\n if (output.mock) {\n data += '\\n\\n';\n data += implementationMock;\n }\n\n await fs.outputFile(path, data);\n\n return [path];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing file => ${error}`,\n );\n }\n};\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport { OutputClient, type WriteModeProps } from '../types';\nimport {\n conventionName,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTarget } from './target';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeSplitMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n try {\n const { filename, dirname, extension } = getFileInfo(output.target, {\n backupFilename: conventionName(\n builder.info.title,\n output.namingConvention,\n ),\n extension: output.fileExtension,\n });\n\n const {\n imports,\n implementation,\n implementationMock,\n importsMock,\n mutators,\n clientMutators,\n formData,\n formUrlEncoded,\n paramsSerializer,\n fetchReviver,\n } = generateTarget(builder, output);\n\n let implementationData = header;\n let mockData = header;\n\n const relativeSchemasPath = output.schemas\n ? upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : './' + filename + '.schemas';\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const importsForBuilder = generateImportsForBuilder(\n output,\n imports,\n relativeSchemasPath,\n );\n\n implementationData += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n const importsMockForBuilder = generateImportsForBuilder(\n output,\n importsMock,\n relativeSchemasPath,\n );\n\n mockData += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n\n const schemasPath = output.schemas\n ? undefined\n : upath.join(dirname, filename + '.schemas' + extension);\n\n if (schemasPath && needSchema) {\n const schemasData = header + generateModelsInline(builder.schemas);\n\n await fs.outputFile(\n upath.join(dirname, filename + '.schemas' + extension),\n schemasData,\n );\n }\n\n if (mutators) {\n implementationData += generateMutatorImports({\n mutators,\n implementation,\n });\n }\n\n if (clientMutators) {\n implementationData += generateMutatorImports({\n mutators: clientMutators,\n });\n }\n\n if (formData) {\n implementationData += generateMutatorImports({ mutators: formData });\n }\n\n if (formUrlEncoded) {\n implementationData += generateMutatorImports({\n mutators: formUrlEncoded,\n });\n }\n\n if (paramsSerializer) {\n implementationData += generateMutatorImports({\n mutators: paramsSerializer,\n });\n }\n\n if (fetchReviver) {\n implementationData += generateMutatorImports({\n mutators: fetchReviver,\n });\n }\n\n if (implementation.includes('NonReadonly<')) {\n implementationData += getOrvalGeneratedTypes();\n implementationData += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n implementationData += getTypedResponse();\n implementationData += '\\n';\n }\n\n implementationData += `\\n${implementation}`;\n mockData += `\\n${implementationMock}`;\n\n const implementationFilename =\n filename +\n (OutputClient.ANGULAR === output.client ? '.service' : '') +\n extension;\n\n const implementationPath = upath.join(dirname, implementationFilename);\n await fs.outputFile(\n upath.join(dirname, implementationFilename),\n implementationData,\n );\n\n const mockPath = output.mock\n ? upath.join(\n dirname,\n filename +\n '.' +\n getMockFileExtensionByTypeName(output.mock) +\n extension,\n )\n : undefined;\n\n if (mockPath) {\n await fs.outputFile(mockPath, mockData);\n }\n\n return [\n implementationPath,\n ...(schemasPath ? [schemasPath] : []),\n ...(mockPath ? [mockPath] : []),\n ];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while splitting => ${error}`,\n );\n }\n};\n","import {\n type GeneratorOperation,\n type GeneratorTarget,\n type GeneratorTargetFull,\n type NormalizedOutputOptions,\n OutputClient,\n type WriteSpecsBuilder,\n} from '../types';\nimport { compareVersions, kebab, pascal } from '../utils';\n\nconst addDefaultTagIfEmpty = (operation: GeneratorOperation) => ({\n ...operation,\n tags: operation.tags.length > 0 ? operation.tags : ['default'],\n});\n\nconst generateTargetTags = (\n currentAcc: Record<string, GeneratorTargetFull>,\n operation: GeneratorOperation,\n): Record<string, GeneratorTargetFull> => {\n const tag = kebab(operation.tags[0]);\n const currentOperation = currentAcc[tag];\n\n if (!currentOperation) {\n currentAcc[tag] = {\n imports: operation.imports,\n importsMock: operation.importsMock,\n mutators: operation.mutator ? [operation.mutator] : [],\n clientMutators: operation.clientMutators ?? [],\n formData: operation.formData ? [operation.formData] : [],\n formUrlEncoded: operation.formUrlEncoded\n ? [operation.formUrlEncoded]\n : [],\n paramsSerializer: operation.paramsSerializer\n ? [operation.paramsSerializer]\n : [],\n fetchReviver: operation.fetchReviver ? [operation.fetchReviver] : [],\n implementation: operation.implementation,\n implementationMock: {\n function: operation.implementationMock.function,\n handler: operation.implementationMock.handler,\n handlerName: ' ' + operation.implementationMock.handlerName + '()',\n },\n };\n\n return currentAcc;\n }\n\n currentAcc[tag] = {\n implementation: currentOperation.implementation + operation.implementation,\n imports: [...currentOperation.imports, ...operation.imports],\n importsMock: [...currentOperation.importsMock, ...operation.importsMock],\n implementationMock: {\n function:\n currentOperation.implementationMock.function +\n operation.implementationMock.function,\n handler:\n currentOperation.implementationMock.handler +\n operation.implementationMock.handler,\n handlerName:\n currentOperation.implementationMock.handlerName +\n ',\\n ' +\n operation.implementationMock.handlerName +\n '()',\n },\n mutators: operation.mutator\n ? [...(currentOperation.mutators ?? []), operation.mutator]\n : currentOperation.mutators,\n clientMutators: operation.clientMutators\n ? [\n ...(currentOperation.clientMutators ?? []),\n ...operation.clientMutators,\n ]\n : currentOperation.clientMutators,\n formData: operation.formData\n ? [...(currentOperation.formData ?? []), operation.formData]\n : currentOperation.formData,\n formUrlEncoded: operation.formUrlEncoded\n ? [...(currentOperation.formUrlEncoded ?? []), operation.formUrlEncoded]\n : currentOperation.formUrlEncoded,\n paramsSerializer: operation.paramsSerializer\n ? [\n ...(currentOperation.paramsSerializer ?? []),\n operation.paramsSerializer,\n ]\n : currentOperation.paramsSerializer,\n fetchReviver: operation.fetchReviver\n ? [...(currentOperation.fetchReviver ?? []), operation.fetchReviver]\n : currentOperation.fetchReviver,\n };\n return currentAcc;\n};\n\nexport const generateTargetForTags = (\n builder: WriteSpecsBuilder,\n options: NormalizedOutputOptions,\n) => {\n const isAngularClient = options.client === OutputClient.ANGULAR;\n\n const allTargetTags = Object.values(builder.operations)\n .map(addDefaultTagIfEmpty)\n .reduce<Record<string, GeneratorTargetFull>>(\n (acc, operation, index, arr) => {\n const targetTags = generateTargetTags(acc, operation);\n\n if (index === arr.length - 1) {\n return Object.entries(targetTags).reduce<\n Record<string, GeneratorTargetFull>\n >((acc, [tag, target]) => {\n const isMutator = !!target.mutators?.some((mutator) =>\n isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n );\n const operationNames = Object.values(builder.operations)\n // Operations can have multiple tags, but they are grouped by the first\n // tag, therefore we only want to handle the case where the tag\n // is the first in the list of tags.\n .filter(({ tags }) => tags.map(kebab).indexOf(kebab(tag)) === 0)\n .map(({ operationName }) => operationName);\n\n const typescriptVersion =\n options.packageJson?.dependencies?.typescript ??\n options.packageJson?.devDependencies?.typescript ??\n '4.4.0';\n\n const hasAwaitedType = compareVersions(typescriptVersion, '4.5.0');\n\n const titles = builder.title({\n outputClient: options.client,\n title: pascal(tag),\n customTitleFunc: options.override.title,\n output: options,\n });\n\n const footer = builder.footer({\n outputClient: options?.client,\n operationNames,\n hasMutator: !!target.mutators?.length,\n hasAwaitedType,\n titles,\n output: options,\n });\n\n const header = builder.header({\n outputClient: options.client,\n isRequestOptions: options.override.requestOptions !== false,\n isMutator,\n isGlobalMutator: !!options.override.mutator,\n provideIn: options.override.angular.provideIn,\n hasAwaitedType,\n titles,\n output: options,\n verbOptions: builder.verbOptions,\n tag,\n clientImplementation: target.implementation,\n });\n\n acc[tag] = {\n implementation:\n header.implementation +\n target.implementation +\n footer.implementation,\n implementationMock: {\n function: target.implementationMock.function,\n handler:\n target.implementationMock.handler +\n header.implementationMock +\n target.implementationMock.handlerName +\n footer.implementationMock,\n handlerName: target.implementationMock.handlerName,\n },\n imports: target.imports,\n importsMock: target.importsMock,\n mutators: target.mutators,\n clientMutators: target.clientMutators,\n formData: target.formData,\n formUrlEncoded: target.formUrlEncoded,\n paramsSerializer: target.paramsSerializer,\n fetchReviver: target.fetchReviver,\n };\n\n return acc;\n }, {});\n }\n\n return targetTags;\n },\n {},\n );\n\n return Object.entries(allTargetTags).reduce<Record<string, GeneratorTarget>>(\n (acc, [tag, target]) => {\n acc[tag] = {\n ...target,\n implementationMock:\n target.implementationMock.function +\n target.implementationMock.handler,\n };\n\n return acc;\n },\n {},\n );\n};\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport { OutputClient, type WriteModeProps } from '../types';\nimport {\n camel,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n pascal,\n upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTargetForTags } from './target-tags';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeSplitTagsMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n const { filename, dirname, extension } = getFileInfo(output.target, {\n backupFilename: camel(builder.info.title),\n extension: output.fileExtension,\n });\n\n const target = generateTargetForTags(builder, output);\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const indexFilePath =\n output.mock && !isFunction(output.mock) && output.mock.indexMockFiles\n ? upath.join(\n dirname,\n 'index.' + getMockFileExtensionByTypeName(output.mock!) + extension,\n )\n : undefined;\n if (indexFilePath) {\n await fs.outputFile(indexFilePath, '');\n }\n\n const generatedFilePathsArray = await Promise.all(\n Object.entries(target).map(async ([tag, target]) => {\n try {\n const {\n imports,\n implementation,\n implementationMock,\n importsMock,\n mutators,\n clientMutators,\n formData,\n fetchReviver,\n formUrlEncoded,\n paramsSerializer,\n } = target;\n\n let implementationData = header;\n let mockData = header;\n\n const relativeSchemasPath = output.schemas\n ? '../' +\n upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : '../' + filename + '.schemas';\n\n const importsForBuilder = generateImportsForBuilder(\n output,\n imports,\n relativeSchemasPath,\n );\n\n implementationData += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n const importsMockForBuilder = generateImportsForBuilder(\n output,\n importsMock,\n relativeSchemasPath,\n );\n\n mockData += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n\n const schemasPath = output.schemas\n ? undefined\n : upath.join(dirname, filename + '.schemas' + extension);\n\n if (schemasPath && needSchema) {\n const schemasData = header + generateModelsInline(builder.schemas);\n\n await fs.outputFile(schemasPath, schemasData);\n }\n\n if (mutators) {\n implementationData += generateMutatorImports({\n mutators,\n implementation,\n oneMore: true,\n });\n }\n\n if (clientMutators) {\n implementationData += generateMutatorImports({\n mutators: clientMutators,\n oneMore: true,\n });\n }\n\n if (formData) {\n implementationData += generateMutatorImports({\n mutators: formData,\n oneMore: true,\n });\n }\n if (formUrlEncoded) {\n implementationData += generateMutatorImports({\n mutators: formUrlEncoded,\n oneMore: true,\n });\n }\n if (paramsSerializer) {\n implementationData += generateMutatorImports({\n mutators: paramsSerializer,\n oneMore: true,\n });\n }\n\n if (fetchReviver) {\n implementationData += generateMutatorImports({\n mutators: fetchReviver,\n oneMore: true,\n });\n }\n\n if (implementation.includes('NonReadonly<')) {\n implementationData += getOrvalGeneratedTypes();\n implementationData += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n implementationData += getTypedResponse();\n implementationData += '\\n';\n }\n\n implementationData += `\\n${implementation}`;\n mockData += `\\n${implementationMock}`;\n\n const implementationFilename =\n tag +\n (OutputClient.ANGULAR === output.client ? '.service' : '') +\n extension;\n\n const implementationPath = upath.join(\n dirname,\n tag,\n implementationFilename,\n );\n await fs.outputFile(implementationPath, implementationData);\n\n const mockPath = output.mock\n ? upath.join(\n dirname,\n tag,\n tag +\n '.' +\n getMockFileExtensionByTypeName(output.mock) +\n extension,\n )\n : undefined;\n\n if (mockPath) {\n await fs.outputFile(mockPath, mockData);\n if (indexFilePath) {\n const localMockPath = upath.joinSafe(\n './',\n tag,\n tag + '.' + getMockFileExtensionByTypeName(output.mock!),\n );\n fs.appendFile(\n indexFilePath,\n `export { get${pascal(tag)}Mock } from '${localMockPath}'\\n`,\n );\n }\n }\n\n return [\n implementationPath,\n ...(schemasPath ? [schemasPath] : []),\n ...(mockPath ? [mockPath] : []),\n ];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while splitting tag ${tag} => ${error}`,\n );\n }\n }),\n );\n\n return generatedFilePathsArray.flat();\n};\n","import fs from 'fs-extra';\n\nimport { generateModelsInline, generateMutatorImports } from '../generators';\nimport type { WriteModeProps } from '../types';\nimport {\n camel,\n getFileInfo,\n isFunction,\n isSyntheticDefaultImportsAllow,\n kebab,\n upath,\n} from '../utils';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport { generateTargetForTags } from './target-tags';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\nexport const writeTagsMode = async ({\n builder,\n output,\n specsName,\n header,\n needSchema,\n}: WriteModeProps): Promise<string[]> => {\n const { filename, dirname, extension } = getFileInfo(output.target, {\n backupFilename: camel(builder.info.title),\n extension: output.fileExtension,\n });\n\n const target = generateTargetForTags(builder, output);\n\n const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n output.tsconfig,\n );\n\n const generatedFilePathsArray = await Promise.all(\n Object.entries(target).map(async ([tag, target]) => {\n try {\n const {\n imports,\n implementation,\n implementationMock,\n importsMock,\n mutators,\n clientMutators,\n formData,\n formUrlEncoded,\n fetchReviver,\n paramsSerializer,\n } = target;\n\n let data = header;\n\n const schemasPathRelative = output.schemas\n ? upath.relativeSafe(\n dirname,\n getFileInfo(output.schemas, { extension: output.fileExtension })\n .dirname,\n )\n : './' + filename + '.schemas';\n\n const importsForBuilder = generateImportsForBuilder(\n output,\n imports.filter(\n (imp) => !importsMock.some((impMock) => imp.name === impMock.name),\n ),\n schemasPathRelative,\n );\n\n data += builder.imports({\n client: output.client,\n implementation,\n imports: importsForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator: !!output.override.mutator,\n hasTagsMutator: Object.values(output.override.tags).some(\n (tag) => !!tag.mutator,\n ),\n hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n packageJson: output.packageJson,\n output,\n });\n\n if (output.mock) {\n const importsMockForBuilder = generateImportsForBuilder(\n output,\n importsMock,\n schemasPathRelative,\n );\n\n data += builder.importsMock({\n implementation: implementationMock,\n imports: importsMockForBuilder,\n specsName,\n hasSchemaDir: !!output.schemas,\n isAllowSyntheticDefaultImports,\n options: isFunction(output.mock) ? undefined : output.mock,\n });\n }\n\n const schemasPath = output.schemas\n ? undefined\n : upath.join(dirname, filename + '.schemas' + extension);\n\n if (schemasPath && needSchema) {\n const schemasData = header + generateModelsInline(builder.schemas);\n\n await fs.outputFile(schemasPath, schemasData);\n }\n\n if (mutators) {\n data += generateMutatorImports({ mutators, implementation });\n }\n\n if (clientMutators) {\n data += generateMutatorImports({\n mutators: clientMutators,\n });\n }\n\n if (formData) {\n data += generateMutatorImports({ mutators: formData });\n }\n\n if (formUrlEncoded) {\n data += generateMutatorImports({ mutators: formUrlEncoded });\n }\n\n if (paramsSerializer) {\n data += generateMutatorImports({ mutators: paramsSerializer });\n }\n\n if (fetchReviver) {\n data += generateMutatorImports({ mutators: fetchReviver });\n }\n\n data += '\\n\\n';\n\n if (implementation.includes('NonReadonly<')) {\n data += getOrvalGeneratedTypes();\n data += '\\n';\n }\n\n if (implementation.includes('TypedResponse<')) {\n data += getTypedResponse();\n data += '\\n';\n }\n\n data += implementation;\n\n if (output.mock) {\n data += '\\n\\n';\n\n data += implementationMock;\n }\n\n const implementationPath = upath.join(\n dirname,\n `${kebab(tag)}${extension}`,\n );\n await fs.outputFile(implementationPath, data);\n\n return [implementationPath, ...(schemasPath ? [schemasPath] : [])];\n } catch (error) {\n throw new Error(\n `Oups... 🍻. An Error occurred while writing tag ${tag} => ${error}`,\n );\n }\n }),\n );\n\n return generatedFilePathsArray.flat();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsLA,MAAa,oBAAoB;CAC/B,cAAc;CACd,eAAe;CAChB;AAKD,MAAa,mBAAmB;CAC9B,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,YAAY;CACb;AAKD,MAAa,iBAAiB;CAC5B,OAAO;CACP,MAAM;CACN,OAAO;CACR;AAoDD,MAAa,eAAe;CAC1B,SAAS;CACT,OAAO;CACP,iBAAiB;CACjB,aAAa;CACb,cAAc;CACd,WAAW;CACX,KAAK;CACL,KAAK;CACL,MAAM;CACN,OAAO;CACP,KAAK;CACN;AAID,MAAa,mBAAmB;CAC9B,OAAO;CACP,OAAO;CACR;AAKD,MAAa,aAAa;CACxB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,YAAY;CACb;AASD,MAAa,iBAAiB,EAC5B,KAAK,OACN;AAkFD,MAAa,wBAAwB;CACnC,WAAW;CACX,SAAS;CACT,yBAAyB;CAC1B;AA0TD,MAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACP;AAqVD,MAAa,iBAAiB;CAC5B,OAAO;CACP,mBAAmB;CACnB,MAAM;CACN,aAAa;CACb,QAAQ;CACT;AA6BD,MAAa,aAAa;CACxB,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,MAAM;CACN,OAAO;CACP,MAAM;CACN,SAAS;CACV;AAsID,IAAa,eAAb,cAAkC,MAAM;CACtC;CACA,YAAY,SAAiB,KAAa,SAAwB;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