fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 113 lines 3.2 kB view raw
1// OVERRIDES 2// hard-coded here because build process doesn't pick up overrides from separate files 3import '@hey-api/codegen-core'; 4import '@hey-api/shared'; 5 6declare module '@hey-api/codegen-core' { 7 interface ProjectRenderMeta { 8 /** 9 * If specified, this will be the file extension used when importing 10 * other modules. By default, we don't add a file extension and let the 11 * runtime resolve it. 12 * 13 * @default null 14 */ 15 importFileExtension?: AnyString | null; 16 } 17 18 interface SymbolMeta { 19 category?: 20 | 'client' 21 | 'external' 22 | 'hook' 23 | 'schema' 24 | 'sdk' 25 | 'transform' 26 | 'type' 27 | 'utility' 28 | AnyString; 29 /** 30 * Path to the resource this symbol represents. 31 */ 32 path?: ReadonlyArray<string | number>; 33 /** 34 * Name of the plugin that registered this symbol. 35 */ 36 pluginName?: string; 37 resource?: 'client' | 'definition' | 'operation' | 'webhook' | AnyString; 38 resourceId?: string; 39 role?: 'data' | 'error' | 'errors' | 'options' | 'response' | 'responses' | AnyString; 40 /** 41 * Tags associated with this symbol. 42 */ 43 tags?: ReadonlyArray<string>; 44 tool?: 'pydantic' | 'sdk' | AnyString; 45 variant?: 'container' | AnyString; 46 } 47} 48 49declare module '@hey-api/shared' { 50 interface PluginConfigMap { 51 '@hey-api/client-httpx': HeyApiClientHttpxPlugin['Types']; 52 '@hey-api/python-sdk': HeyApiSdkPlugin['Types']; 53 pydantic: PydanticPlugin['Types']; 54 } 55} 56// END OVERRIDES 57 58import type { AnyString, LazyOrAsync, MaybeArray } from '@hey-api/types'; 59import colors from 'ansi-colors'; 60// @ts-expect-error 61import colorSupport from 'color-support'; 62 63import type { UserConfig } from './config/types'; 64import type { HeyApiClientHttpxPlugin } from './plugins/@hey-api/client-httpx'; 65import type { HeyApiSdkPlugin } from './plugins/@hey-api/sdk'; 66import type { PydanticPlugin } from './plugins/pydantic'; 67 68colors.enabled = colorSupport().hasBasic; 69 70export { createClient } from './generate'; 71 72/** 73 * Type helper for configuration object, returns {@link MaybeArray<UserConfig>} object(s) 74 */ 75export function defineConfig( 76 config: LazyOrAsync<ReadonlyArray<UserConfig>>, 77): Promise<ReadonlyArray<UserConfig>>; 78export function defineConfig(config: LazyOrAsync<UserConfig>): Promise<UserConfig>; 79export async function defineConfig<T extends MaybeArray<UserConfig>>( 80 config: LazyOrAsync<T>, 81): Promise<T> { 82 return typeof config === 'function' ? await config() : config; 83} 84 85export { defaultPlugins } from './config/plugins'; 86export type { UserConfig } from './config/types'; 87export { Logger } from '@hey-api/codegen-core'; 88export type { 89 DefinePlugin, 90 IR, 91 OpenApi, 92 OpenApiMetaObject, 93 OpenApiOperationObject, 94 OpenApiParameterObject, 95 OpenApiRequestBodyObject, 96 OpenApiResponseObject, 97 OpenApiSchemaObject, 98 Plugin, 99} from '@hey-api/shared'; 100export { 101 defaultPaginationKeywords, 102 definePluginConfig, 103 OperationPath, 104 OperationStrategy, 105 utils, 106} from '@hey-api/shared'; 107 108// Pydantic plugin 109export type { PydanticPlugin } from './plugins/pydantic'; 110export { 111 defaultConfig as defaultPydanticConfig, 112 defineConfig as definePydanticConfig, 113} from './plugins/pydantic';