From 94f8d3c02d1e27e8eaedc12435dae038c8239334 Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Mon, 11 Mar 2024 13:31:24 +1100 Subject: [PATCH] chore(client): regenerate with latest openapi typescript codegen version Signed-off-by: Jordan Shatford --- .../client/src/generated/core/ApiResult.ts | 6 +-- packages/client/src/generated/core/OpenAPI.ts | 37 ++++++++++++++----- packages/client/src/generated/core/types.ts | 16 ++++++++ 3 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 packages/client/src/generated/core/types.ts diff --git a/packages/client/src/generated/core/ApiResult.ts b/packages/client/src/generated/core/ApiResult.ts index 24c93fc1..f41bf656 100644 --- a/packages/client/src/generated/core/ApiResult.ts +++ b/packages/client/src/generated/core/ApiResult.ts @@ -2,10 +2,10 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ApiResult = { - readonly url: string; +export type ApiResult = { + readonly body: TData; readonly ok: boolean; readonly status: number; readonly statusText: string; - readonly body: any; + readonly url: string; }; diff --git a/packages/client/src/generated/core/OpenAPI.ts b/packages/client/src/generated/core/OpenAPI.ts index 147a5e7a..89414390 100644 --- a/packages/client/src/generated/core/OpenAPI.ts +++ b/packages/client/src/generated/core/OpenAPI.ts @@ -3,30 +3,47 @@ /* tslint:disable */ /* eslint-disable */ import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { TConfig, TResult } from './types'; type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; export type OpenAPIConfig = { BASE: string; - VERSION: string; - WITH_CREDENTIALS: boolean; CREDENTIALS: 'include' | 'omit' | 'same-origin'; + ENCODE_PATH?: ((path: string) => string) | undefined; + HEADERS?: Headers | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + RESULT?: TResult; TOKEN?: string | Resolver | undefined; USERNAME?: string | Resolver | undefined; - PASSWORD?: string | Resolver | undefined; - HEADERS?: Headers | Resolver | undefined; - ENCODE_PATH?: ((path: string) => string) | undefined; + VERSION: string; + WITH_CREDENTIALS: boolean; }; export const OpenAPI: OpenAPIConfig = { BASE: '', - VERSION: '1.0.0', - WITH_CREDENTIALS: false, CREDENTIALS: 'include', + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + RESULT: 'body', TOKEN: undefined, USERNAME: undefined, - PASSWORD: undefined, - HEADERS: undefined, - ENCODE_PATH: undefined, + VERSION: '1.0.0', + WITH_CREDENTIALS: false, +}; + +export const mergeOpenApiConfig = (config: OpenAPIConfig, overrides: TConfig) => { + const merged = { ...config }; + Object.entries(overrides) + .filter(([key]) => key.startsWith('_')) + .forEach(([key, value]) => { + const k = key.slice(1).toLocaleUpperCase() as keyof typeof merged; + if (merged.hasOwnProperty(k)) { + // @ts-ignore + merged[k] = value; + } + }); + return merged; }; diff --git a/packages/client/src/generated/core/types.ts b/packages/client/src/generated/core/types.ts new file mode 100644 index 00000000..133f0f21 --- /dev/null +++ b/packages/client/src/generated/core/types.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiResult } from './ApiResult'; + +export type TResult = 'body' | 'raw'; + +export type TApiResponse = + Exclude extends never + ? ApiResult + : ApiResult['body']; + +export type TConfig = { + _result?: T; +};