fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #3586 from hey-api/fix/export-plugins

fix: export Plugins namespace

authored by

Lubos and committed by
GitHub
653d747f 8bd9eb66

+213 -58
+5
.changeset/afraid-mangos-help.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + **internal**: export Plugins namespace
+17 -9
packages/openapi-python/src/index.ts
··· 1 + /* eslint-disable @typescript-eslint/no-namespace */ 1 2 // OVERRIDES 2 3 // hard-coded here because build process doesn't pick up overrides from separate files 3 4 import '@hey-api/codegen-core'; ··· 48 49 49 50 declare module '@hey-api/shared' { 50 51 interface PluginConfigMap { 51 - '@hey-api/client-httpx': HeyApiClientHttpxPlugin['Types']; 52 - '@hey-api/python-sdk': HeyApiSdkPlugin['Types']; 53 - pydantic: PydanticPlugin['Types']; 52 + '@hey-api/client-httpx': Plugins.HeyApiClientHttpx.Types['Types']; 53 + '@hey-api/python-sdk': Plugins.HeyApiSdk.Types['Types']; 54 + pydantic: Plugins.Pydantic.Types['Types']; 54 55 } 55 56 } 56 57 // END OVERRIDES ··· 105 106 utils, 106 107 } from '@hey-api/shared'; 107 108 108 - // Pydantic plugin 109 - export type { PydanticPlugin } from './plugins/pydantic'; 110 - export { 111 - defaultConfig as defaultPydanticConfig, 112 - defineConfig as definePydanticConfig, 113 - } from './plugins/pydantic'; 109 + export 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 Types = PydanticPlugin; 120 + } 121 + }
+187 -42
packages/openapi-ts/src/index.ts
··· 1 + /* eslint-disable @typescript-eslint/no-namespace */ 1 2 // OVERRIDES 2 3 // hard-coded here because build process doesn't pick up overrides from separate files 3 4 import '@hey-api/codegen-core'; ··· 57 58 58 59 declare module '@hey-api/shared' { 59 60 interface PluginConfigMap { 60 - '@angular/common': AngularCommonPlugin['Types']; 61 - '@faker-js/faker': FakerJsFakerPlugin['Types']; 62 - '@hey-api/client-angular': HeyApiClientAngularPlugin['Types']; 63 - '@hey-api/client-axios': HeyApiClientAxiosPlugin['Types']; 64 - '@hey-api/client-fetch': HeyApiClientFetchPlugin['Types']; 65 - '@hey-api/client-ky': HeyApiClientKyPlugin['Types']; 66 - '@hey-api/client-next': HeyApiClientNextPlugin['Types']; 67 - '@hey-api/client-nuxt': HeyApiClientNuxtPlugin['Types']; 68 - '@hey-api/client-ofetch': HeyApiClientOfetchPlugin['Types']; 69 - '@hey-api/schemas': HeyApiSchemasPlugin['Types']; 70 - '@hey-api/sdk': HeyApiSdkPlugin['Types']; 71 - '@hey-api/transformers': HeyApiTransformersPlugin['Types']; 72 - '@hey-api/typescript': HeyApiTypeScriptPlugin['Types']; 73 - '@pinia/colada': PiniaColadaPlugin['Types']; 74 - '@tanstack/angular-query-experimental': TanStackAngularQueryPlugin['Types']; 75 - '@tanstack/preact-query': TanStackPreactQueryPlugin['Types']; 76 - '@tanstack/react-query': TanStackReactQueryPlugin['Types']; 77 - '@tanstack/solid-query': TanStackSolidQueryPlugin['Types']; 78 - '@tanstack/svelte-query': TanStackSvelteQueryPlugin['Types']; 79 - '@tanstack/vue-query': TanStackVueQueryPlugin['Types']; 80 - arktype: ArktypePlugin['Types']; 81 - fastify: FastifyPlugin['Types']; 82 - swr: SwrPlugin['Types']; 83 - valibot: ValibotPlugin['Types']; 84 - zod: ZodPlugin['Types']; 61 + '@angular/common': Plugins.AngularCommon.Types['Types']; 62 + '@faker-js/faker': Plugins.FakerJsFaker.Types['Types']; 63 + '@hey-api/client-angular': Plugins.HeyApiClientAngular.Types['Types']; 64 + '@hey-api/client-axios': Plugins.HeyApiClientAxios.Types['Types']; 65 + '@hey-api/client-fetch': Plugins.HeyApiClientFetch.Types['Types']; 66 + '@hey-api/client-ky': Plugins.HeyApiClientKy.Types['Types']; 67 + '@hey-api/client-next': Plugins.HeyApiClientNext.Types['Types']; 68 + '@hey-api/client-nuxt': Plugins.HeyApiClientNuxt.Types['Types']; 69 + '@hey-api/client-ofetch': Plugins.HeyApiClientOfetch.Types['Types']; 70 + '@hey-api/schemas': Plugins.HeyApiSchemas.Types['Types']; 71 + '@hey-api/sdk': Plugins.HeyApiSdk.Types['Types']; 72 + '@hey-api/transformers': Plugins.HeyApiTransformers.Types['Types']; 73 + '@hey-api/typescript': Plugins.HeyApiTypeScript.Types['Types']; 74 + '@pinia/colada': Plugins.PiniaColada.Types['Types']; 75 + '@tanstack/angular-query-experimental': Plugins.TanStackAngularQuery.Types['Types']; 76 + '@tanstack/preact-query': Plugins.TanStackPreactQuery.Types['Types']; 77 + '@tanstack/react-query': Plugins.TanStackReactQuery.Types['Types']; 78 + '@tanstack/solid-query': Plugins.TanStackSolidQuery.Types['Types']; 79 + '@tanstack/svelte-query': Plugins.TanStackSvelteQuery.Types['Types']; 80 + '@tanstack/vue-query': Plugins.TanStackVueQuery.Types['Types']; 81 + arktype: Plugins.Arktype.Types['Types']; 82 + fastify: Plugins.Fastify.Types['Types']; 83 + swr: Plugins.Swr.Types['Types']; 84 + valibot: Plugins.Valibot.Types['Types']; 85 + zod: Plugins.Zod.Types['Types']; 85 86 } 86 87 87 88 interface PluginInstanceTypes { ··· 97 98 98 99 import type { UserConfig } from './config/types'; 99 100 import type { AngularCommonPlugin } from './plugins/@angular/common'; 100 - import type { FakerJsFakerPlugin } from './plugins/@faker-js/faker'; 101 - import type { HeyApiClientAngularPlugin } from './plugins/@hey-api/client-angular'; 102 - import type { HeyApiClientAxiosPlugin } from './plugins/@hey-api/client-axios'; 103 - import type { HeyApiClientFetchPlugin } from './plugins/@hey-api/client-fetch'; 104 - import type { HeyApiClientKyPlugin } from './plugins/@hey-api/client-ky'; 105 - import type { HeyApiClientNextPlugin } from './plugins/@hey-api/client-next'; 106 - import type { HeyApiClientNuxtPlugin } from './plugins/@hey-api/client-nuxt'; 107 - import type { HeyApiClientOfetchPlugin } from './plugins/@hey-api/client-ofetch'; 101 + import type { FakerJsFakerPlugin, FakerJsFakerResolvers } from './plugins/@faker-js/faker'; 102 + import type { 103 + AngularClient as AngularClientImp, 104 + HeyApiClientAngularPlugin, 105 + } from './plugins/@hey-api/client-angular'; 106 + import type { 107 + AxiosClient as AxiosClientImp, 108 + HeyApiClientAxiosPlugin, 109 + } from './plugins/@hey-api/client-axios'; 110 + import type { 111 + FetchClient as FetchClientImp, 112 + HeyApiClientFetchPlugin, 113 + } from './plugins/@hey-api/client-fetch'; 114 + import type { HeyApiClientKyPlugin, KyClient as KyClientImp } from './plugins/@hey-api/client-ky'; 115 + import type { 116 + HeyApiClientNextPlugin, 117 + NextClient as NextClientImp, 118 + } from './plugins/@hey-api/client-next'; 119 + import type { 120 + HeyApiClientNuxtPlugin, 121 + NuxtClient as NuxtClientImp, 122 + } from './plugins/@hey-api/client-nuxt'; 123 + import type { 124 + HeyApiClientOfetchPlugin, 125 + OfetchClient as OfetchClientImp, 126 + } from './plugins/@hey-api/client-ofetch'; 108 127 import type { HeyApiSchemasPlugin } from './plugins/@hey-api/schemas'; 109 128 import type { HeyApiSdkPlugin } from './plugins/@hey-api/sdk'; 110 129 import type { HeyApiTransformersPlugin } from './plugins/@hey-api/transformers'; 111 - import type { HeyApiTypeScriptPlugin } from './plugins/@hey-api/typescript'; 130 + import type { 131 + HeyApiTypeScriptPlugin, 132 + HeyApiTypeScriptResolvers, 133 + } from './plugins/@hey-api/typescript'; 112 134 import type { PiniaColadaPlugin } from './plugins/@pinia/colada'; 113 135 import type { TanStackAngularQueryPlugin } from './plugins/@tanstack/angular-query-experimental'; 114 136 import type { TanStackPreactQueryPlugin } from './plugins/@tanstack/preact-query'; ··· 119 141 import type { ArktypePlugin } from './plugins/arktype'; 120 142 import type { FastifyPlugin } from './plugins/fastify'; 121 143 import type { SwrPlugin } from './plugins/swr'; 122 - import type { ValibotPlugin } from './plugins/valibot'; 123 - import type { ZodPlugin } from './plugins/zod'; 144 + import type { ValibotPlugin, ValibotResolvers } from './plugins/valibot'; 145 + import type { ZodPlugin, ZodResolvers } from './plugins/zod'; 124 146 import type { TsDsl } from './ts-dsl'; 125 147 126 148 colors.enabled = colorSupport().hasBasic; ··· 142 164 143 165 export { defaultPlugins } from './config/plugins'; 144 166 export type { UserConfig } from './config/types'; 145 - export type { AngularClient } from './plugins/@hey-api/client-angular'; 146 - export type { AxiosClient } from './plugins/@hey-api/client-axios'; 147 167 export { clientDefaultConfig, clientDefaultMeta } from './plugins/@hey-api/client-core/config'; 148 168 export { clientPluginHandler } from './plugins/@hey-api/client-core/plugin'; 149 169 export type { Client } from './plugins/@hey-api/client-core/types'; 150 - export type { FetchClient } from './plugins/@hey-api/client-fetch'; 151 - export type { NextClient } from './plugins/@hey-api/client-next'; 152 - export type { NuxtClient } from './plugins/@hey-api/client-nuxt'; 153 - export type { OfetchClient } from './plugins/@hey-api/client-ofetch'; 154 170 export type { ExpressionTransformer } from './plugins/@hey-api/transformers/expressions'; 155 171 export type { TypeTransformer } from './plugins/@hey-api/transformers/types'; 156 172 export * from './ts-dsl'; ··· 174 190 OperationStrategy, 175 191 utils, 176 192 } from '@hey-api/shared'; 193 + 194 + export namespace Plugins { 195 + export namespace AngularCommon { 196 + export type Types = AngularCommonPlugin; 197 + } 198 + 199 + export namespace Arktype { 200 + export type Types = ArktypePlugin; 201 + } 202 + 203 + export namespace FakerJsFaker { 204 + export type Types = FakerJsFakerPlugin; 205 + export type Resolvers = Required<FakerJsFakerResolvers>['~resolvers']; 206 + } 207 + 208 + export namespace Fastify { 209 + export type Types = FastifyPlugin; 210 + } 211 + 212 + export namespace HeyApiClientAngular { 213 + export type Client = AngularClientImp; 214 + export type Types = HeyApiClientAngularPlugin; 215 + } 216 + 217 + export namespace HeyApiClientAxios { 218 + export type Client = AxiosClientImp; 219 + export type Types = HeyApiClientAxiosPlugin; 220 + } 221 + 222 + export namespace HeyApiClientFetch { 223 + export type Client = FetchClientImp; 224 + export type Types = HeyApiClientFetchPlugin; 225 + } 226 + 227 + export namespace HeyApiClientKy { 228 + export type Client = KyClientImp; 229 + export type Types = HeyApiClientKyPlugin; 230 + } 231 + 232 + export namespace HeyApiClientNext { 233 + export type Client = NextClientImp; 234 + export type Types = HeyApiClientNextPlugin; 235 + } 236 + 237 + export namespace HeyApiClientNuxt { 238 + export type Client = NuxtClientImp; 239 + export type Types = HeyApiClientNuxtPlugin; 240 + } 241 + 242 + export namespace HeyApiClientOfetch { 243 + export type Client = OfetchClientImp; 244 + export type Types = HeyApiClientOfetchPlugin; 245 + } 246 + 247 + export namespace HeyApiSchemas { 248 + export type Types = HeyApiSchemasPlugin; 249 + } 250 + 251 + export namespace HeyApiSdk { 252 + export type Types = HeyApiSdkPlugin; 253 + } 254 + 255 + export namespace HeyApiTransformers { 256 + export type Types = HeyApiTransformersPlugin; 257 + } 258 + 259 + export namespace HeyApiTypeScript { 260 + export type Resolvers = Required<HeyApiTypeScriptResolvers>['~resolvers']; 261 + export type Types = HeyApiTypeScriptPlugin; 262 + } 263 + 264 + export namespace PiniaColada { 265 + export type Types = PiniaColadaPlugin; 266 + } 267 + 268 + export namespace Swr { 269 + export type Types = SwrPlugin; 270 + } 271 + 272 + export namespace TanStackAngularQuery { 273 + export type Types = TanStackAngularQueryPlugin; 274 + } 275 + 276 + export namespace TanStackPreactQuery { 277 + export type Types = TanStackPreactQueryPlugin; 278 + } 279 + 280 + export namespace TanStackReactQuery { 281 + export type Types = TanStackReactQueryPlugin; 282 + } 283 + 284 + export namespace TanStackSolidQuery { 285 + export type Types = TanStackSolidQueryPlugin; 286 + } 287 + 288 + export namespace TanStackSvelteQuery { 289 + export type Types = TanStackSvelteQueryPlugin; 290 + } 291 + 292 + export namespace TanStackVueQuery { 293 + export type Types = TanStackVueQueryPlugin; 294 + } 295 + 296 + export namespace Valibot { 297 + export type Resolvers = Required<ValibotResolvers>['~resolvers']; 298 + export type Types = ValibotPlugin; 299 + } 300 + 301 + export namespace Zod { 302 + export type Resolvers = Required<ZodResolvers>['~resolvers']; 303 + export type Types = ZodPlugin; 304 + } 305 + } 306 + 307 + // DEPRECATED 308 + /** @deprecated Use `Plugins.HeyApiClientAngular.Client` instead. */ 309 + export type AngularClient = AngularClientImp; 310 + /** @deprecated Use `Plugins.HeyApiClientAxios.Client` instead. */ 311 + export type AxiosClient = AxiosClientImp; 312 + /** @deprecated Use `Plugins.HeyApiClientFetch.Client` instead. */ 313 + export type FetchClient = FetchClientImp; 314 + /** @deprecated Use `Plugins.HeyApiClientKy.Client` instead. */ 315 + export type KyClient = KyClientImp; 316 + /** @deprecated Use `Plugins.HeyApiClientNext.Client` instead. */ 317 + export type NextClient = NextClientImp; 318 + /** @deprecated Use `Plugins.HeyApiClientNuxt.Client` instead. */ 319 + export type NuxtClient = NuxtClientImp; 320 + /** @deprecated Use `Plugins.HeyApiClientOfetch.Client` instead. */ 321 + export type OfetchClient = OfetchClientImp;
+1
packages/openapi-ts/src/plugins/@faker-js/faker/index.ts
··· 1 1 export { defaultConfig, defineConfig } from './config'; 2 + export type { Resolvers as FakerJsFakerResolvers } from './resolvers/types'; 2 3 export type { FakerJsFakerPlugin } from './types';
+1 -7
packages/openapi-ts/src/plugins/@hey-api/typescript/index.ts
··· 1 1 export { defaultConfig, defineConfig } from './config'; 2 - export type { 3 - EnumResolverContext, 4 - NumberResolverContext, 5 - ObjectResolverContext, 6 - Resolvers, 7 - StringResolverContext, 8 - } from './resolvers'; 2 + export type { Resolvers as HeyApiTypeScriptResolvers } from './resolvers'; 9 3 export type { HeyApiTypeScriptPlugin } from './types';
+1
packages/openapi-ts/src/plugins/valibot/index.ts
··· 1 1 export { defaultConfig, defineConfig } from './config'; 2 + export type { Resolvers as ValibotResolvers } from './resolvers'; 2 3 export type { ValibotPlugin } from './types';
+1
packages/openapi-ts/src/plugins/zod/index.ts
··· 1 1 export { defaultConfig, defineConfig } from './config'; 2 + export type { Resolvers as ZodResolvers } from './resolvers'; 2 3 export type { ZodPlugin } from './types';