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