···108108109109:::
110110111111-## Import File Extension
111111+## Module Extension
112112113113-You can customize the extension used for imported TypeScript files.
113113+You can customize the extension used for TypeScript modules.
114114115115::: code-group
116116···257257:::
258258259259You can also prevent your output from being linted by adding your output path to the linter's ignore file.
260260+261261+## Name Conflicts
262262+263263+As your project grows, the chances of name conflicts increase. We use a simple conflict resolver that appends numeric suffixes to duplicate identifiers. If you prefer a different strategy, you can provide your own `nameConflictResolver` function.
264264+265265+::: code-group
266266+267267+```js [config]
268268+export default {
269269+ input: 'hey-api/backend', // sign up at app.heyapi.dev
270270+ output: {
271271+ nameConflictResolver({ attempt, baseName }) {
272272+ // [!code ++]
273273+ return attempt === 0 ? baseName : `${baseName}_N${attempt + 1}`; // [!code ++]
274274+ }, // [!code ++]
275275+ path: 'src/client',
276276+ },
277277+};
278278+```
279279+280280+```ts [example]
281281+export type ChatCompletion = string;
282282+283283+export type ChatCompletion_N2 = number;
284284+```
285285+286286+:::
260287261288## TSConfig Path
262289
+22
docs/openapi-ts/migrating.md
···7788While we try to avoid breaking changes, sometimes it's unavoidable in order to offer you the latest features. This page lists changes that require updates to your code. If you run into a problem with migration, please [open an issue](https://github.com/hey-api/openapi-ts/issues).
991010+## v0.89.0
1111+1212+### Prefer named exports
1313+1414+This release changes the default for `index.ts` to prefer named exports. Named exports may lead to better IDE and bundler performance compared to asterisk (`*`) as your tooling doesn't have to inspect the underlying module to discover exports.
1515+1616+While this change is merely cosmetic, you can set `output.preferExportAll` to `true` if you prefer to use the asterisk.
1717+1818+```js
1919+export default {
2020+ input: 'hey-api/backend', // sign up at app.heyapi.dev
2121+ output: {
2222+ path: 'src/client',
2323+ preferExportAll: true, // [!code ++]
2424+ },
2525+};
2626+```
2727+2828+### Removed `symbol:setValue:*` events
2929+3030+These events have been removed in favor of `node:set:*` events.
3131+1032## v0.88.0
11331234### Removed `compiler` and `tsc` exports
-4
docs/openapi-ts/output.md
···111111};
112112```
113113114114-::: warning
115115-Re-exporting additional files from index file may result in broken output due to naming conflicts.
116116-:::
117117-118114<!--@include: ../partials/examples.md-->
119115<!--@include: ../partials/sponsors.md-->
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import { type ClientOptions, type Config, createClient, createConfig } from './client';
44+import type { ClientOptions as ClientOptions2 } from './types.gen';
55+66+/**
77+ * The `createClientConfig()` function will be called on client initialization
88+ * and the returned object will become the client's initial configuration.
99+ *
1010+ * You may want to initialize your client this way instead of calling
1111+ * `setConfig()`. This is useful for example if you're using Next.js
1212+ * to ensure your client always has the correct values.
1313+ */
1414+export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
1515+1616+export const client = createClient(createConfig<ClientOptions2>());
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import type { Auth, AuthToken } from './auth.gen';
44+import type {
55+ BodySerializer,
66+ QuerySerializer,
77+ QuerySerializerOptions,
88+} from './bodySerializer.gen';
99+1010+export type HttpMethod =
1111+ | 'connect'
1212+ | 'delete'
1313+ | 'get'
1414+ | 'head'
1515+ | 'options'
1616+ | 'patch'
1717+ | 'post'
1818+ | 'put'
1919+ | 'trace';
2020+2121+export type Client<
2222+ RequestFn = never,
2323+ Config = unknown,
2424+ MethodFn = never,
2525+ BuildUrlFn = never,
2626+ SseFn = never,
2727+> = {
2828+ /**
2929+ * Returns the final request URL.
3030+ */
3131+ buildUrl: BuildUrlFn;
3232+ getConfig: () => Config;
3333+ request: RequestFn;
3434+ setConfig: (config: Config) => Config;
3535+} & {
3636+ [K in HttpMethod]: MethodFn;
3737+} & ([SseFn] extends [never]
3838+ ? { sse?: never }
3939+ : { sse: { [K in HttpMethod]: SseFn } });
4040+4141+export interface Config {
4242+ /**
4343+ * Auth token or a function returning auth token. The resolved value will be
4444+ * added to the request payload as defined by its `security` array.
4545+ */
4646+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
4747+ /**
4848+ * A function for serializing request body parameter. By default,
4949+ * {@link JSON.stringify()} will be used.
5050+ */
5151+ bodySerializer?: BodySerializer | null;
5252+ /**
5353+ * An object containing any HTTP headers that you want to pre-populate your
5454+ * `Headers` object with.
5555+ *
5656+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
5757+ */
5858+ headers?:
5959+ | RequestInit['headers']
6060+ | Record<
6161+ string,
6262+ | string
6363+ | number
6464+ | boolean
6565+ | (string | number | boolean)[]
6666+ | null
6767+ | undefined
6868+ | unknown
6969+ >;
7070+ /**
7171+ * The request method.
7272+ *
7373+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
7474+ */
7575+ method?: Uppercase<HttpMethod>;
7676+ /**
7777+ * A function for serializing request query parameters. By default, arrays
7878+ * will be exploded in form style, objects will be exploded in deepObject
7979+ * style, and reserved characters are percent-encoded.
8080+ *
8181+ * This method will have no effect if the native `paramsSerializer()` Axios
8282+ * API function is used.
8383+ *
8484+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585+ */
8686+ querySerializer?: QuerySerializer | QuerySerializerOptions;
8787+ /**
8888+ * A function validating request data. This is useful if you want to ensure
8989+ * the request conforms to the desired shape, so it can be safely sent to
9090+ * the server.
9191+ */
9292+ requestValidator?: (data: unknown) => Promise<unknown>;
9393+ /**
9494+ * A function transforming response data before it's returned. This is useful
9595+ * for post-processing data, e.g. converting ISO strings into Date objects.
9696+ */
9797+ responseTransformer?: (data: unknown) => Promise<unknown>;
9898+ /**
9999+ * A function validating response data. This is useful if you want to ensure
100100+ * the response conforms to the desired shape, so it can be safely passed to
101101+ * the transformers and returned to the user.
102102+ */
103103+ responseValidator?: (data: unknown) => Promise<unknown>;
104104+}
105105+106106+type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
107107+ ? true
108108+ : [T] extends [never | undefined]
109109+ ? [undefined] extends [T]
110110+ ? false
111111+ : true
112112+ : false;
113113+114114+export type OmitNever<T extends Record<string, unknown>> = {
115115+ [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
116116+ ? never
117117+ : K]: T[K];
118118+};
···11-import type { Symbol, SymbolIn } from '@hey-api/codegen-core';
11+import type { Node, Symbol, SymbolIn } from '@hey-api/codegen-core';
2233import type { IROperationObject } from '~/ir/types';
44import type { PluginInstance } from '~/plugins/shared/utils/instance';
···88 * Event hooks.
99 */
1010 events?: {
1111+ /**
1212+ * Triggered after adding or updating a node.
1313+ *
1414+ * You can use this to perform actions after a node is added or updated.
1515+ *
1616+ * @param args Arguments object.
1717+ * @returns void
1818+ */
1919+ 'node:set:after'?: (args: {
2020+ /** The node added or updated. */
2121+ node: Node | null;
2222+ /** Plugin that added or updated the node. */
2323+ plugin: PluginInstance;
2424+ }) => void;
2525+ /**
2626+ * Triggered before adding or updating a node.
2727+ *
2828+ * You can use this to modify the node before it's added or updated.
2929+ *
3030+ * @param args Arguments object.
3131+ * @returns void
3232+ */
3333+ 'node:set:before'?: (args: {
3434+ /** The node to be added or updated. */
3535+ node: Node | null;
3636+ /** Plugin adding or updating the node. */
3737+ plugin: PluginInstance;
3838+ }) => void;
1139 /**
1240 * Triggered after executing a plugin handler.
1341 *
···5583 plugin: PluginInstance;
5684 /** Symbol to register. */
5785 symbol: SymbolIn;
5858- }) => void;
5959- /**
6060- * Triggered after setting a symbol value.
6161- *
6262- * You can use this to perform actions after a symbol's value is set.
6363- *
6464- * @param args Arguments object.
6565- * @returns void
6666- */
6767- 'symbol:setValue:after'?: (args: {
6868- /** Plugin that set the symbol value. */
6969- plugin: PluginInstance;
7070- /** The symbol. */
7171- symbol: Symbol;
7272- /** The value that was set. */
7373- value: unknown;
7474- }) => void;
7575- /**
7676- * Triggered before setting a symbol value.
7777- *
7878- * You can use this to modify the value before it's set.
7979- *
8080- * @param args Arguments object.
8181- * @returns void
8282- */
8383- 'symbol:setValue:before'?: (args: {
8484- /** Plugin setting the symbol value. */
8585- plugin: PluginInstance;
8686- /** The symbol. */
8787- symbol: Symbol;
8888- /** The value to set. */
8989- value: unknown;
9086 }) => void;
9187 };
9288 /**