UNPKG

@hey-api/openapi-ts

Version:

🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.

1,702 lines (1,700 loc) • 51.4 kB
import { C as Client$1, D as LazyOrAsync, E as IR, O as MaybeArray, S as Client$3, T as StringCase, _ as Client$2, a as Plugin, b as Client$5, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as Client, x as Client$4, y as Client$6 } from "./config-CNi83ZTD.js"; import "@hey-api/codegen-core"; import * as typescript0 from "typescript"; import ts from "typescript"; //#region src/generate.d.ts /** * Generate a client from the provided configuration. * * @param userConfig User provided {@link UserConfig} configuration(s). */ declare const createClient: (userConfig?: LazyOrAsync<MaybeArray<UserConfig>>, logger?: Logger) => Promise<ReadonlyArray<Context>>; //#endregion //#region src/config/parser.d.ts declare const defaultPaginationKeywords: readonly ["after", "before", "cursor", "offset", "page", "start"]; //#endregion //#region src/config/plugins.d.ts /** * Default plugins used to generate artifacts if plugins aren't specified. */ declare const defaultPlugins: readonly ["@hey-api/typescript", "@hey-api/sdk"]; //#endregion //#region src/plugins/@hey-api/client-core/config.d.ts declare const clientDefaultConfig: { readonly baseUrl: true; readonly bundle: true; readonly exportFromIndex: false; }; declare const clientDefaultMeta: { readonly dependencies: readonly ["@hey-api/typescript"]; readonly tags: readonly ["client"]; }; //#endregion //#region src/plugins/@hey-api/client-core/plugin.d.ts declare const clientPluginHandler: ({ plugin }: Parameters<PluginHandler>[0]) => void; //#endregion //#region src/plugins/shared/utils/config.d.ts declare const definePluginConfig: <T extends Plugin.Types>(defaultConfig: Plugin.Config<T>) => (userConfig?: Omit<T["config"], "name">) => Omit<Plugin.Config<T>, "name"> & { /** * Cast name to `any` so it doesn't throw type error in `plugins` array. * We could allow any `string` as plugin `name` in the object syntax, but * that TypeScript trick would cause all string methods to appear as * suggested auto completions, which is undesirable. */ name: any; }; declare namespace types_d_exports { export { AccessLevel, FunctionParameter, FunctionTypeParameter, ObjectValue, SyntaxKindKeyword, createAnonymousFunction, createArrayLiteralExpression, createArrowFunction, createAsExpression, createAssignment, createAwaitExpression, createBlock, createConditionalExpression, createEnumDeclaration, createForOfStatement, createFunctionTypeNode, createGetAccessorDeclaration, createIndexedAccessTypeNode, createKeywordTypeNode, createLiteralTypeNode, createMappedTypeNode, createNamespaceDeclaration, createNewExpression, createNull, createObjectType, createParameterDeclaration, createPropertyAccessChain, createPropertyAccessExpression, createPropertyAssignment, createRegularExpressionLiteral, createStringLiteral, createTemplateLiteralType, createTypeAliasDeclaration, createTypeNode, createTypeOfExpression, createTypeOperatorNode, createTypeParameterDeclaration, createTypeParenthesizedNode, createTypeReferenceNode, syntaxKindKeyword, toExpression, toParameterDeclarations, toTypeParameters }; } type AccessLevel = 'private' | 'protected' | 'public'; type FunctionParameter = { accessLevel?: AccessLevel; default?: any; isReadOnly?: boolean; isRequired?: boolean; name: string; type?: any | ts.TypeNode; } | { destructure: ReadonlyArray<FunctionParameter>; type?: any | ts.TypeNode; }; interface FunctionTypeParameter { default?: any; extends?: string | ts.TypeNode; name: string | ts.Identifier; } declare const createTypeNode: (base: any | ts.TypeNode, args?: (any | ts.TypeNode)[]) => ts.TypeNode; declare const createPropertyAccessChain: ({ expression, name }: { expression: ts.Expression; name: string | ts.MemberName; }) => ts.PropertyAccessChain; declare const createPropertyAccessExpression: ({ expression, isOptional, name }: { expression: string | ts.Expression; isOptional?: boolean; name: string | number | ts.MemberName; }) => ts.PropertyAccessChain | ts.PropertyAccessExpression | ts.ElementAccessExpression; declare const createNull: () => ts.NullLiteral; /** * Convert an unknown value to an expression. * @param identifiers - list of keys that are treated as identifiers. * @param shorthand - if shorthand syntax is allowed. * @param unescape - if string should be unescaped. * @param value - the unknown value. * @returns ts.Expression */ declare const toExpression: <T = unknown>({ identifiers, isValueAccess, shorthand, unescape, value }: { identifiers?: string[]; isValueAccess?: boolean; shorthand?: boolean; unescape?: boolean; value: T; }) => ts.Expression | undefined; /** * Convert parameters to the declaration array expected by TypeScript * Compiler API. * @param parameters - the parameters to convert to declarations * @returns ts.ParameterDeclaration[] */ declare const toParameterDeclarations: (parameters: ReadonlyArray<FunctionParameter>) => ts.ParameterDeclaration[]; type SyntaxKindKeyword = 'any' | 'async' | 'boolean' | 'export' | 'never' | 'number' | 'private' | 'protected' | 'public' | 'readonly' | 'static' | 'string' | 'undefined' | 'unknown' | 'void'; declare const syntaxKindKeyword: <T extends SyntaxKindKeyword>({ keyword }: { keyword: T; }) => T extends "protected" ? ts.SyntaxKind.ProtectedKeyword : T extends "public" ? ts.SyntaxKind.PublicKeyword : T extends "private" ? ts.SyntaxKind.PrivateKeyword : T extends "export" ? ts.SyntaxKind.ExportKeyword : T extends "async" ? ts.SyntaxKind.ExportKeyword : T extends "readonly" ? ts.SyntaxKind.ExportKeyword : T extends "static" ? ts.SyntaxKind.ExportKeyword : ts.SyntaxKind.AnyKeyword | ts.SyntaxKind.BooleanKeyword | ts.SyntaxKind.NeverKeyword | ts.SyntaxKind.NumberKeyword | ts.SyntaxKind.StringKeyword | ts.SyntaxKind.UndefinedKeyword | ts.SyntaxKind.UnknownKeyword | ts.SyntaxKind.VoidKeyword; declare const createKeywordTypeNode: ({ keyword }: { keyword: Extract<SyntaxKindKeyword, "any" | "boolean" | "never" | "number" | "string" | "undefined" | "unknown" | "void">; }) => ts.KeywordTypeNode<ts.SyntaxKind.VoidKeyword | ts.SyntaxKind.AnyKeyword | ts.SyntaxKind.BooleanKeyword | ts.SyntaxKind.NeverKeyword | ts.SyntaxKind.NumberKeyword | ts.SyntaxKind.StringKeyword | ts.SyntaxKind.UndefinedKeyword | ts.SyntaxKind.UnknownKeyword>; declare const toTypeParameters: (types: (FunctionTypeParameter | ts.TypeParameterDeclaration)[]) => ts.TypeParameterDeclaration[]; declare const createTypeOperatorNode: ({ operator, type }: { operator: "keyof" | "readonly" | "unique"; type: ts.TypeNode; }) => ts.TypeOperatorNode; declare const createTypeParameterDeclaration: ({ constraint, defaultType, modifiers, name }: { constraint?: ts.TypeNode; defaultType?: ts.TypeNode; modifiers?: Array<ts.Modifier>; name: string | ts.Identifier; }) => ts.TypeParameterDeclaration; declare const createMappedTypeNode: ({ members, nameType, questionToken, readonlyToken, type, typeParameter }: { members?: ts.NodeArray<ts.TypeElement>; nameType?: ts.TypeNode; questionToken?: ts.QuestionToken | ts.PlusToken | ts.MinusToken; readonlyToken?: ts.ReadonlyKeyword | ts.PlusToken | ts.MinusToken; type?: ts.TypeNode; typeParameter: ts.TypeParameterDeclaration; }) => ts.MappedTypeNode; declare const createLiteralTypeNode: ({ literal }: { literal: ts.LiteralTypeNode["literal"]; }) => ts.LiteralTypeNode; /** * Create arrow function type expression. */ declare const createArrowFunction: ({ async, comment, multiLine, parameters, returnType, statements, types }: { async?: boolean; comment?: Comments; multiLine?: boolean; parameters?: ReadonlyArray<FunctionParameter>; returnType?: string | ts.TypeNode; statements?: ts.Statement[] | ts.Expression; types?: FunctionTypeParameter[]; }) => ts.ArrowFunction; /** * Create anonymous function type expression. */ declare const createAnonymousFunction: ({ async, comment, multiLine, parameters, returnType, statements, types }: { async?: boolean; comment?: Comments; multiLine?: boolean; parameters?: FunctionParameter[]; returnType?: string | ts.TypeNode; statements?: ReadonlyArray<ts.Statement>; types?: FunctionTypeParameter[]; }) => ts.FunctionExpression; /** * Create Array type expression. */ declare const createArrayLiteralExpression: <T>({ elements, multiLine }: { /** * The array to create. */ elements: T[]; /** * Should the array be multi line? * * @default false */ multiLine?: boolean; }) => ts.ArrayLiteralExpression; declare const createAwaitExpression: ({ expression }: { expression: ts.Expression; }) => ts.AwaitExpression; declare const createFunctionTypeNode: ({ parameters, returnType, typeParameters }: { parameters?: ts.ParameterDeclaration[]; returnType: ts.TypeNode; typeParameters?: ts.TypeParameterDeclaration[]; }) => ts.FunctionTypeNode; type ObjectValue = { assertion?: 'any' | ts.TypeNode; comments?: Comments; spread: string; } | { comments?: Comments; isValueAccess?: boolean; key: string; shorthand?: boolean; value: any; }; /** * Create Object type expression. * @param comments - comments to add to each property. * @param identifier - keys that should be treated as identifiers. * @param multiLine - if the object should be multiline. * @param obj - the object to create expression with. * @param shorthand - if shorthand syntax should be used. * @param unescape - if properties strings should be unescaped. * @returns ts.ObjectLiteralExpression */ declare const createObjectType: <T extends Record<string, any> | Array<ObjectValue>>({ comments, identifiers, multiLine, obj, shorthand, unescape }: { comments?: Comments; identifiers?: string[]; multiLine?: boolean; obj: T; shorthand?: boolean; unescape?: boolean; }) => ts.ObjectLiteralExpression; /** * Create enum declaration. Example `export enum T = { X, Y };` * @param asConst - whether to use const enums. * @param comments - comments to add to each property. * @param leadingComment - leading comment to add to enum. * @param name - the name of the enum. * @param obj - the object representing the enum. * @returns ts.EnumDeclaration */ declare const createEnumDeclaration: <T extends Record<string, any> | Array<ObjectValue>>({ asConst, comments: enumMemberComments, leadingComment: comments, name, obj }: { asConst: boolean; comments?: Record<string | number, Comments>; leadingComment?: Comments; name: string | ts.TypeReferenceNode; obj: T; }) => ts.EnumDeclaration; /** * Create namespace declaration. Example `export namespace MyNamespace { ... }` * @param name - the name of the namespace. * @param nodes - the nodes in the namespace. * @returns */ declare const createNamespaceDeclaration: ({ name, statements }: { name: string; statements: Array<ts.Statement>; }) => ts.ModuleDeclaration; declare const createIndexedAccessTypeNode: ({ indexType, objectType }: { indexType: ts.TypeNode; objectType: ts.TypeNode; }) => ts.IndexedAccessTypeNode; declare const createGetAccessorDeclaration: ({ modifiers, name, returnType, statements }: { modifiers?: Modifier | ReadonlyArray<Modifier>; name: string | ts.PropertyName; returnType?: string | ts.Identifier; statements: ReadonlyArray<ts.Statement>; }) => ts.GetAccessorDeclaration; declare const createStringLiteral: ({ isSingleQuote, text }: { isSingleQuote?: boolean; text: string; }) => ts.StringLiteral; declare const createConditionalExpression: ({ condition, whenFalse, whenTrue }: { condition: ts.Expression; whenFalse: ts.Expression; whenTrue: ts.Expression; }) => ts.ConditionalExpression; declare const createTypeOfExpression: ({ text }: { text: string | ts.Identifier; }) => ts.TypeOfExpression; /** * Create a type alias declaration. Example `export type X = Y;`. * @param comment (optional) comments to add * @param name the name of the type * @param type the type * @returns ts.TypeAliasDeclaration */ declare const createTypeAliasDeclaration: ({ comment, exportType, name, type, typeParameters }: { comment?: Comments; exportType?: boolean; name: string | ts.TypeReferenceNode; type: string | ts.TypeNode | ts.Identifier; typeParameters?: FunctionTypeParameter[]; }) => ts.TypeAliasDeclaration; declare const createTypeReferenceNode: ({ typeArguments, typeName }: { typeArguments?: ts.TypeNode[]; typeName: string | ts.EntityName; }) => ts.TypeReferenceNode; declare const createTypeParenthesizedNode: ({ type }: { type: ts.TypeNode; }) => ts.ParenthesizedTypeNode; declare const createParameterDeclaration: ({ initializer, modifiers, name, required, type }: { initializer?: ts.Expression; modifiers?: ReadonlyArray<ts.ModifierLike>; name: string | ts.BindingName; required?: boolean; type?: ts.TypeNode; }) => ts.ParameterDeclaration; declare const createNewExpression: ({ argumentsArray, expression, typeArguments }: { argumentsArray?: Array<ts.Expression>; expression: ts.Expression; typeArguments?: Array<ts.TypeNode>; }) => ts.NewExpression; declare const createForOfStatement: ({ awaitModifier, expression, initializer, statement }: { awaitModifier?: ts.AwaitKeyword; expression: ts.Expression; initializer: ts.ForInitializer; statement: ts.Statement; }) => ts.ForOfStatement; declare const createAssignment: ({ left, right }: { left: ts.Expression; right: ts.Expression; }) => ts.AssignmentExpression<ts.EqualsToken>; declare const createBlock: ({ multiLine, statements }: { multiLine?: boolean; statements: ReadonlyArray<ts.Statement>; }) => ts.Block; declare const createPropertyAssignment: ({ initializer, name }: { initializer: ts.Expression; name: string | ts.PropertyName; }) => ts.PropertyAssignment; declare const createRegularExpressionLiteral: ({ flags, text }: { flags?: ReadonlyArray<"g" | "i" | "m" | "s" | "u" | "y">; text: string; }) => ts.RegularExpressionLiteral; declare const createAsExpression: ({ expression, type }: { expression: ts.Expression; type: ts.TypeNode; }) => ts.AsExpression; declare const createTemplateLiteralType: ({ value }: { value: ReadonlyArray<string | ts.TypeNode>; }) => ts.TemplateLiteralTypeNode; //#endregion //#region src/tsc/utils.d.ts interface ImportExportItemObject<Name extends string | undefined = string | undefined, Alias extends string | undefined = undefined> { alias?: Alias; asType?: boolean; name: Name; } /** * Print a TypeScript node to a string. * @param node the node to print * @returns string */ declare function tsNodeToString({ node, unescape }: { node: ts.Node; unescape?: boolean; }): string; type Modifier = AccessLevel | 'async' | 'export' | 'readonly' | 'static'; type CommentLines = Array<string | null | false | undefined>; type CommentObject = { jsdoc?: boolean; lines: CommentLines; }; type Comments = CommentLines | Array<CommentObject>; declare namespace module_d_exports { export { ImportExportItem, createCallExpression, createConstVariable, createExportAllDeclaration, createNamedExportDeclarations, createNamedImportDeclarations }; } /** * Create export all declaration. Example: `export * from './y'`. * @param module - module containing exports * @returns ts.ExportDeclaration */ declare const createExportAllDeclaration: ({ module, shouldAppendJs }: { module: string; shouldAppendJs?: boolean; }) => ts.ExportDeclaration; type ImportExportItem = ImportExportItemObject | string; declare const createCallExpression: ({ functionName, parameters, types }: { functionName: string | ts.PropertyAccessExpression | ts.PropertyAccessChain | ts.ElementAccessExpression | ts.Expression; parameters?: Array<string | ts.Expression | undefined>; types?: ReadonlyArray<ts.TypeNode>; }) => ts.CallExpression; /** * Create a named export declaration. Example: `export { X } from './y'`. * @param exports - named imports to export * @param module - module containing exports * @returns ts.ExportDeclaration */ declare const createNamedExportDeclarations: ({ exports, module }: { exports: Array<ImportExportItem> | ImportExportItem; module: string; }) => ts.ExportDeclaration; /** * Create a const variable. Optionally, it can use const assertion or export * statement. Example: `export x = {} as const`. * @param assertion use const assertion? * @param exportConst export created variable? * @param expression expression for the variable. * @param name name of the variable. * @returns ts.VariableStatement */ declare const createConstVariable: ({ assertion, comment, destructure, exportConst, expression, name, typeName }: { assertion?: "const" | ts.TypeNode; comment?: Comments; destructure?: boolean; exportConst?: boolean; expression: ts.Expression; name: string | ts.TypeReferenceNode; typeName?: string | ts.IndexedAccessTypeNode | ts.TypeNode; }) => ts.VariableStatement; /** * Create a named import declaration. Example: `import { X } from './y'`. * @param imports - named exports to import * @param module - module containing imports * @returns ts.ImportDeclaration */ declare const createNamedImportDeclarations: ({ imports, module }: { imports: Array<ImportExportItem> | ImportExportItem; module: string; }) => ts.ImportDeclaration; //#endregion //#region src/tsc/typedef.d.ts type Property = { comment?: Comments; isReadOnly?: boolean; isRequired?: boolean; name: string | ts.PropertyName; type: any | ts.TypeNode; }; //#endregion //#region src/tsc/index.d.ts declare const tsc: { anonymousFunction: ({ async, comment, multiLine, parameters, returnType, statements, types: types_d_exports }: { async?: boolean; comment?: Comments; multiLine?: boolean; parameters?: FunctionParameter[]; returnType?: string | typescript0.TypeNode; statements?: ReadonlyArray<typescript0.Statement>; types?: FunctionTypeParameter[]; }) => typescript0.FunctionExpression; arrayLiteralExpression: <T>({ elements, multiLine }: { elements: T[]; multiLine?: boolean; }) => typescript0.ArrayLiteralExpression; arrowFunction: ({ async, comment, multiLine, parameters, returnType, statements, types: types_d_exports }: { async?: boolean; comment?: Comments; multiLine?: boolean; parameters?: ReadonlyArray<FunctionParameter>; returnType?: string | typescript0.TypeNode; statements?: typescript0.Statement[] | typescript0.Expression; types?: FunctionTypeParameter[]; }) => typescript0.ArrowFunction; asExpression: ({ expression, type }: { expression: typescript0.Expression; type: typescript0.TypeNode; }) => typescript0.AsExpression; assignment: ({ left, right }: { left: typescript0.Expression; right: typescript0.Expression; }) => typescript0.AssignmentExpression<typescript0.EqualsToken>; awaitExpression: ({ expression }: { expression: typescript0.Expression; }) => typescript0.AwaitExpression; binaryExpression: ({ left, operator, right }: { left: typescript0.Expression; operator?: "=" | "===" | "!==" | "in" | "??"; right: typescript0.Expression | string; }) => typescript0.BinaryExpression; block: ({ multiLine, statements }: { multiLine?: boolean; statements: ReadonlyArray<typescript0.Statement>; }) => typescript0.Block; callExpression: ({ functionName, parameters, types: types_d_exports }: { functionName: string | typescript0.PropertyAccessExpression | typescript0.PropertyAccessChain | typescript0.ElementAccessExpression | typescript0.Expression; parameters?: Array<string | typescript0.Expression | undefined>; types?: ReadonlyArray<typescript0.TypeNode>; }) => typescript0.CallExpression; classDeclaration: ({ decorator, exportClass, extendedClasses, name, nodes, typeParameters }: { decorator?: { args: any[]; name: string; }; exportClass?: boolean; extendedClasses?: ReadonlyArray<string>; name: string; nodes: ReadonlyArray<typescript0.ClassElement>; typeParameters?: ReadonlyArray<typescript0.TypeParameterDeclaration>; }) => typescript0.ClassDeclaration; conditionalExpression: ({ condition, whenFalse, whenTrue }: { condition: typescript0.Expression; whenFalse: typescript0.Expression; whenTrue: typescript0.Expression; }) => typescript0.ConditionalExpression; constVariable: ({ assertion, comment, destructure, exportConst, expression, name, typeName }: { assertion?: "const" | typescript0.TypeNode; comment?: Comments; destructure?: boolean; exportConst?: boolean; expression: typescript0.Expression; name: string | typescript0.TypeReferenceNode; typeName?: string | typescript0.IndexedAccessTypeNode | typescript0.TypeNode; }) => typescript0.VariableStatement; constructorDeclaration: ({ accessLevel, comment, multiLine, parameters, statements }: { accessLevel?: AccessLevel; comment?: Comments; multiLine?: boolean; parameters?: FunctionParameter[]; statements?: typescript0.Statement[]; }) => typescript0.ConstructorDeclaration; enumDeclaration: <T extends Record<string, any> | Array<ObjectValue>>({ asConst, comments: enumMemberComments, leadingComment: comments, name, obj }: { asConst: boolean; comments?: Record<string | number, Comments>; leadingComment?: Comments; name: string | typescript0.TypeReferenceNode; obj: T; }) => typescript0.EnumDeclaration; exportAllDeclaration: ({ module: module_d_exports, shouldAppendJs }: { module: string; shouldAppendJs?: boolean; }) => typescript0.ExportDeclaration; exportNamedDeclaration: ({ exports, module: module_d_exports }: { exports: Array<ImportExportItem> | ImportExportItem; module: string; }) => typescript0.ExportDeclaration; expressionToStatement: ({ expression }: { expression: typescript0.Expression; }) => typescript0.ExpressionStatement; forOfStatement: ({ awaitModifier, expression, initializer, statement }: { awaitModifier?: typescript0.AwaitKeyword; expression: typescript0.Expression; initializer: typescript0.ForInitializer; statement: typescript0.Statement; }) => typescript0.ForOfStatement; functionTypeNode: ({ parameters, returnType, typeParameters }: { parameters?: typescript0.ParameterDeclaration[]; returnType: typescript0.TypeNode; typeParameters?: typescript0.TypeParameterDeclaration[]; }) => typescript0.FunctionTypeNode; getAccessorDeclaration: ({ modifiers, name, returnType, statements }: { modifiers?: Modifier | ReadonlyArray<Modifier>; name: string | typescript0.PropertyName; returnType?: string | typescript0.Identifier; statements: ReadonlyArray<typescript0.Statement>; }) => typescript0.GetAccessorDeclaration; identifier: (args: string | { text: string; }) => typescript0.Identifier; ifStatement: ({ elseStatement, expression, thenStatement }: { elseStatement?: typescript0.Statement; expression: typescript0.Expression; thenStatement: typescript0.Statement; }) => typescript0.IfStatement; indexedAccessTypeNode: ({ indexType, objectType }: { indexType: typescript0.TypeNode; objectType: typescript0.TypeNode; }) => typescript0.IndexedAccessTypeNode; isTsNode: (node: any) => node is typescript0.Expression; keywordTypeNode: ({ keyword }: { keyword: Extract<SyntaxKindKeyword, "any" | "boolean" | "never" | "number" | "string" | "undefined" | "unknown" | "void">; }) => typescript0.KeywordTypeNode<typescript0.SyntaxKind.VoidKeyword | typescript0.SyntaxKind.AnyKeyword | typescript0.SyntaxKind.BooleanKeyword | typescript0.SyntaxKind.NeverKeyword | typescript0.SyntaxKind.NumberKeyword | typescript0.SyntaxKind.StringKeyword | typescript0.SyntaxKind.UndefinedKeyword | typescript0.SyntaxKind.UnknownKeyword>; literalTypeNode: ({ literal }: { literal: typescript0.LiteralTypeNode["literal"]; }) => typescript0.LiteralTypeNode; mappedTypeNode: ({ members, nameType, questionToken, readonlyToken, type, typeParameter }: { members?: typescript0.NodeArray<typescript0.TypeElement>; nameType?: typescript0.TypeNode; questionToken?: typescript0.QuestionToken | typescript0.PlusToken | typescript0.MinusToken; readonlyToken?: typescript0.ReadonlyKeyword | typescript0.PlusToken | typescript0.MinusToken; type?: typescript0.TypeNode; typeParameter: typescript0.TypeParameterDeclaration; }) => typescript0.MappedTypeNode; methodDeclaration: ({ accessLevel, comment, isStatic, multiLine, name, parameters, returnType, statements, types: types_d_exports }: { accessLevel?: AccessLevel; comment?: Comments; isStatic?: boolean; multiLine?: boolean; name: string; parameters?: ReadonlyArray<FunctionParameter>; returnType?: string | typescript0.TypeNode; statements?: typescript0.Statement[]; types?: FunctionTypeParameter[]; }) => typescript0.MethodDeclaration; namedImportDeclarations: ({ imports, module: module_d_exports }: { imports: Array<ImportExportItem> | ImportExportItem; module: string; }) => typescript0.ImportDeclaration; namespaceDeclaration: ({ name, statements }: { name: string; statements: Array<typescript0.Statement>; }) => typescript0.ModuleDeclaration; newExpression: ({ argumentsArray, expression, typeArguments }: { argumentsArray?: Array<typescript0.Expression>; expression: typescript0.Expression; typeArguments?: Array<typescript0.TypeNode>; }) => typescript0.NewExpression; nodeToString: typeof tsNodeToString; null: () => typescript0.NullLiteral; objectExpression: <T extends Record<string, any> | Array<ObjectValue>>({ comments, identifiers, multiLine, obj, shorthand, unescape }: { comments?: Comments; identifiers?: string[]; multiLine?: boolean; obj: T; shorthand?: boolean; unescape?: boolean; }) => typescript0.ObjectLiteralExpression; ots: { boolean: (value: boolean) => typescript0.TrueLiteral | typescript0.FalseLiteral; export: ({ alias, asType, name }: ImportExportItemObject) => typescript0.ExportSpecifier; import: ({ alias, asType, name }: ImportExportItemObject) => typescript0.ImportSpecifier; number: (value: number) => typescript0.NumericLiteral | typescript0.PrefixUnaryExpression; string: (value: string, unescape?: boolean) => typescript0.Identifier | typescript0.StringLiteral; }; parameterDeclaration: ({ initializer, modifiers, name, required, type }: { initializer?: typescript0.Expression; modifiers?: ReadonlyArray<typescript0.ModifierLike>; name: string | typescript0.BindingName; required?: boolean; type?: typescript0.TypeNode; }) => typescript0.ParameterDeclaration; prefixUnaryExpression: ({ expression, prefix }: { expression: string | typescript0.Expression; prefix: ("!" | "-") | typescript0.PrefixUnaryOperator; }) => typescript0.PrefixUnaryExpression; propertyAccessExpression: ({ expression, isOptional, name }: { expression: string | typescript0.Expression; isOptional?: boolean; name: string | number | typescript0.MemberName; }) => typescript0.PropertyAccessChain | typescript0.PropertyAccessExpression | typescript0.ElementAccessExpression; propertyAccessExpressions: ({ expressions }: { expressions: Array<string | typescript0.Expression | typescript0.MemberName>; }) => typescript0.PropertyAccessExpression; propertyAssignment: ({ initializer, name }: { initializer: typescript0.Expression; name: string | typescript0.PropertyName; }) => typescript0.PropertyAssignment; propertyDeclaration: ({ initializer, modifiers, name, type }: { initializer?: typescript0.Expression; modifiers?: Modifier | ReadonlyArray<Modifier>; name: string | typescript0.PropertyName; type?: typescript0.TypeNode; }) => typescript0.PropertyDeclaration; regularExpressionLiteral: ({ flags, text }: { flags?: ReadonlyArray<"g" | "i" | "m" | "s" | "u" | "y">; text: string; }) => typescript0.RegularExpressionLiteral; returnFunctionCall: ({ args, name, types: types_d_exports }: { args: any[]; name: string | typescript0.Expression; types?: ReadonlyArray<string | typescript0.StringLiteral>; }) => typescript0.ReturnStatement; returnStatement: ({ expression }: { expression?: typescript0.Expression; }) => typescript0.ReturnStatement; returnVariable: ({ expression }: { expression: string | typescript0.Expression; }) => typescript0.ReturnStatement; safeAccessExpression: (path: string[]) => typescript0.Expression; stringLiteral: ({ isSingleQuote, text }: { isSingleQuote?: boolean; text: string; }) => typescript0.StringLiteral; templateLiteralType: ({ value }: { value: ReadonlyArray<string | typescript0.TypeNode>; }) => typescript0.TemplateLiteralTypeNode; this: () => typescript0.ThisExpression; transformArrayMap: ({ path, transformExpression }: { path: string[]; transformExpression: typescript0.Expression; }) => typescript0.IfStatement; transformArrayMutation: ({ path, transformerName }: { path: string[]; transformerName: string; }) => typescript0.Statement; transformDateMutation: ({ path }: { path: string[]; }) => typescript0.Statement; transformFunctionMutation: ({ path, transformerName }: { path: string[]; transformerName: string; }) => typescript0.IfStatement[]; transformNewDate: ({ parameterName }: { parameterName: string; }) => typescript0.NewExpression; typeAliasDeclaration: ({ comment, exportType, name, type, typeParameters }: { comment?: Comments; exportType?: boolean; name: string | typescript0.TypeReferenceNode; type: string | typescript0.TypeNode | typescript0.Identifier; typeParameters?: FunctionTypeParameter[]; }) => typescript0.TypeAliasDeclaration; typeArrayNode: (types: ReadonlyArray<any | typescript0.TypeNode> | typescript0.TypeNode | typescript0.Identifier | string, isNullable?: boolean) => typescript0.TypeNode; typeInterfaceNode: ({ indexKey, indexProperty, isNullable, properties, useLegacyResolution }: { indexKey?: typescript0.TypeReferenceNode; indexProperty?: Property; isNullable?: boolean; properties: Property[]; useLegacyResolution: boolean; }) => typescript0.TypeNode; typeIntersectionNode: ({ isNullable, types: types_d_exports }: { isNullable?: boolean; types: (any | typescript0.TypeNode)[]; }) => typescript0.TypeNode; typeNode: (base: any | typescript0.TypeNode, args?: (any | typescript0.TypeNode)[]) => typescript0.TypeNode; typeOfExpression: ({ text }: { text: string | typescript0.Identifier; }) => typescript0.TypeOfExpression; typeOperatorNode: ({ operator, type }: { operator: "keyof" | "readonly" | "unique"; type: typescript0.TypeNode; }) => typescript0.TypeOperatorNode; typeParameterDeclaration: ({ constraint, defaultType, modifiers, name }: { constraint?: typescript0.TypeNode; defaultType?: typescript0.TypeNode; modifiers?: Array<typescript0.Modifier>; name: string | typescript0.Identifier; }) => typescript0.TypeParameterDeclaration; typeParenthesizedNode: ({ type }: { type: typescript0.TypeNode; }) => typescript0.ParenthesizedTypeNode; typeRecordNode: (keys: (any | typescript0.TypeNode)[], values: (any | typescript0.TypeNode)[], isNullable?: boolean, useLegacyResolution?: boolean) => typescript0.TypeNode; typeReferenceNode: ({ typeArguments, typeName }: { typeArguments?: typescript0.TypeNode[]; typeName: string | typescript0.EntityName; }) => typescript0.TypeReferenceNode; typeTupleNode: ({ isNullable, types: types_d_exports }: { isNullable?: boolean; types: Array<any | typescript0.TypeNode>; }) => typescript0.TypeNode; typeUnionNode: ({ isNullable, types: types_d_exports }: { isNullable?: boolean; types: ReadonlyArray<any | typescript0.TypeNode>; }) => typescript0.TypeNode; valueToExpression: <T = unknown>({ identifiers, isValueAccess, shorthand, unescape, value }: { identifiers?: string[]; isValueAccess?: boolean; shorthand?: boolean; unescape?: boolean; value: T; }) => typescript0.Expression | undefined; }; /** @deprecated use tsc */ declare const compiler: { anonymousFunction: ({ async, comment, multiLine, parameters, returnType, statements, types: types_d_exports }: { async?: boolean; comment?: Comments; multiLine?: boolean; parameters?: FunctionParameter[]; returnType?: string | typescript0.TypeNode; statements?: ReadonlyArray<typescript0.Statement>; types?: FunctionTypeParameter[]; }) => typescript0.FunctionExpression; arrayLiteralExpression: <T>({ elements, multiLine }: { elements: T[]; multiLine?: boolean; }) => typescript0.ArrayLiteralExpression; arrowFunction: ({ async, comment, multiLine, parameters, returnType, statements, types: types_d_exports }: { async?: boolean; comment?: Comments; multiLine?: boolean; parameters?: ReadonlyArray<FunctionParameter>; returnType?: string | typescript0.TypeNode; statements?: typescript0.Statement[] | typescript0.Expression; types?: FunctionTypeParameter[]; }) => typescript0.ArrowFunction; asExpression: ({ expression, type }: { expression: typescript0.Expression; type: typescript0.TypeNode; }) => typescript0.AsExpression; assignment: ({ left, right }: { left: typescript0.Expression; right: typescript0.Expression; }) => typescript0.AssignmentExpression<typescript0.EqualsToken>; awaitExpression: ({ expression }: { expression: typescript0.Expression; }) => typescript0.AwaitExpression; binaryExpression: ({ left, operator, right }: { left: typescript0.Expression; operator?: "=" | "===" | "!==" | "in" | "??"; right: typescript0.Expression | string; }) => typescript0.BinaryExpression; block: ({ multiLine, statements }: { multiLine?: boolean; statements: ReadonlyArray<typescript0.Statement>; }) => typescript0.Block; callExpression: ({ functionName, parameters, types: types_d_exports }: { functionName: string | typescript0.PropertyAccessExpression | typescript0.PropertyAccessChain | typescript0.ElementAccessExpression | typescript0.Expression; parameters?: Array<string | typescript0.Expression | undefined>; types?: ReadonlyArray<typescript0.TypeNode>; }) => typescript0.CallExpression; classDeclaration: ({ decorator, exportClass, extendedClasses, name, nodes, typeParameters }: { decorator?: { args: any[]; name: string; }; exportClass?: boolean; extendedClasses?: ReadonlyArray<string>; name: string; nodes: ReadonlyArray<typescript0.ClassElement>; typeParameters?: ReadonlyArray<typescript0.TypeParameterDeclaration>; }) => typescript0.ClassDeclaration; conditionalExpression: ({ condition, whenFalse, whenTrue }: { condition: typescript0.Expression; whenFalse: typescript0.Expression; whenTrue: typescript0.Expression; }) => typescript0.ConditionalExpression; constVariable: ({ assertion, comment, destructure, exportConst, expression, name, typeName }: { assertion?: "const" | typescript0.TypeNode; comment?: Comments; destructure?: boolean; exportConst?: boolean; expression: typescript0.Expression; name: string | typescript0.TypeReferenceNode; typeName?: string | typescript0.IndexedAccessTypeNode | typescript0.TypeNode; }) => typescript0.VariableStatement; constructorDeclaration: ({ accessLevel, comment, multiLine, parameters, statements }: { accessLevel?: AccessLevel; comment?: Comments; multiLine?: boolean; parameters?: FunctionParameter[]; statements?: typescript0.Statement[]; }) => typescript0.ConstructorDeclaration; enumDeclaration: <T extends Record<string, any> | Array<ObjectValue>>({ asConst, comments: enumMemberComments, leadingComment: comments, name, obj }: { asConst: boolean; comments?: Record<string | number, Comments>; leadingComment?: Comments; name: string | typescript0.TypeReferenceNode; obj: T; }) => typescript0.EnumDeclaration; exportAllDeclaration: ({ module: module_d_exports, shouldAppendJs }: { module: string; shouldAppendJs?: boolean; }) => typescript0.ExportDeclaration; exportNamedDeclaration: ({ exports, module: module_d_exports }: { exports: Array<ImportExportItem> | ImportExportItem; module: string; }) => typescript0.ExportDeclaration; expressionToStatement: ({ expression }: { expression: typescript0.Expression; }) => typescript0.ExpressionStatement; forOfStatement: ({ awaitModifier, expression, initializer, statement }: { awaitModifier?: typescript0.AwaitKeyword; expression: typescript0.Expression; initializer: typescript0.ForInitializer; statement: typescript0.Statement; }) => typescript0.ForOfStatement; functionTypeNode: ({ parameters, returnType, typeParameters }: { parameters?: typescript0.ParameterDeclaration[]; returnType: typescript0.TypeNode; typeParameters?: typescript0.TypeParameterDeclaration[]; }) => typescript0.FunctionTypeNode; getAccessorDeclaration: ({ modifiers, name, returnType, statements }: { modifiers?: Modifier | ReadonlyArray<Modifier>; name: string | typescript0.PropertyName; returnType?: string | typescript0.Identifier; statements: ReadonlyArray<typescript0.Statement>; }) => typescript0.GetAccessorDeclaration; identifier: (args: string | { text: string; }) => typescript0.Identifier; ifStatement: ({ elseStatement, expression, thenStatement }: { elseStatement?: typescript0.Statement; expression: typescript0.Expression; thenStatement: typescript0.Statement; }) => typescript0.IfStatement; indexedAccessTypeNode: ({ indexType, objectType }: { indexType: typescript0.TypeNode; objectType: typescript0.TypeNode; }) => typescript0.IndexedAccessTypeNode; isTsNode: (node: any) => node is typescript0.Expression; keywordTypeNode: ({ keyword }: { keyword: Extract<SyntaxKindKeyword, "any" | "boolean" | "never" | "number" | "string" | "undefined" | "unknown" | "void">; }) => typescript0.KeywordTypeNode<typescript0.SyntaxKind.VoidKeyword | typescript0.SyntaxKind.AnyKeyword | typescript0.SyntaxKind.BooleanKeyword | typescript0.SyntaxKind.NeverKeyword | typescript0.SyntaxKind.NumberKeyword | typescript0.SyntaxKind.StringKeyword | typescript0.SyntaxKind.UndefinedKeyword | typescript0.SyntaxKind.UnknownKeyword>; literalTypeNode: ({ literal }: { literal: typescript0.LiteralTypeNode["literal"]; }) => typescript0.LiteralTypeNode; mappedTypeNode: ({ members, nameType, questionToken, readonlyToken, type, typeParameter }: { members?: typescript0.NodeArray<typescript0.TypeElement>; nameType?: typescript0.TypeNode; questionToken?: typescript0.QuestionToken | typescript0.PlusToken | typescript0.MinusToken; readonlyToken?: typescript0.ReadonlyKeyword | typescript0.PlusToken | typescript0.MinusToken; type?: typescript0.TypeNode; typeParameter: typescript0.TypeParameterDeclaration; }) => typescript0.MappedTypeNode; methodDeclaration: ({ accessLevel, comment, isStatic, multiLine, name, parameters, returnType, statements, types: types_d_exports }: { accessLevel?: AccessLevel; comment?: Comments; isStatic?: boolean; multiLine?: boolean; name: string; parameters?: ReadonlyArray<FunctionParameter>; returnType?: string | typescript0.TypeNode; statements?: typescript0.Statement[]; types?: FunctionTypeParameter[]; }) => typescript0.MethodDeclaration; namedImportDeclarations: ({ imports, module: module_d_exports }: { imports: Array<ImportExportItem> | ImportExportItem; module: string; }) => typescript0.ImportDeclaration; namespaceDeclaration: ({ name, statements }: { name: string; statements: Array<typescript0.Statement>; }) => typescript0.ModuleDeclaration; newExpression: ({ argumentsArray, expression, typeArguments }: { argumentsArray?: Array<typescript0.Expression>; expression: typescript0.Expression; typeArguments?: Array<typescript0.TypeNode>; }) => typescript0.NewExpression; nodeToString: typeof tsNodeToString; null: () => typescript0.NullLiteral; objectExpression: <T extends Record<string, any> | Array<ObjectValue>>({ comments, identifiers, multiLine, obj, shorthand, unescape }: { comments?: Comments; identifiers?: string[]; multiLine?: boolean; obj: T; shorthand?: boolean; unescape?: boolean; }) => typescript0.ObjectLiteralExpression; ots: { boolean: (value: boolean) => typescript0.TrueLiteral | typescript0.FalseLiteral; export: ({ alias, asType, name }: ImportExportItemObject) => typescript0.ExportSpecifier; import: ({ alias, asType, name }: ImportExportItemObject) => typescript0.ImportSpecifier; number: (value: number) => typescript0.NumericLiteral | typescript0.PrefixUnaryExpression; string: (value: string, unescape?: boolean) => typescript0.Identifier | typescript0.StringLiteral; }; parameterDeclaration: ({ initializer, modifiers, name, required, type }: { initializer?: typescript0.Expression; modifiers?: ReadonlyArray<typescript0.ModifierLike>; name: string | typescript0.BindingName; required?: boolean; type?: typescript0.TypeNode; }) => typescript0.ParameterDeclaration; prefixUnaryExpression: ({ expression, prefix }: { expression: string | typescript0.Expression; prefix: ("!" | "-") | typescript0.PrefixUnaryOperator; }) => typescript0.PrefixUnaryExpression; propertyAccessExpression: ({ expression, isOptional, name }: { expression: string | typescript0.Expression; isOptional?: boolean; name: string | number | typescript0.MemberName; }) => typescript0.PropertyAccessChain | typescript0.PropertyAccessExpression | typescript0.ElementAccessExpression; propertyAccessExpressions: ({ expressions }: { expressions: Array<string | typescript0.Expression | typescript0.MemberName>; }) => typescript0.PropertyAccessExpression; propertyAssignment: ({ initializer, name }: { initializer: typescript0.Expression; name: string | typescript0.PropertyName; }) => typescript0.PropertyAssignment; propertyDeclaration: ({ initializer, modifiers, name, type }: { initializer?: typescript0.Expression; modifiers?: Modifier | ReadonlyArray<Modifier>; name: string | typescript0.PropertyName; type?: typescript0.TypeNode; }) => typescript0.PropertyDeclaration; regularExpressionLiteral: ({ flags, text }: { flags?: ReadonlyArray<"g" | "i" | "m" | "s" | "u" | "y">; text: string; }) => typescript0.RegularExpressionLiteral; returnFunctionCall: ({ args, name, types: types_d_exports }: { args: any[]; name: string | typescript0.Expression; types?: ReadonlyArray<string | typescript0.StringLiteral>; }) => typescript0.ReturnStatement; returnStatement: ({ expression }: { expression?: typescript0.Expression; }) => typescript0.ReturnStatement; returnVariable: ({ expression }: { expression: string | typescript0.Expression; }) => typescript0.ReturnStatement; safeAccessExpression: (path: string[]) => typescript0.Expression; stringLiteral: ({ isSingleQuote, text }: { isSingleQuote?: boolean; text: string; }) => typescript0.StringLiteral; templateLiteralType: ({ value }: { value: ReadonlyArray<string | typescript0.TypeNode>; }) => typescript0.TemplateLiteralTypeNode; this: () => typescript0.ThisExpression; transformArrayMap: ({ path, transformExpression }: { path: string[]; transformExpression: typescript0.Expression; }) => typescript0.IfStatement; transformArrayMutation: ({ path, transformerName }: { path: string[]; transformerName: string; }) => typescript0.Statement; transformDateMutation: ({ path }: { path: string[]; }) => typescript0.Statement; transformFunctionMutation: ({ path, transformerName }: { path: string[]; transformerName: string; }) => typescript0.IfStatement[]; transformNewDate: ({ parameterName }: { parameterName: string; }) => typescript0.NewExpression; typeAliasDeclaration: ({ comment, exportType, name, type, typeParameters }: { comment?: Comments; exportType?: boolean; name: string | typescript0.TypeReferenceNode; type: string | typescript0.TypeNode | typescript0.Identifier; typeParameters?: FunctionTypeParameter[]; }) => typescript0.TypeAliasDeclaration; typeArrayNode: (types: ReadonlyArray<any | typescript0.TypeNode> | typescript0.TypeNode | typescript0.Identifier | string, isNullable?: boolean) => typescript0.TypeNode; typeInterfaceNode: ({ indexKey, indexProperty, isNullable, properties, useLegacyResolution }: { indexKey?: typescript0.TypeReferenceNode; indexProperty?: Property; isNullable?: boolean; properties: Property[]; useLegacyResolution: boolean; }) => typescript0.TypeNode; typeIntersectionNode: ({ isNullable, types: types_d_exports }: { isNullable?: boolean; types: (any | typescript0.TypeNode)[]; }) => typescript0.TypeNode; typeNode: (base: any | typescript0.TypeNode, args?: (any | typescript0.TypeNode)[]) => typescript0.TypeNode; typeOfExpression: ({ text }: { text: string | typescript0.Identifier; }) => typescript0.TypeOfExpression; typeOperatorNode: ({ operator, type }: { operator: "keyof" | "readonly" | "unique"; type: typescript0.TypeNode; }) => typescript0.TypeOperatorNode; typeParameterDeclaration: ({ constraint, defaultType, modifiers, name }: { constraint?: typescript0.TypeNode; defaultType?: typescript0.TypeNode; modifiers?: Array<typescript0.Modifier>; name: string | typescript0.Identifier; }) => typescript0.TypeParameterDeclaration; typeParenthesizedNode: ({ type }: { type: typescript0.TypeNode; }) => typescript0.ParenthesizedTypeNode; typeRecordNode: (keys: (any | typescript0.TypeNode)[], values: (any | typescript0.TypeNode)[], isNullable?: boolean, useLegacyResolution?: boolean) => typescript0.TypeNode; typeReferenceNode: ({ typeArguments, typeName }: { typeArguments?: typescript0.TypeNode[]; typeName: string | typescript0.EntityName; }) => typescript0.TypeReferenceNode; typeTupleNode: ({ isNullable, types: types_d_exports }: { isNullable?: boolean; types: Array<any | typescript0.TypeNode>; }) => typescript0.TypeNode; typeUnionNode: ({ isNullable, types: types_d_exports }: { isNullable?: boolean; types: ReadonlyArray<any | typescript0.TypeNode>; }) => typescript0.TypeNode; valueToExpression: <T = unknown>({ identifiers, isValueAccess, shorthand, unescape, value }: { identifiers?: string[]; isValueAccess?: boolean; shorthand?: boolean; unescape?: boolean; value: T; }) => typescript0.Expression | undefined; }; //#endregion //#region src/utils/exports.d.ts declare const utils: { stringCase: ({ case: _case, stripLeadingSeparators, value }: { readonly case: StringCase | undefined; stripLeadingSeparators?: boolean; value: string; }) => string; }; //#endregion //#region src/index.d.ts declare module '@hey-api/codegen-core' { interface ProjectRenderMeta { /** * If specified, this will be the file extension used when importing * other modules. By default, we don't add a file extension and let the * runtime resolve it. * * @default null */ importFileExtension?: (string & {}) | null; } interface SymbolMeta { category?: 'client' | 'external' | 'hook' | 'schema' | 'sdk' | 'transform' | 'type' | 'utility' | (string & {}); /** * Path to the resource this symbol represents. */ path?: ReadonlyArray<string | number>; /** * Name of the plugin that registered this symbol. */ pluginName?: string; resource?: 'client' | '